當前位置: 首頁>>代碼示例>>PHP>>正文


PHP It::runAsynchCommand方法代碼示例

本文整理匯總了PHP中It::runAsynchCommand方法的典型用法代碼示例。如果您正苦於以下問題:PHP It::runAsynchCommand方法的具體用法?PHP It::runAsynchCommand怎麽用?PHP It::runAsynchCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在It的用法示例。


在下文中一共展示了It::runAsynchCommand方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: startTcpServer

 public function startTcpServer()
 {
     $source = 'TCP:' . $this->forwarding_messages_ip . ":" . $this->tcp_server_command_port;
     $last_connection = Listener::getLastConnectionInfoForSynch($source);
     if ($last_connection && !$last_connection['stopped']) {
     } else {
         $command = Yii::app()->params['applications']['php_exe_path'] . ' -f ' . Yii::app()->params['applications']['console_app_path'] . ' tcpserver ';
         It::runAsynchCommand($command);
     }
 }
開發者ID:anton-itscript,項目名稱:WM-Web,代碼行數:10,代碼來源:Synchronization.php

示例2: run

 public function run()
 {
     ListenerProcess::addComment($this->listener->listener_id, 'comment', 'going to start polling, source= ' . $this->source);
     $failureCount = 0;
     $modemFailureCount = 0;
     $resetSmsMessageWasSent = false;
     $modemReset = false;
     $i = 0;
     while (true) {
         $time = time();
         for ($j = 0; $j < 4; $j++) {
             $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ': Trying to poll data', array('try' => $j));
             // If message was received then exit loop
             if ($this->listenPollingTemp($i++)) {
                 $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ': Message received on', array('try' => $j));
                 $resetSmsMessageWasSent = false;
                 $modemReset = false;
                 break;
             }
             $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ': Delay 1 minute before next try.');
             // Wait 1 minute before next try
             sleep(60);
             // 1min
             if ($j === 3) {
                 $failureCount++;
                 $modemFailureCount++;
             }
         }
         if (!is_null($this->_smsMessageSender) && $failureCount >= Yii::app()->params['sms_params']['failure_count_before_send_sms']) {
             $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ': Going to send reset SMS message.', array('try' => $resetSmsMessageWasSent + 1));
             $failureCount = 0;
             if ($resetSmsMessageWasSent > 3) {
                 $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ' Reset SMS message was already sent');
             } else {
                 if ($this->_smsMessageSender->send()) {
                     $resetSmsMessageWasSent += 1;
                     $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ' SMS message has been sent');
                 } else {
                     $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ' Failed to send SMS message');
                 }
             }
         }
         if ($modemFailureCount >= Yii::app()->params['polling_params']['failure_count_before_modem_reset']) {
             if (Yii::app()->params['polling_params']['enabled'] === true) {
                 $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ': Going to reset polling modem.');
                 $modemFailureCount = 0;
                 if ($modemReset) {
                     $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ' Modem was already reset.');
                 } else {
                     $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ': Resetting.');
                     ListenerProcess::addComment($this->listener->listener_id, 'modem_reset', ' Polling modem was reset.');
                     // Send KILL to wvdial to force modem to re-create connection
                     It::runAsynchCommand('sudo killall wvdial');
                     $modemReset = true;
                 }
             } else {
                 $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ': Resetting of polling modem is disabled.');
             }
         }
         // Delay for 10 minutes - time spent on tries.
         $time = Yii::app()->params['polling_params']['interval'] - (time() - $time);
         $this->_logger->log(__CLASS__ . ' ' . __METHOD__ . ': Delay before next poll', array('seconds' => $time));
         sleep($time);
     }
 }
開發者ID:anton-itscript,項目名稱:WM-Web,代碼行數:65,代碼來源:ProcessListenPolling.php

示例3: runConnection

 public static function runConnection($source, $additional_param, $by = 'user')
 {
     $command = Yii::app()->params['applications']['php_exe_path'] . " -f " . Yii::app()->params['applications']['console_app_path'] . " listen " . $source . " " . $additional_param . " " . $by;
     It::runAsynchCommand($command);
     return true;
 }
開發者ID:anton-itscript,項目名稱:WM-Web,代碼行數:6,代碼來源:Listener.php

示例4: actionStartListening

 public function actionStartListening()
 {
     if (!isset($_REQUEST['source'])) {
         echo json_encode(array('errors' => array('Unknown connection type')));
         Yii::app()->end();
     }
     $source = strtoupper($_REQUEST['source']);
     $communication_type = !empty($_REQUEST['communication_type']) ? strtoupper($_REQUEST['communication_type']) : 'COMMUNICATION_TYPE_NONE';
     $last_connection = Listener::getLastConnectionInfo($source);
     if ($last_connection && !$last_connection['stopped']) {
         echo json_encode(array('ok_still' => 1));
         Yii::app()->end();
     }
     $command = Yii::app()->params['applications']['php_exe_path'] . ' -f ' . Yii::app()->params['console_app_path'] . ' listen ' . $source . '  ' . $communication_type . ' Admin';
     It::runAsynchCommand($command);
     echo json_encode(array('ok' => 1));
     Yii::app()->end();
 }
開發者ID:anton-itscript,項目名稱:WM,代碼行數:18,代碼來源:AdminController.php


注:本文中的It::runAsynchCommand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。