public static function ModifiedFilesService::getModifiedFiles in Automatic Updates 7
Get list of modified files.
Parameters
array $extensions: The list of extensions, keyed by extension name with values an info array.
Return value
\Iterator The modified files.
2 calls to ModifiedFilesService::getModifiedFiles()
- InPlaceUpdate::checkModifiedFiles in ./
InPlaceUpdate.php - Check if files are modified before applying updates.
- ModifiedFiles::modifiedFilesCheck in ReadinessCheckers/
ModifiedFiles.php - Check if the site contains any modified code.
File
- ./
ModifiedFilesService.php, line 22
Class
- ModifiedFilesService
- Modified files service.
Code
public static function getModifiedFiles(array $extensions = []) {
$project_root = drupal_get_path('module', 'automatic_updates');
require_once $project_root . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
$modified_files = new \ArrayIterator();
foreach (static::getHashRequests($extensions) as $hash_info) {
$url = reset($hash_info);
$response = drupal_http_request($url);
$extension_name = key($hash_info);
if (isset($response->code) && $response->code === '200') {
static::processHashes($response->data, $extensions[$extension_name], $modified_files);
}
else {
// Log all the exceptions, even modules that aren't the main project.
watchdog('automatic_updates', 'Request for @url resulted in @error.', [
'@url' => $url,
'@error' => $response->error,
], WATCHDOG_WARNING);
// HTTP 404 is expected for modules that aren't the main project. But
// other error codes should complain loudly.
if ($response->code !== '404') {
throw new \RuntimeException(sprintf('Request for %s resulted in %s.', $url, $response->error));
}
}
}
return $modified_files;
}