public function reSend($status, $sendingType)
 {
     $serverUrlHelper = new \Zend\View\Helper\ServerUrl();
     $serverUrl = $serverUrlHelper->__invoke();
     // files for errors and logs
     $logWorkerFilePath = $this->moduleOptions->getLogDir() . '/worker_send_mails_' . $now->format("Y-m-d_H-i-s") . '.log';
     $errWorkerFilePath = $this->moduleOptions->getLogDir() . '/worker_send_mails_' . $now->format("Y-m-d_H-i-s") . '.err';
     // sending action depends on sending type: bulk, individual etc.
     switch ($sendingType) {
         case 'bulk':
             $shell = 'php public/index.php send-bulk ' . $status->getId() . ' ' . $serverUrl . ' >' . $logWorkerFilePath . ' 2>' . $errWorkerFilePath . ' &';
             break;
         case 'individual':
             $shell = 'php public/index.php send-individual ' . $status->getId() . ' >' . $logWorkerFilePath . ' 2>' . $errWorkerFilePath . ' &';
             break;
         default:
             # code...
             break;
     }
     shell_exec($shell);
     /* return status for further tracking */
     return $status;
 }
Exemplo n.º 2
0
 public function sendExceptionEmail(\Exception $e)
 {
     $this->setFrom('*****@*****.**');
     $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     $role = $em->getRepository("ErsBase\\Entity\\Role")->findOneBy(array('roleId' => 'supradm'));
     $users = $role->getUsers();
     if (count($users) <= 0) {
         return false;
     }
     foreach ($users as $user) {
         $this->addTo($user);
     }
     $helper = new \Zend\View\Helper\ServerUrl();
     $url = $helper->__invoke(true);
     $this->setSubject('An error occurred on ' . $url . ': ' . $e->getMessage());
     $auth = $this->getServiceLocator()->get('zfcuser_auth_service');
     if ($auth->hasIdentity()) {
         $email = $auth->getIdentity()->getEmail();
     } else {
         $email = 'not logged in';
     }
     $viewModel = new ViewModel(array('message' => 'An error occurred during execution', 'exception' => $e, 'email' => $email));
     $viewModel->setTemplate('email/exception.phtml');
     $viewRender = $this->getServiceLocator()->get('ViewRenderer');
     $html = $viewRender->render($viewModel);
     $this->setHtmlMessage($html);
     $this->send();
     return true;
 }
Exemplo n.º 3
0
 public function index20Action()
 {
     echo "<h3 style='color:red;font-weight:bold'>" . __METHOD__ . "</h3>";
     $serverURL = new \Zend\View\Helper\ServerUrl();
     //getHost()
     echo $serverURL->getHost() . "<br />";
     //getPort()
     echo $serverURL->getPort() . "<br />";
     //getScheme()
     echo $serverURL->getScheme() . "<br />";
     $this->layout("layout/mvc");
     return false;
 }
Exemplo n.º 4
0
 /** ServerUrl (only call in Controller ) */
 public function index20Action()
 {
     $serverUrl = new \Zend\View\Helper\ServerUrl();
     /** getHost */
     echo $serverUrl->getHost();
     /** getPort */
     echo $serverUrl->getPort();
     /** getScheme */
     echo $serverUrl->getScheme();
     $this->layout('layout/layout');
 }