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_notification_by_mail.inc.php

    r19703 r25018  
    170170      while ($nbm_user = pwg_db_fetch_assoc($result))
    171171      {
    172         array_push($data_users, $nbm_user);
     172        $data_users[] = $nbm_user;
    173173      }
    174174    }
     
    286286
    287287  $env_nbm['sent_mail_count'] += 1;
    288   array_push($page['infos'], sprintf($env_nbm['msg_info'], stripslashes($nbm_user['username']), $nbm_user['mail_address']));
     288  $page['infos'][] = sprintf($env_nbm['msg_info'], stripslashes($nbm_user['username']), $nbm_user['mail_address']);
    289289}
    290290
     
    299299
    300300  $env_nbm['error_on_mail_count'] += 1;
    301   array_push($page['errors'], sprintf($env_nbm['msg_error'], stripslashes($nbm_user['username']), $nbm_user['mail_address']));
     301  $page['errors'][] = sprintf($env_nbm['msg_error'], stripslashes($nbm_user['username']), $nbm_user['mail_address']);
    302302}
    303303
     
    313313  if ($env_nbm['error_on_mail_count'] != 0)
    314314  {
    315     array_push($page['errors'], l10n_dec('%d mail was not sent.', '%d mails were not sent.', $env_nbm['error_on_mail_count']));
     315    $page['errors'][] = l10n_dec(
     316      '%d mail was not sent.', '%d mails were not sent.',
     317      $env_nbm['error_on_mail_count']
     318      );
     319     
    316320    if ($env_nbm['sent_mail_count'] != 0)
    317       array_push($page['infos'], l10n_dec('%d mail was sent.', '%d mails were sent.', $env_nbm['sent_mail_count']));
     321    {
     322      $page['infos'][] = l10n_dec(
     323        '%d mail was sent.', '%d mails were sent.',
     324        $env_nbm['sent_mail_count']
     325        );
     326    }
    318327  }
    319328  else
    320329  {
    321330    if ($env_nbm['sent_mail_count'] == 0)
    322       array_push($page['infos'], l10n('No mail to send.'));
     331    {
     332      $page['infos'][] = l10n('No mail to send.');
     333    }
    323334    else
    324       array_push($page['infos'], l10n_dec('%d mail was sent.', '%d mails were sent.', $env_nbm['sent_mail_count']));
     335    {
     336      $page['infos'][] = l10n_dec(
     337        '%d mail was sent.', '%d mails were sent.',
     338        $env_nbm['sent_mail_count']
     339        );
     340    }
    325341  }
    326342}
     
    395411      {
    396412        // Stop fill list on 'send', if the quota is override
    397         array_push($page['errors'], $msg_break_timeout);
     413        $page['errors'][] = $msg_break_timeout;
    398414        break;
    399415      }
    400416
    401417      // Fill return list
    402       array_push($check_key_treated, $nbm_user['check_key']);
     418      $check_key_treated[] = $nbm_user['check_key'];
    403419
    404420      $do_update = true;
     
    454470      if ($do_update)
    455471      {
    456         array_push
    457         (
    458           $updates,
    459           array
    460           (
    461             'check_key' => $nbm_user['check_key'],
    462             'enabled' => $enabled_value
    463           )
    464         );
     472        $updates[] = array(
     473          'check_key' => $nbm_user['check_key'],
     474          'enabled' => $enabled_value
     475          );
    465476        $updated_data_count += 1;
    466         array_push($page['infos'], sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']));
     477        $page['infos'][] = sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
    467478      }
    468479      else
    469480      {
    470481        $error_on_updated_data_count += 1;
    471         array_push($page['errors'], sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']));
     482        $page['errors'][] = sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
    472483      }
    473484
     
    490501  }
    491502
    492   array_push($page['infos'], l10n_dec('%d user was updated.', '%d users were updated.', $updated_data_count));
     503  $page['infos'][] = l10n_dec(
     504    '%d user was updated.', '%d users were updated.',
     505    $updated_data_count
     506    );
     507 
    493508  if ($error_on_updated_data_count != 0)
    494509  {
    495     array_push($page['errors'],
    496       l10n_dec('%d user was not updated.',
    497                '%d users were not updated.',
    498                $error_on_updated_data_count));
     510    $page['errors'][] = l10n_dec(
     511      '%d user was not updated.', '%d users were not updated.',
     512      $error_on_updated_data_count
     513      );
    499514  }
    500515
Note: See TracChangeset for help on using the changeset viewer.