Piwik\SettingsPiwik::isMultiServerEnvironment PHP Метод

isMultiServerEnvironment() публичный статический Метод

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.
public static isMultiServerEnvironment ( ) : boolean
Результат boolean
    public static function isMultiServerEnvironment()
    {
        $is = Config::getInstance()->General['multi_server_environment'];
        return !empty($is);
    }

Usage Example

Пример #1
0
 /**
  * Renders the current view. Also sends the stored 'Content-Type' HTML header.
  * See {@link setContentType()}.
  *
  * @return string Generated template.
  */
 public function render()
 {
     try {
         $this->currentModule = Piwik::getModule();
         $this->currentAction = Piwik::getAction();
         $this->url = Common::sanitizeInputValue(Url::getCurrentUrl());
         $this->token_auth = Piwik::getCurrentUserTokenAuth();
         $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
         $this->userIsAnonymous = Piwik::isUserIsAnonymous();
         $this->userIsSuperUser = Piwik::hasUserSuperUserAccess();
         $this->latest_version_available = UpdateCheck::isNewestVersionAvailable();
         $this->disableLink = Common::getRequestVar('disableLink', 0, 'int');
         $this->isWidget = Common::getRequestVar('widget', 0, 'int');
         $this->isMultiServerEnvironment = SettingsPiwik::isMultiServerEnvironment();
         $piwikAds = StaticContainer::get('Piwik\\ProfessionalServices\\Advertising');
         $this->areAdsForProfessionalServicesEnabled = $piwikAds->areAdsForProfessionalServicesEnabled();
         if (Development::isEnabled()) {
             $cacheBuster = rand(0, 10000);
         } else {
             $cacheBuster = UIAssetCacheBuster::getInstance()->piwikVersionBasedCacheBuster();
         }
         $this->cacheBuster = $cacheBuster;
         $this->loginModule = Piwik::getLoginPluginName();
         $user = APIUsersManager::getInstance()->getUser($this->userLogin);
         $this->userAlias = $user['alias'];
     } catch (Exception $e) {
         Log::debug($e);
         // can fail, for example at installation (no plugin loaded yet)
     }
     ProxyHttp::overrideCacheControlHeaders('no-store');
     Common::sendHeader('Content-Type: ' . $this->contentType);
     // always sending this header, sometimes empty, to ensure that Dashboard embed loads
     // - when calling sendHeader() multiple times, the last one prevails
     Common::sendHeader('X-Frame-Options: ' . (string) $this->xFrameOptions);
     return $this->renderTwigTemplate();
 }