diff options
Diffstat (limited to 'misc/generateVisits.php')
-rw-r--r-- | misc/generateVisits.php | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/misc/generateVisits.php b/misc/generateVisits.php index fb72d7c9c6..ad4fb909c1 100644 --- a/misc/generateVisits.php +++ b/misc/generateVisits.php @@ -1,30 +1,30 @@ -<?php
+<?php error_reporting(E_ALL|E_NOTICE); -define('PIWIK_INCLUDE_PATH', '..');
-
-ignore_user_abort(true);
-set_time_limit(0);
-
-set_include_path(PIWIK_INCLUDE_PATH
- . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/libs/'
- . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/plugins/'
- . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/modules'
- . PATH_SEPARATOR . get_include_path() );
-
-$GLOBALS['DEBUGPIWIK'] = false;
-
-ob_start();
-
-// first check that user has privileges to create some random data in the DB -> he must be super user
-define('ENABLE_DISPATCH', false);
-require_once PIWIK_INCLUDE_PATH . "/index.php";
-require_once "FrontController.php";
-Piwik::checkUserIsSuperUser();
-// end check that user was super user
-
-require_once "PluginsManager.php";
-require_once "Timer.php";
+define('PIWIK_INCLUDE_PATH', '..'); + +ignore_user_abort(true); +set_time_limit(0); + +set_include_path(PIWIK_INCLUDE_PATH + . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/libs/' + . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/plugins/' + . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/modules' + . PATH_SEPARATOR . get_include_path() ); + +$GLOBALS['DEBUGPIWIK'] = false; + +ob_start(); + +// first check that user has privileges to create some random data in the DB -> he must be super user +define('ENABLE_DISPATCH', false); +require_once PIWIK_INCLUDE_PATH . "/index.php"; +require_once "FrontController.php"; +Piwik::checkUserIsSuperUser(); +// end check that user was super user + +require_once "PluginsManager.php"; +require_once "Timer.php"; require_once "Cookie.php"; require_once "LogStats.php"; require_once "LogStats/Config.php"; @@ -33,8 +33,8 @@ require_once "LogStats/Db.php"; require_once "LogStats/Visit.php"; require_once "LogStats/Generator.php"; -// unload all loaded plugins
-//Piwik_PluginsManager::getInstance()->unloadPlugins();
+// unload all loaded plugins +//Piwik_PluginsManager::getInstance()->unloadPlugins(); // we unload the Provider plugin otherwise it tries to lookup the IP for ahostname, and there is no dns server here Piwik_PluginsManager::getInstance()->unloadPlugin('Provider'); @@ -53,28 +53,28 @@ $maxVisits = 9; $nbActions = 15; $daysToCompute = 1; -$nbActionsTotal = 0;
-
+$nbActionsTotal = 0; + //$generator->emptyAllLogTables(); -$generator->init();
+$generator->init(); $t = new Piwik_Timer; /* * Generate visits / actions for the last 31 days */ -
-// do NOT edit this line
+ +// do NOT edit this line $startTime = time() - ($daysToCompute-1)*86400; while($startTime <= time()) { - $visits = rand($minVisits,$maxVisits);
+ $visits = rand($minVisits,$maxVisits); $actions=$nbActions; - $generator->setTimestampToUse($startTime);
-
- // we add silent fail because of headers already sent error.
- // although this should'nt happen because we use a OB_START at the top of this page...
+ $generator->setTimestampToUse($startTime); + + // we add silent fail because of headers already sent error. + // although this should'nt happen because we use a OB_START at the top of this page... // but I couldnt find where those headers were sent... $nbActionsTotalThisDay = @$generator->generate($visits,$actions); |