aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions_notification_by_mail.inc.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-10-19 17:43:04 +0000
committermistic100 <mistic@piwigo.org>2013-10-19 17:43:04 +0000
commitae707279a1945e383c312cd648d288606a79e341 (patch)
tree917bdc6e0609ed0eefed5f3693de3a017685acc4 /admin/include/functions_notification_by_mail.inc.php
parent35ff1b7c1f933799397a0ce0a6723cf82f416ff3 (diff)
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
Diffstat (limited to 'admin/include/functions_notification_by_mail.inc.php')
-rw-r--r--admin/include/functions_notification_by_mail.inc.php65
1 files changed, 40 insertions, 25 deletions
diff --git a/admin/include/functions_notification_by_mail.inc.php b/admin/include/functions_notification_by_mail.inc.php
index e727e9e6f..9d5e7ecfc 100644
--- a/admin/include/functions_notification_by_mail.inc.php
+++ b/admin/include/functions_notification_by_mail.inc.php
@@ -169,7 +169,7 @@ order by';
{
while ($nbm_user = pwg_db_fetch_assoc($result))
{
- array_push($data_users, $nbm_user);
+ $data_users[] = $nbm_user;
}
}
}
@@ -285,7 +285,7 @@ function inc_mail_sent_success($nbm_user)
global $page, $env_nbm;
$env_nbm['sent_mail_count'] += 1;
- array_push($page['infos'], sprintf($env_nbm['msg_info'], stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['infos'][] = sprintf($env_nbm['msg_info'], stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
/*
@@ -298,7 +298,7 @@ function inc_mail_sent_failed($nbm_user)
global $page, $env_nbm;
$env_nbm['error_on_mail_count'] += 1;
- array_push($page['errors'], sprintf($env_nbm['msg_error'], stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['errors'][] = sprintf($env_nbm['msg_error'], stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
/*
@@ -312,16 +312,32 @@ function display_counter_info()
if ($env_nbm['error_on_mail_count'] != 0)
{
- array_push($page['errors'], l10n_dec('%d mail was not sent.', '%d mails were not sent.', $env_nbm['error_on_mail_count']));
+ $page['errors'][] = l10n_dec(
+ '%d mail was not sent.', '%d mails were not sent.',
+ $env_nbm['error_on_mail_count']
+ );
+
if ($env_nbm['sent_mail_count'] != 0)
- array_push($page['infos'], l10n_dec('%d mail was sent.', '%d mails were sent.', $env_nbm['sent_mail_count']));
+ {
+ $page['infos'][] = l10n_dec(
+ '%d mail was sent.', '%d mails were sent.',
+ $env_nbm['sent_mail_count']
+ );
+ }
}
else
{
if ($env_nbm['sent_mail_count'] == 0)
- array_push($page['infos'], l10n('No mail to send.'));
+ {
+ $page['infos'][] = l10n('No mail to send.');
+ }
else
- array_push($page['infos'], l10n_dec('%d mail was sent.', '%d mails were sent.', $env_nbm['sent_mail_count']));
+ {
+ $page['infos'][] = l10n_dec(
+ '%d mail was sent.', '%d mails were sent.',
+ $env_nbm['sent_mail_count']
+ );
+ }
}
}
@@ -394,12 +410,12 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
if (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;
}
// Fill return list
- array_push($check_key_treated, $nbm_user['check_key']);
+ $check_key_treated[] = $nbm_user['check_key'];
$do_update = true;
if ($nbm_user['mail_address'] != '')
@@ -453,22 +469,17 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
if ($do_update)
{
- array_push
- (
- $updates,
- array
- (
- 'check_key' => $nbm_user['check_key'],
- 'enabled' => $enabled_value
- )
- );
+ $updates[] = array(
+ 'check_key' => $nbm_user['check_key'],
+ 'enabled' => $enabled_value
+ );
$updated_data_count += 1;
- array_push($page['infos'], sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['infos'][] = sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
else
{
$error_on_updated_data_count += 1;
- array_push($page['errors'], sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']));
+ $page['errors'][] = sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
}
@@ -489,13 +500,17 @@ function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_su
}
- array_push($page['infos'], l10n_dec('%d user was updated.', '%d users were updated.', $updated_data_count));
+ $page['infos'][] = l10n_dec(
+ '%d user was updated.', '%d users were updated.',
+ $updated_data_count
+ );
+
if ($error_on_updated_data_count != 0)
{
- array_push($page['errors'],
- l10n_dec('%d user was not updated.',
- '%d users were not updated.',
- $error_on_updated_data_count));
+ $page['errors'][] = l10n_dec(
+ '%d user was not updated.', '%d users were not updated.',
+ $error_on_updated_data_count
+ );
}
unset_make_full_url();