当前位置: 首页>>代码示例>>PHP>>正文


PHP StaticContainer::setEnvironment方法代码示例

本文整理汇总了PHP中Piwik\Container\StaticContainer::setEnvironment方法的典型用法代码示例。如果您正苦于以下问题:PHP StaticContainer::setEnvironment方法的具体用法?PHP StaticContainer::setEnvironment怎么用?PHP StaticContainer::setEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Container\StaticContainer的用法示例。


在下文中一共展示了StaticContainer::setEnvironment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     $this->checkCompatibility();
     parent::__construct();
     $option = new InputOption('piwik-domain', null, InputOption::VALUE_OPTIONAL, 'Piwik URL (protocol and domain) eg. "http://piwik.example.org"');
     $this->getDefinition()->addOption($option);
     $option = new InputOption('xhprof', null, InputOption::VALUE_NONE, 'Enable profiling with XHProf');
     $this->getDefinition()->addOption($option);
     StaticContainer::setEnvironment('cli');
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:10,代码来源:Console.php

示例2: dirname

<?php

/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
use Piwik\Container\StaticContainer;
use Piwik\FrontController;
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
use Symfony\Component\Console\Output\ConsoleOutput;
define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__) == '/' ? '' : dirname(__FILE__) . '/../..');
if (file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) {
    require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php';
}
if (!defined('PIWIK_INCLUDE_PATH')) {
    define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
}
require_once PIWIK_INCLUDE_PATH . '/core/bootstrap.php';
ignore_user_abort(true);
set_time_limit(0);
$GLOBALS['PIWIK_TRACKER_DEBUG'] = false;
define('PIWIK_ENABLE_DISPATCH', false);
if (Piwik\Common::isPhpCliMode()) {
    StaticContainer::setEnvironment('cli');
    /** @var ConsoleHandler $consoleLogHandler */
    $consoleLogHandler = StaticContainer::get('Symfony\\Bridge\\Monolog\\Handler\\ConsoleHandler');
    $consoleLogHandler->setOutput(new ConsoleOutput());
}
FrontController::getInstance()->init();
开发者ID:bossrabbit,项目名称:piwik,代码行数:31,代码来源:cli-script-bootstrap.php

示例3: recreateContainerWithWebEnvironment

 /**
  * We will be simulating an HTTP request here (by including index.php).
  *
  * To avoid weird side-effects (e.g. the logging output messing up the HTTP response on the CLI output)
  * we need to recreate the container with the default environment instead of the CLI environment.
  */
 private function recreateContainerWithWebEnvironment()
 {
     StaticContainer::setEnvironment(null);
     StaticContainer::clearContainer();
     Log::unsetInstance();
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:12,代码来源:RequestCommand.php

示例4: Tracker

require_once PIWIK_INCLUDE_PATH . '/core/Plugin/Manager.php';
require_once PIWIK_INCLUDE_PATH . '/core/Plugin.php';
require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php';
require_once PIWIK_INCLUDE_PATH . '/core/IP.php';
require_once PIWIK_INCLUDE_PATH . '/core/UrlHelper.php';
require_once PIWIK_INCLUDE_PATH . '/core/Url.php';
require_once PIWIK_INCLUDE_PATH . '/core/SettingsPiwik.php';
require_once PIWIK_INCLUDE_PATH . '/core/SettingsServer.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker.php';
require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
require_once PIWIK_INCLUDE_PATH . '/core/Translate.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Cache.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Request.php';
require_once PIWIK_INCLUDE_PATH . '/core/Cookie.php';
\Piwik\Container\StaticContainer::setEnvironment('tracker');
Tracker::loadTrackerEnvironment();
$tracker = new Tracker();
$requestSet = new RequestSet();
ob_start();
try {
    $handler = Handler\Factory::make();
    $response = $tracker->main($handler, $requestSet);
    if (!is_null($response)) {
        echo $response;
    }
} catch (Exception $e) {
    echo "Error:" . $e->getMessage();
    exit(1);
}
if (ob_get_level() > 1) {
开发者ID:bossrabbit,项目名称:piwik,代码行数:31,代码来源:piwik.php


注:本文中的Piwik\Container\StaticContainer::setEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。