Esempio n. 1
0
 /**
  * Get a list of all installed modules, including enabled and disabled ones
  *
  * @return array
  *   CRM_Core_Module
  */
 public function getModules()
 {
     $result = array();
     $dao = new CRM_Core_DAO_Extension();
     $dao->type = 'module';
     $dao->find();
     while ($dao->fetch()) {
         $result[] = new CRM_Core_Module($dao->full_name, $dao->is_active);
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * Fetch stats about enabled components/extensions
  * Add info to the 'extensions' array
  */
 private function extensionStats()
 {
     // Core components
     $config = CRM_Core_Config::singleton();
     foreach ($config->enableComponents as $comp) {
         $this->stats['extensions'][] = array('name' => 'org.civicrm.component.' . strtolower($comp), 'enabled' => 1, 'version' => $this->stats['version']);
     }
     // Contrib extensions
     $mapper = CRM_Extension_System::singleton()->getMapper();
     $dao = new CRM_Core_DAO_Extension();
     $dao->find();
     while ($dao->fetch()) {
         $info = $mapper->keyToInfo($dao->full_name);
         $this->stats['extensions'][] = array('name' => $dao->full_name, 'enabled' => $dao->is_active, 'version' => isset($info->version) ? $info->version : NULL);
     }
 }
 /**
  * Searches for and returnes installed extensions.
  *
  * @access private
  *
  * @param boolean $fullInfo provide full info (read XML files) if true, otherwise only DB stored data
  *
  * @return array list of extensions
  */
 private function _discoverInstalled($fullInfo = FALSE)
 {
     $result = array();
     $dao = new CRM_Core_DAO_Extension();
     $dao->find();
     // TODO need bool?
     while ($dao->fetch()) {
         $ext = new CRM_Core_Extensions_Extension($dao->full_name, $dao->type, $dao->name, $dao->label, $dao->file, $dao->is_active);
         $ext->setInstalled();
         $ext->setId((int) $dao->id);
         if ($fullInfo) {
             if ($ext->hasXMLInfo()) {
                 $ext->readXMLInfo();
             } else {
                 $ext->setMissing();
                 CRM_Core_Session::setStatus(ts('The extension %1 (%2) is listed as installed, but expected files(s) including info.xml are missing. Has this site been moved to a different server location?', array(1 => $dao->label, 2 => $dao->full_name)) . '<br/>');
             }
         }
         $result[(int) $dao->id] = $ext;
     }
     return $result;
 }