namespace Drupal\Console\Bootstrap;
+use Drupal\Console\Utils\Site;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
new FileLocator($this->root)
);
- $loader->load($this->root. DRUPAL_CONSOLE_CORE . 'services.yml');
- $loader->load($this->root. DRUPAL_CONSOLE . 'services-drupal-install.yml');
- $loader->load($this->root. DRUPAL_CONSOLE . 'services.yml');
+ $servicesFiles = [
+ $this->root. DRUPAL_CONSOLE_CORE . 'services.yml',
+ $this->root. DRUPAL_CONSOLE . 'uninstall.services.yml',
+ $this->root. DRUPAL_CONSOLE . 'services.yml',
+// $this->root. DRUPAL_CONSOLE . 'extend.console.uninstall.services.yml',
+ ];
+
+ foreach ($servicesFiles as $servicesFile) {
+ if (file_exists($servicesFile)) {
+ $loader->load($servicesFile);
+ }
+ }
$container->get('console.configuration_manager')
->loadConfiguration($this->root)
->getConfiguration();
- $cacheDirectory = $container->get('console.site')->getCacheDirectory();
- $consoleServicesFile = $cacheDirectory.'/console.services.yml';
+ /**
+ * @var Site $site
+ */
+ $site = $container->get('console.site');
- if (!$this->rebuild && file_exists($consoleServicesFile)) {
- $loader->load($consoleServicesFile);
+ if (!$this->rebuild && $site->cachedServicesFileExists()) {
+ $loader->load($site->cachedServicesFile());
} else {
- if (file_exists($consoleServicesFile)) {
- unlink($consoleServicesFile);
- }
+ $site->removeCachedServicesFile();
$finder = new Finder();
$finder->files()
->name('*.yml')
}
}
- if ($servicesData && is_writable($cacheDirectory)) {
+ if ($servicesData && is_writable($site->getCacheDirectory())) {
file_put_contents(
- $consoleServicesFile,
+ $site->cachedServicesFile(),
Yaml::dump($servicesData, 4, 2)
);
}
}
- $consoleExtendServicesFile = $this->root. DRUPAL_CONSOLE .'/extend.console.services.yml';
+ $consoleExtendServicesFile = $this->root . DRUPAL_CONSOLE . '/extend.console.services.yml';
+
if (file_exists($consoleExtendServicesFile)) {
$loader->load($consoleExtendServicesFile);
}