added cronjob-auto-update-feature (beware and READ), fixes #1342; remove old backup-ftp-users on update, fixes #1381
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -64,7 +64,7 @@ $lockDirHandle = opendir($lockdir);
|
||||
while ($fName = readdir($lockDirHandle)) {
|
||||
|
||||
if ($lockFilename == substr($fName, 0, strlen($lockFilename))
|
||||
&& $lockfName != $fName
|
||||
&& $lockfName != $fName
|
||||
) {
|
||||
// Check if last run jailed out with an exception
|
||||
$croncontent = file($lockdir . $fName);
|
||||
@@ -169,19 +169,44 @@ if (((int)Settings::Get('system.mod_fcgid') == 1 && (int)Settings::Get('system.m
|
||||
// be sure HTMLPurifier's cache folder is writable
|
||||
safe_exec('chmod -R 0755 '.escapeshellarg(dirname(__FILE__).'/classes/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer'));
|
||||
|
||||
// Initialize logging
|
||||
$cronlog = FroxlorLogger::getInstanceOf(array('loginname' => 'cronjob'));
|
||||
fwrite($debugHandler, 'Logger has been included' . "\n");
|
||||
|
||||
if (Settings::Get('panel.version') == null
|
||||
|| Settings::Get('panel.version') != $version
|
||||
|| Settings::Get('panel.version') != $version
|
||||
) {
|
||||
/**
|
||||
* Do not proceed further if the Database version is not the same as the script version
|
||||
*/
|
||||
fclose($debugHandler);
|
||||
unlink($lockfile);
|
||||
$errormessage = "Version of file doesnt match version of database. Exiting...\n\n";
|
||||
$errormessage.= "Possible reason: Froxlor update\n";
|
||||
$errormessage.= "Information: Current version in database: ".Settings::Get('panel.version')." - version of Froxlor files: ".$version."\n";
|
||||
$errormessage.= "Solution: Please visit your Foxlor admin interface for further information.\n";
|
||||
die($errormessage);
|
||||
if (Settings::Get('system.cron_allowautoupdate') == null
|
||||
|| Settings::Get('system.cron_allowautoupdate') == 0
|
||||
) {
|
||||
/**
|
||||
* Do not proceed further if the Database version is not the same as the script version
|
||||
*/
|
||||
fclose($debugHandler);
|
||||
unlink($lockfile);
|
||||
$errormessage = "Version of file doesnt match version of database. Exiting...\n\n";
|
||||
$errormessage.= "Possible reason: Froxlor update\n";
|
||||
$errormessage.= "Information: Current version in database: ".Settings::Get('panel.version')." - version of Froxlor files: ".$version."\n";
|
||||
$errormessage.= "Solution: Please visit your Foxlor admin interface for further information.\n";
|
||||
die($errormessage);
|
||||
}
|
||||
|
||||
if (Settings::Get('system.cron_allowautoupdate') == 1) {
|
||||
/**
|
||||
* let's walk the walk - do the dangerous shit
|
||||
*/
|
||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, 'Automatic update is activated and we are going to proceed without any notices');
|
||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, 'all new settings etc. will be stored with the default value, that might not always be right for your system!');
|
||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, 'If you dont want this to happen in the future consider removing the --allow-autoupdate flag from the cronjob');
|
||||
fwrite($debugHandler, '*** WARNING *** - Automatic update is activated and we are going to proceed without any notices' . "\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 dont want this to happen in the future consider removing the --allow-autoupdate flag from the cronjob' . "\n");
|
||||
// including update procedures
|
||||
include_once FROXLOR_INSTALL_DIR.'/install/updatesql.php';
|
||||
// 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');
|
||||
fwrite($debugHandler, '*** WARNING *** - Automatic update done - you should check your settings to be sure everything is fine' . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($debugHandler, 'Froxlor version and database version are correct' . "\n");
|
||||
@@ -191,9 +216,5 @@ $cronscriptDebug = (Settings::Get('system.debug_cron') == '1') ? true : false;
|
||||
// Create a new idna converter
|
||||
$idna_convert = new idna_convert_wrapper();
|
||||
|
||||
// Initialize logging
|
||||
$cronlog = FroxlorLogger::getInstanceOf(array('loginname' => 'cronjob'));
|
||||
fwrite($debugHandler, 'Logger has been included' . "\n");
|
||||
|
||||
// check for cron.d-generation task and create it if necessary
|
||||
checkCrondConfigurationFile();
|
||||
|
||||
@@ -80,7 +80,12 @@ function checkCrondConfigurationFile() {
|
||||
}
|
||||
|
||||
// create entry-line
|
||||
$binpath = "/usr/bin/nice -n 5 /usr/bin/php5 -q";
|
||||
$binpath = Settings::Get("system.croncmdline");
|
||||
// fallback as it is important
|
||||
if ($binpath === null) {
|
||||
$binpath = "/usr/bin/nice -n 5 /usr/bin/php5 -q";
|
||||
}
|
||||
|
||||
$cronfile .= "root " . $binpath." " . FROXLOR_INSTALL_DIR . "/scripts/froxlor_master_cronjob.php --" . $row_cronentry['cronfile'] . " 1> /dev/null\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,6 @@ define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings');
|
||||
define('TABLE_DOMAINTOIP', 'panel_domaintoip');
|
||||
|
||||
// VERSION INFO
|
||||
$version = '0.9.32-rc1';
|
||||
$version = '0.9.32-rc2';
|
||||
$dbversion = '2';
|
||||
$branding = '';
|
||||
|
||||
Reference in New Issue
Block a user