diff -u b/core/includes/bootstrap.inc b/core/includes/bootstrap.inc --- b/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -3560,7 +3560,7 @@ * * @see Drupal\Component\PhpLoader\PhpLoaderInterface */ -function _drupal_php_get_loader($bin) { +function drupal_php_loader($bin = 'default') { static $drupal_static_fast; if (!isset($drupal_static_fast)) { $drupal_static_fast['loader_objects'] = &drupal_static(__FUNCTION__); @@ -3583,38 +3582,0 @@ - -/** - * include a PHP file. - * - * @param string $filename - * The filename. Can be a relative path. - * @param string $bin - * An optional bin. Separate bins can use a different loader class. - */ -function drupal_php_include($filename, $bin = 'default') { - return _drupal_php_get_loader($bin)->phpInclude($filename); -} - -/** - * Write a PHP file. - * - * @param string $filename - * The filename. Can be a relative path. - * @param string $data - * The PHP code to be written. - * @param string $bin - * An optional bin. Separate bins can use a different loader class. - */ -function drupal_php_write($filename, $data, $bin = 'default') { - return _drupal_php_get_loader($bin)->write($filename, $data); -} - -/** - * Delete a PHP file. - * - * @param string $filename - * The filename to be deleted. Can be a relative path. - * @param string $bin - * An optional bin. Separate bins can use a different loader class. - */ -function drupal_php_delete($filename, $bin = 'default') { - return _drupal_php_get_loader($bin)->delete($filename); -} diff -u b/core/lib/Drupal/Component/PhpLoader/MTimeProtectedLoader.php b/core/lib/Drupal/Component/PhpLoader/MTimeProtectedLoader.php --- b/core/lib/Drupal/Component/PhpLoader/MTimeProtectedLoader.php +++ b/core/lib/Drupal/Component/PhpLoader/MTimeProtectedLoader.php @@ -32,9 +32,9 @@ } /** - * Implements Drupal\Component\PhpLoader\PhpLoaderInterface::phpInclude() + * Implements Drupal\Component\PhpLoader\PhpLoaderInterface::includePhp() */ - public function phpInclude($filename) { + public function includePhp($filename) { $filename = str_replace('/', '#', $filename); $dir = $this->prefix . '/' . $filename; $filename = $this->getPath($dir, $filename, filemtime($dir)); diff -u b/core/lib/Drupal/Component/PhpLoader/NativeLoader.php b/core/lib/Drupal/Component/PhpLoader/NativeLoader.php --- b/core/lib/Drupal/Component/PhpLoader/NativeLoader.php +++ b/core/lib/Drupal/Component/PhpLoader/NativeLoader.php @@ -27,7 +27,7 @@ /** * Implements Drupal\Component\PhpLoader\PhpLoaderInterface::include() */ - public function phpInclude($filename) { + public function includePhp($filename) { include_once $this->prefix . '/' . $filename; return TRUE; } diff -u b/core/lib/Drupal/Component/PhpLoader/PhpLoaderInterface.php b/core/lib/Drupal/Component/PhpLoader/PhpLoaderInterface.php --- b/core/lib/Drupal/Component/PhpLoader/PhpLoaderInterface.php +++ b/core/lib/Drupal/Component/PhpLoader/PhpLoaderInterface.php @@ -12,7 +12,7 @@ * @return * TRUE if the include was successful. */ - public function phpInclude($filename); + public function includePhp($filename); /** * Write a PHP file. diff -u b/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module --- b/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -528,8 +528,8 @@ * The path that will be obliterated. */ function _simpletest_delete_recursive($path) { - // We can not use file_unmanaged_delete_recursive because it - // deliberately only removes visible files with write permission. + // file_unmanaged_delete_recursive() deliberately only removes visible + // files with write permission. chmod($path, 0700); file_unmanaged_delete_recursive($path, '_simpletest_delete_recursive'); } diff -u b/core/modules/system/lib/Drupal/system/Tests/PhpLoader/MTimeProtectedLoaderTest.php b/core/modules/system/lib/Drupal/system/Tests/PhpLoader/MTimeProtectedLoaderTest.php --- b/core/modules/system/lib/Drupal/system/Tests/PhpLoader/MTimeProtectedLoaderTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/PhpLoader/MTimeProtectedLoaderTest.php @@ -7,9 +7,9 @@ namespace Drupal\system\Tests\PhpLoader; -use Drupal\simpletest\WebTestBase; +use Drupal\simpletest\UnitTestBase; -class MTimeProtectedLoaderTest extends WebTestBase { +class MTimeProtectedLoaderTest extends UnitTestBase { public static function getInfo() { return array( @@ -20,13 +20,13 @@ } public function testMTimeProtectedLoader() { - variable_set('loader_classes', array('default' => + $conf['loader_classes'] = array('default' => array( 'class' => 'Drupal\Component\PhpLoader\MTimeProtectedLoader', 'prefix' => variable_get('file_public_path', conf_path() . '/files') . '/codegen', 'secret' => $GLOBALS['drupal_hash_salt'], ), - )); + ); drupal_static_reset('_drupal_php_get_loader'); $filename = $this->randomName() . '/' . $this->randomName() . '.php'; do { @@ -34,8 +34,8 @@ $function = 'test' . $random; } while (function_exists($function)); $contents = "write($filename, $contents); + drupal_php_loader()->includePhp($filename); $this->assertIdentical($function(), $random); } }