Pommo_Mail_Ctl::queueMake PHP 메소드

queueMake() 공개 메소드

returns (bool) - true if success
public queueMake ( &$in )
    function queueMake(&$in)
    {
        global $pommo;
        $dbo =& Pommo::$_dbo;
        // clearQueue
        $query = "DELETE FROM " . $dbo->table['queue'];
        if (!$dbo->query($query)) {
            return false;
        }
        if (empty($in)) {
            // all subscribers
            $query = "\n                INSERT IGNORE INTO " . $dbo->table['queue'] . "\n                (subscriber_id)\n                SELECT subscriber_id FROM " . $dbo->table['subscribers'] . "\n                WHERE status=1";
            if (!$dbo->query($query)) {
                return false;
            }
            return true;
        }
        $values = array();
        foreach ($in as $id) {
            $values[] = $dbo->prepare("(%i)", array($id));
        }
        $query = "\n            INSERT IGNORE INTO " . $dbo->table['queue'] . "\n            (subscriber_id)\n            VALUES " . implode(',', $values);
        if (!$dbo->query($query)) {
            return false;
        }
        return true;
    }

Usage Example

예제 #1
0
         $state['group'] = Pommo::_T('Test Mailing');
         if ($state['ishtml'] == 'off') {
             $state['body'] = $state['altbody'];
             $state['altbody'] = '';
         }
         // create mailing
         $mailing = Pommo_Mailing::make(array(), TRUE);
         $state['status'] = 1;
         $state['current_status'] = 'stopped';
         $state['command'] = 'restart';
         $state['charset'] = $state['list_charset'];
         $mailing = Pommo_Helper::arrayIntersect($state, $mailing);
         $code = Pommo_Mailing::add($mailing);
         // populate queue
         $queue = array($key);
         if (!Pommo_Mail_Ctl::queueMake($queue)) {
             $logger->addErr('Unable to Populate Queue');
         } else {
             if (!Pommo_Mail_Ctl::spawn(Pommo::$_baseUrl . 'ajax/mailings_send4.php?test=TRUE&code=' . $code)) {
                 $logger->addErr('Unable to spawn background mailer');
             } else {
                 $smarty->assign('sent', $_POST['email']);
             }
         }
     }
 } elseif ($current) {
     $logger->addMsg(Pommo::_T('A mailing is currently taking place. Please try again later.'));
     $smarty->assign($_POST);
 } else {
     // __ FORM NOT VALID
     $logger->addMsg(Pommo::_T('Please review and correct errors with your submission.'));
All Usage Examples Of Pommo_Mail_Ctl::queueMake