Index: simplenews.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews/simplenews.module,v
retrieving revision 1.76.2.136
diff -u -p -r1.76.2.136 simplenews.module
--- simplenews.module	9 Sep 2009 13:32:06 -0000	1.76.2.136
+++ simplenews.module	18 Oct 2009 11:20:31 -0000
@@ -59,6 +59,12 @@ define('SIMPLENEWS_SEND_CHECK_INTERVAL',
 define('SIMPLENEWS_SEND_TIME_LIMIT', 0.8);
 
 /**
+ * CAPTURE THE PHP MAX EXUCUTION TIME BEFORE drupal_cron_run() CHANGES THIS.
+ * THIS IS A WORK AROUND FOR DRUPAL6.14 BUG. SEE http://drupal.org/node/584334
+ */
+define('SIMPLENEWS_MAX_EXECUTION_TIME', ini_get('max_execution_time'));
+
+/**
  * Implementation of hook_perm().
  */
 function simplenews_perm() {
@@ -1704,6 +1710,10 @@ function simplenews_mail_spool($nid = NU
   $limit = isset($limit) ? $limit : variable_get('simplenews_throttle', 20);
   if ($messages = simplenews_get_spool(SIMPLENEWS_SPOOL_PENDING, $nid, $vid, $limit)) {
     $mail_sent = array();
+
+    // Get PHP maximum execution time. 30 seconds default.
+    $max_execution_time = ini_get('max_execution_time') ? ini_get('max_execution_time') : SIMPLENEWS_MAX_EXECUTION_TIME;
+
     _simplenews_measure_usec(TRUE);
 
     foreach ($messages as $key => $message) {
@@ -1724,7 +1734,7 @@ function simplenews_mail_spool($nid = NU
         $check_counter = 0;
         // Break the sending if a percentage of max execution time was exceeded.
         $elapsed = _simplenews_measure_usec();
-        if ($elapsed > SIMPLENEWS_SEND_TIME_LIMIT * ini_get('max_execution_time')) {
+        if ($elapsed > SIMPLENEWS_SEND_TIME_LIMIT * $max_execution_time) {
           watchdog('simplenews', 'Sending interrupted: PHP maximum execution time almost exceeded. Remaining newsletters will be send during the next cron run. If this warning occurs regularly you should reduce the !cron_throttle_setting.', array('!cron_throttle_setting' => l(t('Cron throttle setting'), 'admin/settings/simplenews/mail')), WATCHDOG_WARNING);
           break;
         }
