Skip to content
Extraits de code Groupes Projets
Valider 56875fe8 rédigé par sgiehl's avatar sgiehl
Parcourir les fichiers

backported #10468 to 2.x

parent 7a2f3c50
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -415,6 +415,14 @@ class Manager
if ($this->isPluginInFilesystem($pluginName)) {
return false;
}
/**
* Event triggered after a plugin has been uninstalled.
*
* @param string $pluginName The plugin that has been uninstalled.
*/
Piwik::postEvent('PluginManager.pluginUninstalled', array($pluginName));
return true;
}
......@@ -1076,6 +1084,15 @@ class Manager
$updater = new Updater();
$updater->markComponentSuccessfullyUpdated($plugin->getPluginName(), $plugin->getVersion());
$saveConfig = true;
/**
* Event triggered after a new plugin has been installed.
*
* Note: Might be triggered more than once if the config file is not writable
*
* @param string $pluginName The plugin that has been installed.
*/
Piwik::postEvent('PluginManager.pluginInstalled', array($pluginName));
}
if ($saveConfig) {
......
......@@ -272,6 +272,35 @@ class Updater
$this->executeListenerHook('onComponentUpdateFinished', array($componentName, $updatedVersion, $warningMessages));
/**
* Event triggered after a component has been updated.
*
* Can be used to handle stuff that should be done after a component was updated
*
* **Example**
*
* Piwik::addAction('Updater.componentUpdated', function ($componentName, $updatedVersion, $warningMessages) {
* $mail = new Mail();
* $mail->setDefaultFromPiwik();
* $mail->addTo('test@example.org');
* $mail->setSubject('Component was updated);
* $message = sprintf(
* 'Component %1$s has been updated to version %2$s',
* $componentName, $updatedVersion
* );
* if (!empty($warningMessages)) {
* $message .= "Some warnings occured:\n" . implode("\n", $warningMessages);
* }
* $mail->setBodyText($message);
* $mail->send();
* });
*
* @param string $componentName 'core', or plugin name
* @param string $updatedVersion version updated to
* @param array $warningMessages warnings occurred during update
*/
Piwik::postEvent('Updater.componentUpdated', array($componentName, $updatedVersion, $warningMessages));
return $warningMessages;
}
......
......@@ -17,9 +17,12 @@ class CustomPiwikJs extends Plugin
{
return array(
'CoreUpdater.update.end' => 'updateTracker',
'PluginManager.pluginDeactivated' => 'updateTracker',
'PluginManager.pluginActivated' => 'updateTracker',
'CronArchive.end' => 'updateTracker',
'PluginManager.pluginActivated' => 'updateTracker',
'PluginManager.pluginDeactivated' => 'updateTracker',
'PluginManager.pluginInstalled' => 'updateTracker',
'PluginManager.pluginUninstalled' => 'updateTracker',
'Updater.componentUpdated' => 'updateTracker',
);
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter