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


PHP Url::setHost方法代碼示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $serverGlobal = $input->getOption('server-global');
     if ($serverGlobal) {
         $_SERVER = json_decode($serverGlobal, true);
     }
     $this->requireFixtureFiles($input);
     $this->setIncludePathAsInTestBootstrap();
     $host = Url::getHost();
     if (empty($host)) {
         Url::setHost('localhost');
     }
     $fixture = $this->createFixture($input);
     $this->setupDatabaseOverrides($input, $fixture);
     // perform setup and/or teardown
     if ($input->getOption('teardown')) {
         $fixture->getTestEnvironment()->save();
         $fixture->performTearDown();
     } else {
         $fixture->performSetUp();
     }
     if ($input->getOption('set-phantomjs-symlinks')) {
         $this->createSymbolicLinksForUITests();
     }
     $this->writeSuccessMessage($output, array("Fixture successfully setup!"));
     $sqlDumpPath = $input->getOption('sqldump');
     if ($sqlDumpPath) {
         $this->createSqlDump($sqlDumpPath, $output);
     }
 }
開發者ID:a4tunado,項目名稱:piwik,代碼行數:30,代碼來源:TestsSetupFixture.php

示例2: setUp

 public function setUp()
 {
     parent::setup();
     File::reset();
     Url::setHost(false);
     $this->output = new Output('myid');
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:7,代碼來源:OutputTest.php

示例3: initHostAndQueryString

 /**
  * @param InputInterface $input
  */
 protected function initHostAndQueryString(InputInterface $input)
 {
     $_GET = array();
     $hostname = $input->getOption('piwik-domain');
     Url::setHost($hostname);
     $query = $input->getArgument('url-query');
     $query = UrlHelper::getArrayFromQueryString($query);
     foreach ($query as $name => $value) {
         $_GET[$name] = $value;
     }
 }
開發者ID:carriercomm,項目名稱:piwik,代碼行數:14,代碼來源:RequestCommand.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!defined('PIWIK_TEST_MODE')) {
         define('PIWIK_TEST_MODE', true);
     }
     Environment::setGlobalEnvironmentManipulator(new TestingEnvironmentManipulator(new TestingEnvironmentVariables()));
     $serverGlobal = $input->getOption('server-global');
     if ($serverGlobal) {
         $_SERVER = json_decode($serverGlobal, true);
     }
     if (Config::getInstance()->database_tests['tables_prefix'] !== '') {
         throw new \Exception("To generate OmniFixture for the UI tests, you must set an empty tables_prefix in [database_tests]");
     }
     $this->requireFixtureFiles($input);
     $this->setIncludePathAsInTestBootstrap();
     $host = Url::getHost();
     if (empty($host)) {
         $host = 'localhost';
         Url::setHost('localhost');
     }
     $configDomainToSave = $input->getOption('save-config');
     if (!empty($configDomainToSave)) {
         $pathToDomainConfig = PIWIK_INCLUDE_PATH . '/config/' . $host . '.config.ini.php';
         if (!file_exists($pathToDomainConfig)) {
             link(PIWIK_INCLUDE_PATH . '/config/config.ini.php', $pathToDomainConfig);
         }
     }
     if ($input->getOption('set-phantomjs-symlinks')) {
         $this->createSymbolicLinksForUITests();
     }
     $fixture = $this->createFixture($input, $allowSave = !empty($configDomainToSave));
     $this->setupDatabaseOverrides($input, $fixture);
     // perform setup and/or teardown
     if ($input->getOption('teardown')) {
         $fixture->getTestEnvironment()->save();
         $fixture->performTearDown();
     } else {
         $fixture->performSetUp();
     }
     $this->writeSuccessMessage($output, array("Fixture successfully setup!"));
     $sqlDumpPath = $input->getOption('sqldump');
     if ($sqlDumpPath) {
         $this->createSqlDump($sqlDumpPath, $output);
     }
     if (!empty($configDomainToSave)) {
         Config::getInstance()->forceSave();
     }
 }
