Problem/Motivation
The drupal_rebuild()
function (called from rebuild.php
) isn't finding code that lives in DRUPAL_ROOT/modules
.
To reproduce, create and enable a foobar
module, and add this to modules/foobar/src/PhpStorage/MtimeReplace.php
/**
* Test swapping out storage to contrib.
*/
namespace Drupal\foobar\PhpStorage;
use Drupal\Component\PhpStorage\MTimeProtectedFileStorage;
class CoordinatedMtimeReplace extends MTimeProtectedFileStorage {
}
then edit settings.php
and add these lines:
$settings['php_storage']['twig'] = array(
'class' => 'Drupal\foobar\PhpStorage\MtimeReplace',
'secret' => $settings['hash_salt'],
);
running php rebuild.php
now results in:
Fatal error: Class 'Drupal\foobar\PhpStorage\MtimeReplace' not found in /.../core/lib/Drupal/Core/PhpStorage/PhpStorageFactory.php on line 57
This was originally thought to be a drush issue, but is actually a problem with rebuild.php
and drupal_rebuild()
.