Example #1
0
 /**
  * Replicates module_list(FALSE, FALSE, $sort, $fixed_list)
  *
  * @param array $fixed_list
  * @param bool $sort
  *
  * @return string[]
  */
 function setModuleList($fixed_list, $sort = FALSE)
 {
     foreach ($fixed_list as $name => $module) {
         $this->drupalGetFilename->drupalSetFilename('module', $name, $module['filename']);
         $this->list[$name] = $name;
     }
     if ($sort) {
         return $this->moduleListSorted();
     }
     return $this->list;
 }
Example #2
0
 /**
  * @see drupal_load()
  */
 function drupalLoad($type, $name)
 {
     if (isset($this->files[$type][$name])) {
         return TRUE;
     }
     $filename = $this->drupalGetFilename->drupalGetFilename($type, $name);
     if ($filename) {
         include_once $filename;
         $this->files[$type][$name] = TRUE;
         return TRUE;
     }
     return FALSE;
 }
Example #3
0
 /**
  * Replicates system_list('bootstrap')
  *
  * @see system_list()
  *
  * @return array|null
  */
 function systemListBootstrap()
 {
     $lists =& $this->drupalStatic->get('system_list');
     // For bootstrap modules, attempt to fetch the list from cache if possible.
     // if not fetch only the required information to fire bootstrap hooks
     // in case we are going to serve the page from cache.
     if (isset($lists['bootstrap'])) {
         return $lists['bootstrap'];
     }
     if ($cached = $this->cache->cacheGet('bootstrap_modules', 'cache_bootstrap')) {
         $bootstrap_list = $cached->data;
     } else {
         $bootstrap_list = $this->systemListLoader->fetchBootstrapSystemList();
         $this->cache->cacheSet('bootstrap_modules', $bootstrap_list, 'cache_bootstrap');
     }
     // To avoid a separate database lookup for the filepath, prime the
     // drupal_get_filename() static cache for bootstrap modules only.
     // The rest is stored separately to keep the bootstrap module cache small.
     foreach ($bootstrap_list as $module) {
         $this->drupalGetFilename->drupalSetFilename('module', $module->name, $module->filename);
     }
     // We only return the module names here since module_list() doesn't need
     // the filename itself.
     return $lists['bootstrap'] = array_keys($bootstrap_list);
 }
Example #4
0
 /**
  * @param string $extension
  * @param bool $install
  *
  * @see module_enable()
  */
 private function enableModule($extension, $install)
 {
     $filename = $this->drupalGetFilename->drupalGetFilename('module', $extension);
     // Include module files.
     require_once $filename;
     if (file_exists($install_file = dirname($filename) . '/' . $extension . '.install')) {
         require_once $install_file;
     }
     // Update status in system table
     $this->systemTable->moduleSetEnabled($extension);
     // Clear various caches, especially hook_module_implements()
     $this->systemListReset->systemListReset();
     $this->moduleList->moduleList(TRUE);
     $this->hookSystem->moduleImplementsReset();
     $this->systemUpdateBootstrapStatus->systemUpdateBootstrapStatus();
     // Update the registry to include it.
     # registry_update();
     // Refresh the schema to include it.
     # drupal_get_schema(NULL, TRUE);
     // Update the theme registry to include it.
     # drupal_theme_rebuild();
     // Clear entity cache.
     # entity_info_cache_clear();
     if ($install) {
         PureFunctions::moduleInvoke($extension, 'schema');
         $this->systemTable->moduleSetSchemaVersion($extension, 7000);
         PureFunctions::moduleInvoke($extension, 'update_last_removed');
         // Optional hook_install()..
         PureFunctions::moduleInvoke($extension, 'install');
         // Optional watchdog()
         $this->hookSystem->moduleInvokeAll('watchdog');
     }
     // hook_enable()
     PureFunctions::moduleInvoke($extension, 'enable');
     // watchdog()
     $this->hookSystem->moduleInvokeAll('watchdog');
 }