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

Expanded class hierarchy of Cleaner

File

core/modules/package_manager/src/Plugin/QueueWorker/Cleaner.php, line 19

Namespace

Drupal\package_manager\Plugin\QueueWorker
View 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 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.