public static function HudtInternal::canReadFile in Hook Update Deploy Tools 8
Same name and namespace in other branches
- 7 src/HudtInternal.php \HookUpdateDeployTools\HudtInternal::canReadFile()
Checks to see if a storagefile can be read.
Parameters
string $filename: The filename of the file.
string $storage_type: The type of storage (menu, panel, rules...).
Return value
bool TRUE if the file can be read.
Throws
HudtException When the file can not be read.
6 calls to HudtInternal::canReadFile()
- HudtInternal::readFileToArray in src/
HudtInternal.php - Read the contents of a file into an array of one element per line.
- HudtInternal::readFileToString in src/
HudtInternal.php - Read the contents of a file into a string for the entire contents.
- Menus::import in src/
Menus.php - Imports menus using the menu_import module & template.
- PageManager::import in src/
PageManager.php - Imports Page Manager pages using the panels module & template.
- Redirects::import in src/
Redirects.php - Imports a set of redirects from an import csv file.
File
- src/
HudtInternal.php, line 25
Class
- HudtInternal
- Methods for processes internal to Hook Deploy Update Tools.
Namespace
HookUpdateDeployToolsCode
public static function canReadFile($filename, $storage_type) {
$path = self::getStoragePath($storage_type);
$file = "{$path}{$filename}";
if (file_exists($file)) {
// The file is present.
return TRUE;
}
else {
// The file is not there.
$variables = array(
'@path' => $path,
'!filename' => $filename,
'!storage' => $storage_type,
);
$message = "The requested !storage read failed because the file '!filename' was not found in '@path'. \nRe-run update when the file has been placed there and is readable.";
Message::make($message, $variables, WATCHDOG_ERROR);
throw new HudtException($message, $variables, WATCHDOG_ERROR, FALSE);
}
}