public function MTimeProtectedFileStorage::load

public MTimeProtectedFileStorage::load($name)

Loads PHP code from storage.

Depending on storage implementation, exists() checks can be expensive, so this function may be called for a file that doesn't exist, and that should not result in errors. This function does not return anything, so it is up to the caller to determine if any code was loaded (for example, check class_exists() or function_exists() for what was expected in the code).

Parameters

string $name: The virtual file name. Can be a relative path.

Overrides FileStorage::load

File

core/lib/Drupal/Component/PhpStorage/MTimeProtectedFileStorage.php, line 37

Class

MTimeProtectedFileStorage
Stores PHP code in files with securely hashed names.

Namespace

Drupal\Component\PhpStorage

Code

public function load($name) {
  if (($filename = $this->checkFile($name)) !== FALSE) {
    // Inline parent::load() to avoid an expensive getFullPath() call.
    return (@include_once $filename) !== FALSE;
  }
  return FALSE;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!PhpStorage!MTimeProtectedFileStorage.php/function/MTimeProtectedFileStorage::load/8.1.x