protected static function InPlaceUpdate::rollback in Automatic Updates 7
Rollback after a failed update.
Parameters
string $project_root: The project root directory.
1 call to InPlaceUpdate::rollback()
File
- ./
InPlaceUpdate.php, line 345
Class
- InPlaceUpdate
- Class to apply in-place updates.
Code
protected static function rollback($project_root) {
if (!self::$backup) {
return;
}
foreach (self::getFilesList(self::getTempDirectory()) as $file) {
$file_real_path = self::getFileRealPath($file);
$file_path = substr($file_real_path, strlen(self::getTempDirectory() . self::ARCHIVE_DIRECTORY));
$project_real_path = self::getProjectRealPath($file_path, $project_root);
$success = file_unmanaged_delete($project_real_path);
if ($success) {
watchdog('automatic_updates', '"@file" was successfully removed during rollback.', [
'@file' => $project_real_path,
], WATCHDOG_INFO);
}
else {
watchdog('automatic_updates', '"@file" failed removal on rollback.', [
'@file' => $project_real_path,
], WATCHDOG_ERROR);
}
}
foreach (self::getFilesList(self::$backup) as $file) {
self::doRestore($file, $project_root);
}
}