From 04e09afcccbf4e7f3eafa540ea35ac22b38f5bc0 Mon Sep 17 00:00:00 2001
From: filip <filip@ispconfig3>
Date: Mon, 27 Sep 2010 07:31:33 -0400
Subject: [PATCH] Implemented new FAQ functionality in help module
---
server/mods-available/remoteaction_core_module.inc.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/server/mods-available/remoteaction_core_module.inc.php b/server/mods-available/remoteaction_core_module.inc.php
index 7e8c0b1..e5e8868 100644
--- a/server/mods-available/remoteaction_core_module.inc.php
+++ b/server/mods-available/remoteaction_core_module.inc.php
@@ -118,6 +118,13 @@
* 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;
+ }
}
}
@@ -134,5 +141,53 @@
$this->_actionDone($action['action_id'], 'ok');
}
+ private function _doIspCUpdate($action) {
+ /*
+ * 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