From ae707279a1945e383c312cd648d288606a79e341 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sat, 19 Oct 2013 17:43:04 +0000 Subject: 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 --- admin/notification_by_mail.php | 66 +++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 36 deletions(-) (limited to 'admin/notification_by_mail.php') diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php index b72a5c69b..cd3445f7c 100644 --- a/admin/notification_by_mail.php +++ b/admin/notification_by_mail.php @@ -80,10 +80,11 @@ function do_timeout_treatment($post_keyname, $check_key_treated = array()) $_POST[$post_keyname] = array_diff($_POST[$post_keyname], $check_key_treated); $must_repost = true; - array_push($page['errors'], - l10n_dec('Execution time is out, treatment must be continue [Estimated time: %d second].', - 'Execution time is out, treatment must be continue [Estimated time: %d seconds].', - $time_refresh)); + $page['errors'][] = l10n_dec( + 'Execution time is out, treatment must be continue [Estimated time: %d second].', + 'Execution time is out, treatment must be continue [Estimated time: %d seconds].', + $time_refresh + ); } } @@ -156,29 +157,20 @@ order by $nbm_user['check_key'] = find_available_check_key(); // Save key - array_push($check_key_list, $nbm_user['check_key']); + $check_key_list[] = $nbm_user['check_key']; // Insert new nbm_users - array_push - ( - $inserts, - array - ( - 'user_id' => $nbm_user['user_id'], - 'check_key' => $nbm_user['check_key'], - 'enabled' => 'false' // By default if false, set to true with specific functions - ) - ); - - array_push - ( - $page['infos'], - l10n( - 'User %s [%s] added.', - stripslashes($nbm_user['username']), - get_email_address_as_display_text($nbm_user['mail_address']) - ) - ); + $inserts[] = array( + 'user_id' => $nbm_user['user_id'], + 'check_key' => $nbm_user['check_key'], + 'enabled' => 'false' // By default if false, set to true with specific functions + ); + + $page['infos'][] = l10n( + 'User %s [%s] added.', + stripslashes($nbm_user['username']), + get_email_address_as_display_text($nbm_user['mail_address']) + ); } // Insert new nbm_users @@ -282,13 +274,13 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l if ((!$is_action_send) and check_sendmail_timeout()) { // Stop fill list on 'list_to_send', if the quota is override - array_push($page['infos'], $msg_break_timeout); + $page['infos'][] = $msg_break_timeout; break; } if (($is_action_send) and check_sendmail_timeout()) { // Stop fill list on 'send', if the quota is override - array_push($page['errors'], $msg_break_timeout); + $page['errors'][] = $msg_break_timeout; break; } @@ -299,7 +291,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l { set_make_full_url(); // Fill return list of "treated" check_key for 'send' - array_push($return_list, $nbm_user['check_key']); + $return_list[] = $nbm_user['check_key']; if ($conf['nbm_send_detailed_content']) { @@ -402,9 +394,10 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l { inc_mail_sent_success($nbm_user); - $data = array('user_id' => $nbm_user['user_id'], - 'last_send' => $dbnow); - array_push($datas, $data); + $datas[] = array( + 'user_id' => $nbm_user['user_id'], + 'last_send' => $dbnow + ); } else { @@ -419,7 +412,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l if (news_exists($nbm_user['last_send'], $dbnow)) { // Fill return list of "selected" users for 'list_to_send' - array_push($return_list, $nbm_user); + $return_list[] = $nbm_user; } } @@ -448,7 +441,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l { if ($is_action_send) { - array_push($page['errors'], l10n('No user to send notifications by mail.')); + $page['errors'][] = l10n('No user to send notifications by mail.'); } } } @@ -529,9 +522,10 @@ where } } - array_push($page['infos'], - l10n_dec('%d parameter was updated.', '%d parameters were updated.', - $updated_param_count)); + $page['infos'][] = l10n_dec( + '%d parameter was updated.', '%d parameters were updated.', + $updated_param_count + ); // Reload conf with new values load_conf_from_db('param like \'nbm\\_%\''); -- cgit v1.2.3