/**
  * Scans and collects module .info data.
  *
  * @see _system_rebuild_module_data()
  *
  * @return object[]
  */
 public function systemBuildModuleData()
 {
     // Find modules
     $modules = $this->exampleModules->drupalSystemListingModules();
     if (FALSE) {
         // Include the installation profile in modules that are loaded.
         $profile = 'minimal';
         $modules[$profile] = new \stdClass();
         $modules[$profile]->name = $profile;
         $modules[$profile]->uri = 'profiles/' . $profile . '/' . $profile . '.profile';
         $modules[$profile]->filename = $profile . '.profile';
         // Installation profile hooks are always executed last.
         $modules[$profile]->weight = 1000;
     } else {
         $profile = 'NO_PROFILE';
     }
     // Set defaults for module info.
     $defaults = array('dependencies' => array(), 'description' => '', 'package' => 'Other', 'version' => NULL, 'files' => array(), 'bootstrap' => 0);
     // Read info files for each module.
     foreach ($modules as $key => $module) {
         // The module system uses the key 'filename' instead of 'uri' so copy the
         // value so it will be used by the modules system.
         $modules[$key]->filename = $module->uri;
         // Look for the info file.
         $module->info = $this->exampleModules->drupalParseInfoFile($module->name);
         // Skip modules that don't provide info.
         if (empty($module->info)) {
             unset($modules[$key]);
             continue;
         }
         // Merge in defaults and save.
         $modules[$key]->info = $module->info + $defaults;
         // Installation profiles are hidden by default, unless explicitly specified
         // otherwise in the .info file.
         if ($key == $profile && !isset($modules[$key]->info['hidden'])) {
             $modules[$key]->info['hidden'] = TRUE;
         }
         // Invoke hook_system_info_alter() to give installed modules a chance to
         // modify the data in the .info files if necessary.
         $type = 'module';
         $this->hookSystem->drupalAlter('system_info', $modules[$key]->info, $modules[$key], $type);
     }
     if (isset($modules[$profile])) {
         // The installation profile is required, if it's a valid module.
         $modules[$profile]->info['required'] = TRUE;
         // Add a default distribution name if the profile did not provide one. This
         // matches the default value used in install_profile_info().
         if (!isset($modules[$profile]->info['distribution_name'])) {
             $modules[$profile]->info['distribution_name'] = 'Drupal';
         }
     }
     unset($modules['NO_PROFILE']);
     return $modules;
 }
 /**
  * @see _system_update_bootstrap_status()
  */
 function systemUpdateBootstrapStatus()
 {
     $bootstrap_modules = array();
     foreach (PureFunctions::bootstrapHooks() as $hook) {
         foreach ($this->hookSystem->moduleImplements($hook) as $module) {
             $bootstrap_modules[$module] = TRUE;
         }
     }
     $this->systemTable->setBootstrapModules($bootstrap_modules);
     // Reset the cached list of bootstrap modules.
     $this->systemListReset->systemListReset();
 }
Пример #3
0
 /**
  * @param string $hook
  * @param bool $sort
  *
  * @return array
  */
 private function discoverImplementations($hook, $sort)
 {
     # StaticCallLog::addCall();
     // The hook is not cached, so ensure that whether or not it has
     // implementations, that the cache is updated at the end of the request.
     $this->writeCache = TRUE;
     $hook_info = $this->moduleHookInfo();
     $implementations = array();
     $list = $this->moduleList->moduleList(FALSE, FALSE, $sort);
     if ('modules_enabled' === $hook) {
         # HackyLog::logx($list);
     }
     foreach ($list as $module) {
         $include_file = isset($hook_info[$hook]['group']) && module_load_include('inc', $module, $module . '.' . $hook_info[$hook]['group']);
         // Since module_hook() may needlessly try to load the include file again,
         // function_exists() is used directly here.
         if (function_exists($module . '_' . $hook)) {
             $implementations[$module] = $include_file ? $hook_info[$hook]['group'] : FALSE;
         }
     }
     // Allow modules to change the weight of specific implementations but avoid
     // an infinite loop.
     if ($hook != 'module_implements_alter') {
         $this->hookSystem->drupalAlter('module_implements', $implementations, $hook);
     }
     return $implementations;
 }
Пример #4
0
 /**
  * @see libraries_info()
  *
  * @param string|null $name
  *
  * @return mixed
  */
 function &getLibrariesInfo($name = NULL)
 {
     // This static cache is re-used by libraries_detect() to save memory.
     $libraries =& $this->drupalStatic->get('libraries_info');
     if (!isset($libraries)) {
         $libraries = array();
         // Gather information from hook_libraries_info().
         foreach ($this->hookSystem->moduleImplements('libraries_info') as $module) {
             foreach (PureFunctions::moduleInvoke($module, 'libraries_info') as $machine_name => $properties) {
                 $properties['module'] = $module;
                 $libraries[$machine_name] = $properties;
             }
         }
         // Gather information from hook_libraries_info() in enabled themes.
         // @see drupal_alter()
         // SKIPPED
         // Gather information from .info files.
         // .info files override module definitions.
         // SKIPPED
         // Provide defaults.
         foreach ($libraries as $machine_name => &$properties) {
             $this->librariesInfoDefaults($properties, $machine_name);
         }
         // Allow modules to alter the registered libraries.
         $this->hookSystem->drupalAlter('libraries_info', $libraries);
         // Invoke callbacks in the 'info' group.
         // SKIPPED
     }
     if (isset($name)) {
         if (!empty($libraries[$name])) {
             return $libraries[$name];
         } else {
             $false = FALSE;
             return $false;
         }
     }
     return $libraries;
 }
Пример #5
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');
 }
Пример #6
0
 /**
  * @see menu_set_custom_theme()
  */
 private function menuSetCustomTheme()
 {
     $this->hookSystem->moduleInvokeAll('custom_theme');
 }