diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2016-11-15 04:03:59 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2016-11-15 04:03:59 +0300 |
commit | 587cc39e0362719332d410b7a4d5ddcc68788eeb (patch) | |
tree | c982c369cdda542c3a4de08be11c893e5364838c /core/SettingsPiwik.php | |
parent | 64314b26dbc6619d535002bdb79b9e55d1fc87db (diff) |
Update Marketplace to work with new API (#10799)
* starting to port marketplace to piwik 3
* updating tests
* fix translation key
* fix various issues
* use material select
* fix plugin upload
* deprecate license_homepage plugin metadata and link to a LICENSE[.md|.txt] file if found (#10756)
* deprecate license_homepage plugin metadata, and link to a LICENSE[.md|.txt] file if found
* Make license view HTML only without menu
* fix tests and update
* fix some links did not work
* we need to show warnings even when plugin is installed, not only when activated. otherwise it is not clear why something is not downloadable
* fix install was not working
* improved responsiveness of marketplace
* fix more tests
* fix search was shown when only a few plugins are there
* fix ui tests
* fix some translations
* fix tests and remove duplicated test
Diffstat (limited to 'core/SettingsPiwik.php')
-rw-r--r-- | core/SettingsPiwik.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php index c0b2d8e177..52c4f3e16f 100644 --- a/core/SettingsPiwik.php +++ b/core/SettingsPiwik.php @@ -233,6 +233,43 @@ class SettingsPiwik } /** + * Detect whether user has enabled auto updates. Please note this config is a bit misleading. It is currently + * actually used for 2 things: To disable making any connections back to Piwik, and to actually disable the auto + * update of core and plugins. + * @return bool + */ + public static function isAutoUpdateEnabled() + { + return (bool) Config::getInstance()->General['enable_auto_update']; + } + + /** + * Detects whether an auto update can be made. An update is possible if the user is not on multiple servers and if + * automatic updates are actually enabled. If a user is running Piwik on multiple servers an update is not possible + * as it would be installed only on one server instead of all of them. Also if a user has disabled automatic updates + * we cannot perform any automatic updates. + * + * @return bool + */ + public static function isAutoUpdatePossible() + { + return !self::isMultiServerEnvironment() && self::isAutoUpdateEnabled(); + } + + /** + * Returns `true` if Piwik is running on more than one server. For example in a load balanced environment. In this + * case we should not make changes to the config and not install a plugin via the UI as it would be only executed + * on one server. + * @return bool + */ + public static function isMultiServerEnvironment() + { + $is = Config::getInstance()->General['multi_server_environment']; + + return !empty($is); + } + + /** * Returns `true` if segmentation is allowed for this user, `false` if otherwise. * * @return bool |