1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Mailout ajax process timing correction and log file added in debug mode.

This commit is contained in:
Cameron
2014-10-27 18:31:17 -07:00
parent 14a403d0de
commit 41ee837c7e
3 changed files with 67 additions and 30 deletions

View File

@@ -98,8 +98,10 @@ function sendProgress($id)
ob_start();
$perAjaxHit = e107::getConfig()->get('mail_pause',1);
$mailManager = new e107MailManager();
$mailManager->doEmailTask(varset($pref['mail_workpertick'],5));
$mailManager->doEmailTask($perAjaxHit);
$sqld = e107::getDb('progress');
@@ -716,6 +718,8 @@ class mailout_main_ui extends e_admin_ui
function sendnowPage()
{
$id = $this->getId();
$this->getResponse()->setTitle(LAN_MAILOUT_15.SEP.'Process Mail Queue #'.$id);
e107::getDb()->update('mail_content', 'mail_content_status='.MAIL_STATUS_PENDING.' WHERE mail_source_id = '.intval($id));
e107::getDb()->update('mail_recipients', 'mail_status='.MAIL_STATUS_PENDING.' WHERE mail_detail_id = '.intval($id));
@@ -727,8 +731,10 @@ class mailout_main_ui extends e_admin_ui
}
else
{
$text = "<h4>Ready to Process Mail Queue</h4>";
$text .= e107::getForm()->progressBar('mail-progress',1, array('btn-label'=>'Start #'.$id, 'url'=> e_SELF, 'mode'=>$id));
$pause = e107::getConfig()->get('mail_pausetime',1);
$interval = ($pause * 1000);
$text = e107::getForm()->progressBar('mail-progress',1, array('btn-label'=>'Start', 'interval'=>$interval, 'url'=> e_SELF, 'mode'=>$id));
}
return $text;

View File

@@ -1116,11 +1116,13 @@ class e_form
$buttonId = $target.'-start';
if(vartrue($options['btn-label']))
{
$text .= '<a id="'.$buttonId.'" data-loading-text="'.$loading.'" data-progress-target="'.$target.'" data-progress="' . $options['url'] . '" data-progress-mode="'.varset($options['mode'],0).'" data-progress-show="'.$nextStep.'" data-progress-hide="'.$buttonId.'" class="btn btn-primary e-progress" >'.$options['btn-label'].'</a>';
$interval = vartrue($options['interval'],1000);
$text .= '<a id="'.$buttonId.'" data-loading-text="'.$loading.'" data-progress-interval="'.$interval.'" data-progress-target="'.$target.'" data-progress="' . $options['url'] . '" data-progress-mode="'.varset($options['mode'],0).'" data-progress-show="'.$nextStep.'" data-progress-hide="'.$buttonId.'" class="btn btn-primary e-progress" >'.$options['btn-label'].'</a>';
$text .= ' <a data-progress-target="'.$target.'" class="btn btn-danger e-progress-cancel" >'.LAN_CANCEL.'</a>';
}
@@ -3336,14 +3338,31 @@ class e_form
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$methodParms = call_user_func_array(array($this, $method), array($value, 'inline', $parms));
if($attributes['inline'] === 'checklist')
if(is_string($attributes['inline'])) // text, textarea, select, checklist.
{
$xtype = 'checklist';
switch ($attributes['inline'])
{
case 'checklist':
$xtype = 'checklist';
break;
case 'select':
$xtype = 'select';
break;
case 'textarea':
$xtype = 'textarea';
break;
default:
$xtype = 'text';
$methodParms = null;
break;
}
}
else
{
$xtype = 'select';
}

View File

