class Cleaner
Processes a queue of defunct stage directories, deleting them.
Attributes
#[QueueWorker(id: 'package_manager_cleanup', title: new TranslatableMarkup('Stage directory cleaner'), cron: [
'time' => 30,
])]
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase extends \Drupal\Core\Queue\QueueWorkerInterface implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\package_manager\Plugin\QueueWorker\Cleaner extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface implements \Drupal\Core\Queue\QueueWorkerBase
- class \Drupal\Core\Queue\QueueWorkerBase extends \Drupal\Core\Queue\QueueWorkerInterface implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of Cleaner
File
-
core/
modules/ package_manager/ src/ Plugin/ QueueWorker/ Cleaner.php, line 15
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, private readonly 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 | Deprecated | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|---|
Cleaner::create | public static | function | Creates an instance of the plugin. | Overrides ContainerFactoryPluginInterface::create | ||
Cleaner::processItem | public | function | Works on a single queue item. | Overrides QueueWorkerInterface::processItem | ||
Cleaner::__construct | public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | Overrides PluginBase::__construct | ||
PluginBase::$configuration | protected | property | Configuration information passed into the plugin. | 1 | ||
PluginBase::$pluginDefinition | protected | property | The plugin implementation definition. | 1 | ||
PluginBase::$pluginId | protected | property | The plugin ID. | |||
PluginBase::DERIVATIVE_SEPARATOR | constant | A string which is used to separate base plugin IDs from the derivative ID. | ||||
PluginBase::getBaseId | public | function | Gets the base_plugin_id of the plugin instance. | Overrides DerivativeInspectionInterface::getBaseId | ||
PluginBase::getDerivativeId | public | function | Gets the derivative_id of the plugin instance. | Overrides DerivativeInspectionInterface::getDerivativeId | ||
PluginBase::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | Overrides PluginInspectionInterface::getPluginDefinition | 2 | |
PluginBase::getPluginId | public | function | Gets the plugin ID of the plugin instance. | Overrides PluginInspectionInterface::getPluginId | ||
PluginBase::isConfigurable | Deprecated | public | function | Determines if the plugin is configurable. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.