Esempio n. 1
0
 /**
  * Load the data.
  * This will also set some warnings if needed.
  */
 private function loadData()
 {
     // inform that the module is not installed yet
     if (!BackendExtensionsModel::isModuleInstalled($this->currentModule)) {
         $this->warnings[] = array('message' => BL::getMessage('InformationModuleIsNotInstalled'));
     }
     // path to information file
     $pathInfoXml = BACKEND_MODULES_PATH . '/' . $this->currentModule . '/info.xml';
     // information needs to exists
     if (SpoonFile::exists($pathInfoXml)) {
         try {
             // load info.xml
             $infoXml = @new SimpleXMLElement($pathInfoXml, LIBXML_NOCDATA, true);
             // convert xml to useful array
             $this->information = BackendExtensionsModel::processModuleXml($infoXml);
             // empty data (nothing useful)
             if (empty($this->information)) {
                 $this->warnings[] = array('message' => BL::getMessage('InformationFileIsEmpty'));
             }
             // check if cronjobs are installed already
             if (isset($this->information['cronjobs'])) {
                 foreach ($this->information['cronjobs'] as $cronjob) {
                     if (!$cronjob['active']) {
                         $this->warnings[] = array('message' => BL::getError('CronjobsNotSet'));
                     }
                     break;
                 }
             }
         } catch (Exception $e) {
             $this->warnings[] = array('message' => BL::getMessage('InformationFileCouldNotBeLoaded'));
         }
     } else {
         $this->warnings[] = array('message' => BL::getMessage('InformationFileIsMissing'));
     }
 }