/** * @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(); }
/** * @return true[] */ public function getBootstrapModules() { $bootstrap_modules = array(); foreach ($this->discoverModuleFilenames('module') as $name => $filename) { $php = file_get_contents($filename); foreach (PureFunctions::bootstrapHooks() as $hook) { if (FALSE !== strpos($php, 'function ' . $name . '_' . $hook)) { $bootstrap_modules[$name] = TRUE; break; } } } return $bootstrap_modules; }
/** * @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; }
/** * @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'); }
/** * @see bootstrap_invoke_all() * * @param string $hook */ private function bootstrapInvokeAll($hook) { // Bootstrap modules should have been loaded when this function is called, so // we don't need to tell module_list() to reset its internal list (and we // therefore leave the first parameter at its default value of FALSE). We // still pass in TRUE for the second parameter, though; in case this is the // first time during the bootstrap that module_list() is called, we want to // make sure that its internal cache is primed with the bootstrap modules // only. foreach ($this->moduleList->moduleList(FALSE, TRUE) as $module) { $this->drupalLoad->drupalLoad('module', $module); PureFunctions::moduleInvoke($module, $hook); } }
/** * @see module_invoke() * * @param string $module * @param string $hook * * @return mixed * * @throws \Exception */ function moduleInvoke($module, $hook) { $args = func_get_args(); switch (count($args)) { case 2: return PureFunctions::moduleInvoke($module, $hook); case 3: return PureFunctions::moduleInvoke($module, $hook, $args[2]); case 4: return PureFunctions::moduleInvoke($module, $hook, $args[2], $args[3]); default: throw new \Exception("More arguments than expected."); } }