Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2008-12-08 17:08:24 +0300
committermattpiwik <matthieu.aubry@gmail.com>2008-12-08 17:08:24 +0300
commit93ac4b09d9f0b2deec4ea0fa56d8fe4b5bc08437 (patch)
tree00a6cb5a31bdd30706ae5e7959d78993308d9181 /core
parent40cf751bf1d592900feb3684c567fbe148d9e97f (diff)
- cleaning the API/ code
- deleting class Api_Apiable concept not used anymore git-svn-id: http://dev.piwik.org/svn/trunk@826 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core')
-rw-r--r--core/API/APIable.php54
-rw-r--r--core/API/DocumentationGenerator.php162
-rw-r--r--core/API/Proxy.php253
-rw-r--r--core/API/Request.php2
-rw-r--r--core/FrontController.php3
-rw-r--r--core/Piwik.php20
-rw-r--r--core/Timer.php34
-rw-r--r--core/iView.php2
8 files changed, 253 insertions, 277 deletions
diff --git a/core/API/APIable.php b/core/API/APIable.php
deleted file mode 100644
index c05f47d3d2..0000000000
--- a/core/API/APIable.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id: APIable.php 482 2008-05-18 17:22:35Z matt $
- *
- * @package Piwik_API
- */
-require_once 'Archive.php';
-
-/**
- * This class is the parent class of all the plugins that can be called using the API Proxy.
- * For example a plugin "Provider" can publish its API by creating a file plugins/Provider/API.php
- * that is extending this Piwik_Apiable class.
- * All the Piwik_Apiable classes are read and loaded by the Piwik_API_Proxy class.
- * The public methods of this class are published in the API and are then callable using the API module.
- * The parameters of the function are read directly from the GET request (they must have the same name).
- *
- * For example
- * public function helloWorld($text) { return "hello " . $text; }
- * call be called using
- * ?module=API&method=PluginName.helloWorld&text=world!
- *
- * See the documentation on http://dev.piwik.org > API
- *
- * @package Piwik_API
- * @see Piwik_API_Proxy
- */
-
-abstract class Piwik_Apiable
-{
- /**
- * This array contains the name of the methods of the class we don't want to publish in the API.
- * By default only public methods are published. Names of public methods in this array won't be published.
- *
- * @var array of strings
- */
- static public $methodsNotToPublish = array();
-
- /**
- * @see self::$methodsNotToPublish
- * @param string Method name not to be published
- */
- protected function doNotPublishMethod( $methodName )
- {
- if(!method_exists($this, $methodName))
- {
- throw new Exception("The method $methodName doesn't exist so it can't be added to the list of the methods not to be published in the API.");
- }
- $this->methodsNotToPublish[] = $methodName;
- }
-}
diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php
new file mode 100644
index 0000000000..ad6018ab51
--- /dev/null
+++ b/core/API/DocumentationGenerator.php
@@ -0,0 +1,162 @@
+<?php
+
+class Piwik_API_DocumentationGenerator
+{
+ /**
+ * Returns a HTML page containing help for all the successfully loaded APIs.
+ * For each module it will return a mini help with the method names, parameters to give,
+ * links to get the result in Xml/Csv/etc
+ *
+ * @return string
+ */
+ public function getAllInterfaceString( $outputExampleUrls = true, $prefixUrls = '' )
+ {
+ $str = '';
+ $token_auth = "&token_auth=" . Piwik::getCurrentUserTokenAuth();
+ $parametersToSet = array(
+ 'idSite' => Piwik_Common::getRequestVar('idSite', 1, 'int'),
+ 'period' => Piwik_Common::getRequestVar('period', 'day', 'string'),
+ 'date' => Piwik_Common::getRequestVar('date', 'today', 'string')
+ );
+
+ foreach(Piwik_API_Proxy::getInstance()->getMetadata() as $class => $info)
+ {
+ $moduleName = Piwik_API_Proxy::getInstance()->getModuleNameFromClassName($class);
+ $str .= "\n<h2 id='$moduleName'>Module ".$moduleName."</h2>";
+
+ foreach($info as $methodName => $infoMethod)
+ {
+ $params = $this->getStrListParameters($class, $methodName);
+ $str .= "\n" . "- <b>$moduleName.$methodName " . $params . "</b>";
+ $str .= '<small>';
+
+ if($outputExampleUrls)
+ {
+ // we prefix all URLs with $prefixUrls
+ // used when we include this output in the Piwik official documentation for example
+ $str .= "<span class=\"example\">";
+ $exampleUrl = $this->getExampleUrl($class, $methodName, $parametersToSet);
+ if($exampleUrl !== false)
+ {
+ $lastNUrls = '';
+ if( ereg('(&period)|(&date)',$exampleUrl))
+ {
+ $exampleUrlRss1 = $prefixUrls . $this->getExampleUrl($class, $methodName, $parametersToSet + array('date' => 'last10')) ;
+ $exampleUrlRss2 = $prefixUrls . $this->getExampleUrl($class, $methodName, $parametersToSet + array('date' => 'last5','period' => 'week',));
+ $lastNUrls = ", RSS of the last <a target=_blank href='$exampleUrlRss1&format=rss$token_auth'>10 days</a>, <a target=_blank href='$exampleUrlRss2&format=Rss'>5 weeks</a>,
+ XML of the <a target=_blank href='$exampleUrlRss1&format=xml$token_auth'>last 10 days</a>";
+ }
+ $exampleUrl = $prefixUrls . $exampleUrl ;
+ $str .= " [ Example in
+ <a target=_blank href='$exampleUrl&format=xml$token_auth'>XML</a>,
+ <a target=_blank href='$exampleUrl&format=PHP&prettyDisplay=true$token_auth'>PHP</a>,
+ <a target=_blank href='$exampleUrl&format=JSON$token_auth'>Json</a>,
+ <a target=_blank href='$exampleUrl&format=Csv$token_auth'>Csv</a>,
+ <a target=_blank href='$exampleUrl&format=Html$token_auth'>Basic html</a>
+ $lastNUrls
+ ]";
+ }
+ else
+ {
+ $str .= " [ No example available ]";
+ }
+ $str .= "</span>";
+ }
+ $str .= '</small>';
+ $str .= "\n<br>";
+ }
+ }
+ return $str;
+ }
+
+
+ /**
+ * Returns a string containing links to examples on how to call a given method on a given API
+ * It will export links to XML, CSV, HTML, JSON, PHP, etc.
+ * It will not export links for methods such as deleteSite or deleteUser
+ *
+ * @param string the class
+ * @param methodName the method
+ * @return string|false when not possible
+ */
+ protected function getExampleUrl($class, $methodName, $parametersToSet = array())
+ {
+ $knowExampleDefaultParametersValues = array(
+ 'access' => 'view',
+ 'userLogin' => 'test',
+ 'password' => 'passwordExample',
+ 'passwordMd5ied' => 'passwordExample',
+ 'email' => 'test@example.org',
+
+ 'siteName' => 'new example website',
+ 'urls' => 'http://example.org', // used in addSite, updateSite
+
+ 'languageCode' => 'fr',
+ );
+
+ foreach($parametersToSet as $name => $value)
+ {
+ $knowExampleDefaultParametersValues[$name] = $value;
+ }
+
+ // no links for these method names
+ $doNotPrintExampleForTheseMethods = array(
+ 'deleteSite',
+ 'deleteUser',
+ );
+
+ if(in_array($methodName,$doNotPrintExampleForTheseMethods))
+ {
+ return false;
+ }
+
+ // we try to give an URL example to call the API
+ $aParameters = Piwik_API_Proxy::getInstance()->getParametersList($class, $methodName);
+ $moduleName = Piwik_API_Proxy::getInstance()->getModuleNameFromClassName($class);
+ $urlExample = '?module=API&method='.$moduleName.'.'.$methodName.'&';
+ foreach($aParameters as $nameVariable=> $defaultValue)
+ {
+ // if there isn't a default value for a given parameter,
+ // we need a 'know default value' or we can't generate the link
+ if($defaultValue === Piwik_API_Proxy::NO_DEFAULT_VALUE)
+ {
+ if(isset($knowExampleDefaultParametersValues[$nameVariable]))
+ {
+ $exampleValue = $knowExampleDefaultParametersValues[$nameVariable];
+ $urlExample .= $nameVariable . '=' . $exampleValue . '&';
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ return substr($urlExample,0,-1);
+ }
+
+
+ /**
+ * Returns the methods $class.$name parameters (and default value if provided) as a string.
+ *
+ * @param string The class name
+ * @param string The method name
+ * @return string For example "(idSite, period, date = 'today')"
+ */
+ protected function getStrListParameters($class, $name)
+ {
+ $aParameters = Piwik_API_Proxy::getInstance()->getParametersList($class, $name);
+ $asParameters = array();
+ foreach($aParameters as $nameVariable=> $defaultValue)
+ {
+ $str = $nameVariable;
+ if($defaultValue !== Piwik_API_Proxy::NO_DEFAULT_VALUE)
+ {
+ $str .= " = '$defaultValue'";
+ }
+ $asParameters[] = $str;
+ }
+ $sParameters = implode(", ", $asParameters);
+ return "($sParameters)";
+ }
+}
diff --git a/core/API/Proxy.php b/core/API/Proxy.php
index 41f7191b4c..d42a69e218 100644
--- a/core/API/Proxy.php
+++ b/core/API/Proxy.php
@@ -13,7 +13,6 @@
/**
* The API Proxy receives all the API calls requests and forwards them to the given module.
*
- * It registers all the APIable plugins (@see Piwik_Apiable)
* The class checks that a call to the API has the correct number of parameters.
* The proxy is a singleton that has the knowledge of every method available, their parameters and default values.
*
@@ -28,14 +27,13 @@ class Piwik_API_Proxy
// array of already registered plugins names
protected $alreadyRegistered = array();
- private $api = array();
+ private $metadataArray = array();
// when a parameter doesn't have a default value we use this constant
const NO_DEFAULT_VALUE = null;
static private $instance = null;
- protected function __construct()
- {}
+ protected function __construct() {}
/**
* Singleton, returns instance
@@ -52,11 +50,15 @@ class Piwik_API_Proxy
return self::$instance;
}
+ public function getMetadata()
+ {
+ return $this->metadataArray;
+ }
+
/**
* Registers the API information of a given module.
*
* The module to be registered must be
- * - extending the Piwik_Apiable class
* - a singleton (providing a getInstance() method)
* - the API file must be located in plugins/ModuleName/API.php
* for example plugins/Referers/API.php
@@ -74,15 +76,9 @@ class Piwik_API_Proxy
$this->includeApiFile($moduleName);
$class = $this->getClassNameFromModule($moduleName);
+ $this->checkClassIsSingleton($class);
$rClass = new ReflectionClass($class);
- if(!$rClass->isSubclassOf(new ReflectionClass("Piwik_Apiable")))
- {
- throw new Exception("To publish its public methods in the API, the class '$class' must be a subclass of 'Piwik_Apiable'.");
- }
-
- $this->checkClassIsSingleton($class);
-
foreach($rClass->getMethods() as $method)
{
$this->loadMethodMetadata($class, $method);
@@ -173,7 +169,36 @@ class Piwik_API_Proxy
return $returnedValue;
}
- protected function includeApiFile($fileName)
+ /**
+ * Returns the 'moduleName' part of 'Piwik_moduleName_API' classname
+ *
+ * @param string moduleName
+ * @return string className
+ */
+ public function getModuleNameFromClassName( $className )
+ {
+ $start = strpos($className, '_') + 1;
+ return substr($className, $start , strrpos($className, '_') - $start);
+ }
+
+ /**
+ * Returns the parameters names and default values for the method $name
+ * of the class $class
+ *
+ * @param string The class name
+ * @param string The method name
+ * @return array Format array(
+ * 'testParameter' => null, // no default value
+ * 'life' => 42, // default value = 42
+ * 'date' => 'yesterday',
+ * );
+ */
+ public function getParametersList($class, $name)
+ {
+ return $this->metadataArray[$class][$name]['parameters'];
+ }
+
+ private function includeApiFile($fileName)
{
$potentialPaths = array( "plugins/". $fileName ."/API.php", );
@@ -194,7 +219,7 @@ class Piwik_API_Proxy
}
}
- protected function loadMethodMetadata($class, $method)
+ private function loadMethodMetadata($class, $method)
{
// use this trick to read the static attribute of the class
// $class::$methodsNotToPublish doesn't work
@@ -222,196 +247,9 @@ class Piwik_API_Proxy
$aParameters[$nameVariable] = $defaultValue;
}
- $this->api[$class][$name]['parameters'] = $aParameters;
- $this->api[$class][$name]['numberOfRequiredParameters'] = $method->getNumberOfRequiredParameters();
- }
- }
-
- /**
- * Returns the 'moduleName' part of 'Piwik_moduleName_API' classname
- *
- * @param string moduleName
- * @return string className
- */
- protected function getModuleNameFromClassName( $className )
- {
- $start = strpos($className, '_') + 1;
- return substr($className, $start , strrpos($className, '_') - $start);
- }
-
- /**
- * Returns a string containing links to examples on how to call a given method on a given API
- * It will export links to XML, CSV, HTML, JSON, PHP, etc.
- * It will not export links for methods such as deleteSite or deleteUser
- *
- * @param string the class
- * @param methodName the method
- * @return string|false when not possible
- */
- public function getExampleUrl($class, $methodName, $parametersToSet = array())
- {
- $knowExampleDefaultParametersValues = array(
- 'access' => 'view',
- 'userLogin' => 'test',
- 'password' => 'passwordExample',
- 'passwordMd5ied' => 'passwordExample',
- 'email' => 'test@example.org',
-
- 'siteName' => 'new example website',
- 'urls' => 'http://example.org', // used in addSite, updateSite
-
- 'languageCode' => 'fr',
- );
-
- foreach($parametersToSet as $name => $value)
- {
- $knowExampleDefaultParametersValues[$name] = $value;
- }
-
- // no links for these method names
- $doNotPrintExampleForTheseMethods = array(
- 'deleteSite',
- 'deleteUser',
- );
-
- if(in_array($methodName,$doNotPrintExampleForTheseMethods))
- {
- return false;
- }
-
-
- // we try to give an URL example to call the API
- $aParameters = $this->getParametersList($class, $methodName);
- $moduleName = $this->getModuleNameFromClassName($class);
- $urlExample = '?module=API&method='.$moduleName.'.'.$methodName.'&';
- foreach($aParameters as $nameVariable=> $defaultValue)
- {
- // if there isn't a default value for a given parameter,
- // we need a 'know default value' or we can't generate the link
- if($defaultValue === Piwik_API_Proxy::NO_DEFAULT_VALUE)
- {
- if(isset($knowExampleDefaultParametersValues[$nameVariable]))
- {
- $exampleValue = $knowExampleDefaultParametersValues[$nameVariable];
- $urlExample .= $nameVariable . '=' . $exampleValue . '&';
- }
- else
- {
- return false;
- }
- }
-
+ $this->metadataArray[$class][$name]['parameters'] = $aParameters;
+ $this->metadataArray[$class][$name]['numberOfRequiredParameters'] = $method->getNumberOfRequiredParameters();
}
-
- return substr($urlExample,0,-1);
- }
-
- /**
- * Returns a HTML page containing help for all the successfully loaded APIs.
- * For each module it will return a mini help with the method names, parameters to give,
- * links to get the result in Xml/Csv/etc
- *
- * @return string
- */
- public function getAllInterfaceString( $outputExampleUrls = true, $prefixUrls = '' )
- {
- $str = '';
- $token_auth = "&token_auth=" . Piwik::getCurrentUserTokenAuth();
- $parametersToSet = array(
- 'idSite' => Piwik_Common::getRequestVar('idSite', 1, 'int'),
- 'period' => Piwik_Common::getRequestVar('period', 'day', 'string'),
- 'date' => Piwik_Common::getRequestVar('date', 'today', 'string')
- );
-
- foreach($this->api as $class => $info)
- {
- $moduleName = $this->getModuleNameFromClassName($class);
- $str .= "\n<h2 id='$moduleName'>Module ".$moduleName."</h2>";
-
- foreach($info as $methodName => $infoMethod)
- {
- $params = $this->getStrListParameters($class, $methodName);
- $str .= "\n" . "- <b>$moduleName.$methodName " . $params . "</b>";
- $str .= '<small>';
-
- if($outputExampleUrls)
- {
- // we prefix all URLs with $prefixUrls
- // used when we include this output in the Piwik official documentation for example
- $str .= "<span class=\"example\">";
- $exampleUrl = $this->getExampleUrl($class, $methodName, $parametersToSet);
- if($exampleUrl !== false)
- {
- $lastNUrls = '';
- if( ereg('(&period)|(&date)',$exampleUrl))
- {
- $exampleUrlRss1 = $prefixUrls . $this->getExampleUrl($class, $methodName, $parametersToSet + array('date' => 'last10')) ;
- $exampleUrlRss2 = $prefixUrls . $this->getExampleUrl($class, $methodName, $parametersToSet + array('date' => 'last5','period' => 'week',));
- $lastNUrls = ", RSS of the last <a target=_blank href='$exampleUrlRss1&format=rss$token_auth'>10 days</a>, <a target=_blank href='$exampleUrlRss2&format=Rss'>5 weeks</a>,
- XML of the <a target=_blank href='$exampleUrlRss1&format=xml$token_auth'>last 10 days</a>";
- }
- $exampleUrl = $prefixUrls . $exampleUrl ;
- $str .= " [ Example in
- <a target=_blank href='$exampleUrl&format=xml$token_auth'>XML</a>,
- <a target=_blank href='$exampleUrl&format=PHP&prettyDisplay=true$token_auth'>PHP</a>,
- <a target=_blank href='$exampleUrl&format=JSON$token_auth'>Json</a>,
- <a target=_blank href='$exampleUrl&format=Csv$token_auth'>Csv</a>,
- <a target=_blank href='$exampleUrl&format=Html$token_auth'>Basic html</a>
- $lastNUrls
- ]";
- }
- else
- {
- $str .= " [ No example available ]";
- }
- $str .= "</span>";
- }
- $str .= '</small>';
- $str .= "\n<br>";
- }
- }
- return $str;
- }
-
- /**
- * Returns the methods $class.$name parameters (and default value if provided) as a string.
- *
- * @param string The class name
- * @param string The method name
- * @return string For example "(idSite, period, date = 'today')"
- */
- private function getStrListParameters($class, $name)
- {
- $aParameters = $this->getParametersList($class, $name);
- $asParameters = array();
- foreach($aParameters as $nameVariable=> $defaultValue)
- {
- $str = $nameVariable;
- if($defaultValue !== Piwik_API_Proxy::NO_DEFAULT_VALUE)
- {
- $str .= " = '$defaultValue'";
- }
- $asParameters[] = $str;
- }
- $sParameters = implode(", ", $asParameters);
- return "($sParameters)";
- }
-
- /**
- * Returns the parameters names and default values for the method $name
- * of the class $class
- *
- * @param string The class name
- * @param string The method name
- * @return array Format array(
- * 'testParameter' => null, // no default value
- * 'life' => 42, // default value = 42
- * 'date' => 'yesterday',
- * );
- */
- public function getParametersList($class, $name)
- {
- return $this->api[$class][$name]['parameters'];
}
/**
@@ -423,7 +261,7 @@ class Piwik_API_Proxy
*/
private function getNumberOfRequiredParameters($class, $name)
{
- return $this->api[$class][$name]['numberOfRequiredParameters'];
+ return $this->metadataArray[$class][$name]['numberOfRequiredParameters'];
}
/**
@@ -435,7 +273,7 @@ class Piwik_API_Proxy
*/
private function isMethodAvailable( $className, $methodName)
{
- return isset($this->api[$className][$methodName]);
+ return isset($this->metadataArray[$className][$methodName]);
}
/**
@@ -474,13 +312,12 @@ class Piwik_API_Proxy
* Returns the API class name given the module name.
*
* For exemple for $module = 'Referers' it returns 'Piwik_Referers_API'
- * Piwik_Referers_API is the class that extends Piwik_Apiable
- * and that contains the methods to be published in the API.
+ * Piwik_Referers_API contains the methods to be published in the API.
*
* @param string module name
* @return string class name
*/
- protected function getClassNameFromModule($module)
+ private function getClassNameFromModule($module)
{
$class = Piwik::prefixClass($module ."_API");
return $class;
diff --git a/core/API/Request.php b/core/API/Request.php
index 09c96a2de1..55404c5a2f 100644
--- a/core/API/Request.php
+++ b/core/API/Request.php
@@ -128,7 +128,7 @@ class Piwik_API_Request
$toReturn = $response->getResponse($returnedValue);
} catch(Exception $e ) {
- return $response->getResponseException( $e );
+ $toReturn = $response->getResponseException( $e );
}
return $toReturn;
}
diff --git a/core/FrontController.php b/core/FrontController.php
index fcbba59e26..591693c453 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -23,11 +23,12 @@ require_once "Zend/Auth/Adapter/DbTable.php";
*/
require_once "Timer.php";
require_once "core/Piwik.php";
-require_once "API/APIable.php";
require_once "Access.php";
require_once "Auth.php";
require_once "API/Proxy.php";
require_once "Site.php";
+require_once "Date.php";
+require_once "DataTable.php";
require_once "Translate.php";
require_once "Mail.php";
require_once "Url.php";
diff --git a/core/Piwik.php b/core/Piwik.php
index 3a0e0ce40c..998d6da08b 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -57,7 +57,7 @@ class Piwik
Piwik::createHtAccess($path);
}
}
-
+
/**
* Checks that the directories Piwik needs write access are actually writable
* Displays a nice error page if permissions are missing on some directories
@@ -399,6 +399,23 @@ class Piwik
}
}
+ static public function getPrettySizeFromBytes($size)
+ {
+ $bytes = array('','K','M','G','T');
+ foreach($bytes as $val)
+ {
+ if($size > 1024)
+ {
+ $size = $size / 1024;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return round($size, 1)." ".$val;
+ }
+
static public function isPhpCliMode()
{
return in_array(substr(php_sapi_name(), 0, 3), array('cgi', 'cli'));
@@ -584,6 +601,7 @@ class Piwik
visit_entry_idaction INTEGER(11) NOT NULL,
visit_total_actions SMALLINT(5) UNSIGNED NOT NULL,
visit_total_time SMALLINT(5) UNSIGNED NOT NULL,
+ visit_goal_converted TINYINT(1) NOT NULL,
referer_type INTEGER UNSIGNED NULL,
referer_name VARCHAR(70) NULL,
referer_url TEXT NOT NULL,
diff --git a/core/Timer.php b/core/Timer.php
index 8e71b41ba5..783dcff6ea 100644
--- a/core/Timer.php
+++ b/core/Timer.php
@@ -15,36 +15,48 @@
*/
class Piwik_Timer
{
- private $m_Start;
+ private $timerStart;
+ private $memoryStart;
public function __construct()
{
- $this->m_Start = 0.0;
$this->init();
}
- private function getMicrotime()
- {
- list($micro_seconds, $seconds) = explode(" ", microtime());
- return ((float)$micro_seconds + (float)$seconds);
- }
-
public function init()
{
- $this->m_Start = $this->getMicrotime();
+ $this->timerStart = $this->getMicrotime();
+ $this->memoryStart = $this->getMemoryUsage();
}
public function getTime($decimals = 2)
{
- return number_format($this->getMicrotime() - $this->m_Start, $decimals, '.', '');
+ return number_format($this->getMicrotime() - $this->timerStart, $decimals, '.', '');
}
+
public function getTimeMs($decimals = 2)
{
- return number_format(1000*($this->getMicrotime() - $this->m_Start), $decimals, '.', '');
+ return number_format(1000*($this->getMicrotime() - $this->timerStart), $decimals, '.', '');
}
+ public function getMemoryLeak()
+ {
+ return "Memory delta: ".Piwik::getPrettySizeFromBytes($this->getMemoryUsage() - $this->memoryStart);
+ }
+
public function __toString()
{
return "Time elapsed: ". $this->getTime() ."s";
}
+
+ private function getMicrotime()
+ {
+ list($micro_seconds, $seconds) = explode(" ", microtime());
+ return ((float)$micro_seconds + (float)$seconds);
+ }
+
+ private function getMemoryUsage()
+ {
+ return memory_get_usage();
+ }
}
diff --git a/core/iView.php b/core/iView.php
index c35edafa50..82bb01bcd3 100644
--- a/core/iView.php
+++ b/core/iView.php
@@ -4,7 +4,7 @@
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id: APIable.php 162 2008-01-14 04:27:21Z matt $
+ * @version $Id$
*
* @package Piwik_Visualization
*/