[Piwik-svn] r173 - in trunk: config misc modules plugins/Home plugins/Installation tests
svnmaster at piwik.org
svnmaster at piwik.org
Tue Jan 15 02:03:23 CET 2008
Author: matt
Date: 2008-01-15 02:03:22 +0100 (Tue, 15 Jan 2008)
New Revision: 173
Removed:
trunk/misc/Installation specification.txt
Modified:
trunk/config/global.ini.php
trunk/misc/db-schema-README
trunk/misc/generateVisits.php
trunk/modules/Piwik.php
trunk/modules/PluginsManager.php
trunk/plugins/Home/Controller.php
trunk/plugins/Installation/Controller.php
trunk/tests/all_tests.php
trunk/tests/config_test.php
Log:
- cleaned unit tests homepage
- the homepage of piwik is now by default the report page
- generateVisits now require Super user access
Modified: trunk/config/global.ini.php
===================================================================
--- trunk/config/global.ini.php 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/config/global.ini.php 2008-01-15 01:03:22 UTC (rev 173)
@@ -17,7 +17,7 @@
host = localhost
username = root
password =
-dbname = piwik_tests3
+dbname = piwik_tests4
tables_prefix = piwiktests_
adapter = PDO_MYSQL
Deleted: trunk/misc/Installation specification.txt
===================================================================
--- trunk/misc/Installation specification.txt 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/misc/Installation specification.txt 2008-01-15 01:03:22 UTC (rev 173)
@@ -1,10 +0,0 @@
-
-
-Installation composed of different steps
-Plugin can add / delete steps from the installation
-The installation uses a different set of base templates
-But can use the output of some plugins
-
-
-Installation is triggered when config file not found
-
Modified: trunk/misc/db-schema-README
===================================================================
--- trunk/misc/db-schema-README 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/misc/db-schema-README 2008-01-15 01:03:22 UTC (rev 173)
@@ -1,6 +1,9 @@
Schema edited with DBDESIGNER
=============================
+--> Official documentation on http://dev.piwik.org/trac/wiki/DatabaseSchema <--
+
+
DBdesigner is a great tool for designing Database schema, generating the SQL associated,
and editing beautiful database schema images so that you're proud and happy to show your
design to your fellow developer friends.
Modified: trunk/misc/generateVisits.php
===================================================================
--- trunk/misc/generateVisits.php 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/misc/generateVisits.php 2008-01-15 01:03:22 UTC (rev 173)
@@ -1,36 +1,41 @@
-<?php
+<?php
error_reporting(E_ALL|E_NOTICE);
define('PIWIK_INCLUDE_PATH', '..');
-define('PIWIK_PLUGINS_PATH', PIWIK_INCLUDE_PATH . '/plugins');
-define('PIWIK_DATAFILES_INCLUDE_PATH', PIWIK_INCLUDE_PATH . "/modules/DataFiles");
-
-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() );
-
-require_once "Event/Dispatcher.php";
-require_once "Common.php";
-require_once "PluginsManager.php";
-
+
+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";
require_once "LogStats/Action.php";
-require_once "Cookie.php";
require_once "LogStats/Db.php";
require_once "LogStats/Visit.php";
+require_once "LogStats/Generator.php";
+
+Piwik_PluginsManager::getInstance()->unloadPlugins();
-$GLOBALS['DEBUGPIWIK'] = false;
-require_once "Timer.php";
-require_once "LogStats/Generator.php";
-
-ob_start();
Piwik_PluginsManager::getInstance()->doNotLoadPlugins();
$generator = new Piwik_LogStats_Generator;
$generator->setMaximumUrlDepth(4);
@@ -38,8 +43,9 @@
$nbActionsTotal = 0;
//$generator->emptyAllLogTables();
-$generator->init();
+$generator->init();
+
$t = new Piwik_Timer;
/*
@@ -52,13 +58,18 @@
$startTime = time() - ($daysToCompute-1)*86400;
while($startTime <= time())
{
- $visits = rand(1,2);
- $actions = 10;
- $visits = rand(10,30);
- $actions = 5;
+ $visits = rand(1,20);
+ $actions=10;
+// $actions = 10;
+// $visits = rand(10,30);
+// $actions = 5;
- $generator->setTimestampToUse($startTime);
- $nbActionsTotalThisDay = $generator->generate($visits,$actions);
+ $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);
$actionsPerVisit = round($nbActionsTotalThisDay / $visits);
print("Generated $visits visits and $actionsPerVisit actions per visit for the ".date("Y-m-d", $startTime)."<br>\n");
Modified: trunk/modules/Piwik.php
===================================================================
--- trunk/modules/Piwik.php 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/modules/Piwik.php 2008-01-15 01:03:22 UTC (rev 173)
@@ -706,7 +706,9 @@
}
Zend_Registry::set($loggerType, $logger);
}
- }
+ }
+
+
static public function createConfigObject( $pathConfigFile = null )
{
$config = new Piwik_Config($pathConfigFile);
Modified: trunk/modules/PluginsManager.php
===================================================================
--- trunk/modules/PluginsManager.php 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/modules/PluginsManager.php 2008-01-15 01:03:22 UTC (rev 173)
@@ -172,7 +172,25 @@
$this->dispatcher->addObserver( array( $plugin, $methodToCall), $hookName );
}
}
-
+
+ public function unloadPlugins()
+ {
+ $pluginsLoaded = $this->getLoadedPlugins();
+ foreach($pluginsLoaded as $plugin)
+ {
+ $hooks = $plugin->getListHooksRegistered();
+
+ foreach($hooks as $hookName => $methodToCall)
+ {
+ $success = $this->dispatcher->removeObserver( array( $plugin, $methodToCall), $hookName );
+ if($success !== true)
+ {
+ throw new Exception("Error unloading plugin for method = $methodToCall // hook = $hookName ");
+ }
+ }
+ }
+ $this->loadedPlugins = array();
+ }
}
/**
Modified: trunk/plugins/Home/Controller.php
===================================================================
--- trunk/plugins/Home/Controller.php 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/plugins/Home/Controller.php 2008-01-15 01:03:22 UTC (rev 173)
@@ -22,9 +22,13 @@
{
function getDefaultAction()
{
- return 'homepage';
+ return 'redirectToIndex';
}
-
+
+ function redirectToIndex()
+ {
+ header("Location:?module=Home&action=index&idSite=1&period=day&date=yesterday");
+ }
function homepage()
{
$view = new Piwik_View('Home/templates/homepage.tpl');
Modified: trunk/plugins/Installation/Controller.php
===================================================================
--- trunk/plugins/Installation/Controller.php 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/plugins/Installation/Controller.php 2008-01-15 01:03:22 UTC (rev 173)
@@ -498,7 +498,13 @@
return $infos;
}
-}
+}
+
+
+/**
+ *
+ * @package Piwik_Installation
+ */
class Piwik_FakeAccess_SetSuperUser {
function checkUserIsSuperUser()
{
Modified: trunk/tests/all_tests.php
===================================================================
--- trunk/tests/all_tests.php 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/tests/all_tests.php 2008-01-15 01:03:22 UTC (rev 173)
@@ -1,10 +1,20 @@
-
-<a href='modules'>Tests by module</a>
-<hr>
<?php
flush();
-require_once "config_test.php";
-
+require_once "config_test.php";
+Piwik::createConfigObject();
+$databaseTestName = Zend_Registry::get('config')->database_tests->dbname;
+
+?>
+
+<h2>Piwik unit tests</h2>
+<p>Some of the tests require a database access. The database used for tests is different from your normal Piwik database.
+You may need to create this database ; you can edit the settings for the unit tests database access in your config file
+/config/global.ini.php</p>
+<p><b>The database used in your test is called "<?php echo $databaseTestName; ?>". Create it if necessary.</b></p>
+<p><a href='modules'>Run the tests by module</a></p>
+<hr>
+
+<?php
/*
assertTrue($x) Fail if $x is false
assertFalse($x) Fail if $x is true
@@ -28,7 +38,7 @@
require_once(SIMPLE_TEST . 'unit_tester.php');
require_once(SIMPLE_TEST . 'reporter.php');
-$test = &new GroupTest('All Piwik Tests');
+$test = &new GroupTest('Piwik - running all tests');
$toInclude = array();
function globr($sDir, $sPattern, $nFlags = NULL)
Modified: trunk/tests/config_test.php
===================================================================
--- trunk/tests/config_test.php 2008-01-15 00:05:48 UTC (rev 172)
+++ trunk/tests/config_test.php 2008-01-15 01:03:22 UTC (rev 173)
@@ -83,8 +83,3 @@
define('CONFIG_TEST_INCLUDED', true);
-
-
-
-
-
More information about the Piwik-svn
mailing list