aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/database.php3
-rw-r--r--engine/lib/upgrades/2008100601.php8
-rw-r--r--engine/lib/version.php65
3 files changed, 71 insertions, 5 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;
}