Skip to content
Extraits de code Groupes Projets
Valider 6bfbb324 rédigé par robocoder's avatar robocoder
Parcourir les fichiers

fixes #1049 - peephole optimizations (assignment to a temporary variable before returning)

git-svn-id: http://dev.piwik.org/svn/trunk@1613 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 6258535f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -588,14 +588,13 @@ class Piwik_DataTable ...@@ -588,14 +588,13 @@ class Piwik_DataTable
*/ */
public function getRowsCount() public function getRowsCount()
{ {
$count = count($this->rows);
if(is_null($this->summaryRow)) if(is_null($this->summaryRow))
{ {
return $count; return count($this->rows);
} }
else else
{ {
return $count + 1; return count($this->rows) + 1;
} }
} }
...@@ -820,10 +819,7 @@ class Piwik_DataTable ...@@ -820,10 +819,7 @@ class Piwik_DataTable
$table1->rebuildIndex(); $table1->rebuildIndex();
$table2->rebuildIndex(); $table2->rebuildIndex();
$countrows1 = $table1->getRowsCount(); if($table1->getRowsCount() != $table2->getRowsCount())
$countrows2 = $table2->getRowsCount();
if($countrows1 != $countrows2)
{ {
return false; return false;
} }
...@@ -831,11 +827,8 @@ class Piwik_DataTable ...@@ -831,11 +827,8 @@ class Piwik_DataTable
foreach($rows1 as $row1) foreach($rows1 as $row1)
{ {
$row2 = $table2->getRowFromLabel($row1->getColumn('label')); $row2 = $table2->getRowFromLabel($row1->getColumn('label'));
if($row2 === false) if($row2 === false
{ || !Piwik_DataTable_Row::isEqual($row1,$row2))
return false;
}
if( !Piwik_DataTable_Row::isEqual($row1,$row2) )
{ {
return false; return false;
} }
......
...@@ -139,8 +139,7 @@ class Piwik_Log_Formatter_FileFormatter implements Zend_Log_Formatter_Interface ...@@ -139,8 +139,7 @@ class Piwik_Log_Formatter_FileFormatter implements Zend_Log_Formatter_Interface
} }
$ts = $event['timestamp']; $ts = $event['timestamp'];
unset($event['timestamp']); unset($event['timestamp']);
$str = $ts . ' ' . implode(" ", $event) . "\n"; return $ts . ' ' . implode(" ", $event) . "\n";
return $str;
} }
} }
...@@ -156,11 +155,10 @@ class Piwik_Log_Formatter_ScreenFormatter implements Zend_Log_Formatter_Interfac ...@@ -156,11 +155,10 @@ class Piwik_Log_Formatter_ScreenFormatter implements Zend_Log_Formatter_Interfac
// no injection in error messages, backtrace when displayed on screen // no injection in error messages, backtrace when displayed on screen
return array_map('htmlspecialchars', $event); return array_map('htmlspecialchars', $event);
} }
function format($string) function format($string)
{ {
$string = self::getFormattedString($string); return self::getFormattedString($string);
return $string;
} }
static public function getFormattedString($string) static public function getFormattedString($string)
......
...@@ -221,8 +221,7 @@ abstract class Piwik_Period ...@@ -221,8 +221,7 @@ abstract class Piwik_Period
public function __toString() public function __toString()
{ {
$elements = $this->toString(); return implode(",", $this->toString());
return implode(",", $elements);
} }
public function get( $part= null ) public function get( $part= null )
......
...@@ -192,9 +192,7 @@ class Piwik_PluginsManager ...@@ -192,9 +192,7 @@ class Piwik_PluginsManager
*/ */
public function getLoadedPluginsName() public function getLoadedPluginsName()
{ {
$oPlugins = $this->getLoadedPlugins(); return array_map('get_class', $this->getLoadedPlugins());
$pluginNames = array_map('get_class',$oPlugins);
return $pluginNames;
} }
/** /**
......
...@@ -108,11 +108,7 @@ class Piwik_TablePartitioning_Monthly extends Piwik_TablePartitioning ...@@ -108,11 +108,7 @@ class Piwik_TablePartitioning_Monthly extends Piwik_TablePartitioning
protected function generateTableName() protected function generateTableName()
{ {
$config = Zend_Registry::get('config'); $config = Zend_Registry::get('config');
$prefixTables = $config->database->tables_prefix; return $config->database->tables_prefix . $this->tableName . "_" . date("Y_m", $this->timestamp);
$date = date("Y_m", $this->timestamp);
return $prefixTables . $this->tableName . "_" . $date;
} }
} }
...@@ -131,10 +127,6 @@ class Piwik_TablePartitioning_Daily extends Piwik_TablePartitioning ...@@ -131,10 +127,6 @@ class Piwik_TablePartitioning_Daily extends Piwik_TablePartitioning
protected function generateTableName() protected function generateTableName()
{ {
$config = Zend_Registry::get('config'); $config = Zend_Registry::get('config');
$prefixTables = $config->database->tables_prefix; return $config->database->tables_prefix . $this->tableName . "_" . date("Y_m_d", $this->timestamp);
$date = date("Y_m_d", $this->timestamp);
return $prefixTables . $this->tableName . "_" . $date;
} }
} }
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