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:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-03-30 06:22:03 +0400
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-03-30 06:22:03 +0400
commit241cd5c015c46945140be70c7daec15e166de29c (patch)
tree6c7740e8e5dffaa4006b9208324a1952bac49469 /core
parent7b3d0025c861bff8d9230faafae5d6ffff8f912c (diff)
- fixing recently introduced sorting issue, refactoring, cleaning up the generic filters concept by removing the automatic sorting of data
- fixing issue when executing unit tests would invalidate tmp/cache/tracker files - fixed edge case issue when calling several apis from one http request, and requesting recursive output, it was failing in some random cases - adding a unit test that calls all callable api methods and check for non empty output -
Diffstat (limited to 'core')
-rw-r--r--core/API/DataTableGenericFilter.php2
-rw-r--r--core/API/DocumentationGenerator.php12
-rw-r--r--core/Common.php8
-rw-r--r--core/DataTable.php2
-rw-r--r--core/DataTable/Filter/ReplaceColumnNames.php16
-rw-r--r--core/DataTable/Filter/Sort.php6
-rw-r--r--core/DataTable/Renderer.php5
-rw-r--r--core/DataTable/Renderer/Json.php2
-rw-r--r--core/DataTable/Renderer/Php.php2
-rw-r--r--core/DataTable/Renderer/Xml.php2
-rw-r--r--core/Piwik.php2
-rw-r--r--core/ViewDataTable.php4
12 files changed, 45 insertions, 18 deletions
diff --git a/core/API/DataTableGenericFilter.php b/core/API/DataTableGenericFilter.php
index c9be367136..0143397d40 100644
--- a/core/API/DataTableGenericFilter.php
+++ b/core/API/DataTableGenericFilter.php
@@ -51,7 +51,7 @@ class Piwik_API_DataTableGenericFilter
'filter_update_columns_when_show_all_goals' => array('integer')
),
'Sort' => array(
- 'filter_sort_column' => array('string', Piwik_Archive::INDEX_NB_VISITS),
+ 'filter_sort_column' => array('string'),
'filter_sort_order' => array('string', Zend_Registry::get('config')->General->dataTable_default_sort_order),
),
'Limit' => array(
diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php
index a77f2f27ae..3e0a6bbd2d 100644
--- a/core/API/DocumentationGenerator.php
+++ b/core/API/DocumentationGenerator.php
@@ -102,7 +102,6 @@ class Piwik_API_DocumentationGenerator
$knowExampleDefaultParametersValues = array(
'access' => 'view',
'userLogin' => 'test',
- 'password' => 'passwordExample',
'passwordMd5ied' => 'passwordExample',
'email' => 'test@example.org',
@@ -116,8 +115,19 @@ class Piwik_API_DocumentationGenerator
// no links for these method names
$doNotPrintExampleForTheseMethods = array(
+ //Sites
'deleteSite',
+ 'addSite',
+ 'updateSite',
+ 'addSiteAliasUrls',
+ //Users
'deleteUser',
+ 'addUser',
+ 'updateUser',
+ 'setUserAccess',
+ //Goals
+ 'addGoal',
+ 'updateGoal',
'deleteGoal',
);
diff --git a/core/Common.php b/core/Common.php
index 2cc6ade424..491e562948 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -82,7 +82,6 @@ class Piwik_Common
{
return $cacheContent;
}
- // if DB is not in the registry, we are in tracker mode, we add it in the registry
if(defined('PIWIK_TRACKER_MODE')
&& PIWIK_TRACKER_MODE)
{
@@ -116,7 +115,12 @@ class Piwik_Common
$content = array();
Piwik_PostEvent('Common.fetchWebsiteAttributes', $content, $idSite);
- $cache->set($filename, $content);
+ // if nothing is returned from the plugins, we don't save the content
+ // this is not expected: all websites are expected to have at least one URL
+ if(!empty($content))
+ {
+ $cache->set($filename, $content);
+ }
return $content;
}
diff --git a/core/DataTable.php b/core/DataTable.php
index e1d956e1e4..b195d64480 100644
--- a/core/DataTable.php
+++ b/core/DataTable.php
@@ -320,7 +320,7 @@ class Piwik_DataTable
}
/**
- * Queue a DataTable_Filter that will be applied at the end of the process
+ * Queue a DataTable_Filter that will be applied when applyQueuedFilters() is called.
* (just before sending the datatable back to the browser (or API, etc.)
*
* @param string $className The class name of the filter, eg. Piwik_DataTable_Filter_Limit
diff --git a/core/DataTable/Filter/ReplaceColumnNames.php b/core/DataTable/Filter/ReplaceColumnNames.php
index 8d25c960ac..36c03da672 100644
--- a/core/DataTable/Filter/ReplaceColumnNames.php
+++ b/core/DataTable/Filter/ReplaceColumnNames.php
@@ -35,10 +35,11 @@ class Piwik_DataTable_Filter_ReplaceColumnNames extends Piwik_DataTable_Filter
* OLD_COLUMN_NAME2 => NEW_COLUMN NAME2,
* )
*/
- public function __construct( $table, $mappingToApply = null )
+ public function __construct( $table, $recursive = false, $mappingToApply = null )
{
parent::__construct($table);
$this->mappingToApply = Piwik_Archive::$mappingFromIdToName;
+ $this->applyFilterRecursively = $recursive;
if(!is_null($mappingToApply))
{
$this->mappingToApply = $mappingToApply;
@@ -58,11 +59,14 @@ class Piwik_DataTable_Filter_ReplaceColumnNames extends Piwik_DataTable_Filter
$oldColumns = $row->getColumns();
$newColumns = $this->getRenamedColumns($oldColumns);
$row->setColumns( $newColumns );
- try {
- $subTable = Piwik_DataTable_Manager::getInstance()->getTable( $row->getIdSubDataTable() );
- $this->filterTable($subTable);
- } catch(Exception $e){
- // case idSubTable == null, or if the table is not loaded in memory
+ if($this->applyFilterRecursively)
+ {
+ try {
+ $subTable = Piwik_DataTable_Manager::getInstance()->getTable( $row->getIdSubDataTable() );
+ $this->filterTable($subTable);
+ } catch(Exception $e){
+ // case idSubTable == null, or if the table is not loaded in memory
+ }
}
}
}
diff --git a/core/DataTable/Filter/Sort.php b/core/DataTable/Filter/Sort.php
index 222a2ca5d8..077a09cbca 100644
--- a/core/DataTable/Filter/Sort.php
+++ b/core/DataTable/Filter/Sort.php
@@ -20,13 +20,17 @@ class Piwik_DataTable_Filter_Sort extends Piwik_DataTable_Filter
protected $columnToSort;
protected $order;
- public function __construct( $table, $columnToSort, $order = 'desc', $naturalSort = false )
+ public function __construct( $table, $columnToSort, $order = 'desc', $naturalSort = false, $recursiveSort = false )
{
parent::__construct($table);
if(empty($columnToSort))
{
return;
}
+ if($recursiveSort)
+ {
+ $table->enableRecursiveSort();
+ }
$this->columnToSort = $columnToSort;
$this->naturalSort = $naturalSort;
$this->setOrder($order);
diff --git a/core/DataTable/Renderer.php b/core/DataTable/Renderer.php
index 03b51ec97a..0177289ed1 100644
--- a/core/DataTable/Renderer.php
+++ b/core/DataTable/Renderer.php
@@ -30,6 +30,11 @@ abstract class Piwik_DataTable_Renderer
$this->renderSubTables = (bool)$enableRenderSubTable;
}
+ protected function isRenderSubtables()
+ {
+ return $this->renderSubTables;
+ }
+
/**
* Computes the dataTable output and returns the string/binary
*
diff --git a/core/DataTable/Renderer/Json.php b/core/DataTable/Renderer/Json.php
index 63f8c3a2e9..e20fd8fecf 100644
--- a/core/DataTable/Renderer/Json.php
+++ b/core/DataTable/Renderer/Json.php
@@ -28,7 +28,7 @@ class Piwik_DataTable_Renderer_Json extends Piwik_DataTable_Renderer
{
$renderer = new Piwik_DataTable_Renderer_Php();
$renderer->setTable($table);
- $renderer->setRenderSubTables($this->renderSubTables);
+ $renderer->setRenderSubTables($this->isRenderSubtables());
$renderer->setSerialize(false);
$array = $renderer->flatRender();
diff --git a/core/DataTable/Renderer/Php.php b/core/DataTable/Renderer/Php.php
index aa1d20996f..1d44869e86 100644
--- a/core/DataTable/Renderer/Php.php
+++ b/core/DataTable/Renderer/Php.php
@@ -174,7 +174,7 @@ class Piwik_DataTable_Renderer_Php extends Piwik_DataTable_Renderer
'idsubdatatable' => $row->getIdSubDataTable(),
);
- if($this->renderSubTables
+ if($this->isRenderSubtables()
&& $row->getIdSubDataTable() !== null)
{
try{
diff --git a/core/DataTable/Renderer/Xml.php b/core/DataTable/Renderer/Xml.php
index 9ac267373b..f509c3e9bf 100644
--- a/core/DataTable/Renderer/Xml.php
+++ b/core/DataTable/Renderer/Xml.php
@@ -30,7 +30,7 @@ class Piwik_DataTable_Renderer_Xml extends Piwik_DataTable_Renderer
protected function getArrayFromDataTable($table)
{
$renderer = new Piwik_DataTable_Renderer_Php();
- $renderer->setRenderSubTables($this->renderSubTables);
+ $renderer->setRenderSubTables($this->isRenderSubtables());
$renderer->setSerialize(false);
$renderer->setTable($table);
return $renderer->flatRender();
diff --git a/core/Piwik.php b/core/Piwik.php
index c01610feb0..ae7360c375 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -116,7 +116,7 @@ class Piwik
*/
static public function getJavascriptCode($idSite, $piwikUrl, $actionName = "''")
{
- $jsTag = file_get_contents( "core/Tracker/javascriptTag.tpl");
+ $jsTag = file_get_contents( PIWIK_INCLUDE_PATH . "/core/Tracker/javascriptTag.tpl");
$jsTag = nl2br(htmlentities($jsTag));
$piwikUrl = preg_match('/^(http|https):\/\/(.*)$/', $piwikUrl, $matches);
$piwikUrl = $matches[2];
diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php
index c450cc80f5..3e998be4e5 100644
--- a/core/ViewDataTable.php
+++ b/core/ViewDataTable.php
@@ -740,8 +740,8 @@ abstract class Piwik_ViewDataTable
*/
public function setSortedColumn( $columnId, $order = 'desc')
{
- $this->variablesDefault['filter_sort_column']= $columnId;
- $this->variablesDefault['filter_sort_order']= $order;
+ $this->variablesDefault['filter_sort_column'] = $columnId;
+ $this->variablesDefault['filter_sort_order'] = $order;
}
/**