Skip to content
Extraits de code Groupes Projets
Valider 7d6d9837 rédigé par benakamoorthi's avatar benakamoorthi
Parcourir les fichiers

Fixes #3102, removed upper limit for 'action_category_level_limit' config...

Fixes #3102, removed upper limit for 'action_category_level_limit' config setting by making MAXIMUM_DEPTH_LEVEL_ALLOWED settable.


git-svn-id: http://dev.piwik.org/svn/trunk@6294 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent d88437f4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -87,7 +87,6 @@ action_title_category_delimiter = /
; the maximum url category depth to track. if this is set to 2, then a url such as
; "example.com/blog/development/first-post" would be treated as "example.com/blog/development".
; this setting is used mainly to limit the amount of data that is stored by Piwik.
; note: this value is not allowed to be greater than Piwik_DataTable::MAXIMUM_DEPTH_LEVEL_ALLOWED.
action_category_level_limit = 10
; minimum number of websites to run autocompleter
......
......@@ -137,7 +137,14 @@ require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
* @subpackage Piwik_DataTable
*/
class Piwik_DataTable
{
{
/**
* Maximum nesting level
*
* @var int
*/
static private $maximumDepthLevelAllowed = 15;
/**
* Array of Piwik_DataTable_Row
*
......@@ -227,13 +234,6 @@ class Piwik_DataTable
const ID_SUMMARY_ROW = -1;
const LABEL_SUMMARY_ROW = -1;
const ID_PARENTS = -2;
/**
* Maximum nesting level
*
* @var int
*/
const MAXIMUM_DEPTH_LEVEL_ALLOWED = 15;
/**
* Builds the DataTable, registers itself to the manager
......@@ -251,7 +251,7 @@ class Piwik_DataTable
{
static $depth = 0;
// destruct can be called several times
if($depth < self::MAXIMUM_DEPTH_LEVEL_ALLOWED
if($depth < self::$maximumDepthLevelAllowed
&& isset($this->rows))
{
$depth++;
......@@ -959,10 +959,10 @@ class Piwik_DataTable
{
static $depth = 0;
if($depth > self::MAXIMUM_DEPTH_LEVEL_ALLOWED)
if($depth > self::$maximumDepthLevelAllowed)
{
$depth = 0;
throw new Exception("Maximum recursion level of ".self::MAXIMUM_DEPTH_LEVEL_ALLOWED. " reached. You have probably set a DataTable_Row with an associated DataTable which belongs already to its parent hierarchy.");
throw new Exception("Maximum recursion level of ".self::$maximumDepthLevelAllowed. " reached. You have probably set a DataTable_Row with an associated DataTable which belongs already to its parent hierarchy.");
}
if( !is_null($maximumRowsInDataTable) )
{
......@@ -1251,4 +1251,39 @@ class Piwik_DataTable
return $this->parents;
}
/**
* Gets the maximum nesting level for datatables.
*
* @return int
*/
static public function getMaximumDepthLevelAllowed()
{
return self::$maximumDepthLevelAllowed;
}
/**
* Sets the maximum nesting level.
*
* @param int $level Must be > 0.
*/
static public function setMaximumDepthLevelAllowed( $level )
{
if ($level <= 0)
{
throw new Exception("Invalid maximum depth level: $level");
}
self::$maximumDepthLevelAllowed = $level;
}
/**
* Sets the maximum nesting level to at least a certain value. If the current value is
* greater than the supplied level, the maximum nesting level is not changed.
*
* @param int $atLeastLevel
*/
static public function setMaximumDepthLevelAllowedAtLeast( $atLeastLevel )
{
self::$maximumDepthLevelAllowed = max($atLeastLevel, self::$maximumDepthLevelAllowed);
}
}
......@@ -394,6 +394,9 @@ class Piwik_Actions extends Piwik_Plugin
$this->columnToSortByBeforeTruncation = Piwik_Archive::INDEX_NB_VISITS;
$this->maximumRowsInDataTableLevelZero = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_actions'];
$this->maximumRowsInSubDataTable = Piwik_Config::getInstance()->General['datatable_archiving_maximum_rows_subtable_actions'];
// Piwik_DataTable::MAXIMUM_DEPTH_LEVEL_ALLOWED must be greater than the category level limit
Piwik_DataTable::setMaximumDepthLevelAllowedAtLeast(self::getSubCategoryLevelLimit() + 1);
}
/**
......@@ -899,17 +902,13 @@ class Piwik_Actions extends Piwik_Plugin
}
/**
* Returns the configured sub-category level limit. The result will be less than
* Piwik_DataTable::MAXIMUM_DEPTH_LEVEL_ALLOWED.
* Returns the configured sub-category level limit.
*
* @return int
*/
public static function getSubCategoryLevelLimit()
{
$limit = Piwik_Config::getInstance()->General['action_category_level_limit'];
// limit must be less than Piwik_DataTable::MAXIMUM_DEPTH_LEVEL_ALLOWED
return min($limit, Piwik_DataTable::MAXIMUM_DEPTH_LEVEL_ALLOWED - 1);
return Piwik_Config::getInstance()->General['action_category_level_limit'];
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter