remove all array_push (50% slower than []) + some changes missing for feature:2978

git-svn-id: http://piwigo.org/svn/trunk@25018 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
mistic100
2013-10-19 17:43:04 +00:00
parent 35ff1b7c1f
commit ae707279a1
89 changed files with 700 additions and 1084 deletions
+12 -21
View File
@@ -77,12 +77,9 @@ class themes
$missing_parent = $this->missing_parent_theme($theme_id);
if (isset($missing_parent))
{
array_push(
$errors,
sprintf(
l10n('Impossible to activate this theme, the parent theme is missing: %s'),
$missing_parent
)
$errors[] = l10n(
'Impossible to activate this theme, the parent theme is missing: %s',
$missing_parent
);
break;
@@ -93,7 +90,7 @@ class themes
and !empty($conf['mobile_theme'])
and $conf['mobile_theme'] != $theme_id)
{
array_push($errors, l10n('You can activate only one mobile theme.'));
$errors[] = l10n('You can activate only one mobile theme.');
break;
}
@@ -134,10 +131,7 @@ INSERT INTO '.THEMES_TABLE.'
// you can't deactivate the last theme
if (count($this->db_themes_by_id) <= 1)
{
array_push(
$errors,
l10n('Impossible to deactivate this theme, you need at least one theme.')
);
$errors[] = l10n('Impossible to deactivate this theme, you need at least one theme.');
break;
}
@@ -190,7 +184,7 @@ DELETE
case 'delete':
if (!empty($crt_db_theme))
{
array_push($errors, 'CANNOT DELETE - THEME IS INSTALLED');
$errors[] = 'CANNOT DELETE - THEME IS INSTALLED';
break;
}
if (!isset($this->fs_themes[$theme_id]))
@@ -202,12 +196,9 @@ DELETE
$children = $this->get_children_themes($theme_id);
if (count($children) > 0)
{
array_push(
$errors,
sprintf(
l10n('Impossible to delete this theme. Other themes depends on it: %s'),
implode(', ', $children)
)
$errors[] = l10n(
'Impossible to delete this theme. Other themes depends on it: %s',
implode(', ', $children)
);
break;
}
@@ -262,7 +253,7 @@ DELETE
{
if (isset($test_child['parent']) and $test_child['parent'] == $theme_id)
{
array_push($children, $test_child['name']);
$children[] = $test_child['name'];
}
}
@@ -322,7 +313,7 @@ SELECT
$themes = array();
while ($row = pwg_db_fetch_assoc($result))
{
array_push($themes, $row);
$themes[] = $row;
}
return $themes;
}
@@ -628,7 +619,7 @@ SELECT
and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES)
and !empty($old_files))
{
array_push($old_files, 'obsolete.list');
$old_files[] = 'obsolete.list';
foreach($old_files as $old_file)
{
$path = $extract_path.'/'.$old_file;