diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-03-02 07:28:20 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-03-04 06:58:59 +0300 |
commit | 1202d1a4f476e8d8abb7e62f5c282d249f5df10b (patch) | |
tree | 84ee73675e9cf587e853059ad2ac2fbb76fa027d /plugins | |
parent | a24a01eef84a6b110f020a634f479f2c0e76c986 (diff) |
Update Piwik using HTTPS + add a system check
- Piwik will update over HTTPS if curl is supported
- the system check verifies that updating over HTTPS is supported (= curl supported)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreUpdater/Controller.php | 11 | ||||
-rw-r--r-- | plugins/Installation/SystemCheck.php | 4 | ||||
-rw-r--r-- | plugins/Installation/lang/en.json | 2 | ||||
-rwxr-xr-x | plugins/Installation/templates/_systemCheckSection.twig | 11 |
4 files changed, 27 insertions, 1 deletions
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index 90b0d13aa5..ca72b62ac0 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -48,7 +48,8 @@ class Controller extends \Piwik\Plugin\Controller protected static function getLatestZipUrl($newVersion) { if (@Config::getInstance()->Debug['allow_upgrades_to_beta']) { - return 'http://builds.piwik.org/piwik-' . $newVersion . '.zip'; + $url = Config::getInstance()->General['latest_beta_version_url']; + return sprintf($url, $newVersion); } return Config::getInstance()->General['latest_version_url']; } @@ -426,4 +427,12 @@ class Controller extends \Piwik\Plugin\Controller return PluginManager::getInstance()->getIncompatiblePlugins($piwikVersion); } + public static function isUpdatingOverHttps() + { + if (strpos(self::getLatestZipUrl(''), 'https') === false) { + return false; + } + + return Http::getTransportMethod() === 'curl'; + } } diff --git a/plugins/Installation/SystemCheck.php b/plugins/Installation/SystemCheck.php index de55506884..93ed1ac75f 100644 --- a/plugins/Installation/SystemCheck.php +++ b/plugins/Installation/SystemCheck.php @@ -19,6 +19,7 @@ use Piwik\Filechecks; use Piwik\Filesystem; use Piwik\Http; use Piwik\Piwik; +use Piwik\Plugins\CoreUpdater; use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\SettingsServer; use Piwik\Url; @@ -102,6 +103,9 @@ class SystemCheck $infos['tracker_status'] = Common::getRequestVar('trackerStatus', 0, 'int'); $infos['is_nfs'] = Filesystem::checkIfFileSystemIsNFS(); + + $infos['https_update'] = CoreUpdater\Controller::isUpdatingOverHttps(); + $infos = self::enrichSystemChecks($infos); return $infos; diff --git a/plugins/Installation/lang/en.json b/plugins/Installation/lang/en.json index 9711d997c3..57abb9c4cf 100644 --- a/plugins/Installation/lang/en.json +++ b/plugins/Installation/lang/en.json @@ -115,6 +115,8 @@ "SystemCheckCronArchiveProcess": "Archive Cron", "SystemCheckCronArchiveProcessCLI": "Managing processes via CLI", "SystemCheckPhpSetting": "To prevent some critical issue, you must set the following in your php.ini file: %s", + "SystemCheckUpdateHttps": "Update over HTTPS", + "SystemCheckUpdateHttpsNotSupported": "Piwik will update without using HTTPS which is insecure. Check that CURL is installed.", "NotSupported": "not supported", "Tables": "Creating the Tables", "TablesCreatedSuccess": "Tables created with success!", diff --git a/plugins/Installation/templates/_systemCheckSection.twig b/plugins/Installation/templates/_systemCheckSection.twig index f797d18969..b56db9b672 100755 --- a/plugins/Installation/templates/_systemCheckSection.twig +++ b/plugins/Installation/templates/_systemCheckSection.twig @@ -356,6 +356,17 @@ </tr> {% endif %} + <tr> + <td class="label">{{ 'Installation_SystemCheckUpdateHttps'|translate }}</td> + <td> + {% if infos.https_update %} + {{ ok }} + {% else %} + {{ warning }} {{ 'Installation_SystemCheckUpdateHttpsNotSupported'|translate }} + {% endif %} + </td> + </tr> + </table> {% include "@Installation/_integrityDetails.twig" %} |