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


PHP Piwik\SettingsServer類代碼示例

本文整理匯總了PHP中Piwik\SettingsServer的典型用法代碼示例。如果您正苦於以下問題:PHP SettingsServer類的具體用法?PHP SettingsServer怎麽用?PHP SettingsServer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: validate

 public function validate()
 {
     $inTrackerRequest = SettingsServer::isTrackerApiRequest();
     $inConsole = Common::isPhpCliMode();
     $this->checkConfigFileExists($this->settingsProvider->getPathGlobal());
     $this->checkConfigFileExists($this->settingsProvider->getPathLocal(), $startInstaller = !$inTrackerRequest && !$inConsole);
 }
開發者ID:JoeHorn,項目名稱:piwik,代碼行數:7,代碼來源:EnvironmentValidator.php

示例2: makeTrackerInstance

 private function makeTrackerInstance()
 {
     SettingsServer::setIsTrackerApiRequest();
     $storage = Factory::make('PluginName');
     SettingsServer::setIsNotTrackerApiRequest();
     return $storage;
 }
開發者ID:mgou-net,項目名稱:piwik,代碼行數:7,代碼來源:FactoryTest.php

示例3: updatePiwik

 /**
  * Update Piwik codebase by downloading and installing the latest version.
  *
  * @param bool $https Whether to use HTTPS if supported of not. If false, will use HTTP.
  * @return string[] Return an array of messages for the user.
  * @throws ArchiveDownloadException
  * @throws UpdaterException
  * @throws Exception
  */
 public function updatePiwik($https = true)
 {
     if (!$this->isNewVersionAvailable()) {
         throw new Exception($this->translator->translate('CoreUpdater_ExceptionAlreadyLatestVersion', Version::VERSION));
     }
     SettingsServer::setMaxExecutionTime(0);
     $newVersion = $this->getLatestVersion();
     $url = $this->getArchiveUrl($newVersion, $https);
     $messages = array();
     try {
         $archiveFile = $this->downloadArchive($newVersion, $url);
         $messages[] = $this->translator->translate('CoreUpdater_DownloadingUpdateFromX', $url);
         $extractedArchiveDirectory = $this->decompressArchive($archiveFile);
         $messages[] = $this->translator->translate('CoreUpdater_UnpackingTheUpdate');
         $this->verifyDecompressedArchive($extractedArchiveDirectory);
         $messages[] = $this->translator->translate('CoreUpdater_VerifyingUnpackedFiles');
         $disabledPluginNames = $this->disableIncompatiblePlugins($newVersion);
         if (!empty($disabledPluginNames)) {
             $messages[] = $this->translator->translate('CoreUpdater_DisablingIncompatiblePlugins', implode(', ', $disabledPluginNames));
         }
         $this->installNewFiles($extractedArchiveDirectory);
         $messages[] = $this->translator->translate('CoreUpdater_InstallingTheLatestVersion');
     } catch (ArchiveDownloadException $e) {
         throw $e;
     } catch (Exception $e) {
         throw new UpdaterException($e, $messages);
     }
     return $messages;
 }
開發者ID:CaptainSharf,項目名稱:SSAD_Project,代碼行數:38,代碼來源:Updater.php

示例4: getLongErrorMessage

    private function getLongErrorMessage()
    {
        $message = '<p>';

        if (SettingsServer::isWindows()) {
            $message .= $this->translator->translate(
                'Installation_SystemCheckWinPdoAndMysqliHelp',
                array('<br /><br /><code>extension=php_mysqli.dll</code><br /><code>extension=php_pdo.dll</code><br /><code>extension=php_pdo_mysql.dll</code><br />')
            );
        } else {
            $message .= $this->translator->translate(
                'Installation_SystemCheckPdoAndMysqliHelp',
                array(
                    '<br /><br /><code>--with-mysqli</code><br /><code>--with-pdo-mysql</code><br /><br />',
                    '<br /><br /><code>extension=mysqli.so</code><br /><code>extension=pdo.so</code><br /><code>extension=pdo_mysql.so</code><br />'
                )
            );
        }

        $message .= $this->translator->translate('Installation_RestartWebServer') . '<br/><br/>';
        $message .= $this->translator->translate('Installation_SystemCheckPhpPdoAndMysqli', array(
            '<a style="color:red" href="http://php.net/pdo">',
            '</a>',
            '<a style="color:red" href="http://php.net/mysqli">',
            '</a>',
        ));
        $message .= '</p>';

        return $message;
    }
開發者ID:GovanifY,項目名稱:piwik,代碼行數:30,代碼來源:DbAdapterCheck.php

