X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=d88f43467e86eba578d1f1cfcfad09a9c2f26353;hb=854ea372553d6ef8174cae320801e5ff3a101a87;hp=9785c419e477ebc6404259fdd6961216b90cc453;hpb=2865118ca44661c7535aaf7b83e3b9222bc1f9a6;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 9785c419..d88f4346 100644 --- a/index.php +++ b/index.php @@ -44,6 +44,9 @@ $GLOBALS['config']['DATASTORE'] = $GLOBALS['config']['DATADIR'].'/datastore.php' // Banned IPs $GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php'; +// Processed updates file. +$GLOBALS['config']['UPDATES_FILE'] = $GLOBALS['config']['DATADIR'].'/updates.txt'; + // Access log $GLOBALS['config']['LOG_FILE'] = $GLOBALS['config']['DATADIR'].'/log.txt'; @@ -64,7 +67,6 @@ $GLOBALS['config']['CACHEDIR'] = 'cache'; // Atom & RSS feed cache directory $GLOBALS['config']['PAGECACHE'] = 'pagecache'; - /* * Global configuration */ @@ -163,6 +165,7 @@ require_once 'application/Utils.php'; require_once 'application/Config.php'; require_once 'application/PluginManager.php'; require_once 'application/Router.php'; +require_once 'application/Updater.php'; // Ensure the PHP version is supported try { @@ -1114,6 +1117,25 @@ function renderPage() $GLOBALS['redirector'] ); + $updater = new Updater( + read_updates_file($GLOBALS['config']['UPDATES_FILE']), + $GLOBALS, + $LINKSDB, + isLoggedIn() + ); + try { + $newUpdates = $updater->update(); + if (! empty($newUpdates)) { + write_updates_file( + $GLOBALS['config']['UPDATES_FILE'], + $updater->getDoneUpdates() + ); + } + } + catch(Exception $e) { + die($e->getMessage()); + } + $PAGE = new pageBuilder; // Determine which page will be rendered. @@ -2519,15 +2541,6 @@ function resizeImage($filepath) return true; } -try { - mergeDeprecatedConfig($GLOBALS, isLoggedIn()); -} catch(Exception $e) { - error_log( - 'ERROR while merging deprecated options.php file.' . PHP_EOL . - $e->getMessage() - ); -} - if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=genthumbnail')) { genThumbnail(); exit; } // Thumbnail generation/cache does not need the link database. if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=rss')) { showRSS(); exit; } if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=atom')) { showATOM(); exit; }