- setting version to 0.9.2

- checking for sane last-system-guid on update
- added a bit of cronlogging to ApsUpdater (only in paranoid mode)
This commit is contained in:
Michael Kaufmann (d00p)
2010-02-22 12:24:45 +00:00
parent 66d5ea8f9e
commit d236a5ceda
5 changed files with 29 additions and 7 deletions

View File

@@ -451,7 +451,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.1'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.2');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900'); INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');

View File

@@ -287,4 +287,15 @@ if(isFroxlorVersion('0.9'))
updateToVersion('0.9.1'); updateToVersion('0.9.1');
} }
if(isFroxlorVersion('0.9.1'))
{
showUpdateStep("Updating from 0.9.1 to 0.9.2", false);
showUpdateStep("Checking wether last-system-guid is sane");
checkLastGuid($settings['system']['lastguid']);
lastStepStatus(0);
updateToVersion('0.9.2');
}
?> ?>

View File

@@ -31,6 +31,12 @@ class ApsUpdater extends ApsParser
private $RequestDomain = ''; private $RequestDomain = '';
private $RootUrl = ''; private $RootUrl = '';
private $RootDir = ''; private $RootDir = '';
/**
* FroxlorLogger
* @var FroxlorLogger
*/
private $_cronlog = null;
/** /**
* constructor of class. setup some basic variables needed by class * constructor of class. setup some basic variables needed by class
@@ -38,12 +44,13 @@ class ApsUpdater extends ApsParser
* @param db instance of the database class from syscp * @param db instance of the database class from syscp
*/ */
public function __construct($db) public function __construct($db, $cronlog)
{ {
$this->db = $db; $this->db = $db;
$this->RequestDomain = 'apscatalog.com'; $this->RequestDomain = 'apscatalog.com';
$this->RootUrl = '/1/'; $this->RootUrl = '/1/';
$this->RootDir = dirname(dirname(dirname(dirname(__FILE__)))) . '/'; $this->RootDir = dirname(dirname(dirname(dirname(__FILE__)))) . '/';
$this->_cronlog = $cronlog;
} }
/** /**
@@ -52,12 +59,14 @@ class ApsUpdater extends ApsParser
public function UpdateHandler() public function UpdateHandler()
{ {
$this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Changing directory to '" . $this->RootDir . "'");
chdir($this->RootDir); chdir($this->RootDir);
//return if allow_url_fopen is disabled //return if allow_url_fopen is disabled
if(!ini_get('allow_url_fopen')) if(!ini_get('allow_url_fopen'))
{ {
$this->_cronlog->logAction(CRON_ACTION, LOG_ERROR, "The APS updater cronjob requires that allow_url_fopen is enabled for the PHP CLI binary!");
echo "The APS updater cronjob requires that allow_url_fopen is enabled for the PHP CLI binary!\n"; echo "The APS updater cronjob requires that allow_url_fopen is enabled for the PHP CLI binary!\n";
return; return;
} }
@@ -68,6 +77,7 @@ class ApsUpdater extends ApsParser
if($this->db->num_rows($Result) == 0) if($this->db->num_rows($Result) == 0)
{ {
$this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "No tasks for ApsUpdater");
return; return;
} }
@@ -77,20 +87,21 @@ class ApsUpdater extends ApsParser
$this->db->query('DELETE FROM `' . TABLE_APS_TASKS . '` WHERE `Task` = ' . $Task['Task']); $this->db->query('DELETE FROM `' . TABLE_APS_TASKS . '` WHERE `Task` = ' . $Task['Task']);
//fetch all vendors //fetch all vendors
$this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Fetching all Vendors from '" . $this->RootUrl . "'");
$Vendors = self::FetchSubUrls($this->RootUrl); $Vendors = self::FetchSubUrls($this->RootUrl);
if($Vendors !== false) if($Vendors !== false)
{ {
foreach($Vendors as $Vendor) foreach($Vendors as $Vendor)
{ {
//fetch all applications from vendors //fetch all applications from vendors
$this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Fetching all from Vendor '" . $Vendor. "'");
$Applications = self::FetchSubUrls($this->RootUrl . $Vendor); $Applications = self::FetchSubUrls($this->RootUrl . $Vendor);
if($Applications !== false) if($Applications !== false)
{ {
foreach($Applications as $Application) foreach($Applications as $Application)
{ {
//get newest version of package which is already installed //get newest version of package which is already installed
$this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Checking application '" . substr($Application, 0, -1) . "'");
$CurrentVersion = ''; $CurrentVersion = '';
$Result = $this->db->query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Name` = "' . $this->db->escape(substr($Application, 0, -1)) . '"'); $Result = $this->db->query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Name` = "' . $this->db->escape(substr($Application, 0, -1)) . '"');
@@ -193,7 +204,7 @@ class ApsUpdater extends ApsParser
$Url = str_replace(' ', '%20', $Url); $Url = str_replace(' ', '%20', $Url);
//get content from website url //get content from website url
$this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Downloading '" . 'http://' . $this->RequestDomain . $Url . '.aps' . $Downloads[0] . "'");
$Content = @file_get_contents('http://' . $this->RequestDomain . $Url . '.aps' . $Downloads[0]); $Content = @file_get_contents('http://' . $this->RequestDomain . $Url . '.aps' . $Downloads[0]);
if($Content != false) if($Content != false)

View File

@@ -68,7 +68,7 @@ define('PACKAGE_ENABLED', 2);
// VERSION INFO // VERSION INFO
$version = '0.9.1'; $version = '0.9.2';
$dbversion = '2'; $dbversion = '2';
?> ?>

View File

@@ -17,7 +17,7 @@
* @version $Id$ * @version $Id$
*/ */
$Aps = new ApsUpdater($db); $Aps = new ApsUpdater($db, $cronlog);
$Aps->UpdateHandler(); $Aps->UpdateHandler();
?> ?>