aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2016-02-15 20:36:42 +0100
committerArthur <arthur@hoa.ro>2016-02-15 20:36:42 +0100
commit854ea372553d6ef8174cae320801e5ff3a101a87 (patch)
treeda9185d7c5d733219ca4638b512b18f2d9a55174 /index.php
parent2865118ca44661c7535aaf7b83e3b9222bc1f9a6 (diff)
parent510377d2cb4b12d1a421e8a88bd7edb86f223451 (diff)
downloadShaarli-854ea372553d6ef8174cae320801e5ff3a101a87.tar.gz
Shaarli-854ea372553d6ef8174cae320801e5ff3a101a87.tar.zst
Shaarli-854ea372553d6ef8174cae320801e5ff3a101a87.zip
Merge pull request #442 from ArthurHoaro/updater
Introduce the Updater class which
Diffstat (limited to 'index.php')
-rw-r--r--index.php33
1 files changed, 23 insertions, 10 deletions
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'
44// Banned IPs 44// Banned IPs
45$GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php'; 45$GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php';
46 46
47// Processed updates file.
48$GLOBALS['config']['UPDATES_FILE'] = $GLOBALS['config']['DATADIR'].'/updates.txt';
49
47// Access log 50// Access log
48$GLOBALS['config']['LOG_FILE'] = $GLOBALS['config']['DATADIR'].'/log.txt'; 51$GLOBALS['config']['LOG_FILE'] = $GLOBALS['config']['DATADIR'].'/log.txt';
49 52
@@ -64,7 +67,6 @@ $GLOBALS['config']['CACHEDIR'] = 'cache';
64// Atom & RSS feed cache directory 67// Atom & RSS feed cache directory
65$GLOBALS['config']['PAGECACHE'] = 'pagecache'; 68$GLOBALS['config']['PAGECACHE'] = 'pagecache';
66 69
67
68/* 70/*
69 * Global configuration 71 * Global configuration
70 */ 72 */
@@ -163,6 +165,7 @@ require_once 'application/Utils.php';
163require_once 'application/Config.php'; 165require_once 'application/Config.php';
164require_once 'application/PluginManager.php'; 166require_once 'application/PluginManager.php';
165require_once 'application/Router.php'; 167require_once 'application/Router.php';
168require_once 'application/Updater.php';
166 169
167// Ensure the PHP version is supported 170// Ensure the PHP version is supported
168try { 171try {
@@ -1114,6 +1117,25 @@ function renderPage()
1114 $GLOBALS['redirector'] 1117 $GLOBALS['redirector']
1115 ); 1118 );
1116 1119
1120 $updater = new Updater(
1121 read_updates_file($GLOBALS['config']['UPDATES_FILE']),
1122 $GLOBALS,
1123 $LINKSDB,
1124 isLoggedIn()
1125 );
1126 try {
1127 $newUpdates = $updater->update();
1128 if (! empty($newUpdates)) {
1129 write_updates_file(
1130 $GLOBALS['config']['UPDATES_FILE'],
1131 $updater->getDoneUpdates()
1132 );
1133 }
1134 }
1135 catch(Exception $e) {
1136 die($e->getMessage());
1137 }
1138
1117 $PAGE = new pageBuilder; 1139 $PAGE = new pageBuilder;
1118 1140
1119 // Determine which page will be rendered. 1141 // Determine which page will be rendered.
@@ -2519,15 +2541,6 @@ function resizeImage($filepath)
2519 return true; 2541 return true;
2520} 2542}
2521 2543
2522try {
2523 mergeDeprecatedConfig($GLOBALS, isLoggedIn());
2524} catch(Exception $e) {
2525 error_log(
2526 'ERROR while merging deprecated options.php file.' . PHP_EOL .
2527 $e->getMessage()
2528 );
2529}
2530
2531if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=genthumbnail')) { genThumbnail(); exit; } // Thumbnail generation/cache does not need the link database. 2544if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=genthumbnail')) { genThumbnail(); exit; } // Thumbnail generation/cache does not need the link database.
2532if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=rss')) { showRSS(); exit; } 2545if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=rss')) { showRSS(); exit; }
2533if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=atom')) { showATOM(); exit; } 2546if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=atom')) { showATOM(); exit; }