Ignore:
Timestamp:
Oct 19, 2013, 7:43:04 PM (11 years ago)
Author:
mistic100
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r24987 r25018  
    541541            and is_dir($path.'/'.$node))
    542542        {
    543           array_push($dirs, $path.'/'.$node);
     543          $dirs[] = $path.'/'.$node;
    544544          if ($recursive)
    545545          {
     
    748748    list($representative) = pwg_db_fetch_row(pwg_query($query));
    749749
    750     array_push(
    751       $datas,
    752       array(
    753         'id' => $category_id,
    754         'representative_picture_id' => $representative,
    755         )
     750    $datas[] = array(
     751      'id' => $category_id,
     752      'representative_picture_id' => $representative,
    756753      );
    757754  }
     
    863860            if (basename($path) == 'thumbnail')
    864861            {
    865               array_push($fs['thumbnails'], $path.'/'.$node);
     862              $fs['thumbnails'][] = $path.'/'.$node;
    866863            }
    867864            else if (basename($path) == 'pwg_representative')
    868865            {
    869               array_push($fs['representatives'], $path.'/'.$node);
     866              $fs['representatives'][] = $path.'/'.$node;
    870867            }
    871868            else
    872869            {
    873               array_push($fs['elements'], $path.'/'.$node);
     870              $fs['elements'][] = $path.'/'.$node;
    874871            }
    875872          }
     
    877874          else if (isset($conf['flip_file_ext'][$extension]))
    878875          {
    879             array_push($fs['elements'], $path.'/'.$node);
     876            $fs['elements'][] = $path.'/'.$node;
    880877          }
    881878        }
    882879        else if (is_dir($path.'/'.$node) and $node != 'pwg_high' and $recursive)
    883880        {
    884           array_push($subdirs, $node);
     881          $subdirs[] = $node;
    885882        }
    886883      }
     
    996993    while ($uppercat)
    997994    {
    998       array_push($upper_list, $uppercat);
     995      $upper_list[] = $uppercat;
    999996      $uppercat = $cat_map[$uppercat]['id_uppercat'];
    1000997    }
     
    10031000    if ($new_uppercats != $cat['uppercats'])
    10041001    {
    1005       array_push(
    1006         $datas,
    1007         array(
    1008           'id' => $id,
    1009           'uppercats' => $new_uppercats
    1010           )
     1002      $datas[] = array(
     1003        'id' => $id,
     1004        'uppercats' => $new_uppercats
    10111005        );
    10121006    }
     
    10961090      if (preg_match('/^'.$category['uppercats'].'(,|$)/', $new_parent_uppercats))
    10971091      {
    1098         array_push(
    1099           $page['errors'],
    1100           l10n('You cannot move an album in its own sub album')
    1101           );
     1092        $page['errors'][] = l10n('You cannot move an album in its own sub album');
    11021093        return;
    11031094      }
     
    11781169  }
    11791170
    1180   array_push(
    1181     $page['infos'],
    1182     l10n_dec(
    1183       '%d album moved', '%d albums moved',
    1184       count($categories)
    1185       )
     1171  $page['infos'][] = l10n_dec(
     1172    '%d album moved', '%d albums moved',
     1173    count($categories)
    11861174    );
    11871175}
     
    13081296    foreach ($granted_grps as $granted_grp)
    13091297    {
    1310       array_push(
    1311         $inserts,
    1312         array(
    1313           'group_id' => $granted_grp,
    1314           'cat_id' => $inserted_id
    1315           )
     1298      $inserts[] = array(
     1299        'group_id' => $granted_grp,
     1300        'cat_id' => $inserted_id
    13161301        );
    13171302    }
     
    15871572        $rank = ++$current_rank_of[$category_id];
    15881573
    1589         array_push(
    1590           $inserts,
    1591           array(
    1592             'image_id' => $image_id,
    1593             'category_id' => $category_id,
    1594             'rank' => $rank,
    1595             )
     1574        $inserts[] = array(
     1575          'image_id' => $image_id,
     1576          'category_id' => $category_id,
     1577          'rank' => $rank,
    15961578          );
    15971579      }
     
    23162298  while ($row = pwg_db_fetch_assoc($result))
    23172299  {
    2318     array_push($granteds[$row['cat_id']], $row['user_id']);
     2300    $granteds[ $row['cat_id'] ][] = $row['user_id'];
    23192301  }
    23202302
     
    23272309    foreach ($grant_to_users as $user_id)
    23282310    {
    2329       array_push(
    2330         $inserts,
    2331         array(
    2332           'user_id' => $user_id,
    2333           'cat_id' => $cat_id
    2334           )
     2311      $inserts[] = array(
     2312        'user_id' => $user_id,
     2313        'cat_id' => $cat_id
    23352314        );
    23362315    }
     
    25142493          and $file != '.svn')
    25152494      {
    2516         array_push($sub_dirs, $file);
     2495        $sub_dirs[] = $file;
    25172496      }
    25182497    }
Note: See TracChangeset for help on using the changeset viewer.