本文整理汇总了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');
}
示例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();
示例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();
}
示例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) {