開發者ID:dorelljames,項目名稱:piwik,代碼行數:48,代碼來源:TestsSetupFixture.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $serverGlobal = $input->getOption('server-global');
     if ($serverGlobal) {
         $_SERVER = json_decode($serverGlobal, true);
     }
     $this->requireFixtureFiles($input);
     $this->setIncludePathAsInTestBootstrap();
     $host = Url::getHost();
     if (empty($host)) {
         $host = 'localhost';
         Url::setHost('localhost');
     }
     $configDomainToSave = $input->getOption('save-config');
     if (!empty($configDomainToSave)) {
         $pathToDomainConfig = PIWIK_INCLUDE_PATH . '/config/' . $host . '.config.ini.php';
         if (!file_exists($pathToDomainConfig)) {
             link(PIWIK_INCLUDE_PATH . '/config/config.ini.php', $pathToDomainConfig);
         }
     }
     $fixture = $this->createFixture($input);
     $this->setupDatabaseOverrides($input, $fixture);
     // perform setup and/or teardown
     if ($input->getOption('teardown')) {
         $fixture->getTestEnvironment()->save();
         $fixture->performTearDown();
     } else {
         $fixture->performSetUp();
     }
     if ($input->getOption('set-phantomjs-symlinks')) {
         $this->createSymbolicLinksForUITests();
     }
     $this->writeSuccessMessage($output, array("Fixture successfully setup!"));
     $sqlDumpPath = $input->getOption('sqldump');
     if ($sqlDumpPath) {
         $this->createSqlDump($sqlDumpPath, $output);
     }
     if (!empty($configDomainToSave)) {
         Config::getInstance()->forceSave();
     }
 }
開發者ID:TensorWrenchOSS,項目名稱:piwik,代碼行數:41,代碼來源:TestsSetupFixture.php