@@ -696,8 +696,19 @@ class e107MailManager
// print_a($email);
if($this->debugMode)
{
$logName = "mailout_simulation_".$email['mail_source_id'];
e107::getLog()->addDebug("Sending Email to <".$email['mail_recipient_name']."> ".$email['mail_recipient_email'])->toFile($logName,'Mailout Simulation Log',true);
$result = true;
}
else
{
$result = $this->mailer->sendEmail($email['mail_recipient_email'], $email['mail_recipient_name'], $mailToSend, TRUE);
}
// Try and send
$result = $this->mailer->sendEmail($email['mail_recipient_email'], $email['mail_recipient_name'], $mailToSend, TRUE);
// return; // ************************************************** Temporarily stop DB being updated when line active *****************************
@@ -738,20 +749,19 @@ class e107MailManager
if (count($targetData))
{
//print_a($targetData);
$this->db2->db_Update('mail_recipients', array('data' => $targetData,
'_FIELD_TYPES' => $this->dbTypes['mail_recipients'],
'WHERE' => '`mail_target_id` = '.intval($email['mail_target_id'])));
$this->db2->update('mail_recipients', array('data' => $targetData, '_FIELD_TYPES' => $this->dbTypes['mail_recipients'], 'WHERE' => '`mail_target_id` = '.intval($email['mail_target_id'])));
}
if (count($this->currentBatchInfo))
{
//print_a($this->currentBatchInfo);
$this->db2->db_Update('mail_content', array('data' => $this->currentBatchInfo,
$this->db2->update('mail_content', array('data' => $this->currentBatchInfo,
'_FIELD_TYPES' => $this->dbTypes['mail_content'],
'WHERE' => '`mail_source_id` = '.intval($email['mail_source_id'])));
}
if (($this->currentBatchInfo['mail_togo_count'] == 0) && ($email['mail_notify_complete'] > 0))
{ // Need to notify completion
if (($this->currentBatchInfo['mail_togo_count'] == 0) && ($email['mail_notify_complete'] > 0)) // Need to notify completion
{
$email = array_merge($email, $this->currentBatchInfo); // This should ensure the counters are up to date
$mailInfo = LAN_MAILOUT_247.'<br />'.LAN_MAILOUT_135.': '.$email['mail_title'].'<br />'.LAN_MAILOUT_248.$this->statusToText($email['mail_content_status']).'<br />';
$mailInfo .= '<br />'.LAN_MAILOUT_249.'<br />';
@@ -765,20 +775,17 @@ class e107MailManager
'mail_body' => $mailInfo.'<br />'
);
if ($email['mail_notify_complete'] & 1)
{ // Notify email initiator
if ($email['mail_notify_complete'] & 1) // Notify email initiator
{
if ($this->db2->select('user', 'user_name, user_email', '`user_id`='.intval($email['mail_creator'])))
{
$row = $this->db2->fetch(MYSQL_ASSOC);
require_once(e_HANDLER.'mail.php');
$mailer = new e107Email();
$mailer->sendEmail($row['user_name'], $row['user_email'], $message,FALSE);
$row = $this->db2->fetch();
e107::getEmail()->sendEmail($row['user_name'], $row['user_email'], $message,FALSE);
}
}
if ($email['mail_notify_complete'] & 2)
{ // Do e107 notify
if ($email['mail_notify_complete'] & 2) // Do e107 notify
{
require_once(e_HANDLER."notify_class.php");
notify_maildone($message);
}
e107::getEvent()->trigger('maildone', $email);
@@ -874,7 +881,7 @@ class e107MailManager
}
$title = "<h4>".__METHOD__." Line: ".__LINE__."</h4>";
e107::getAdminLog()->addDebug($title.print_a($email,true),true);
// e107::getAdminLog()->addDebug($title.print_a($email,true),true);
if(!empty($email['mail_media']))
{
@@ -882,7 +889,7 @@ class e107MailManager
}
$title2 = "<h4>".__METHOD__." Line: ".__LINE__."</h4>";
e107::getAdminLog()->addDebug($title2.print_a($result,true),true);
// e107::getAdminLog()->addDebug($title2.print_a($result,true),true);
$result['shortcodes']['MAILREF'] = $email['mail_source_id'];
@@ -1630,7 +1637,7 @@ class e107MailManager
$log = e107::getAdminLog();
$log->addDebug(print_a($emailData, true),true);
$log->addDebug(print_a($recipientData, true),true);
$log->toFile('mail_manager','Main Manager Log',true);
$log->toFile('mail_manager','Mail Manager Log',true);
if (!is_array($emailData))
@@ -1723,6 +1730,11 @@ class e107MailManager
// Fill in other bits of email
$emailData['mail_target_info'] = $recip;
$mailToSend = $this->makeEmailBlock($emailData); // Substitute mail-specific variables, attachments etc
if (FALSE == $this->mailer->sendEmail($recip['mail_recipient_email'], $recip['mail_recipient_name'], $mailToSend, TRUE))
{
$tempResult = FALSE;