Filesystem.php in Automatic Updates 8
File
src/ReadinessChecker/Filesystem.php
View source
<?php
namespace Drupal\automatic_updates\ReadinessChecker;
use Drupal\Core\StringTranslation\StringTranslationTrait;
abstract class Filesystem implements ReadinessCheckerInterface {
use StringTranslationTrait;
protected $rootPath;
protected $vendorPath;
public function __construct($app_root) {
$this->rootPath = (string) $app_root;
}
public function run() {
if (!file_exists($this
->getRootPath() . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, [
'core',
'core.api.php',
]))) {
return [
$this
->t('The web root could not be located.'),
];
}
return $this
->doCheck();
}
protected abstract function doCheck();
protected function getRootPath() {
if (!$this->rootPath) {
$this->rootPath = (string) \Drupal::root();
}
return $this->rootPath;
}
protected function getVendorPath() {
if (!$this->vendorPath) {
$this->vendorPath = $this
->getRootPath() . DIRECTORY_SEPARATOR . 'vendor';
}
return $this->vendorPath;
}
protected function areSameLogicalDisk($root, $vendor) {
$root_statistics = stat($root);
$vendor_statistics = stat($vendor);
return $root_statistics && $vendor_statistics && $root_statistics['dev'] === $vendor_statistics['dev'];
}
}