ReadOnlyFilesystem.php in Automatic Updates 7
File
ReadinessCheckers/ReadOnlyFilesystem.php
View source
<?php
class ReadOnlyFilesystem implements ReadinessCheckerInterface {
public static function run() {
return static::readOnlyCheck();
}
protected static function readOnlyCheck() {
$messages = [];
$file_path = DRUPAL_ROOT;
$file = 'modules/node/node.api.php';
if (file_unmanaged_copy("{$file_path}/{$file}", "{$file_path}/{$file}.automatic_updates", FILE_EXISTS_REPLACE)) {
file_unmanaged_delete("{$file_path}/{$file}.automatic_updates");
}
else {
$error = t('Filesystem at "@path" is read only. Updates to Drupal core cannot be applied against a read only file system.', [
'@path' => DRUPAL_ROOT,
]);
watchdog('automatic_updates', $error, [], WATCHDOG_ERROR);
$messages[] = $error;
}
return $messages;
}
}