Ejemplo n.º 1
0
 public function deployModel()
 {
     if ($this->event_handlers_model == null || $this->event_handlers_model->getCountTimers() == 0 && $this->event_handlers_model->getCountEventHandlers() == 0) {
         Log::writeWarn("There is no code to deploy to Backendless...");
         exit;
     }
     Log::writeInfo("Deploying model to server, and starting debug...");
     try {
         CodeRunnerUtil::getInstance()->deployModel($this->event_handlers_model);
         ExternalHostHolder::getInstance()->setUrls(Config::$APPLICATION_ID, CodeRunnerUtil::getInstance()->getExternalHost());
         GlobalState::$STATE = "DEPLOY";
         Log::writeInfo("Model successfully deployed...");
         Log::writeInfo("Waiting for events...");
     } catch (CodeRunnerException $e) {
         Log::writeError("Model deploying failed...");
         Log::writeError($e->getMessage(), $target = 'file');
         self::Stop();
     } catch (Exception $e) {
         Log::writeError("Model deploying failed...");
         Log::writeError($e->getMessage(), $target = 'file');
         self::Stop();
     }
 }
Ejemplo n.º 2
0
 public function deployModel()
 {
     $is_empty_event_handlers_model = false;
     $is_empty_hosted_model = false;
     if ($this->event_handlers_model == null || $this->event_handlers_model->getCountTimers() == 0 && $this->event_handlers_model->getCountEventHandlers() == 0) {
         $is_empty_event_handlers_model = true;
     }
     if ($this->hosted_model == null || $this->hosted_model->getCountOfEvents() == 0) {
         $is_empty_hosted_model = true;
     }
     if ($is_empty_event_handlers_model && $is_empty_hosted_model) {
         Log::writeWarn("There is no code to deploy to Backendless...");
         exit;
     }
     if (!Config::$AUTO_PUBLISH) {
         Log::writeInfo("Deploying model to server, and starting debug...");
         //Log::writeInfo( "Deploying models to server, and starting debug..." );
     } else {
         Log::writeInfo("Deploying model to server...");
         //Log::writeInfo( "Deploying models to server..." );
     }
     try {
         CodeRunnerUtil::getInstance()->deployModel($this->event_handlers_model);
         //CodeRunnerUtil::getInstance()->deployModel( $this->hosted_model, true );
         ExternalHostHolder::getInstance()->setUrls(Config::$APPLICATION_ID, CodeRunnerUtil::getInstance()->getExternalHost());
         //Log::writeInfo( "Models successfully deployed..." );
         Log::writeInfo("Model successfully deployed...");
         if (!Config::$AUTO_PUBLISH) {
             Log::writeInfo("Waiting for events...");
         }
     } catch (CodeRunnerException $e) {
         //Log::writeError( "Models deploying failed..." );
         Log::writeError("Model deploying failed...");
         Log::writeError($e->getMessage(), $target = 'file');
         self::Stop();
     } catch (Exception $e) {
         Log::writeError("Model deploying failed...");
         //          Log::writeError( "Models deploying failed..." );
         Log::writeError($e->getMessage(), $target = 'file');
         self::Stop();
     }
 }