public function markComponentSuccessfullyUpdated($name, $version, $isNew = false)
{
try {
Option::set(self::getNameInOptionTable($name), $version, $autoLoad = 1);
} catch (\Exception $e) {
// case when the option table is not yet created (before 0.2.10)
}
if ($isNew) {
/**
* Event triggered after a new component has been installed.
*
* @param string $name The component that has been installed.
*/
Piwik::postEvent('Updater.componentInstalled', array($name));
return;
}
/**
* Event triggered after a component has been updated.
*
* Can be used to handle logic that should be done after a component was updated
*
* **Example**
*
* Piwik::addAction('Updater.componentUpdated', function ($componentName, $updatedVersion) {
* $mail = new Mail();
* $mail->setDefaultFromPiwik();
* $mail->addTo('[email protected]');
* $mail->setSubject('Component was updated);
* $message = sprintf(
* 'Component %1$s has been updated to version %2$s',
* $componentName, $updatedVersion
* );
* $mail->setBodyText($message);
* $mail->send();
* });
*
* @param string $componentName 'core', plugin name or dimension name
* @param string $updatedVersion version updated to
*/
Piwik::postEvent('Updater.componentUpdated', array($name, $version));
}