aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-07 11:38:32 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-07 11:38:32 +0000
commit1c9fafbf3b817ae6fb038c1f25f9e4fd817df929 (patch)
tree4e11280242c2bcfdba7d74d51802e924b62fb5b7
parentf89ef0c9768871d42529ec81d2ec8e14565d6c71 (diff)
downloadelgg-1c9fafbf3b817ae6fb038c1f25f9e4fd817df929.tar.gz
elgg-1c9fafbf3b817ae6fb038c1f25f9e4fd817df929.tar.bz2
Closes #409: PHP update script to update core added
git-svn-id: https://code.elgg.org/elgg/trunk@2208 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/database.php3
-rw-r--r--engine/lib/upgrades/2008100601.php8
-rw-r--r--engine/lib/version.php65
-rw-r--r--languages/en.php3
-rw-r--r--version.php4
5 files changed, 75 insertions, 8 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index 0ac5eba65..c46d6023f 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -458,7 +458,8 @@
}
}
-
+
+ return true;
}
/**
diff --git a/engine/lib/upgrades/2008100601.php b/engine/lib/upgrades/2008100601.php
new file mode 100644
index 000000000..cf976e84c
--- /dev/null
+++ b/engine/lib/upgrades/2008100601.php
@@ -0,0 +1,8 @@
+<?php
+ /// Activate mail plugin
+ /**
+ * Because Elgg now has a plugable account activation process we need to activate
+ * the email account activation plugin for existing installs.
+ */
+ enable_plugin('uservalidationbyemail', $CONFIG->site->guid);
+?> \ No newline at end of file
diff --git a/engine/lib/version.php b/engine/lib/version.php
index 58f3cbde6..4799b1a85 100644
--- a/engine/lib/version.php
+++ b/engine/lib/version.php
@@ -9,7 +9,58 @@
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @copyright Curverider Ltd 2008
* @link http://elgg.org/
- */
+ */
+
+ /**
+ * Run any php upgrade scripts which are required
+ *
+ * @param unknown_type $version
+ */
+ function upgrade_code($version)
+ {
+ global $CONFIG;
+
+ // Elgg and its database must be installed to upgrade it!
+ if (!is_db_installed() || !is_installed()) return false;
+
+ $version = (int) $version;
+
+ if ($handle = opendir($CONFIG->path . 'engine/lib/upgrades/')) {
+
+ $upgrades = array();
+
+ while ($updatefile = readdir($handle)) {
+
+ // Look for upgrades and add to upgrades list
+ if (!is_dir($CONFIG->path . 'engine/lib/upgrades/' . $updatefile)) {
+ if (preg_match('/([0-9]*)\.php/',$updatefile,$matches)) {
+ $core_version = (int) $matches[1];
+ if ($core_version > $version) {
+ $upgrades[] = $updatefile;
+ }
+ }
+ }
+
+ }
+
+ // Sort and execute
+ asort($upgrades);
+ if (sizeof($upgrades) > 0) {
+ foreach($upgrades as $upgrade) {
+ try {
+ @include($CONFIG->path . 'engine/lib/upgrades/' . $upgrade);
+ } catch (Exception $e) {
+ error_log($e->getmessage());
+ }
+
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+ }
/**
* Get the current version information
@@ -53,11 +104,17 @@
function version_upgrade() {
$dbversion = (int) datalist_get('version');
+
+ // Upgrade database
db_upgrade($dbversion);
+ system_message(elgg_echo('upgrade:db'));
+
+ // Upgrade core
+ if (upgrade_code($dbversion))
+ system_message(elgg_echo('upgrade:core'));
+
+ // Update the version
datalist_set('version', get_version());
- system_message(elgg_echo('upgrade:db'));
- //forward();
- //exit;
}
diff --git a/languages/en.php b/languages/en.php
index 44440a072..2e97f3c1b 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -668,7 +668,8 @@ Alternatively, you can enter your database settings below and we will try and do
'installation:disableapi' => "Elgg comes with an flexible and extendible API that enables applications use certain Elgg features remotely",
'installation:disableapi:label' => "Enable the RESTful API",
- 'upgrade:db' => 'Your database was upgraded.',
+ 'upgrade:db' => 'Your database was upgraded.',
+ 'upgrade:core' => 'Your elgg installation was upgraded',
/**
* Welcome
diff --git a/version.php b/version.php
index 93586efa6..2b5b18010 100644
--- a/version.php
+++ b/version.php
@@ -13,9 +13,9 @@
* @link http://elgg.org/
*/
- $version = 2008100601; // YYYYMMDD = Elgg Date
+ $version = 2008100701; // YYYYMMDD = Elgg Date
// XX = Interim incrementer
- $release = '1.06'; // Human-friendly version name
+ $release = '1.07'; // Human-friendly version name
?> \ No newline at end of file