示例5: createWebConfigFiles

    /**
     * Generate IIS web.config files to restrict access
     *
     * Note: for IIS 7 and above
     */
    public static function createWebConfigFiles()
    {
        if (!SettingsServer::isIIS()) {
            return;
        }
        @file_put_contents(PIWIK_INCLUDE_PATH . '/web.config', '<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <security>
      <requestFiltering>
        <hiddenSegments>
          <add segment="config" />
          <add segment="core" />
          <add segment="lang" />
          <add segment="tmp" />
        </hiddenSegments>
        <fileExtensions>
          <add fileExtension=".tpl" allowed="false" />
          <add fileExtension=".twig" allowed="false" />
          <add fileExtension=".php4" allowed="false" />
          <add fileExtension=".php5" allowed="false" />
          <add fileExtension=".inc" allowed="false" />
          <add fileExtension=".in" allowed="false" />
          <add fileExtension=".csv" allowed="false" />
          <add fileExtension=".pdf" allowed="false" />
          <add fileExtension=".log" allowed="false" />
        </fileExtensions>
      </requestFiltering>
    </security>
    <directoryBrowse enabled="false" />
    <defaultDocument>
      <files>
        <remove value="index.php" />
        <add value="index.php" />
      </files>
    </defaultDocument>
    <staticContent>
      <remove fileExtension=".svg" />
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    </staticContent>
  </system.webServer>
</configuration>');
        // deny direct access to .php files
        $directoriesToProtect = array('/libs', '/vendor', '/plugins');
        foreach ($directoriesToProtect as $directoryToProtect) {
            @file_put_contents(PIWIK_INCLUDE_PATH . $directoryToProtect . '/web.config', '<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <security>
      <requestFiltering>
        <denyUrlSequences>
          <add sequence=".php" />
        </denyUrlSequences>
      </requestFiltering>
    </security>
  </system.webServer>
</configuration>');
        }
    }
開發者ID:TensorWrenchOSS,項目名稱:piwik,代碼行數:64,代碼來源:ServerFilesGenerator.php

示例6: execute

 public function execute()
 {
     $label = $this->translator->translate('Installation_SystemCheckGDFreeType');
     if (SettingsServer::isGdExtensionEnabled()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
     }
     $comment = sprintf('%s<br />%s', $this->translator->translate('Installation_SystemCheckGDFreeType'), $this->translator->translate('Installation_SystemCheckGDHelp'));
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:9,代碼來源:GdExtensionCheck.php

示例7: make

 public static function make($pluginName)
 {
     if (SettingsServer::isTrackerApiRequest()) {
         $storage = new SettingsStorage($pluginName);
     } else {
         $storage = new Storage($pluginName);
     }
     return $storage;
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:9,代碼來源:Factory.php

示例8: execute

 public function execute()
 {
     $label = $this->translator->translate('SitesManager_Timezone');
     if (SettingsServer::isTimezoneSupportEnabled()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
     }
     $comment = sprintf('%s<br />%s.', $this->translator->translate('SitesManager_AdvancedTimezoneSupportNotFound'), '<a href="http://php.net/manual/en/datetime.installation.php" rel="noreferrer" target="_blank">Timezone PHP documentation</a>');
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:9,代碼來源:TimezoneCheck.php

示例9: createHtAccess

 /**
  * Create .htaccess file in specified directory
  *
  * Apache-specific; for IIS @see web.config
  *
  * @param string $path without trailing slash
  * @param bool $overwrite whether to overwrite an existing file or not
  * @param string $content
  */
 public static function createHtAccess($path, $overwrite = true, $content = "<Files \"*\">\n<IfModule mod_access.c>\nDeny from all\n</IfModule>\n<IfModule !mod_access_compat>\n<IfModule mod_authz_host.c>\nDeny from all\n</IfModule>\n</IfModule>\n<IfModule mod_access_compat>\nDeny from all\n</IfModule>\n</Files>\n")
 {
     if (SettingsServer::isApache()) {
         $file = $path . '/.htaccess';
         if ($overwrite || !file_exists($file)) {
             @file_put_contents($file, $content);
         }
     }
 }
開發者ID:KiwiJuicer,項目名稱:handball-dachau,代碼行數:18,代碼來源:Filesystem.php

示例10: get

 /**
  * Returns the database connection and creates it if it hasn't been already.
  *
  * @return \Piwik\Tracker\Db|\Piwik\Db\AdapterInterface|\Piwik\Db
  */
 public static function get()
 {
     if (SettingsServer::isTrackerApiRequest()) {
         return Tracker::getDatabase();
     }
     if (!self::hasDatabaseObject()) {
         self::createDatabaseObject();
     }
     return self::$connection;
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:15,代碼來源:Db.php

示例11: getPythonBinary

 /**
  * @return string
  */
 protected static function getPythonBinary()
 {
     if (\Piwik\SettingsServer::isWindows()) {
         return "C:\\Python27\\python.exe";
     }
     if (IntegrationTestCase::isTravisCI()) {
         return 'python2.6';
     }
     return 'python';
 }
開發者ID:igorclark,項目名稱:piwik,代碼行數:13,代碼來源:Fixture.php

示例12: execute

 public function execute()
 {
     $label = $this->translator->translate('Installation_SystemCheckMemoryLimit');
     SettingsServer::raiseMemoryLimitIfNecessary();
     $memoryLimit = SettingsServer::getMemoryLimitValue();
     $comment = $memoryLimit . 'M';
     if ($memoryLimit >= $this->minimumMemoryLimit) {
         $status = DiagnosticResult::STATUS_OK;
     } else {
         $status = DiagnosticResult::STATUS_WARNING;
         $comment .= sprintf('<br />%s<br />%s', $this->translator->translate('Installation_SystemCheckMemoryLimitHelp'), $this->translator->translate('Installation_RestartWebServer'));
     }
     return array(DiagnosticResult::singleResult($label, $status, $comment));
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:14,代碼來源:MemoryLimitCheck.php

示例13: execute

 public function execute()
 {
     $label = $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsWritable');
     $file = new File(PIWIK_DOCUMENT_ROOT . '/piwik.js');
     if ($file->hasWriteAccess()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, ''));
     }
     $comment = $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsNotWritable');
     if (!SettingsServer::isWindows()) {
         $realpath = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/piwik.js');
         $command = "<br/><code> chmod +w {$realpath}<br/> chown " . Filechecks::getUserAndGroup() . " " . $realpath . "</code><br />";
         $comment .= $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsMakeWritable', $command);
     }
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
開發者ID:diosmosis,項目名稱:piwik,代碼行數:15,代碼來源:PiwikJsCheck.php

示例14: getSelectQueryString

 public function getSelectQueryString(SegmentExpression $segmentExpression, $select, $from, $where, $bind, $groupBy, $orderBy, $limit)
 {
     $result = parent::getSelectQueryString($segmentExpression, $select, $from, $where, $bind, $groupBy, $orderBy, $limit);
     $prefixParts = array();
     if (SettingsServer::isArchivePhpTriggered()) {
         $prefixParts[] = 'trigger = CronArchive';
     }
     $idSegments = $this->getSegmentIdOfExpression($segmentExpression);
     if (!empty($idSegments)) {
         $prefixParts[] = "idSegments = [" . implode(', ', $idSegments) . "]";
     }
     if (!empty($prefixParts)) {
         $result['sql'] = "/* " . implode(', ', $prefixParts) . " */\n" . $result['sql'];
     }
     return $result;
 }
開發者ID:diosmosis,項目名稱:piwik,代碼行數:16,代碼來源:SegmentQueryDecorator.php

示例15: index

 /**
  * Main view showing listing of websites and settings
  */
 public function index()
 {
     $view = new View('@SitesManager/index');
     Site::clearCache();
     if (Piwik::isUserIsSuperUser()) {
         $sitesRaw = API::getInstance()->getAllSites();
     } else {
         $sitesRaw = API::getInstance()->getSitesWithAdminAccess();
     }
     // Gets sites after Site.setSite hook was called
     $sites = array_values(Site::getSites());
     if (count($sites) != count($sitesRaw)) {
         throw new Exception("One or more website are missing or invalid.");
     }
     foreach ($sites as &$site) {
         $site['alias_urls'] = API::getInstance()->getSiteUrlsFromId($site['idsite']);
         $site['excluded_ips'] = explode(',', $site['excluded_ips']);
         $site['excluded_parameters'] = explode(',', $site['excluded_parameters']);
         $site['excluded_user_agents'] = explode(',', $site['excluded_user_agents']);
     }
     $view->adminSites = $sites;
     $view->adminSitesCount = count($sites);
     $timezones = API::getInstance()->getTimezonesList();
     $view->timezoneSupported = SettingsServer::isTimezoneSupportEnabled();
     $view->timezones = Common::json_encode($timezones);
     $view->defaultTimezone = API::getInstance()->getDefaultTimezone();
     $view->currencies = Common::json_encode(API::getInstance()->getCurrencyList());
     $view->defaultCurrency = API::getInstance()->getDefaultCurrency();
     $view->utcTime = Date::now()->getDatetime();
     $excludedIpsGlobal = API::getInstance()->getExcludedIpsGlobal();
     $view->globalExcludedIps = str_replace(',', "\n", $excludedIpsGlobal);
     $excludedQueryParametersGlobal = API::getInstance()->getExcludedQueryParametersGlobal();
     $view->globalExcludedQueryParameters = str_replace(',', "\n", $excludedQueryParametersGlobal);
     $globalExcludedUserAgents = API::getInstance()->getExcludedUserAgentsGlobal();
     $view->globalExcludedUserAgents = str_replace(',', "\n", $globalExcludedUserAgents);
     $view->globalSearchKeywordParameters = API::getInstance()->getSearchKeywordParametersGlobal();
     $view->globalSearchCategoryParameters = API::getInstance()->getSearchCategoryParametersGlobal();
     $view->isSearchCategoryTrackingEnabled = \Piwik\Plugin\Manager::getInstance()->isPluginActivated('CustomVariables');
     $view->allowSiteSpecificUserAgentExclude = API::getInstance()->isSiteSpecificUserAgentExcludeEnabled();
     $view->globalKeepURLFragments = API::getInstance()->getKeepURLFragmentsGlobal();
     $view->currentIpAddress = IP::getIpFromHeader();
     $view->showAddSite = (bool) Common::getRequestVar('showaddsite', false);
     $this->setBasicVariablesView($view);
     return $view->render();
 }
開發者ID:KiwiJuicer,項目名稱:handball-dachau,代碼行數:48,代碼來源:Controller.php


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