class Cleaner
Processes a queue of defunct stage directories, deleting them.
Plugin annotation
@QueueWorker(
id = "package_manager_cleanup",
title = @Translation("Stage directory cleaner"),
cron = {"time" = 30}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Core\Queue\QueueWorkerInterface
- class \Drupal\package_manager\Plugin\QueueWorker\Cleaner extends \Drupal\Core\Queue\QueueWorkerBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface
- class \Drupal\Core\Queue\QueueWorkerBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Core\Queue\QueueWorkerInterface
Expanded class hierarchy of Cleaner
File
-
core/
modules/ package_manager/ src/ Plugin/ QueueWorker/ Cleaner.php, line 19
Namespace
Drupal\package_manager\Plugin\QueueWorkerView source
final class Cleaner extends QueueWorkerBase implements ContainerFactoryPluginInterface {
public function __construct(array $configuration, string $plugin_id, mixed $plugin_definition, FileSystemInterface $fileSystem) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get(FileSystemInterface::class));
}
/**
* {@inheritdoc}
*/
public function processItem($dir) : void {
assert(is_string($dir));
if (file_exists($dir)) {
$this->fileSystem
->deleteRecursive($dir, function (string $path) : void {
$this->fileSystem
->chmod($path, is_dir($path) ? 0700 : 0600);
});
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
Cleaner::create | public static | function | Creates an instance of the plugin. | Overrides ContainerFactoryPluginInterface::create |
Cleaner::processItem | public | function | ||
Cleaner::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.