diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-10-08 03:18:06 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-10-08 03:18:06 +0400 |
commit | 16f8dd60bf76b080e1e6b6f1b887339edc351665 (patch) | |
tree | 3e258c095fb0ec42d256ccf4fe9137dfaba77ba0 /core/Updater.php | |
parent | 4737bb6ab39879c8decd5c10ff38e390394e226d (diff) |
Fixes #4203 DevicesDetection 1.14 version schema update to account for longer strings ( fields config_os_version and config_device_type are not large enough )
Refs #4204 Plugin schema example with DevicesDetection
Diffstat (limited to 'core/Updater.php')
-rw-r--r-- | core/Updater.php | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/core/Updater.php b/core/Updater.php index 0783b964f3..971a00847e 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -122,14 +122,14 @@ class Updater require_once $file; // prefixed by PIWIK_INCLUDE_PATH $className = $this->getUpdateClassName($componentName, $fileVersion); - if (class_exists($className, false)) { - $queriesForComponent = call_user_func(array($className, 'getSql')); - foreach ($queriesForComponent as $query => $error) { - $queries[] = $query . ';'; - } - - $this->hasMajorDbUpdate = $this->hasMajorDbUpdate || call_user_func(array($className, 'isMajorUpdate')); + if (!class_exists($className, false)) { + throw new \Exception("The class $className was not found in $file"); } + $queriesForComponent = call_user_func(array($className, 'getSql')); + foreach ($queriesForComponent as $query => $error) { + $queries[] = $query . ';'; + } + $this->hasMajorDbUpdate = $this->hasMajorDbUpdate || call_user_func(array($className, 'isMajorUpdate')); } // unfortunately had to extract this query from the Option class $queries[] = 'UPDATE `' . Common::prefixTable('option') . '` @@ -141,12 +141,13 @@ class Updater private function getUpdateClassName($componentName, $fileVersion) { - ////unprefixClass TODOA FIXME $suffix = strtolower(str_replace(array('-', '.'), '_', $fileVersion)); + $className = 'Updates_' . $suffix; + if ($componentName == 'core') { - return 'Piwik_Updates_' . $suffix; + return '\\Piwik\\Updates\\' . $className; } - return 'Piwik_' . $componentName . '_Updates_' . $suffix; + return '\\Piwik\\Plugins\\' . $componentName . '\\'. $className; } /** |