當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Piwik_Config::getLocalConfigPath方法代碼示例

本文整理匯總了PHP中Piwik_Config::getLocalConfigPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Piwik_Config::getLocalConfigPath方法的具體用法?PHP Piwik_Config::getLocalConfigPath怎麽用?PHP Piwik_Config::getLocalConfigPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik_Config的用法示例。


在下文中一共展示了Piwik_Config::getLocalConfigPath方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 static function update()
 {
     $salt = Piwik_Common::generateUniqId();
     if (!isset(Piwik_Config::getInstance()->superuser['salt'])) {
         try {
             if (is_writable(Piwik_Config::getLocalConfigPath())) {
                 Piwik_Config::getInstance()->setConfigOption('superuser', 'salt', $salt);
                 Piwik_Config::getInstance()->forceSave();
             } else {
                 throw new Exception('mandatory update failed');
             }
         } catch (Exception $e) {
             throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = {$salt}</code>");
         }
     }
     $plugins = Piwik_Config::getInstance()->Plugins;
     if (!in_array('MultiSites', $plugins)) {
         try {
             if (is_writable(Piwik_Config::getLocalConfigPath())) {
                 $plugins[] = 'MultiSites';
                 Piwik_Config::getInstance()->setConfigSection('Plugins', $plugins);
                 Piwik_Config::getInstance()->forceSave();
             } else {
                 throw new Exception('optional update failed');
             }
         } catch (Exception $e) {
             throw new Exception("You can now enable the new MultiSites plugin in the Plugins screen in the Piwik admin!");
         }
     }
     Piwik_Updater::updateDatabase(__FILE__, self::getSql());
 }
開發者ID:nnnnathann,項目名稱:piwik,代碼行數:31,代碼來源:0.5.4.php

示例2: update

 static function update()
 {
     $dbInfos = Piwik_Config::getInstance()->database;
     if (!isset($dbInfos['schema'])) {
         try {
             if (is_writable(Piwik_Config::getLocalConfigPath())) {
                 Piwik_Config::getInstance()->setConfigOption('database', 'schema', 'Myisam');
                 Piwik_Config::getInstance()->forceSave();
             } else {
                 throw new Exception('mandatory update failed');
             }
         } catch (Exception $e) {
             throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>");
         }
     }
     Piwik_Updater::updateDatabase(__FILE__, self::getSql());
 }
開發者ID:nnnnathann,項目名稱:piwik,代碼行數:17,代碼來源:0.6.3.php

示例3: checkPreviousStepIsValid

 /**
  * The previous step is valid if it is either
  * - any step before (OK to go back)
  * - the current step (case when validating a form)
  * If step is invalid, then exit.
  *
  * @param string $currentStep Current step
  */
 protected function checkPreviousStepIsValid($currentStep)
 {
     $error = false;
     if (empty($this->session->currentStepDone)) {
         $error = true;
     } else {
         if ($currentStep == 'finished' && $this->session->currentStepDone == 'finished') {
             // ok to refresh this page or use language selector
         } else {
             if (file_exists(Piwik_Config::getLocalConfigPath())) {
                 $error = true;
             }
             $steps = array_keys($this->steps);
             // the currentStep
             $currentStepId = array_search($currentStep, $steps);
             // the step before
             $previousStepId = array_search($this->session->currentStepDone, $steps);
             // not OK if currentStepId > previous+1
             if ($currentStepId > $previousStepId + 1) {
                 $error = true;
             }
         }
     }
     if ($error) {
         Piwik_Login_Controller::clearSession();
         $message = Piwik_Translate('Installation_ErrorInvalidState', array('<br /><b>', '</b>', '<a href=\'' . Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrlWithoutFileName()) . '\'>', '</a>'));
         Piwik::exitWithErrorMessage($message);
     }
 }
開發者ID:0h546f6f78696342756e4e59,項目名稱:piwik,代碼行數:37,代碼來源:Controller.php

示例4: saveTrustedHostnameInConfig

 /**
  * Records one host, or an array of hosts in the config file,
  * if user is super user
  *
  * @static
  * @param $host string|array
  */
 public static function saveTrustedHostnameInConfig($host)
 {
     if (Piwik::isUserIsSuperUser() && file_exists(Piwik_Config::getLocalConfigPath())) {
         $general = Piwik_Config::getInstance()->General;
         if (!is_array($host)) {
             $host = array($host);
         }
         $host = array_filter($host);
         if (empty($host)) {
             return false;
         }
         $general['trusted_hosts'] = $host;
         Piwik_Config::getInstance()->General = $general;
         Piwik_Config::getInstance()->forceSave();
     }
 }
開發者ID:nomoto-ubicast,項目名稱:piwik,代碼行數:23,代碼來源:Url.php


注:本文中的Piwik_Config::getLocalConfigPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。