Commit 2afd1ed4 authored by catch's avatar catch

Issue #1467126 by effulgentsia, Rob Loach, sun, catch, amateescu, yched,...

Issue #1467126 by effulgentsia, Rob Loach, sun, catch, amateescu, yched, EclipseGc: Fixed Provider based PSR-0 Classes that load more than once.
parent f7538615
...@@ -176,7 +176,6 @@ function system_list($type) { ...@@ -176,7 +176,6 @@ function system_list($type) {
} }
// Build a list of filenames so drupal_get_filename can use it. // Build a list of filenames so drupal_get_filename can use it.
if ($record->status) { if ($record->status) {
drupal_classloader_register($record->name, dirname($record->filename));
$lists['filepaths'][] = array('type' => $record->type, 'name' => $record->name, 'filepath' => $record->filename); $lists['filepaths'][] = array('type' => $record->type, 'name' => $record->name, 'filepath' => $record->filename);
} }
} }
...@@ -210,6 +209,7 @@ function system_list($type) { ...@@ -210,6 +209,7 @@ function system_list($type) {
// drupal_get_filename() static cache with all enabled modules and themes. // drupal_get_filename() static cache with all enabled modules and themes.
foreach ($lists['filepaths'] as $item) { foreach ($lists['filepaths'] as $item) {
drupal_get_filename($item['type'], $item['name'], $item['filepath']); drupal_get_filename($item['type'], $item['name'], $item['filepath']);
drupal_classloader_register($item['name'], dirname($item['filepath']));
} }
} }
......
...@@ -260,13 +260,19 @@ class ModuleClassLoaderTestCase extends DrupalWebTestCase { ...@@ -260,13 +260,19 @@ class ModuleClassLoaderTestCase extends DrupalWebTestCase {
module_enable(array('module_test', 'module_autoload_test'), FALSE); module_enable(array('module_test', 'module_autoload_test'), FALSE);
$this->resetAll(); $this->resetAll();
$this->drupalGet('module-test/class-loading'); // Check twice to test an unprimed and primed system_list() cache.
$this->assertText($expected, t('Autoloader loads classes from an enabled module.')); for ($i=0; $i<2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertText($expected, t('Autoloader loads classes from an enabled module.'));
}
module_disable(array('module_autoload_test'), FALSE); module_disable(array('module_autoload_test'), FALSE);
$this->resetAll(); $this->resetAll();
$this->drupalGet('module-test/class-loading'); // Check twice to test an unprimed and primed system_list() cache.
$this->assertNoText($expected, t('Autoloader does not load classes from a disabled module.')); for ($i=0; $i<2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertNoText($expected, t('Autoloader does not load classes from a disabled module.'));
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment