Skip to content
Snippets Groups Projects
Commit 4ae7f854 authored by catch's avatar catch
Browse files

Issue #3420985 by godotislate, larowlan, smustgrave, mstrelan: Convert...

Issue #3420985 by godotislate, larowlan, smustgrave, mstrelan: Convert Archiver discovery to attributes
parent 83874f2b
No related branches found
No related tags found
30 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!9470[10.3.x-only-DO-NOT-MERGE]: #3331771 Fix file_get_contents(): Passing null to parameter,!8540Issue #3457061: Bootstrap Modal dialog Not closing after 10.3.0 Update,!8528Issue #3456871 by Tim Bozeman: Support NULL services,!8373Issue #3427374 by danflanagan8, Vighneshh: taxonomy_tid ViewsArgumentDefault...,!7526Expose roles in response,!7352Draft: Resolve #3203489 "Set filename as",!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2794Issue #3100732: Allow specifying `meta` data on JSON:API objects,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #108197 canceled
Pipeline: drupal

#108199

    ...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
    * Defines the common interface for all Archiver classes. * Defines the common interface for all Archiver classes.
    * *
    * @see \Drupal\Core\Archiver\ArchiverManager * @see \Drupal\Core\Archiver\ArchiverManager
    * @see \Drupal\Core\Archiver\Annotation\Archiver * @see \Drupal\Core\Archiver\Attribute\Archiver
    * @see plugin_api * @see plugin_api
    */ */
    interface ArchiverInterface { interface ArchiverInterface {
    ......
    ...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
    namespace Drupal\Core\Archiver; namespace Drupal\Core\Archiver;
    use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Plugin\Factory\DefaultFactory;
    use Drupal\Core\Archiver\Attribute\Archiver;
    use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
    use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
    use Drupal\Core\File\FileSystemInterface; use Drupal\Core\File\FileSystemInterface;
    ...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
    /** /**
    * Provides an Archiver plugin manager. * Provides an Archiver plugin manager.
    * *
    * @see \Drupal\Core\Archiver\Annotation\Archiver * @see \Drupal\Core\Archiver\Attribute\Archiver
    * @see \Drupal\Core\Archiver\ArchiverInterface * @see \Drupal\Core\Archiver\ArchiverInterface
    * @see plugin_api * @see plugin_api
    */ */
    ...@@ -38,7 +39,7 @@ class ArchiverManager extends DefaultPluginManager { ...@@ -38,7 +39,7 @@ class ArchiverManager extends DefaultPluginManager {
    * The file handler. * The file handler.
    */ */
    public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FileSystemInterface $file_system) { public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FileSystemInterface $file_system) {
    parent::__construct('Plugin/Archiver', $namespaces, $module_handler, 'Drupal\Core\Archiver\ArchiverInterface', 'Drupal\Core\Archiver\Annotation\Archiver'); parent::__construct('Plugin/Archiver', $namespaces, $module_handler, 'Drupal\Core\Archiver\ArchiverInterface', Archiver::class, 'Drupal\Core\Archiver\Annotation\Archiver');
    $this->alterInfo('archiver_info'); $this->alterInfo('archiver_info');
    $this->setCacheBackend($cache_backend, 'archiver_info_plugins'); $this->setCacheBackend($cache_backend, 'archiver_info_plugins');
    $this->fileSystem = $file_system; $this->fileSystem = $file_system;
    ......
    <?php
    namespace Drupal\Core\Archiver\Attribute;
    use Drupal\Component\Plugin\Attribute\Plugin;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    /**
    * Defines an archiver attribute object.
    *
    * Plugin Namespace: Plugin\Archiver
    *
    * For a working example, see \Drupal\system\Plugin\Archiver\Zip
    *
    * @see \Drupal\Core\Archiver\ArchiverManager
    * @see \Drupal\Core\Archiver\ArchiverInterface
    * @see plugin_api
    * @see hook_archiver_info_alter()
    */
    #[\Attribute(\Attribute::TARGET_CLASS)]
    class Archiver extends Plugin {
    /**
    * Constructs an archiver plugin attribute object.
    *
    * @param string $id
    * The archiver plugin ID.
    * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $title
    * The human-readable name of the archiver plugin.
    * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $description
    * The description of the archiver plugin.
    * @param array $extensions
    * An array of valid extensions for this archiver.
    * @param string|null $deriver
    * (optional) The deriver class.
    */
    public function __construct(
    public readonly string $id,
    public readonly ?TranslatableMarkup $title = NULL,
    public readonly ?TranslatableMarkup $description = NULL,
    public readonly array $extensions = [],
    public readonly ?string $deriver = NULL) {}
    }
    ...@@ -2,17 +2,18 @@ ...@@ -2,17 +2,18 @@
    namespace Drupal\system\Plugin\Archiver; namespace Drupal\system\Plugin\Archiver;
    use Drupal\Core\Archiver\Attribute\Archiver;
    use Drupal\Core\Archiver\Tar as BaseTar; use Drupal\Core\Archiver\Tar as BaseTar;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    /** /**
    * Defines an archiver implementation for .tar files. * Defines an archiver implementation for .tar files.
    *
    * @Archiver(
    * id = "Tar",
    * title = @Translation("Tar"),
    * description = @Translation("Handles .tar files."),
    * extensions = {"tar", "tgz", "tar.gz", "tar.bz2"}
    * )
    */ */
    #[Archiver(
    id: 'Tar',
    title: new TranslatableMarkup('Tar'),
    description: new TranslatableMarkup('Handles .tar files.'),
    extensions: ['tar', 'tgz', 'tar.gz', 'tar.bz2']
    )]
    class Tar extends BaseTar { class Tar extends BaseTar {
    } }
    ...@@ -2,19 +2,20 @@ ...@@ -2,19 +2,20 @@
    namespace Drupal\system\Plugin\Archiver; namespace Drupal\system\Plugin\Archiver;
    use Drupal\Core\Archiver\Attribute\Archiver;
    use Drupal\Core\Archiver\Zip as BaseZip; use Drupal\Core\Archiver\Zip as BaseZip;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    /** /**
    * Defines an archiver implementation for .zip files. * Defines an archiver implementation for .zip files.
    * *
    * @link http://php.net/zip * @link http://php.net/zip
    *
    * @Archiver(
    * id = "Zip",
    * title = @Translation("Zip"),
    * description = @Translation("Handles zip files."),
    * extensions = {"zip"}
    * )
    */ */
    #[Archiver(
    id: 'Zip',
    title: new TranslatableMarkup('Zip'),
    description: new TranslatableMarkup('Handles zip files.'),
    extensions: ['zip']
    )]
    class Zip extends BaseZip { class Zip extends BaseZip {
    } }
    ...@@ -3,16 +3,18 @@ ...@@ -3,16 +3,18 @@
    namespace Drupal\update_test\Plugin\Archiver; namespace Drupal\update_test\Plugin\Archiver;
    use Drupal\Core\Archiver\ArchiverInterface; use Drupal\Core\Archiver\ArchiverInterface;
    use Drupal\Core\Archiver\Attribute\Archiver;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    /** /**
    * Defines a test archiver implementation. * Defines a test archiver implementation.
    *
    * @Archiver(
    * id = "update_test_archiver",
    * title = @Translation("Update Test Archiver"),
    * extensions = {"update-test-extension"}
    * )
    */ */
    #[Archiver(
    id: 'update_test_archiver',
    title: new TranslatableMarkup('Tar'),
    description: new TranslatableMarkup('Update Test Archiver'),
    extensions: ['update-test-extension']
    )]
    class UpdateTestArchiver implements ArchiverInterface { class UpdateTestArchiver implements ArchiverInterface {
    /** /**
    ......
    • catch @catch

      mentioned in commit 9b7b5a9d

      ·

      mentioned in commit 9b7b5a9d

      Toggle commit list
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment