public function update($componentName)
{
$warningMessages = array();
$this->executeListenerHook('onComponentUpdateStarting', array($componentName));
foreach ($this->componentsWithUpdateFile[$componentName] as $file => $fileVersion) {
try {
require_once $file;
// prefixed by PIWIK_INCLUDE_PATH
$className = $this->getUpdateClassName($componentName, $fileVersion);
if (!in_array($className, $this->updatedClasses) && class_exists($className, false)) {
$this->executeListenerHook('onComponentUpdateFileStarting', array($componentName, $file, $className, $fileVersion));
$this->executeSingleUpdateClass($className);
$this->executeListenerHook('onComponentUpdateFileFinished', array($componentName, $file, $className, $fileVersion));
// makes sure to call Piwik\Columns\Updater only once as one call updates all dimensions at the same
// time for better performance
$this->updatedClasses[] = $className;
}
$this->markComponentSuccessfullyUpdated($componentName, $fileVersion);
} catch (UpdaterErrorException $e) {
$this->executeListenerHook('onError', array($componentName, $fileVersion, $e));
throw $e;
} catch (\Exception $e) {
$warningMessages[] = $e->getMessage();
$this->executeListenerHook('onWarning', array($componentName, $fileVersion, $e));
}
}
// to debug, create core/Updates/X.php, update the core/Version.php, throw an Exception in the try, and comment the following lines
$updatedVersion = $this->componentsWithNewVersion[$componentName][self::INDEX_NEW_VERSION];
$this->markComponentSuccessfullyUpdated($componentName, $updatedVersion);
$this->executeListenerHook('onComponentUpdateFinished', array($componentName, $updatedVersion, $warningMessages));
return $warningMessages;
}