Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobocoder <anthon.pang@gmail.com>2009-08-02 11:44:32 +0400
committerrobocoder <anthon.pang@gmail.com>2009-08-02 11:44:32 +0400
commit1808072ca126ffabc4da3cf54ac4fd902f3c9251 (patch)
treec6aed830f4fdf2d3a917e9bfe6a6dc15d88d364e /core/Updater.php
parenta4ffad91b8bf71317dfd794bf474bf66cde951b7 (diff)
fixes #894, refs #666 - fix problems and inconsistencies between fresh install and upgrade path
Only the utf8 side-effects of converting of TEXT columns to MEDIUMTEXT columns was unchanged. git-svn-id: http://dev.piwik.org/svn/trunk@1351 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Updater.php')
-rw-r--r--core/Updater.php39
1 files changed, 34 insertions, 5 deletions
diff --git a/core/Updater.php b/core/Updater.php
index 1be7884a9d..79555ace4a 100644
--- a/core/Updater.php
+++ b/core/Updater.php
@@ -73,7 +73,7 @@ class Piwik_Updater
public function update($name)
{
$warningMessages = array();
- foreach($this->componentsWithUpdateFile[$name] as $fileVersion => $file)
+ foreach($this->componentsWithUpdateFile[$name] as $file => $fileVersion)
{
try {
require_once $file; // prefixed by PIWIK_INCLUDE_PATH
@@ -91,7 +91,7 @@ class Piwik_Updater
}
/**
- * @return array array( componentName => array( file1, [...]), [...])
+ * @return array array( componentName => array( file1 => version1, [...]), [...])
*/
private function loadComponentsWithUpdateFile()
{
@@ -103,11 +103,11 @@ class Piwik_Updater
if($name == 'core')
{
- $pathToUpdates = $this->pathUpdateFileCore . '*';
+ $pathToUpdates = $this->pathUpdateFileCore . '*.php';
}
else
{
- $pathToUpdates = sprintf($this->pathUpdateFilePlugins, $name) . '*';
+ $pathToUpdates = sprintf($this->pathUpdateFilePlugins, $name) . '*.php';
}
$files = glob( $pathToUpdates );
@@ -120,7 +120,7 @@ class Piwik_Updater
$fileVersion = basename($file, '.php');
if(version_compare($currentVersion, $fileVersion) == -1)
{
- $componentsWithUpdateFile[$name][$fileVersion] = $file;
+ $componentsWithUpdateFile[$name][$file] = $fileVersion;
}
}
@@ -197,6 +197,35 @@ class Piwik_Updater
}
return $componentsToUpdate;
}
+
+ /**
+ * Performs database update(s)
+ */
+ static function updateDatabase($file, $sqlarray)
+ {
+ foreach($sqlarray as $update => $ignoreError)
+ {
+ try {
+ Piwik_Query( $update );
+ } catch(Exception $e) {
+ if(($ignoreError === false) || !preg_match($ignoreError, $e->getMessage()))
+ {
+ $message = $file .":\nError trying to execute the query '". $update ."'.\nThe error was: ". $e->getMessage();
+ throw new Piwik_Updater_UpdateErrorException($message);
+ }
+ }
+ }
+ }
}
+// If you encountered an error during the database update:
+// - correct the source of the problem
+// - execute the remaining queries in the update that failed
+// - manually update the `option` table in your Piwik database, setting the value of version_core to the version of the failed update
+// - re-run the updater (through the browser or command-line) to continue with the remaining updates
+//
+// If the source of the problem is:
+// - insufficient memory: increase memory_limit
+// - browser timeout: increase max_execution_time or run the updater from the command-line (shell)
+
class Piwik_Updater_UpdateErrorException extends Exception {}