Issue #2159915 by ianthomas_uk, martin107, InternetDevels: Remove drupal_load().
parent
2d6f7e74e1
commit
f9c316f9fd
|
@ -844,44 +844,6 @@ function drupal_page_is_cacheable($allow_caching = NULL) {
|
|||
&& !drupal_is_cli();
|
||||
}
|
||||
|
||||
/**
|
||||
* Includes a file with the provided type and name.
|
||||
*
|
||||
* This prevents including a theme, engine, module, etc., more than once.
|
||||
*
|
||||
* @param $type
|
||||
* The type of item to load (i.e. theme, theme_engine, module).
|
||||
* @param $name
|
||||
* The name of the item to load.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the item is loaded or has already been loaded.
|
||||
*/
|
||||
function drupal_load($type, $name) {
|
||||
if ($type == 'module' && \Drupal::moduleHandler()->moduleExists($name)) {
|
||||
return \Drupal::moduleHandler()->load($name);
|
||||
}
|
||||
|
||||
// Once a file is included this can't be reversed during a request so do not
|
||||
// use drupal_static() here.
|
||||
static $files = array();
|
||||
|
||||
if (isset($files[$type][$name])) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$filename = drupal_get_filename($type, $name);
|
||||
|
||||
if ($filename) {
|
||||
include_once DRUPAL_ROOT . '/' . $filename;
|
||||
$files[$type][$name] = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an HTTP response header for the current page.
|
||||
*
|
||||
|
|
|
@ -2039,10 +2039,6 @@ function hook_requirements($phase) {
|
|||
* tables and their related keys and indexes. A schema is defined by
|
||||
* hook_schema() which must live in your module's .install file.
|
||||
*
|
||||
* This hook is called at install and uninstall time, and in the latter case, it
|
||||
* cannot rely on the .module file being loaded or hooks being known. If the
|
||||
* .module file is needed, it may be loaded with drupal_load().
|
||||
*
|
||||
* The tables declared by this hook will be automatically created when the
|
||||
* module is installed, and removed when the module is uninstalled. This happens
|
||||
* before hook_install() is invoked, and after hook_uninstall() is invoked,
|
||||
|
@ -2458,14 +2454,6 @@ function hook_update_last_removed() {
|
|||
* tables are removed, allowing your module to query its own tables during
|
||||
* this routine.
|
||||
*
|
||||
* When hook_uninstall() is called, your module will already be disabled, so
|
||||
* its .module file will not be automatically included. If you need to call API
|
||||
* functions from your .module file in this hook, use drupal_load() to make
|
||||
* them available. (Keep this usage to a minimum, though, especially when
|
||||
* calling API functions that invoke hooks, or API functions from modules
|
||||
* listed as dependencies, since these may not be available or work as expected
|
||||
* when the module is disabled.)
|
||||
*
|
||||
* @see hook_install()
|
||||
* @see hook_schema()
|
||||
* @see hook_disable()
|
||||
|
|
Loading…
Reference in New Issue