Example #1
0
 /**
  *
  * @return bool
  */
 public static function thereIsAMisconfiguration()
 {
     try {
         $redisHandler = new Predis\Client(INIT::$REDIS_SERVERS);
         return INIT::$VOLUME_ANALYSIS_ENABLED && !Analysis_Manager::fastAnalysisIsRunning($redisHandler) && !Analysis_Manager::tmAnalysisIsRunning($redisHandler);
     } catch (Exception $ex) {
         $msg = "****** No REDIS instances found. ******";
         Log::doLog($msg);
         return false;
     }
 }
Example #2
0
 public function setTemplateVars()
 {
     $this->template->jobs = $this->jobs;
     $this->template->fast_analysis_wc = $this->fast_analysis_wc;
     $this->template->fast_analysis_wc_print = $this->fast_analysis_wc_print;
     $this->template->tm_analysis_wc = $this->tm_analysis_wc;
     $this->template->tm_analysis_wc_print = $this->tm_analysis_wc_print;
     $this->template->standard_analysis_wc = $this->standard_analysis_wc;
     $this->template->standard_analysis_wc_print = $this->standard_analysis_wc_print;
     $this->template->total_raw_word_count = $this->total_raw_word_count;
     $this->template->total_raw_word_count_print = $this->total_raw_word_count_print;
     $this->template->pname = $this->pname;
     $this->template->pid = $this->pid;
     $this->template->project_password = $this->ppassword;
     $this->template->project_not_found = $this->project_not_found;
     $this->template->fast_wc_time = $this->fast_wc_time;
     $this->template->tm_wc_time = $this->tm_wc_time;
     $this->template->tm_wc_unit = $this->tm_wc_unit;
     $this->template->fast_wc_unit = $this->fast_wc_unit;
     $this->template->standard_wc_unit = $this->standard_wc_unit;
     $this->template->raw_wc_time = $this->raw_wc_time;
     $this->template->standard_wc_time = $this->standard_wc_time;
     $this->template->raw_wc_unit = $this->raw_wc_unit;
     $this->template->project_status = $this->project_status;
     $this->template->num_segments = $this->num_segments;
     $this->template->num_segments_analyzed = $this->num_segments_analyzed;
     $this->template->logged_user = $this->logged_user !== false ? $this->logged_user->shortName() : "";
     $this->template->extended_user = $this->logged_user !== false ? trim($this->logged_user->fullName()) : "";
     $this->template->build_number = INIT::$BUILD_NUMBER;
     $this->template->enable_outsource = INIT::$ENABLE_OUTSOURCE;
     $this->template->outsource_service_login = $this->_outsource_login_API;
     $this->template->support_mail = INIT::$SUPPORT_MAIL;
     $langDomains = Langs_LanguageDomains::getInstance();
     $this->subject = $langDomains::getDisplayDomain($this->subject);
     $this->template->subject = $this->subject;
     $this->template->isLoggedIn = $this->isLoggedIn();
     if (isset($_SESSION['_anonym_pid']) && !empty($_SESSION['_anonym_pid'])) {
         $_SESSION['incomingUrl'] = INIT::$HTTPHOST . $_SERVER['REQUEST_URI'];
         $_SESSION['_newProject'] = 1;
         $this->template->showModalBoxLogin = true;
     } else {
         $this->template->showModalBoxLogin = false;
     }
     //url to which to send data in case of login
     $client = OauthClient::getInstance()->getClient();
     $this->template->oauthFormUrl = $client->createAuthUrl();
     $this->template->incomingUrl = '/login?incomingUrl=' . $_SERVER['REQUEST_URI'];
     //perform check on running daemons and send a mail randomly
     $misconfiguration = Analysis_Manager::thereIsAMisconfiguration();
     if ($misconfiguration && mt_rand(1, 3) == 1) {
         $msg = "<strong>The analysis daemons seem not to be running despite server configuration.</strong><br />Change the application configuration or start analysis daemons.";
         Utils::sendErrMailReport($msg, "Matecat Misconfiguration");
     }
     $this->template->daemon_misconfiguration = var_export($misconfiguration, true);
 }