]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Updater.php
Fix #773: set Piwik URL protocol
[github/shaarli/Shaarli.git] / application / Updater.php
index 27cb2f0a43e29b2e4879d91cac672b4a16e3159f..fd7e2073089eaca16a51fee881a1a68b45cc05df 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 use Shaarli\Config\ConfigJson;
 use Shaarli\Config\ConfigPhp;
+use Shaarli\Config\ConfigManager;
 
 /**
  * Class Updater.
@@ -363,6 +364,22 @@ class Updater
 
         return true;
     }
+
+    /**
+     * Add 'http://' to Piwik URL the setting is set.
+     *
+     * @return bool true if the update is successful, false otherwise.
+     */
+    public function updateMethodPiwikUrl()
+    {
+        if (! $this->conf->exists('plugins.PIWIK_URL') || startsWith($this->conf->get('plugins.PIWIK_URL'), 'http')) {
+            return true;
+        }
+
+        $this->conf->set('plugins.PIWIK_URL', 'http://'. $this->conf->get('plugins.PIWIK_URL'));
+        $this->conf->write($this->isLoggedIn);
+        return true;
+    }
 }
 
 /**