aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/database.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-18 00:46:54 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-18 00:46:54 +0000
commit5a06233304a9965c8319ec5c1fcc4fd582393d02 (patch)
treec70268e7920779f890ad3858c39b1ed2b0fa1623 /engine/lib/database.php
parent5ee52a817885e641a56eef6ebcdd4250ef8be4b5 (diff)
downloadelgg-5a06233304a9965c8319ec5c1fcc4fd582393d02.tar.gz
elgg-5a06233304a9965c8319ec5c1fcc4fd582393d02.tar.bz2
Fixes #1433, #2183. Upgrades are now tracked and will be run if needed regardless of version.
git-svn-id: http://code.elgg.org/elgg/trunk@8277 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/database.php')
-rw-r--r--engine/lib/database.php64
1 files changed, 0 insertions, 64 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index b2cc5ca29..fa5b4a894 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -629,70 +629,6 @@ function run_sql_script($scriptlocation) {
}
/**
- * Upgrade the database schema in an ordered sequence.
- *
- * Executes all upgrade files in elgg/engine/schema/upgrades/ in sequential order.
- * Upgrade files must be in the standard Elgg release format of YYYYMMDDII.sql
- * where II is an incrementor starting from 01.
- *
- * Files that are < $version will be ignored.
- *
- * @warning Plugin authors should not call this function directly.
- *
- * @param int $version The version you are upgrading from in the format YYYYMMDDII.
- * @param string $fromdir Optional directory to load upgrades from. default: engine/schema/upgrades/
- * @param bool $quiet If true, suppress all error messages. Only use for the upgrade from <=1.6.
- *
- * @return bool
- * @see upgrade.php
- * @see version.php
- */
-function db_upgrade($version, $fromdir = "", $quiet = FALSE) {
- global $CONFIG;
-
- $version = (int) $version;
-
- if (!$fromdir) {
- $fromdir = $CONFIG->path . 'engine/schema/upgrades/';
- }
-
- if ($handle = opendir($fromdir)) {
- $sqlupgrades = array();
-
- while ($sqlfile = readdir($handle)) {
- if (!is_dir($fromdir . $sqlfile)) {
- if (preg_match('/^([0-9]{10})\.(sql)$/', $sqlfile, $matches)) {
- $sql_version = (int) $matches[1];
- if ($sql_version > $version) {
- $sqlupgrades[] = $sqlfile;
- }
- }
- }
- }
-
- asort($sqlupgrades);
-
- if (sizeof($sqlupgrades) > 0) {
- foreach ($sqlupgrades as $sqlfile) {
-
- // hide all errors.
- if ($quiet) {
- try {
- run_sql_script($fromdir . $sqlfile);
- } catch (DatabaseException $e) {
- error_log($e->getmessage());
- }
- } else {
- run_sql_script($fromdir . $sqlfile);
- }
- }
- }
- }
-
- return TRUE;
-}
-
-/**
* Sanitise a string for database use, but with the option of escaping extra characters.
*
* @param string $string The string to sanitise