From 5bbfc1b098302671bcbf2f754efc627d50eaa5c7 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Thu, 13 Jan 2011 09:25:59 -0500 Subject: [PATCH] Added global functions library which conatins a mail functin that supports attachments and a array_merge function that merges arrays that conatain numeric keys and strings correctly. --- server/mods-available/remoteaction_core_module.inc.php | 87 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 77 insertions(+), 10 deletions(-) diff --git a/server/mods-available/remoteaction_core_module.inc.php b/server/mods-available/remoteaction_core_module.inc.php index 7e8c0b1..4416bd8 100644 --- a/server/mods-available/remoteaction_core_module.inc.php +++ b/server/mods-available/remoteaction_core_module.inc.php @@ -110,13 +110,22 @@ /* * process all actions */ - foreach ($actions as $action) { - if ($action['action_type'] == 'os_update') { - /* do the update */ - $this->_doOsUpdate($action); - /* this action takes so much time, - * we stop executing the actions not to waste more time */ - return; + if(is_array($actions)) { + foreach ($actions as $action) { + if ($action['action_type'] == 'os_update') { + /* do the update */ + $this->_doOsUpdate($action); + /* this action takes so much time, + * we stop executing the actions not to waste more time */ + return; + } + if ($action['action_type'] == 'ispc_update') { + /* do the update */ + $this->_doIspCUpdate($action); + /* this action takes so much time, + * we stop executing the actions not to waste more time */ + return; + } } } } @@ -125,14 +134,72 @@ /* * Do the update */ - exec("aptitude update"); - exec("aptitude upgrade -y"); - + //TODO : change this when distribution information has been integrated into server record + if(file_exists('/etc/gentoo-release')) { + exec("glsa-check -f --nocolor affected"); + } + else { + exec("aptitude update"); + exec("aptitude upgrade -y"); + } + /* * All well done! */ $this->_actionDone($action['action_id'], 'ok'); } + private function _doIspCUpdate($action) { + + // Ensure that this code is not executed twice as this would cause a loop in case of a failure + $this->_actionDone($action['action_id'], 'ok'); + + /* + * Get the version-number of the newest version + */ + $new_version = @file_get_contents('http://www.ispconfig.org/downloads/ispconfig3_version.txt'); + $new_version = trim($new_version); + + /* + * Do the update + */ + + /* jump into the temporary dir */ + $oldDir = getcwd(); + chdir("/tmp"); + + /* delete the old files (if there are any...) */ + exec("rm /tmp/ISPConfig-" . $new_version . ".tar.gz"); + exec("rm /tmp/ispconfig3_install -R"); + + /* get the newest version */ + exec("wget http://www.ispconfig.org/downloads/ISPConfig-" . $new_version . ".tar.gz"); + + /* extract the files */ + exec("tar xvfz ISPConfig-" . $new_version . ".tar.gz"); + + /* + * Start the automated update + */ + chdir("/tmp/ispconfig3_install/install"); + exec("touch autoupdate"); + exec("php -q autoupdate.php"); + + /* + * do some clean-up + */ + exec("rm /tmp/ISPConfig-" . $new_version . ".tar.gz"); + exec("rm /tmp/ispconfig3_install -R"); + + /* + * go back to the "old path" + */ + chdir($oldDir); + + /* + * All well done! + */ + //$this->_actionDone($action['action_id'], 'ok'); + } } ?> \ No newline at end of file -- Gitblit v1.9.1