Ejemplo n.º 1
0
 /**
  * Upgrade step two:
  */
 public function actionStepTwo()
 {
     // Upgrade process can take much time, because upgrade schema script.
     // Set timeout for upgrade to 12 hours.
     set_time_limit(12 * 60 * 60);
     Yii::app()->gameHelper->muteScoringModelsOnSave();
     $nextView = new UpgradeStepTwoCompleteView($this->getId(), $this->getModule()->getId());
     $view = new InstallPageView($nextView);
     echo $view->render();
     $template = ZurmoHtml::script("\$('#logging-table').prepend('{message}<br/>');");
     $messageStreamer = new MessageStreamer($template);
     $messageStreamer->setExtraRenderBytes(4096);
     $messageStreamer->add(Zurmo::t('InstallModule', 'Starting upgrade process.'));
     UpgradeUtil::runPart2($messageStreamer);
     ForgetAllCacheUtil::forgetAllCaches();
     echo ZurmoHtml::script('$("#progress-table").hide(); $("#upgrade-step-two").show();');
     Yii::app()->gameHelper->unmuteScoringModelsOnSave();
 }
Ejemplo n.º 2
0
 /**
  * Added forgetAllCaches in case you are debugging and want to run this action again with a saved db.
  */
 public function actionInstallDemoData()
 {
     RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
     InstallUtil::freezeDatabase();
     ForgetAllCacheUtil::forgetAllCaches();
     Yii::app()->user->userModel = User::getByUsername('super');
     $nextView = new InstallCompleteView($this->getId(), $this->getModule()->getId());
     $view = new InstallPageView($nextView);
     echo $view->render();
     $template = ZurmoHtml::script("\$('#logging-table').prepend('{message}<br/>');");
     $messageStreamer = new MessageStreamer($template);
     $messageStreamer->add(Zurmo::t('InstallModule', 'Starting to load demo data.'));
     $messageLogger = new MessageLogger($messageStreamer);
     DemoDataUtil::load($messageLogger, 6);
     $messageStreamer->add(Zurmo::t('InstallModule', 'Finished loading demo data.'));
     $messageStreamer->add(Zurmo::t('InstallModule', 'Locking Installation.'));
     InstallUtil::writeInstallComplete(INSTANCE_ROOT);
     ForgetAllCacheUtil::forgetAllCaches();
     echo ZurmoHtml::script('$("#progress-table").hide(); $("#complete-table").show();');
 }
 public function actionQueueJob($type, $delay = 0, $messageLoggerClassName = 'MessageLogger')
 {
     if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
         echo Zurmo::t('JobsManagerModule', 'Only super administrators can run jobs from the browser');
         Yii::app()->end(0, false);
     }
     if (!Yii::app()->jobQueue->isEnabled()) {
         echo Zurmo::t('JobsManagerModule', 'Job queuing must be enabled in order to queue a job');
         Yii::app()->end(0, false);
     }
     $breadCrumbLinks = array(Zurmo::t('JobsManagerModule', 'JobsManagerModuleSingularLabel', LabelUtil::getTranslationParamsForAllModules()) => array('/jobsManager/default'), Yii::app()->jobQueue->getQueueJobLabel());
     $messageLogger = new $messageLoggerClassName();
     $queueJobView = new QueueJobView($this->getId(), $this->getModule()->getId(), $type, (int) $delay, $messageLogger);
     $view = new JobsManagerPageView(ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $queueJobView, $breadCrumbLinks, 'SettingsBreadCrumbView'));
     echo $view->render();
     $template = ZurmoHtml::script("\$('#logging-table ol').append('<li>{message}</li>');");
 }
Ejemplo n.º 4
0
 public function actionRunJob($type, $timeLimit = 500, $messageLoggerClassName = 'MessageLogger')
 {
     if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
         echo Zurmo::t('JobsManagerModule', 'Only super administrators can run jobs from the browser');
         Yii::app()->end(0, false);
     }
     $breadcrumbLinks = array(Zurmo::t('JobsManagerModule', 'Run Job'));
     $runJobView = new RunJobView($this->getId(), $this->getModule()->getId(), $type, (int) $timeLimit);
     $view = new JobsManagerPageView(ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $runJobView, $breadcrumbLinks, 'JobsManagerBreadCrumbView'));
     echo $view->render();
     $template = ZurmoHtml::script("\$('#logging-table ol').append('<li>{message}</li>');");
     JobsManagerUtil::runFromJobManagerCommandOrBrowser($type, (int) $timeLimit, $messageLoggerClassName, $template);
     echo ZurmoHtml::script('$("#progress-table").hide(); $("#complete-table").show();');
 }