示例6: beforeContainerCreated

 public function beforeContainerCreated()
 {
     $this->vars->reload();
     if ($this->vars->queryParamOverride) {
         foreach ($this->vars->queryParamOverride as $key => $value) {
             $_GET[$key] = $value;
         }
     }
     if ($this->vars->globalsOverride) {
         foreach ($this->vars->globalsOverride as $key => $value) {
             $GLOBALS[$key] = $value;
         }
     }
     if ($this->vars->hostOverride) {
         \Piwik\Url::setHost($this->vars->hostOverride);
     }
     if ($this->vars->useXhprof) {
         \Piwik\Profiler::setupProfilerXHProf($mainRun = false, $setupDuringTracking = true);
     }
     \Piwik\Cache\Backend\File::$invalidateOpCacheBeforeRead = true;
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:21,代碼來源:TestingEnvironmentManipulator.php

示例7: initPiwikHost

 protected function initPiwikHost(InputInterface $input)
 {
     $piwikHostname = $input->getParameterOption('--piwik-domain');
     if (empty($piwikHostname)) {
         $piwikHostname = $input->getParameterOption('--url');
     }
     $piwikHostname = UrlHelper::getHostFromUrl($piwikHostname);
     Url::setHost($piwikHostname);
 }
開發者ID:josl,項目名稱:CGE-File-Sharing,代碼行數:9,代碼來源:Console.php

示例8: getPiwikDomain

define('PIWIK_ENABLE_SESSION_START', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
if (!Common::isPhpCliMode()) {
    return;
}
$testmode = in_array('--testmode', $_SERVER['argv']);
if ($testmode) {
    define('PIWIK_TEST_MODE', true);
    Environment::setGlobalEnvironmentManipulator(new TestingEnvironmentManipulator(new TestingEnvironmentVariables()));
}
function getPiwikDomain()
{
    foreach ($_SERVER['argv'] as $param) {
        $pattern = '--piwik-domain=';
        if (false !== strpos($param, $pattern)) {
            return substr($param, strlen($pattern));
        }
    }
    return null;
}
$environment = new Environment('cli');
$environment->init();
$piwikDomain = getPiwikDomain();
if ($piwikDomain) {
    Url::setHost($piwikDomain);
}
$token = Db::get()->fetchOne("SELECT token_auth\n                              FROM " . Common::prefixTable("user") . "\n                              WHERE superuser_access = 1\n                              ORDER BY date_registered ASC");
$filename = $environment->getContainer()->get('path.tmp') . '/cache/token.php';
$content = "<?php exit; //\t" . $token;
file_put_contents($filename, $content);
echo $filename;
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:31,代碼來源:updatetoken.php

示例9: initConfigObject

 /**
  * Checks the config file is found.
  *
  * @param $piwikUrl
  * @throws Exception
  */
 protected function initConfigObject($piwikUrl)
 {
     // HOST is required for the Config object
     $parsed = parse_url($piwikUrl);
     Url::setHost($parsed['host']);
     Config::getInstance()->clear();
     try {
         Config::getInstance()->checkLocalConfigFound();
     } catch (Exception $e) {
         throw new Exception("The configuration file for Piwik could not be found. " . "Please check that config/config.ini.php is readable by the user " . get_current_user());
     }
 }
開發者ID:pombredanne,項目名稱:ArcherSys,代碼行數:18,代碼來源:CronArchive.php

示例10: setUp

 public function setUp()
 {
     \Piwik\Url::setHost(false);
     $this->output = new Output('myid');
 }
開發者ID:carriercomm,項目名稱:piwik,代碼行數:5,代碼來源:OutputTest.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $serverGlobal = $input->getOption('server-global');
     if ($serverGlobal) {
         $_SERVER = json_decode($serverGlobal, true);
     }
     $this->requireFixtureFiles();
     $this->setIncludePathAsInTestBootstrap();
     $file = $input->getOption('file');
     if ($file) {
         if (is_file($file)) {
             require_once $file;
         } else {
             if (is_file(PIWIK_INCLUDE_PATH . '/' . $file)) {
                 require_once PIWIK_INCLUDE_PATH . '/' . $file;
             } else {
                 throw new \Exception("Cannot find --file option file '{$file}'.");
             }
         }
     }
     $host = Url::getHost();
     if (empty($host)) {
         Url::setHost('localhost');
     }
     // get the fixture class
     $fixtureClass = $input->getArgument('fixture');
     if (class_exists("Piwik\\Tests\\Fixtures\\" . $fixtureClass)) {
         $fixtureClass = "Piwik\\Tests\\Fixtures\\" . $fixtureClass;
     }
     if (!class_exists($fixtureClass)) {
         throw new \Exception("Cannot find fixture class '{$fixtureClass}'.");
     }
     // create the fixture
     $fixture = new $fixtureClass();
     $fixture->printToScreen = true;
     $dbName = $input->getOption('db-name');
     if ($dbName) {
         $fixture->dbName = $dbName;
     }
     if ($input->getOption('persist-fixture-data')) {
         $fixture->persistFixtureData = true;
     }
     if ($input->getOption('drop')) {
         $fixture->resetPersistedFixture = true;
     }
     $extraPluginsToLoad = $input->getOption('plugins');
     if ($extraPluginsToLoad) {
         $fixture->extraPluginsToLoad = explode(',', $extraPluginsToLoad);
     }
     if ($fixture->createConfig) {
         Config::getInstance()->setTestEnvironment();
     }
     $fixture->createConfig = false;
     // setup database overrides
     $testingEnvironment = $fixture->getTestEnvironment();
     $optionsToOverride = array('dbname' => $fixture->getDbName(), 'host' => $input->getOption('db-host'), 'user' => $input->getOption('db-user'), 'password' => $input->getOption('db-pass'));
     foreach ($optionsToOverride as $configOption => $value) {
         if ($value) {
             $configOverride = $testingEnvironment->configOverride;
             $configOverride['database_tests'][$configOption] = $configOverride['database'][$configOption] = $value;
             $testingEnvironment->configOverride = $configOverride;
             Config::getInstance()->database[$configOption] = $value;
         }
     }
     // perform setup and/or teardown
     if ($input->getOption('teardown')) {
         $testingEnvironment->save();
         $fixture->performTearDown();
     } else {
         $fixture->performSetUp();
     }
     if ($input->getOption('set-phantomjs-symlinks')) {
         // make sure symbolic links exist (phantomjs doesn't support symlink-ing yet)
         foreach (array('libs', 'plugins', 'tests', 'piwik.js') as $linkName) {
             $linkPath = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/' . $linkName;
             if (!file_exists($linkPath)) {
                 symlink(PIWIK_INCLUDE_PATH . '/' . $linkName, $linkPath);
             }
         }
     }
     $this->writeSuccessMessage($output, array("Fixture successfully setup!"));
 }
開發者ID:kreynen,項目名稱:elmsln,代碼行數:82,代碼來源:SetupFixture.php


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