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


PHP Piwik::createLogObject方法代码示例

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


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

示例1: init

 function init()
 {
     Zend_Registry::get('config')->disableSavingConfigurationFileUpdates();
     Zend_Registry::get('config')->log->log_only_when_debug_parameter = 0;
     Zend_Registry::get('config')->log->logger_message = array("logger_message" => "screen");
     Piwik::createLogObject();
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:7,代码来源:test_generateLotsVisitsWebsites.php

示例2: setUp

 /**
  * Setup the database and create the base tables for all tests
  */
 public function setUp()
 {
     parent::setUp();
     try {
         Piwik::createConfigObject();
         Piwik_Config::getInstance()->setTestEnvironment();
         $dbConfig = Piwik_Config::getInstance()->database;
         $dbName = $dbConfig['dbname'];
         $dbConfig['dbname'] = null;
         Piwik::createDatabaseObject($dbConfig);
         Piwik::dropDatabase();
         Piwik::createDatabase($dbName);
         Piwik::disconnectDatabase();
         Piwik::createDatabaseObject();
         Piwik::createTables();
         Piwik::createLogObject();
         Piwik_PluginsManager::getInstance()->loadPlugins(array());
     } catch (Exception $e) {
         $this->fail("TEST INITIALIZATION FAILED: " . $e->getMessage());
     }
     include "DataFiles/SearchEngines.php";
     include "DataFiles/Languages.php";
     include "DataFiles/Countries.php";
     include "DataFiles/Currencies.php";
     include "DataFiles/LanguageToCountry.php";
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:29,代码来源:DatabaseTestCase.php

示例3: test_callableApiMethods_doNotFail

 function test_callableApiMethods_doNotFail()
 {
     Piwik::createConfigObject();
     Piwik_Config::getInstance()->setTestEnvironment();
     Piwik::createLogObject();
     Piwik::createAccessObject();
     Piwik::createDatabaseObject();
     Piwik::setUserIsSuperUser();
     Piwik_Translate::getInstance()->loadEnglishTranslation();
     $pluginsManager = Piwik_PluginsManager::getInstance();
     $pluginsManager->loadPlugins(Piwik_Config::getInstance()->Plugins['Plugins']);
     Piwik_SitesManager_API::getInstance()->addSite("name", "http://example.org");
     $apiGenerator = new Piwik_API_DocumentationGenerator_CallAllMethods();
     $requestUrls = $apiGenerator->getAllRequestsWithParameters();
     $this->assertTrue(count($requestUrls) > 20);
     foreach ($requestUrls as $url) {
         $call = new Piwik_API_Request($url);
         $output = $call->process();
         //			var_dump($url);
         //			var_dump($output);
         $this->assertTrue(!empty($output));
     }
     Piwik_Translate::getInstance()->unloadEnglishTranslation();
     $this->pass();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:25,代码来源:DocumentationGenerator.test.php

示例4: init

 function init()
 {
     $config = Piwik_Config::getInstance();
     $config->log['log_only_when_debug_parameter'] = 0;
     $config->log['logger_message'] = array("logger_message" => "screen");
     Piwik::createLogObject();
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:7,代码来源:test_generateLotsVisitsWebsites.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass($dbName = false, $createEmptyDatabase = true, $createConfig = true)
 {
     try {
         Piwik::$piwikUrlCache = '';
         if ($createConfig) {
             self::createTestConfig();
         }
         if ($dbName === false) {
             $dbName = Piwik_Config::getInstance()->database['dbname'];
         }
         self::connectWithoutDatabase();
         if ($createEmptyDatabase) {
             Piwik::dropDatabase();
         }
         Piwik::createDatabase($dbName);
         Piwik::disconnectDatabase();
         // reconnect once we're sure the database exists
         Piwik_Config::getInstance()->database['dbname'] = $dbName;
         Piwik::createDatabaseObject();
         Piwik::createTables();
         Piwik::createLogObject();
         Piwik_PluginsManager::getInstance()->loadPlugins(array());
     } catch (Exception $e) {
         self::fail("TEST INITIALIZATION FAILED: " . $e->getMessage());
     }
     include "DataFiles/SearchEngines.php";
     include "DataFiles/Languages.php";
     include "DataFiles/Countries.php";
     include "DataFiles/Currencies.php";
     include "DataFiles/LanguageToCountry.php";
     Piwik::createAccessObject();
     Piwik_PostEvent('FrontController.initAuthenticationObject');
     // We need to be SU to create websites for tests
     Piwik::setUserIsSuperUser();
     // Load and install plugins
     $pluginsManager = Piwik_PluginsManager::getInstance();
     $plugins = $pluginsManager->readPluginsDirectory();
     $pluginsManager->loadPlugins($plugins);
     if ($createEmptyDatabase) {
         $pluginsManager->installLoadedPlugins();
     }
     $_GET = $_REQUEST = array();
     $_SERVER['HTTP_REFERER'] = '';
     // Make sure translations are loaded to check messages in English
     Piwik_Translate::getInstance()->loadEnglishTranslation();
     Piwik_LanguagesManager_API::getInstance()->setLanguageForUser('superUserLogin', 'en');
     // List of Modules, or Module.Method that should not be called as part of the XML output compare
     // Usually these modules either return random changing data, or are already tested in specific unit tests.
     self::setApiNotToCall(self::$defaultApiNotToCall);
     self::setApiToCall(array());
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:51,代码来源:IntegrationTestCase.php

示例6: __construct

 function __construct($title = '')
 {
     parent::__construct($title);
     print "The test class extends Test_Database: the test Piwik database is created once in the constructor, and all tables are truncated at the end of EACH unit test method.<br>";
     Piwik::createConfigObject();
     Piwik::createDatabaseObject();
     Zend_Registry::get('config')->setTestEnvironment();
     Zend_Registry::get('config')->disableSavingConfigurationFileUpdates();
     Piwik::createLogObject();
     Piwik::dropDatabase();
     Piwik::createDatabase();
     Piwik::disconnectDatabase();
     Piwik::createDatabaseObject();
     Piwik::createTables();
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:15,代码来源:Database.test.php

示例7: __construct

 function __construct($title = '')
 {
     parent::__construct($title);
     try {
         Piwik::createConfigObject();
         Piwik_Config::getInstance()->setTestEnvironment();
         Piwik::createDatabaseObject();
         Piwik::createLogObject();
         Piwik::dropDatabase();
         Piwik::createDatabase();
         Piwik::disconnectDatabase();
         Piwik::createDatabaseObject();
         Piwik::createTables();
         Piwik_PluginsManager::getInstance()->installLoadedPlugins();
     } catch (Exception $e) {
         echo $e->getMessage();
         echo "<br/><b>TEST INITIALIZATION FAILED!";
         throw $e;
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:20,代码来源:Database.test.php

示例8: test_callableApiMethods_doNotFail

 function test_callableApiMethods_doNotFail()
 {
     Piwik::createConfigObject();
     Piwik::createLogObject();
     Piwik::createAccessObject();
     Piwik::createDatabaseObject();
     Piwik::setUserIsSuperUser();
     $pluginsManager = Piwik_PluginsManager::getInstance();
     $pluginsManager->setPluginsToLoad(Zend_Registry::get('config')->Plugins->Plugins->toArray());
     $apiGenerator = new Piwik_API_DocumentationGenerator_CallAllMethods();
     $requestUrls = $apiGenerator->getAllRequestsWithParameters();
     $this->assertTrue(count($requestUrls) > 20);
     foreach ($requestUrls as $url) {
         $call = new Piwik_API_Request($url);
         $output = $call->process();
         //			var_dump($url);
         //			var_dump($output);
         $this->assertTrue(!empty($output));
     }
     $this->pass();
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:21,代码来源:DocumentationGenerator.test.php

示例9: oneShotTest_memoryUsageArrayIncreasingIndexOrJumps

 function oneShotTest_memoryUsageArrayIncreasingIndexOrJumps()
 {
     ini_set('memory_limit', '200M');
     Piwik::createConfigObject();
     Piwik_Config::getInstance()->setTestEnvironment();
     Piwik::createLogObject();
     //test array[0] array[1] array[2]
     //VS
     // test array[0] array[100] array[200]
     // same memory  usage? hash
     echo "start " . __FUNCTION__ . "<br>";
     echo Piwik::getMemoryUsage();
     $timer = new Piwik_Timer();
     $testId = 2;
     if ($testId == 1) {
         echo "start incrementing index<br>";
         $array = array();
         for ($i = 0; $i < 1000000; $i++) {
             $array[$i] = 1;
         }
     } elseif ($testId == 2) {
         echo "start indexing by strings<br>";
         $array = array();
         for ($i = 0; $i < 1000000; $i++) {
             $array[$i . "_" . $i] = 1;
         }
     } elseif ($testId == 3) {
         echo "start jumping index<br>";
         for ($i = 0; $i < 1000000; $i++) {
             $array[$i * 100] = 1;
         }
     }
     echo $timer . "<br>";
     echo "size serialized:" . Piwik::getPrettySizeFromBytes(strlen(serialize($array))) . "<br>";
     echo Piwik::getMemoryUsage();
     echo "end " . __FUNCTION__ . "<br>";
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:37,代码来源:PHP_Related.test.php

示例10: init

 /**
  * Must be called before dispatch()
  * - checks that directories are writable,
  * - loads the configuration file,
  * - loads the plugin, 
  * - inits the DB connection,
  * - etc.
  */
 function init()
 {
     try {
         Zend_Registry::set('timer', new Piwik_Timer());
         $directoriesToCheck = array('/tmp', '/tmp/templates_c', '/tmp/cache');
         Piwik::checkDirectoriesWritableOrDie($directoriesToCheck);
         self::assignCliParametersToRequest();
         Piwik_Translate::getInstance()->loadEnglishTranslation();
         $exceptionToThrow = false;
         try {
             Piwik::createConfigObject();
         } catch (Exception $e) {
             Piwik_PostEvent('FrontController.NoConfigurationFile', $e);
             $exceptionToThrow = $e;
         }
         $pluginsManager = Piwik_PluginsManager::getInstance();
         $pluginsManager->setPluginsToLoad(Zend_Registry::get('config')->Plugins->Plugins->toArray());
         if ($exceptionToThrow) {
             throw $exceptionToThrow;
         }
         Piwik_Translate::getInstance()->loadUserTranslation();
         try {
             Piwik::createDatabaseObject();
         } catch (Exception $e) {
             Piwik_PostEvent('FrontController.badConfigurationFile', $e);
             throw $e;
         }
         Piwik::createLogObject();
         // creating the access object, so that core/Updates/* can enforce Super User and use some APIs
         Piwik::createAccessObject();
         Piwik_PostEvent('FrontController.dispatchCoreAndPluginUpdatesScreen');
         Piwik_PluginsManager::getInstance()->installLoadedPlugins();
         Piwik::install();
         Piwik_PostEvent('FrontController.initAuthenticationObject');
         try {
             $authAdapter = Zend_Registry::get('auth');
         } catch (Exception $e) {
             throw new Exception("Authentication object cannot be found in the Registry. Maybe the Login plugin is not activated?\n\t\t\t\t\t\t\t\t\t<br>You can activate the plugin by adding:<br>\n\t\t\t\t\t\t\t\t\t<code>Plugins[] = Login</code><br>\n\t\t\t\t\t\t\t\t\tunder the <code>[Plugins]</code> section in your config/config.inc.php");
         }
         Zend_Registry::get('access')->reloadAccess($authAdapter);
         Piwik::raiseMemoryLimitIfNecessary();
         $pluginsManager->setLanguageToLoad(Piwik_Translate::getInstance()->getLanguageToLoad());
         $pluginsManager->postLoadPlugins();
         Piwik_PostEvent('FrontController.checkForUpdates');
     } catch (Exception $e) {
         Piwik_ExitWithMessage($e->getMessage(), $e->getTraceAsString(), true);
     }
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:56,代码来源:FrontController.php

示例11: initLog

 private function initLog()
 {
     $config = Piwik_Config::getInstance();
     $config->log['log_only_when_debug_parameter'] = 0;
     $config->log['logger_message'] = array("logger_message" => "screen");
     Piwik::createLogObject();
     if (!function_exists("curl_multi_init")) {
         $this->log("ERROR: this script requires curl extension php_curl enabled in your CLI php.ini");
         $this->usage();
         exit;
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:12,代码来源:archive.php

示例12: initObjectsToCallAPI

	/**
	 * Instantiate access and log objects
	 */
	protected function initObjectsToCallAPI()
	{
		// connect to the database using the DB infos currently in the session
		$this->createDbFromSessionInformation();

		Piwik::createAccessObject();
		Piwik::setUserIsSuperUser();
		Piwik::createLogObject();
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:12,代码来源:Controller.php

示例13: init

	/**
	 * Init the Generator script:
	 * - init the SQL profiler
	 * - init the random generator
	 * - setup the different possible values for parameters such as 'resolution',
	 * 		'color', 'hour', 'minute', etc.
	 * - load from DataFiles and setup values for the other parameters such as UserAgent, Referers, AcceptedLanguages, etc.
	 *   @see misc/generateVisitsData/
	 */
	public function init()
	{
		Piwik::createLogObject();
		
		$this->initProfiler();
		
		/*
		 * Init the random number generator 
		 */ 
		function make_seed()
		{
		  list($usec, $sec) = explode(' ', microtime());
		  return (float) $sec + ((float) $usec * 100000);
		}
		mt_srand(make_seed());
		
		// set rec=1 parameter, required as of 0.5.5 in order to force the request to be recorded
		$this->setCurrentRequest('rec', 1);
		
		/*
		 * Sets values for: resolutions, colors, idSite, times
		 */
		$common = array(
			'res' => array('1289x800','1024x768','800x600','564x644','200x100','50x2000',),
			'col' => array(24,32,16),
			'idsite'=> $this->idSite,
			'h' => range(0,23),
			'm' => range(0,59),
			's' => range(0,59),
		);
		
		foreach($common as $label => $values)
		{
			$this->addParam($label,$values);
		}
		
		/*
		 * Sets values for: outlinks, downloads, campaigns
		 */
		// we get the name of the Download/outlink variables
		$downloadOrOutlink = array('download', 'link');

		// we have a 20% chance to add a download or outlink variable to the URL 
		$this->addParam('piwik_downloadOrOutlink', $downloadOrOutlink);
		$this->addParam('piwik_downloadOrOutlink', array_fill(0,8,''));
		
		// we get the variables name for the campaign parameters
		$campaigns = array(
						'piwik_campaign'
		);
		// we generate a campaign in the URL in 3/18 % of the generated URls
		$this->addParam('piwik_vars_campaign', $campaigns);
		$this->addParam('piwik_vars_campaign', array_fill(0,15,''));
		
		
		/*
		 * Sets values for: Referers, user agents, accepted languages
		 */
		// we load some real referers to be used by the generator
		$referers = array();
		require_once PIWIK_INCLUDE_PATH . '/plugins/VisitorGenerator/data/Referers.php';

		$this->addParam('urlref',$referers);

		// and we add 2000 empty referers so that some visitors don't come using a referer (direct entry)
		$this->addParam('urlref',array_fill(0,2000,''));
		
		// load some user agent and accept language
		$userAgent = $acceptLanguages = array();
		require_once PIWIK_INCLUDE_PATH . '/plugins/VisitorGenerator/data/UserAgent.php';
		require_once PIWIK_INCLUDE_PATH . '/plugins/VisitorGenerator/data/AcceptLanguage.php';
		$this->userAgents=$userAgent;
		$this->acceptLanguage=$acceptLanguages;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:83,代码来源:Generator.php

示例14: init

 /**
  * Must be called before dispatch()
  * - checks that directories are writable,
  * - loads the configuration file,
  * - loads the plugin, 
  * - inits the DB connection,
  * - etc.
  * 
  * @return void 
  */
 function init()
 {
     Zend_Registry::set('timer', new Piwik_Timer());
     $this->checkDirectoriesWritableOrDie();
     $this->assignCliParametersToRequest();
     $exceptionToThrow = false;
     //move into a init() method
     try {
         Piwik::createConfigObject();
     } catch (Exception $e) {
         Piwik_PostEvent('FrontController.NoConfigurationFile', $e);
         $exceptionToThrow = $e;
     }
     Piwik::loadPlugins();
     if ($exceptionToThrow) {
         throw $exceptionToThrow;
     }
     // database object
     Piwik::createDatabaseObject();
     // Create the log objects
     Piwik::createLogObject();
     Piwik::terminateLoadPlugins();
     Piwik::install();
     //		Piwik::printMemoryUsage('Start program');
     // can be used for debug purpose
     $doNotDrop = array(Piwik::prefixTable('access'), Piwik::prefixTable('user'), Piwik::prefixTable('site'), Piwik::prefixTable('archive'), Piwik::prefixTable('logger_api_call'), Piwik::prefixTable('logger_error'), Piwik::prefixTable('logger_exception'), Piwik::prefixTable('logger_message'), Piwik::prefixTable('log_visit'), Piwik::prefixTable('log_link_visit_action'), Piwik::prefixTable('log_action'), Piwik::prefixTable('log_profiling'));
     // Setup the auth object
     Piwik_PostEvent('FrontController.authSetCredentials');
     try {
         $authAdapter = Zend_Registry::get('auth');
     } catch (Exception $e) {
         throw new Exception("Object 'auth' cannot be found in the Registry. Maybe the Login plugin is not enabled?\r\n\t\t\t\t\t\t\t\t<br>You can enable the plugin by adding:<br>\r\n\t\t\t\t\t\t\t\t<code>Plugins[] = Login</code><br>\r\n\t\t\t\t\t\t\t\tunder the <code>[Plugins]</code> section in your config/config.inc.php");
     }
     // Perform the authentication query, saving the result
     $access = new Piwik_Access($authAdapter);
     Zend_Registry::set('access', $access);
     Zend_Registry::get('access')->loadAccess();
     Piwik::raiseMemoryLimitIfNecessary();
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:49,代码来源:FrontController.php

示例15: init

 /**
  * Init the Generator script:
  * - init the SQL profiler
  * - init the random generator
  * - setup the different possible values for parameters such as 'resolution',
  * 		'color', 'hour', 'minute', etc.
  * - load from DataFiles and setup values for the other parameters such as UserAgent, Referers, AcceptedLanguages, etc.
  *  @see /misc/generateVisitsData/
  * 
  * @return void
  */
 public function init()
 {
     Piwik::createLogObject();
     $this->initProfiler();
     /*
      * Init the random number generator 
      */
     function make_seed()
     {
         list($usec, $sec) = explode(' ', microtime());
         return (double) $sec + (double) $usec * 100000;
     }
     mt_srand(make_seed());
     /*
      * Sets values for: resolutions, colors, idSite, times
      */
     $common = array('res' => array('1289x800', '1024x768', '800x600', '564x644', '200x100', '50x2000'), 'col' => array(24, 32, 16), 'idsite' => $this->idSite, 'h' => range(0, 23), 'm' => range(0, 59), 's' => range(0, 59));
     foreach ($common as $label => $values) {
         $this->addParam($label, $values);
     }
     /*
      * Sets values for: outlinks, downloads, campaigns
      */
     // we get the name of the Download/outlink variables
     $downloadOrOutlink = array(Piwik_Tracker_Config::getInstance()->Tracker['download_url_var_name'], Piwik_Tracker_Config::getInstance()->Tracker['outlink_url_var_name']);
     // we have a 20% chance to add a download or outlink variable to the URL
     $this->addParam('piwik_downloadOrOutlink', $downloadOrOutlink);
     $this->addParam('piwik_downloadOrOutlink', array_fill(0, 8, ''));
     // we get the variables name for the campaign parameters
     $campaigns = array(Piwik_Tracker_Config::getInstance()->Tracker['campaign_var_name']);
     // we generate a campaign in the URL in 3/18 % of the generated URls
     $this->addParam('piwik_vars_campaign', $campaigns);
     $this->addParam('piwik_vars_campaign', array_fill(0, 15, ''));
     /*
      * Sets values for: Referers, user agents, accepted languages
      */
     // we load some real referers to be used by the generator
     $referers = array();
     require_once PIWIK_INCLUDE_PATH . "/misc/generateVisitsData/Referers.php";
     $this->addParam('urlref', $referers);
     // and we add 2000 empty referers so that some visitors don't come using a referer (direct entry)
     $this->addParam('urlref', array_fill(0, 2000, ''));
     // load some user agent and accept language
     $userAgent = $acceptLanguages = array();
     require_once PIWIK_INCLUDE_PATH . "/misc/generateVisitsData/UserAgent.php";
     require_once PIWIK_INCLUDE_PATH . "/misc/generateVisitsData/AcceptLanguage.php";
     $this->userAgents = $userAgent;
     $this->acceptLanguage = $acceptLanguages;
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:60,代码来源:Generator.php


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