fix auto-update of database in cronjob if activated

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2017-01-28 21:20:37 +01:00
parent 4cd1a8d656
commit 202eb0931f
3 changed files with 15 additions and 10 deletions

View File

@@ -14,9 +14,11 @@
* @package Install * @package Install
* *
*/ */
if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) { if (!defined('_CRON_UPDATE')) {
header('Location: ../../../../index.php'); if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) {
exit(); header('Location: ../../../../index.php');
exit();
}
} }
if (isFroxlorVersion('0.9-r0')) { if (isFroxlorVersion('0.9-r0')) {

View File

@@ -17,13 +17,15 @@
* *
*/ */
if (!defined('AREA') if (!defined('_CRON_UPDATE')) {
|| (defined('AREA') && AREA != 'admin') if (!defined('AREA')
|| !isset($userinfo['loginname']) || (defined('AREA') && AREA != 'admin')
|| (isset($userinfo['loginname']) && $userinfo['loginname'] == '') || !isset($userinfo['loginname'])
) { || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')
header('Location: ../index.php'); ) {
exit; header('Location: ../index.php');
exit;
}
} }
$updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater')); $updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater'));

View File

@@ -205,6 +205,7 @@ if (hasUpdates($version) || hasDbUpdates($dbversion)
fwrite($debugHandler, '*** WARNING *** - all new settings etc. will be stored with the default value, that might not always be right for your system!' . "\n"); fwrite($debugHandler, '*** WARNING *** - all new settings etc. will be stored with the default value, that might not always be right for your system!' . "\n");
fwrite($debugHandler, "*** WARNING *** - If you don't want this to happen in the future consider removing the --allow-autoupdate flag from the cronjob\n"); fwrite($debugHandler, "*** WARNING *** - If you don't want this to happen in the future consider removing the --allow-autoupdate flag from the cronjob\n");
// including update procedures // including update procedures
define('_CRON_UPDATE', 1);
include_once FROXLOR_INSTALL_DIR.'/install/updatesql.php'; include_once FROXLOR_INSTALL_DIR.'/install/updatesql.php';
// pew - everything went better than expected // pew - everything went better than expected
$cronlog->logAction(CRON_ACTION, LOG_WARNING, 'Automatic update done - you should check your settings to be sure everything is fine'); $cronlog->logAction(CRON_ACTION, LOG_WARNING, 'Automatic update done - you should check your settings to be sure everything is fine');