Changeset 1156 for trunk/admin/include


Ignore:
Timestamp:
Apr 13, 2006, 12:49:42 AM (18 years ago)
Author:
rub
Message:

Issue ID 330:

o Change NBM configuration in order to avoid lose treatment action when occurred timeout
o Add news redirect/repost functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_notification_by_mail.inc.php

    r1116 r1156  
    2828
    2929/* nbm_global_var */
    30 $env_nbm = array();
     30$env_nbm = array
     31          (
     32            'start_time' => get_moment(),
     33            'sendmail_timeout' => (intval(ini_get('max_execution_time')) * $conf['nbm_max_treatment_timeout_percent']),
     34            'is_sendmail_timeout' => false
     35          );
     36
    3137
    3238/*
     
    5662    }
    5763  }
     64}
     65
     66/*
     67 * Check sendmail timeout state
     68 *
     69 * @return true, if it's timeout
     70 */
     71function check_sendmail_timeout()
     72{
     73  global $env_nbm;
     74
     75  $env_nbm['is_sendmail_timeout'] = ((get_moment() - $env_nbm['start_time']) > $env_nbm['sendmail_timeout']);
     76
     77  return $env_nbm['is_sendmail_timeout'];
    5878}
    5979
     
    319339 * check_key list where action will be done
    320340 *
    321  * @return updated data count
     341 * @return check_key lisr treated
    322342 */
    323343function do_subscribe_unsubcribe_notification_by_mail($is_admin_request, $is_subscribe = false, $check_key_list = array())
     
    325345  global $conf, $page, $env_nbm, $conf;
    326346
     347  $check_key_treated = array();
    327348  $updated_data_count = 0;
    328349  $error_on_updated_data_count = 0;
     
    345366    $data_users = get_user_notifications('subscribe', $check_key_list, !$is_subscribe);
    346367
     368    // Prepare message after change language
     369    $msg_break_timeout = l10n('nbm_nbm_break_timeout_send_mail');
     370
    347371    // Begin nbm users environment
    348372    begin_users_env_nbm(true);
     
    350374    foreach ($data_users as $nbm_user)
    351375    {
    352       if (($env_nbm['error_on_mail_count'] + $env_nbm['sent_mail_count']) >= $conf['nbm_max_mails_send'])
     376      if (check_sendmail_timeout())
    353377      {
    354378        // Stop fill list on 'send', if the quota is override
    355         array_push($page['errors'], sprintf(l10n('nbm_nbm_break_send_mail'), $conf['nbm_max_mails_send']));
     379        array_push($page['errors'], $msg_break_timeout);
    356380        break;
    357381      }
     382
     383      // Fill return list
     384      array_push($check_key_treated, $nbm_user['check_key']);
    358385
    359386      $do_update = true;
     
    437464  }
    438465
    439   return $updated_data_count;
     466  return $check_key_treated;
    440467}
    441468
     
    445472 * check_key list where action will be done
    446473 *
    447  * @return updated data count
     474 * @return check_key lisr treated
    448475 */
    449476function unsubcribe_notification_by_mail($is_admin_request, $check_key_list = array())
     
    457484 * check_key list where action will be done
    458485 *
    459  * @return updated data count
     486 * @return check_key lisr treated
    460487 */
    461488function subcribe_notification_by_mail($is_admin_request, $check_key_list = array())
Note: See TracChangeset for help on using the changeset viewer.