Example #1
0
 public static function start($jsfile, $params = "")
 {
     $cmd = realpath(Yii::getPathOfAlias('webroot') . '/' . trim($jsfile, '/'));
     if (is_file($cmd)) {
         NodeProcess::checkNode();
         $pid = null;
         if (substr(php_uname(), 0, 7) == "Windows") {
             exec("plansys\\commands\\shell\\psexec.exe -accepteula -d node " . $cmd . " " . $params, $output, $input);
             $pid = $input;
         } else {
             $pid = exec("nodejs " . $cmd . " " . $params . " > /dev/null 2>&1 & echo \$!;", $output, $input);
         }
         NodeProcess::addPid($pid);
         return $pid;
     } else {
         throw new CException("File Not Found " . $cmd);
     }
 }
Example #2
0
 public function actionEmail()
 {
     $postdata = file_get_contents("php://input");
     $post = CJSON::decode($postdata);
     if (!empty($post)) {
         $error = null;
         try {
             NodeProcess::checkNode();
         } catch (CException $ex) {
             $error = $ex->getMessage();
         }
         if (is_null($error)) {
             Email::initalSetting();
             touch(Email::$path . DIRECTORY_SEPARATOR . 'email.lock');
             $this->setEmailSettings($post);
             Email::sendTestMail();
         }
         echo json_encode($error);
     }
 }