update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -109,34 +109,8 @@ class UpdateCommunication
|
|||
$hasPluginUpdate = $hasPluginUpdate || !$plugin['isTheme'];
|
||||
}
|
||||
|
||||
$subject = Piwik::translate('CoreUpdater_NotificationSubjectAvailablePluginUpdate');
|
||||
$message = Piwik::translate('ScheduledReports_EmailHello');
|
||||
$message .= "\n\n";
|
||||
$message .= Piwik::translate('CoreUpdater_ThereIsNewPluginVersionAvailableForUpdate');
|
||||
$message .= "\n\n";
|
||||
|
||||
foreach ($pluginsToBeNotified as $plugin) {
|
||||
$message .= sprintf(' * %s %s', $plugin['name'], $plugin['latestVersion']);
|
||||
$message .= "\n";
|
||||
}
|
||||
|
||||
$message .= "\n";
|
||||
|
||||
$host = SettingsPiwik::getPiwikUrl();
|
||||
if ($hasThemeUpdate) {
|
||||
$message .= Piwik::translate('CoreUpdater_NotificationClickToUpdateThemes') . "\n";
|
||||
$message .= $host. 'index.php?module=CorePluginsAdmin&action=themes';
|
||||
}
|
||||
if ($hasPluginUpdate) {
|
||||
if ($hasThemeUpdate) {
|
||||
$message .= "\n\n";
|
||||
}
|
||||
$message .= Piwik::translate('CoreUpdater_NotificationClickToUpdatePlugins') . "\n";
|
||||
$message .= $host. 'index.php?module=CorePluginsAdmin&action=plugins';
|
||||
}
|
||||
|
||||
$message .= "\n\n";
|
||||
$message .= Piwik::translate('Installation_HappyAnalysing');
|
||||
$subject = Piwik::translate('CoreUpdater_NotificationSubjectAvailablePluginUpdate');
|
||||
$message = $this->buildNotificationMessage($pluginsToBeNotified, $hasThemeUpdate, $hasPluginUpdate);
|
||||
|
||||
$this->sendEmailNotification($subject, $message);
|
||||
}
|
||||
|
|
@ -161,24 +135,24 @@ class UpdateCommunication
|
|||
}
|
||||
}
|
||||
|
||||
private function setHasLatestUpdateNotificationReceived($plugin)
|
||||
protected function setHasLatestUpdateNotificationReceived($plugin)
|
||||
{
|
||||
$latestVersion = $this->getLatestVersion($plugin);
|
||||
|
||||
Option::set($this->getNotificationSentOptionName($plugin), $latestVersion);
|
||||
}
|
||||
|
||||
private function getLatestVersionSent($plugin)
|
||||
protected function getLatestVersionSent($plugin)
|
||||
{
|
||||
return Option::get($this->getNotificationSentOptionName($plugin));
|
||||
}
|
||||
|
||||
private function getLatestVersion($plugin)
|
||||
protected function getLatestVersion($plugin)
|
||||
{
|
||||
return $plugin['latestVersion'];
|
||||
}
|
||||
|
||||
private function hasNotificationAlreadyReceived($plugin)
|
||||
protected function hasNotificationAlreadyReceived($plugin)
|
||||
{
|
||||
$latestVersion = $this->getLatestVersion($plugin);
|
||||
$lastVersionSent = $this->getLatestVersionSent($plugin);
|
||||
|
|
@ -192,7 +166,7 @@ class UpdateCommunication
|
|||
return false;
|
||||
}
|
||||
|
||||
private function getNotificationSentOptionName($plugin)
|
||||
protected function getNotificationSentOptionName($plugin)
|
||||
{
|
||||
return 'last_update_communication_sent_plugin_' . $plugin['name'];
|
||||
}
|
||||
|
|
@ -207,4 +181,39 @@ class UpdateCommunication
|
|||
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
protected function buildNotificationMessage($pluginsToBeNotified, $hasThemeUpdate, $hasPluginUpdate)
|
||||
{
|
||||
$message = Piwik::translate('ScheduledReports_EmailHello');
|
||||
$message .= "\n\n";
|
||||
$message .= Piwik::translate('CoreUpdater_ThereIsNewPluginVersionAvailableForUpdate');
|
||||
$message .= "\n\n";
|
||||
|
||||
foreach ($pluginsToBeNotified as $plugin) {
|
||||
$message .= sprintf(' * %s %s', $plugin['name'], $plugin['latestVersion']);
|
||||
$message .= "\n";
|
||||
}
|
||||
|
||||
$message .= "\n";
|
||||
|
||||
$host = SettingsPiwik::getPiwikUrl();
|
||||
|
||||
if ($hasThemeUpdate) {
|
||||
$message .= Piwik::translate('CoreUpdater_NotificationClickToUpdateThemes') . "\n";
|
||||
$message .= $host . 'index.php?module=CorePluginsAdmin&action=themes';
|
||||
}
|
||||
|
||||
if ($hasPluginUpdate) {
|
||||
if ($hasThemeUpdate) {
|
||||
$message .= "\n\n";
|
||||
}
|
||||
$message .= Piwik::translate('CoreUpdater_NotificationClickToUpdatePlugins') . "\n";
|
||||
$message .= $host . 'index.php?module=CorePluginsAdmin&action=plugins';
|
||||
}
|
||||
|
||||
$message .= "\n\n";
|
||||
$message .= Piwik::translate('Installation_HappyAnalysing');
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue