From c14182e84b8286a117f8855e53755869b7db2ec1 Mon Sep 17 00:00:00 2001 From: bcweaver <brianweaver@gmail.com> Date: Tue, 23 Oct 2018 16:54:52 -0400 Subject: [PATCH] Removing 'config_sync' module until we know if we're going to use it --- web/modules/config_sync/LICENSE.txt | 339 ---------------- web/modules/config_sync/composer.json | 23 -- web/modules/config_sync/config_sync.info.yml | 19 - web/modules/config_sync/config_sync.install | 16 - web/modules/config_sync/config_sync.module | 46 --- .../config_sync/config_sync.services.yml | 45 --- web/modules/config_sync/drush.services.yml | 10 - .../src/Commands/ConfigSyncCommands.php | 109 ------ .../config_sync/src/ConfigSyncLister.php | 221 ----------- .../src/ConfigSyncListerInterface.php | 38 -- .../config_sync/src/ConfigSyncSnapshotter.php | 207 ---------- .../src/ConfigSyncSnapshotterInterface.php | 42 -- .../ConfigSyncSnapshotSubscriber.php | 97 ----- .../src/Form/ConfigSyncImportForm.php | 369 ------------------ .../src/Plugin/ConfigFilter/SyncFilter.php | 212 ---------- .../Plugin/ConfigFilter/SyncFilterDeriver.php | 115 ------ .../src/Plugin/SyncConfigCollector.php | 40 -- .../Plugin/SyncConfigCollectorInterface.php | 39 -- .../Plugin/SyncConfigProviderInterface.php | 30 -- .../src/Routing/RouteSubscriber.php | 23 -- 20 files changed, 2040 deletions(-) delete mode 100644 web/modules/config_sync/LICENSE.txt delete mode 100644 web/modules/config_sync/composer.json delete mode 100644 web/modules/config_sync/config_sync.info.yml delete mode 100644 web/modules/config_sync/config_sync.install delete mode 100644 web/modules/config_sync/config_sync.module delete mode 100644 web/modules/config_sync/config_sync.services.yml delete mode 100644 web/modules/config_sync/drush.services.yml delete mode 100644 web/modules/config_sync/src/Commands/ConfigSyncCommands.php delete mode 100644 web/modules/config_sync/src/ConfigSyncLister.php delete mode 100644 web/modules/config_sync/src/ConfigSyncListerInterface.php delete mode 100644 web/modules/config_sync/src/ConfigSyncSnapshotter.php delete mode 100644 web/modules/config_sync/src/ConfigSyncSnapshotterInterface.php delete mode 100644 web/modules/config_sync/src/EventSubscriber/ConfigSyncSnapshotSubscriber.php delete mode 100644 web/modules/config_sync/src/Form/ConfigSyncImportForm.php delete mode 100644 web/modules/config_sync/src/Plugin/ConfigFilter/SyncFilter.php delete mode 100644 web/modules/config_sync/src/Plugin/ConfigFilter/SyncFilterDeriver.php delete mode 100644 web/modules/config_sync/src/Plugin/SyncConfigCollector.php delete mode 100644 web/modules/config_sync/src/Plugin/SyncConfigCollectorInterface.php delete mode 100644 web/modules/config_sync/src/Plugin/SyncConfigProviderInterface.php delete mode 100644 web/modules/config_sync/src/Routing/RouteSubscriber.php diff --git a/web/modules/config_sync/LICENSE.txt b/web/modules/config_sync/LICENSE.txt deleted file mode 100644 index d159169d10..0000000000 --- a/web/modules/config_sync/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/web/modules/config_sync/composer.json b/web/modules/config_sync/composer.json deleted file mode 100644 index b3a37f7ed5..0000000000 --- a/web/modules/config_sync/composer.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "drupal/config_sync", - "description": "Synchronize your site with updated configuration provided by modules and themes.", - "type": "drupal-module", - "homepage": "https://www.drupal.org/project/config_sync", - "license": "GPL-2.0+", - "authors": [ - { - "name": "Nedjo Rogers (nedjo)", - "email": "nedjo@4481.no-reply.drupal.org", - "homepage": "https://www.drupal.org/u/nedjo", - "role": "Maintainer" - } - ], - "support": { - "issues": "https://drupal.org/project/issues/config_sync", - "irc": "irc://irc.freenode.org/drupal-contribute", - "source": "https://cgit.drupalcode.org/config_sync" - }, - "require": { - "symfony/yaml": "~2.7.14|~2.8.7|~3.0.7|^3.1.1" - } -} diff --git a/web/modules/config_sync/config_sync.info.yml b/web/modules/config_sync/config_sync.info.yml deleted file mode 100644 index e985e36748..0000000000 --- a/web/modules/config_sync/config_sync.info.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: 'Configuration Synchronizer' -type: module -description: 'Synchronize your site with updated configuration provided by modules and themes.' -# core: 8.x -package: Config -configure: config_distro.import -dependencies: - - config_distro:config_distro - - config_filter:config_filter - - config_merge:config_merge - - 'config_provider:config_provider (>=8.x-2.x)' - - config_update:config_update - - 'drupal:system (>=8.3)' - -# Information added by Drupal.org packaging script on 2018-06-05 -version: '8.x-2.0-alpha6' -core: '8.x' -project: 'config_sync' -datestamp: 1528236791 diff --git a/web/modules/config_sync/config_sync.install b/web/modules/config_sync/config_sync.install deleted file mode 100644 index 65c648b159..0000000000 --- a/web/modules/config_sync/config_sync.install +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -/** - * @file - * Install, update and uninstall functions for the config_sync module. - */ - -/** - * Implements hook_install(). - * - * Takes a snapshot of configuration from extensions already installed on the - * site. - */ -function config_sync_install() { - \Drupal::service('config_sync.snapshotter')->createSnapshot(); -} diff --git a/web/modules/config_sync/config_sync.module b/web/modules/config_sync/config_sync.module deleted file mode 100644 index dc1f9c3e56..0000000000 --- a/web/modules/config_sync/config_sync.module +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -/** - * @file - * Manage synchronizing configuration from extensions. - */ - -use Drupal\config_sync\ConfigSyncSnapshotterInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Routing\RouteMatchInterface; - -/** - * Implements hook_help(). - */ -function config_sync_help($route_name, RouteMatchInterface $route_match) { - switch ($route_name) { - case 'help.page.config_sync': - $output = ''; - $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('The Configuration Synchronizer module provides a way to import configuration changes from updated modules and themes.') . '</p>'; - $output .= '<p>' . t('When you update to a new version of a module or theme, it may come with configuration changes. For example, if you previously installed an <em>Event</em> module that provided an <em>Event</em> content type and related fields, some of those fields may have changed in the new version, while new fields may have been added. With Configuration Synchronizer you can import those changes.') . '</p>'; - $output .= '<h3>' . t('Usage') . '</h3>'; - $output .= '<p>' . t('You can import available updates from your installed modules and themes on the <a href=":url">Distribution Updates</a> page.', array(':url' => \Drupal::url('config_distro.import'))) . ' </p>'; - return $output; - case 'config_distro.import': - $output = ''; - $output .= '<p>' . t('Any available configuration updates from installed modules or themes are displayed here.') . '</p>'; - $output .= '<p>' . t('If you\'re an advanced user, you may wish to use the checkboxes to select which modules and themes to run updates from. Running some updates while skipping others can lead to unexpected results and so should be done with caution.') . '</p>'; - $output .= '<p>' . t('Changes will be merged into the site\'s active configuration so as to retain any customizations you\'ve made. For example, if you\'ve edited the label of a field for which updates are available, that edit will be retained.') . '</p>'; - return $output; - } -} - -/** - * Implements hook_modules_installed(). - */ -function config_sync_modules_installed($module_names) { - \Drupal::service('config_sync.snapshotter')->refreshExtensionSnapshot('module', $module_names, ConfigSyncSnapshotterInterface::SNAPSHOT_MODE_INSTALL); -} - -/** - * Implements hook_themes_installed(). - */ -function config_sync_themes_installed($theme_names) { - \Drupal::service('config_sync.snapshotter')->refreshExtensionSnapshot('theme', $theme_names, ConfigSyncSnapshotterInterface::SNAPSHOT_MODE_INSTALL); -} diff --git a/web/modules/config_sync/config_sync.services.yml b/web/modules/config_sync/config_sync.services.yml deleted file mode 100644 index 9005c109cd..0000000000 --- a/web/modules/config_sync/config_sync.services.yml +++ /dev/null @@ -1,45 +0,0 @@ -services: - config_sync.snapshot_storage: - class: Drupal\Core\Config\DatabaseStorage - arguments: - - '@database' - - 'config_sync_snapshot_extension' - tags: - - { name: backend_overridable } - config_sync.snapshotter: - class: Drupal\config_sync\ConfigSyncSnapshotter - arguments: - - '@app.root' - - '@config_sync.collector' - - '@config_provider.storage' - - '@config_sync.snapshot_storage' - - '@config.manager' - config_sync.collector: - class: Drupal\config_sync\Plugin\SyncConfigCollector - arguments: - - '@config.factory' - - '@config.storage' - - '@config.manager' - - '@config_provider.storage' - - '@plugin.manager.config_provider.processor' - config_sync.lister: - class: Drupal\config_sync\ConfigSyncLister - arguments: - - '@config_sync.collector' - - '@config_update.config_list' - - '@config.storage' - - '@config_provider.storage' - - '@config_sync.snapshot_storage' - - '@config.manager' - config_sync_snapshot_subscriber: - class: Drupal\config_sync\EventSubscriber\ConfigSyncSnapshotSubscriber - tags: - - { name: event_subscriber } - arguments: - - '@config_sync.snapshotter' - - '@plugin.manager.config_filter' - - '@state' - config_sync.route_subscriber: - class: Drupal\config_sync\Routing\RouteSubscriber - tags: - - { name: event_subscriber } \ No newline at end of file diff --git a/web/modules/config_sync/drush.services.yml b/web/modules/config_sync/drush.services.yml deleted file mode 100644 index 171a3fc5d6..0000000000 --- a/web/modules/config_sync/drush.services.yml +++ /dev/null @@ -1,10 +0,0 @@ -services: - config_sync.commands: - class: \Drupal\config_sync\Commands\ConfigSyncCommands - arguments: - - '@config_sync.lister' - - '@config.storage' - - '@config.manager' - - '@config.import.commands' - tags: - - { name: drush.command } diff --git a/web/modules/config_sync/src/Commands/ConfigSyncCommands.php b/web/modules/config_sync/src/Commands/ConfigSyncCommands.php deleted file mode 100644 index 428da7e89c..0000000000 --- a/web/modules/config_sync/src/Commands/ConfigSyncCommands.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php - -namespace Drupal\config_sync\Commands; - -use Consolidation\OutputFormatters\StructuredData\RowsOfFields; -use Drupal\config_sync\ConfigSyncListerInterface; -use Drupal\Core\Config\ConfigManagerInterface; -use Drupal\Core\Config\StorageComparer; -use Drupal\Core\Config\StorageInterface; -use Drush\Commands\DrushCommands; -use Drush\Drupal\Commands\config\ConfigCommands; -use Drush\Drupal\Commands\config\ConfigImportCommands; -use Drush\Exceptions\UserAbortException; - -/** - * Drush integration for the Configuration Synchronizer module. - */ -class ConfigSyncCommands extends DrushCommands { - - /** - * The config synchronisation lister service. - * - * @var \Drupal\config_sync\ConfigSyncListerInterface - */ - protected $configSyncLister; - - /** - * The active configuration storage. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $activeStorage; - - /** - * The configuration manager. - * - * @var \Drupal\Core\Config\ConfigManagerInterface - */ - protected $configManager; - - /** - * The service containing Drush commands for regular core config imports. - * - * @var \Drush\Drupal\Commands\config\ConfigImportCommands - */ - protected $configImportCommands; - - /** - * Constructs a new ConfigSyncCommands object. - * - * @param \Drupal\config_sync\ConfigSyncListerInterface $configSyncLister - * The config synchronisation lister service. - * @param \Drupal\Core\Config\StorageInterface $activeStorage - * The active configuration storage. - * @param \Drupal\Core\Config\ConfigManagerInterface $configManager - * The configuration manager. - * @param \Drush\Drupal\Commands\config\ConfigImportCommands $configImportCommands - * The service containing Drush commands for regular core config imports. - */ - public function __construct(ConfigSyncListerInterface $configSyncLister, StorageInterface $activeStorage, ConfigManagerInterface $configManager, ConfigImportCommands $configImportCommands) { - parent::__construct(); - $this->configSyncLister = $configSyncLister; - $this->activeStorage = $activeStorage; - $this->configManager = $configManager; - $this->configImportCommands = $configImportCommands; - } - - /** - * Displays a list of all extensions with available configuration updates. - * - * @command config-sync-list-updates - * @usage drush config-sync-list-updates - * Display a list of all extensions with available configuration updates. - * @aliases cs-list - * @field-labels - * type: Operation type - * id: Config ID - * collection: Collection - * label: Label - * extension_type: Extension type - * extension: Extension - * @default-fields extension,type,label - * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields - */ - public function syncListUpdates($options = ['format' => 'table']) { - $rows = []; - foreach ($this->configSyncLister->getExtensionChangelists() as $extension_type => $extensions) { - foreach ($extensions as $extension_id => $collection_changelists) { - foreach ($collection_changelists as $collection => $operation_types) { - foreach ($operation_types as $operation_type => $configurations) { - foreach ($configurations as $config_id => $config_label) { - $rows[$config_id] = [ - 'type' => $operation_type, - 'id' => $config_id, - 'collection' => $collection === '' ? 'default' : $collection, - 'label' => $config_label, - 'extension_type' => $extension_type, - 'extension' => $extension_id, - ]; - } - } - } - } - } - - return new RowsOfFields($rows); - } - -} diff --git a/web/modules/config_sync/src/ConfigSyncLister.php b/web/modules/config_sync/src/ConfigSyncLister.php deleted file mode 100644 index 27a9ea6a93..0000000000 --- a/web/modules/config_sync/src/ConfigSyncLister.php +++ /dev/null @@ -1,221 +0,0 @@ -<?php - -namespace Drupal\config_sync; - -use Drupal\config_sync\Plugin\SyncConfigCollectorInterface; -use Drupal\config_update\ConfigListInterface as ConfigUpdateListerInterface; -use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Config\ConfigManagerInterface; -use Drupal\Core\Config\StorageComparer; -use Drupal\Core\Config\StorageInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Extension\Extension; -use Drupal\Core\StringTranslation\StringTranslationTrait; - -/** - * Provides methods related to listing configuration changes. - */ -class ConfigSyncLister implements ConfigSyncListerInterface { - - use StringTranslationTrait; - - /** - * The configuration collector. - * - * @var \Drupal\config_sync\Plugin\SyncConfigCollectorInterface - */ - protected $configCollector; - - /** - * The configuration update lister. - * - * @var \Drupal\config_update\ConfigListInterface - */ - protected $configUpdateLister; - - /** - * The active configuration storage. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $activeStorage; - - /** - * The provider configuration storage. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $providerStorage; - - /** - * The snapshot config storage for values from the extension storage. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $snapshotStorage; - - /** - * The configuration manager. - * - * @var \Drupal\Core\Config\ConfigManagerInterface - */ - protected $configManager; - - /** - * List of current config entity type labels, keyed by entity type. - * - * This is not set up until ConfigLister::listTypes() has been called. - * - * @var array - */ - protected $configTypes = []; - - /** - * Constructs a ConfigSyncLister object. - * - * @param \Drupal\config_sync\Plugin\SyncConfigCollectorInterface $config_collector - * The config collector. - * @param \Drupal\config_update\ConfigListInterface $config_update_lister - * The configuration update lister. - * @param \Drupal\Core\Config\StorageInterface $active_storage - * The active storage. - * @param \Drupal\Core\Config\StorageInterface $provider_storage - * The provider configuration storage. - * @param \Drupal\Core\Config\StorageInterface $snapshot_storage - * The snapshot storage for the items from the extension storage. - * @param \Drupal\Core\Config\ConfigManagerInterface $config_manager - * The configuration manager. - */ - public function __construct(SyncConfigCollectorInterface $config_collector, ConfigUpdateListerInterface $config_update_lister, StorageInterface $active_storage, StorageInterface $provider_storage, StorageInterface $snapshot_storage, ConfigManagerInterface $config_manager) { - $this->configCollector = $config_collector; - $this->configUpdateLister = $config_update_lister; - $this->activeStorage = $active_storage; - $this->providerStorage = $provider_storage; - $this->snapshotStorage = $snapshot_storage; - $this->configManager = $config_manager; - } - - /** - * {@inheritdoc} - */ - public function getExtensionChangelists(array $extension_names = []) { - $changelist = []; - // If no extensions were specified, use all installed extensions. - if (empty($extension_names)) { - $installed_extensions = $this->activeStorage->read('core.extension'); - foreach (array('module', 'theme') as $type) { - if (!empty($installed_extensions[$type])) { - $extension_names[$type] = array_keys($installed_extensions[$type]); - } - } - } - foreach ($extension_names as $type => $names) { - foreach ($names as $name) { - if ($extension_changelist = $this->getExtensionChangelist($type, $name)) { - $changelist[$type][$name] = $extension_changelist; - } - } - } - - return $changelist; - } - - /** - * {@inheritdoc} - */ - public function getExtensionChangelist($type, $name) { - $pathname = $this->drupalGetFilename($type, $name); - $extension = new Extension(\Drupal::root(), $type, $pathname); - $extensions = [ - $name => $extension, - ]; - - $this->configCollector->addInstallableConfig($extensions); - // Set up a storage comparer. - $storage_comparer = new StorageComparer( - $this->providerStorage, - $this->snapshotStorage, - $this->configManager - ); - - $return = []; - - if ($storage_comparer->createChangelist()->hasChanges()) { - foreach ($storage_comparer->getAllCollectionNames() as $collection) { - $changelist = $storage_comparer->getChangelist(NULL, $collection); - // We're only concerned with create and update lists. - unset($changelist['delete']); - unset($changelist['rename']); - $changelist = array_filter($changelist); - - // Convert the changelist into a format that includes the item label. - foreach ($changelist as $change_type => $item_names) { - foreach ($item_names as $item_name) { - $adjusted_change_type = $change_type; - // Check to ensure this item exists in the active configuration. If - // not, convert this to a 'create' change. This may occur, for - // example, where optional configuration that previously did not - // meet the criteria for installation now does. - if ($change_type === 'update' && !$this->activeStorage->read($item_name)) { - $adjusted_change_type = 'create'; - } - // Figure out what type of config it is, and get the ID. - $config_type = $this->configUpdateLister->getTypeNameByConfigName($item_name); - - if (!$config_type) { - // This is simple config. - $label = $item_name; - } - else { - $config = $this->providerStorage->read($item_name); - $definition = $this->configUpdateLister->getType($config_type); - $key = $definition->getKey('label') ?: $definition->getKey('id'); - $label = $config[$key]; - } - $return[$collection][$adjusted_change_type][$item_name] = $label; - } - } - } - } - - return $return; - } - - /** - * {@inheritdoc} - */ - public function listConfigTypes() { - if (empty($this->configTypes)) { - $definitions = $this->configUpdateLister->listTypes(); - $config_types = array_map(function (EntityTypeInterface $definition) { - return $definition->getLabel(); - }, $definitions); - $config_types['system_simple'] = $this->t('Simple configuration'); - // Sort the entity types by label. - uasort($config_types, 'strnatcasecmp'); - $this->configTypes = $config_types; - } - return $this->configTypes; - } - - /** - * Wraps the function drupal_get_filename(). - * - * @param $type - * The type of the item; one of 'core', 'profile', 'module', 'theme', or - * 'theme_engine'. - * @param $name - * The name of the item for which the filename is requested. Ignored for - * $type 'core'. - * @param $filename - * (Optional) The filename of the item if it is to be set explicitly rather - * than by consulting the database. - * - * @return - * The filename of the requested item or NULL if the item is not found. - */ - protected function drupalGetFilename($type, $name, $filename = NULL) { - return drupal_get_filename($type, $name, $filename); - } - -} diff --git a/web/modules/config_sync/src/ConfigSyncListerInterface.php b/web/modules/config_sync/src/ConfigSyncListerInterface.php deleted file mode 100644 index 96f97a1c0e..0000000000 --- a/web/modules/config_sync/src/ConfigSyncListerInterface.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -namespace Drupal\config_sync; - -/** - * Provides methods related to config listing. - */ -interface ConfigSyncListerInterface { - - /** - * Returns a change list for all installed extensions. - * - * @param array $extension_names - * Array with keys of extension types ('module', 'theme') and values arrays - * of extension names. - * - * @return array - * Associative array of configuration changes keyed by extension type - * (module or theme) in which values are arrays keyed by extension name. - */ - public function getExtensionChangelists(array $extension_names = []); - - /** - * Returns a change list for a given module or theme. - * - * @param string $type - * The type of extension (module or theme). - * @param string $name - * The machine name of the extension. - * - * @return array - * Associative array of configuration changes keyed by the type of change - * in which values are arrays of configuration item labels keyed by item - * name. - */ - public function getExtensionChangelist($type, $name); - -} diff --git a/web/modules/config_sync/src/ConfigSyncSnapshotter.php b/web/modules/config_sync/src/ConfigSyncSnapshotter.php deleted file mode 100644 index 68fa86b397..0000000000 --- a/web/modules/config_sync/src/ConfigSyncSnapshotter.php +++ /dev/null @@ -1,207 +0,0 @@ -<?php - -namespace Drupal\config_sync; - -use Drupal\config_provider\InMemoryStorage; -use Drupal\config_sync\Plugin\SyncConfigCollectorInterface; -use Drupal\Core\Config\ConfigManagerInterface; -use Drupal\Core\Config\StorageComparer; -use Drupal\Core\Config\StorageInterface; -use Drupal\Core\Extension\Extension; - -/** - * The ConfigSyncSnapshotter provides helper functions for taking snapshots of - * extension-provided configuration. - */ -class ConfigSyncSnapshotter implements ConfigSyncSnapshotterInterface { - - /** - * The app root for the current operation. - * - * @var string - */ - protected $root; - - /** - * The configuration collector. - * - * @var \Drupal\config_sync\Plugin\SyncConfigCollectorInterface - */ - protected $configCollector; - - /** - * The provider configuration storage. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $providerStorage; - - /** - * The snapshot config storage for values from the extension storage. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $snapshotStorage; - - /** - * The configuration manager. - * - * @var \Drupal\Core\Config\ConfigManagerInterface - */ - protected $configManager; - - /** - * Constructs a ConfigSyncSnapshotter object. - * - * @param string $root - * The app root. - * @param \Drupal\config_provider\Plugin\SyncConfigCollectorInterface $config_collector - * The config collector. - * @param \Drupal\Core\Config\StorageInterface $provider_storage - * The provider configuration storage. - * @param \Drupal\Core\Config\StorageInterface $snapshot_storage - * The snapshot storage for the items from the extension storage. - * @param \Drupal\Core\Config\ConfigManagerInterface $config_manager - * The configuration manager. - */ - public function __construct($root, SyncConfigCollectorInterface $config_collector, StorageInterface $provider_storage, StorageInterface $snapshot_storage, ConfigManagerInterface $config_manager) { - $this->root = $root; - $this->configCollector = $config_collector; - $this->providerStorage = $provider_storage; - $this->snapshotStorage = $snapshot_storage; - $this->configManager = $config_manager; - } - - /** - * {@inheritdoc} - */ - public function refreshExtensionSnapshot($type, array $names, $mode) { - $extensions = []; - foreach ($names as $name) { - $pathname = $this->drupalGetFilename($type, $name); - $extensions[$name] = new Extension($this->root, $type, $pathname); - } - - switch ($mode) { - case ConfigSyncSnapshotterInterface::SNAPSHOT_MODE_INSTALL: - // Take the snapshot in two stages. - // First, add the unaltered configuration. - $this->configCollector->addConfigForSnapshotting($extensions); - $this->saveSnapshotChanges(); - // Now alter the previously added configuration. - $this->configCollector->alterConfigForSnapshotting($extensions); - $this->saveSnapshotChanges(); - return; - case ConfigSyncSnapshotterInterface::SNAPSHOT_MODE_IMPORT: - // No special handling for alter on update since the item will already have - // been altered on install. - $this->configCollector->addInstallableConfig($extensions); - $this->saveSnapshotChanges(); - return; - } - } - - /** - * Saves changes from the provider storage to the snapshot storage. - */ - protected function saveSnapshotChanges() { - // Set up a storage comparer. - $storage_comparer = new StorageComparer( - $this->providerStorage, - $this->snapshotStorage, - $this->configManager - ); - $storage_comparer->createChangelist(); - - $changelist = $storage_comparer->getChangelist(); - - // Only add new or changed items. - foreach (['create', 'update'] as $changelist_type) { - if (isset($changelist[$changelist_type])) { - foreach ($changelist[$changelist_type] as $item_name) { - if ($provided_data = $this->providerStorage->read($item_name)) { - // Snapshot the configuration item as provided by the extension. - $this->snapshotStorage->write($item_name, $provided_data); - } - } - } - } - - // Snapshot collections as well. - foreach ($this->providerStorage->getAllCollectionNames() as $collection) { - $changelist = $storage_comparer->getChangelist(NULL, $collection); - $this->providerStorage = $this->providerStorage->createCollection($collection); - $snapshot_storage = $this->snapshotStorage->createCollection($collection); - - // Only add new or changed items. - foreach (['create', 'update'] as $changelist_type) { - if (isset($changelist[$changelist_type])) { - foreach ($changelist[$changelist_type] as $item_name) { - if ($provided_data = $this->providerStorage->read($item_name)) { - // Snapshot the configuration item as provided by the extension. - $snapshot_storage->write($item_name, $provided_data); - } - } - } - } - - } - - } - - /** - * {@inheritdoc} - */ - public function createSnapshot() { - // Take the snapshot in two stages. - // First, add the unaltered configuration. - $this->configCollector->addConfigForSnapshotting(); - $this->configManager->createSnapshot($this->providerStorage, $this->snapshotStorage); - // Now alter the previously added configuration. - $this->configCollector->alterConfigForSnapshotting(); - // Don't call ::createSnapshot() because we don't want to remove what we - // added in the first stage. - $this->copyStorage($this->providerStorage, $this->snapshotStorage); - } - - /** - * Copies the content of one storage to another. - * - * @param \Drupal\Core\Config\StorageInterface $source_storage - * The storage to synchronize configuration from. - * @param \Drupal\Core\Config\StorageInterface $snapshot_storage - * The storage to synchronize configuration to. - */ - protected function copyStorage($source_storage, $snapshot_storage) { - foreach ($source_storage->listAll() as $name) { - $snapshot_storage->write($name, $source_storage->read($name)); - } - // Copy collections as well. - foreach ($source_storage->getAllCollectionNames() as $collection) { - $source_collection = $source_storage->createCollection($collection); - $snapshot_collection = $snapshot_storage->createCollection($collection); - foreach ($source_collection->listAll() as $name) { - $snapshot_collection->write($name, $source_collection->read($name)); - } - } - } - - /** - * Wrapper for drupal_get_filename(). - * - * @param $type - * The type of the item; one of 'core', 'profile', 'module', 'theme', or - * 'theme_engine'. - * @param $name - * The name of the item for which the path is requested. Ignored for - * $type 'core'. - * - * @return string - * The path to the requested item or an empty string if the item is not - * found. - */ - protected function drupalGetFilename($type, $name) { - return drupal_get_filename($type, $name); - } - -} diff --git a/web/modules/config_sync/src/ConfigSyncSnapshotterInterface.php b/web/modules/config_sync/src/ConfigSyncSnapshotterInterface.php deleted file mode 100644 index 53d701bd27..0000000000 --- a/web/modules/config_sync/src/ConfigSyncSnapshotterInterface.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -namespace Drupal\config_sync; - -/** - * The ConfigSyncSnapshotter provides helper functions for taking snapshots of - * extension-provided configuration. - */ -interface ConfigSyncSnapshotterInterface { - - /** - * Install snapshot mode. - */ - const SNAPSHOT_MODE_INSTALL = 'install'; - - /** - * Import snapshot mode. - */ - const SNAPSHOT_MODE_IMPORT = 'import'; - - /** - * Takes a snapshot of configuration from specified modules or themes. - * - * Only new or changed items are added. - * - * @param string $type - * The type of extension to snapshot. - * @param array $names - * An array of extension names. - * @param string $mode - * The snapshot mode. Valid values are: - * - \Drupal\config_sync\ConfigSyncSnapshotterInterface::SNAPSHOT_MODE_INSTALL - * - \Drupal\config_sync\ConfigSyncSnapshotterInterface::SNAPSHOT_MODE_IMPORT - */ - public function refreshExtensionSnapshot($type, array $names, $mode); - - /** - * Takes a snapshot of configuration from all installed modules and themes. - */ - public function createSnapshot(); - -} diff --git a/web/modules/config_sync/src/EventSubscriber/ConfigSyncSnapshotSubscriber.php b/web/modules/config_sync/src/EventSubscriber/ConfigSyncSnapshotSubscriber.php deleted file mode 100644 index 5c8d5aa116..0000000000 --- a/web/modules/config_sync/src/EventSubscriber/ConfigSyncSnapshotSubscriber.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -namespace Drupal\config_sync\EventSubscriber; - -use Drupal\config_distro\Event\ConfigDistroEvents; -use Drupal\config_filter\ConfigFilterManagerInterface; -use Drupal\config_sync\Plugin\ConfigFilter\SyncFilter; -use Drupal\config_sync\ConfigSyncSnapshotterInterface; -use Drupal\Core\State\StateInterface; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Updates the snapshot when config is imported. - */ -class ConfigSyncSnapshotSubscriber implements EventSubscriberInterface { - - /** - * The snapshotter. - * - * @var \Drupal\config_sync\ConfigSyncSnapshotterInterface - */ - protected $snapshotter; - - /** - * The filter manager. - * - * @var \Drupal\config_filter\ConfigFilterManagerInterface - */ - protected $configFilterManager; - - /** - * The state storage object. - * - * @var \Drupal\Core\State\StateInterface - */ - protected $state; - - /** - * Constructs the ConfigSnapshotSubscriber object. - * - * @param \Drupal\config_sync\ConfigSyncSnapshotterInterface $snapshotter - * The snapshotter. - * @param \Drupal\config_filter\ConfigFilterManagerInterface $config_filter_manager - * The filter manager. - * @param \Drupal\Core\State\StateInterface $state - * The state storage object. - */ - public function __construct(ConfigSyncSnapshotterInterface $snapshotter, ConfigFilterManagerInterface $config_filter_manager, StateInterface $state) { - $this->snapshotter = $snapshotter; - $this->configFilterManager = $config_filter_manager; - $this->state = $state; - } - - /** - * Refreshes the snapshot for extensions whose updates were imported. - * - * @param \Drupal\Core\Config\ConfigImporterEvent $event - * The Event to process. - */ - public function onConfigDistroImport(Event $event) { - $filters = $this->configFilterManager->getDefinitions(); - $extensions = []; - // There is a filter for each extension that had updates. - foreach ($filters as $filter) { - // Only process our own filters. - if (($filter['provider'] === 'config_sync') && - // The updates were imported if the filter was enabled. - $filter['status'] && - // We're only responding to events for filters using the storage - // provided by config_distro. - in_array('config_distro.storage.distro', $filter['storages'])) { - $extensions[$filter['extension_type']][] = $filter['extension_name']; - } - } - - foreach ($extensions as $type => $names) { - $this->snapshotter->refreshExtensionSnapshot($type, $names, ConfigSyncSnapshotterInterface::SNAPSHOT_MODE_IMPORT); - } - - // Clear data on previously-selected plugins. - $this->state->delete('config_sync.plugins'); - $this->configFilterManager->clearCachedDefinitions(); - } - - /** - * Registers the methods in this class that should be listeners. - * - * @return array - * An array of event listener definitions. - */ - public static function getSubscribedEvents() { - $events[ConfigDistroEvents::IMPORT][] = ['onConfigDistroImport', 40]; - return $events; - } - -} diff --git a/web/modules/config_sync/src/Form/ConfigSyncImportForm.php b/web/modules/config_sync/src/Form/ConfigSyncImportForm.php deleted file mode 100644 index f6c06946fc..0000000000 --- a/web/modules/config_sync/src/Form/ConfigSyncImportForm.php +++ /dev/null @@ -1,369 +0,0 @@ -<?php - -namespace Drupal\config_sync\Form; - -use Drupal\config_distro\Form\ConfigDistroImportForm; -use Drupal\Core\Config\StorageInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\Core\Url; -use Symfony\Component\DependencyInjection\ContainerInterface; - -class ConfigSyncImportForm extends ConfigDistroImportForm { - - use StringTranslationTrait; - - /** - * The configuration synchronizer lister. - * - * @var \Drupal\config_sync\configSyncListerInterface - */ - protected $configSyncLister; - - /** - * The configuration update lister. - * - * @var \Drupal\config_update\ConfigListInterface - */ - protected $configUpdateLister; - - /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * The theme handler. - * - * @var \Drupal\Core\Extension\ThemeHandlerInterface - */ - protected $themeHandler; - - /** - * The state storage object. - * - * @var \Drupal\Core\State\StateInterface - */ - protected $state; - - /** - * The filter manager. - * - * @var \Drupal\config_filter\ConfigFilterManagerInterface - */ - protected $configFilterManager; - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - $class = parent::create($container); - $class->configSyncLister = $container->get('config_sync.lister'); - $class->configUpdateLister = $container->get('config_update.config_list'); - $class->moduleHandler = $container->get('module_handler'); - $class->themeHandler = $container->get('theme_handler'); - $class->state = $container->get('state'); - $class->configFilterManager = $container->get('plugin.manager.config_filter'); - return $class; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - // Ensure the filters reflect the current state of the file system. - $this->configFilterManager->clearCachedDefinitions(); - $form = parent::buildForm($form, $form_state); - - // Transform the UI to one based on our changelists. - if ($changelists = $this->configSyncLister->getExtensionChangelists()) { - // Create a wrapper for the classic UI provided by core. - $form['classic'] = [ - '#type' => 'details', - '#title' => $this->t('Classic version of configuration change listings'), - '#weight' => 10, - ]; - - // For each collection, move the original listings coming from core's - // form. - foreach ($this->getAllChangelistCollections($changelists) as $collection) { - if (isset($form[$collection])) { - $form['classic'][$collection] = $form[$collection]; - unset($form[$collection]); - } - } - - $form['config_sync'] = [ - '#type' => 'container', - ]; - foreach ($changelists as $type => $extension_changelists) { - $form['config_sync'][$type] = $this->buildUpdatesListing($type, $extension_changelists); - } - - if (!empty($form['actions']['submit'])) { - $form['actions']['submit']['#value'] = $this->t('Import'); - } - } - - return $form; - } - - - /** - * Returns a list of collections for a given set of changelists. - * - * @param array $changelists - * A set of changelists. - * - * @return array - * An array of collection names. - */ - protected function getAllChangelistCollections(array $changelists) { - $collections = []; - - foreach ($changelists as $extension_changelists) { - foreach ($extension_changelists as $collection_changelists) { - $collections = array_unique(array_merge($collections, array_keys($collection_changelists))); - } - } - - return $collections; - } - - /** - * Builds the portion of the form showing a listing of updates. - * - * @param string $type - * The type of extension (module or theme). - * @param array $extension_changelists - * Associative array of configuration changes keyed by extension name. - * - * @return array - * A render array of a form element. - */ - protected function buildUpdatesListing($type, array $extension_changelists) { - $plugin_data = $this->state->get('config_sync.plugins_previous'); - - $type_labels = [ - 'module' => $this->t('Module'), - 'theme' => $this->t('Theme'), - ]; - $header = [ - 'name' => [ - 'data' => $this->t('@type name', ['@type' => $type_labels[$type]]), - ], - 'details' => [ - 'data' => $this->t('Available configuration changes'), 'class' => [RESPONSIVE_PRIORITY_LOW], - ], - ]; - - $options = []; - $default_value = []; - - foreach ($extension_changelists as $name => $collection_changelists) { - $options[$name] = $this->buildExtensionDetail($type, $name, $collection_changelists); - // Status can be overridden in the state. - $default_value[$name] = !isset($plugin_data[$type][$name]['status']) || ($plugin_data[$type][$name]['status'] === TRUE); - } - $element = [ - '#type' => 'tableselect', - '#header' => $header, - '#options' => $options, - '#multiple' => TRUE, - '#attributes' => ['class' => ['config-sync-listing']], - '#default_value' => $default_value, - ]; - - return $element; - } - - /** - * Builds the details of a package. - * - * @param string $type - * The type of extension (module or theme). - * @param string $name - * The machine name of the extension. - * @param array $collection_changelists - * Associative array of configuration changes keyed by the type of change. - * @param string $collection - * The configuration collection. - * - * @return array - * A render array of a form element. - */ - protected function buildExtensionDetail($type, $name, $collection_changelists) { - switch ($type) { - case 'module': - $label = $this->moduleHandler->getName($name); - break; - case 'theme': - $label = $this->themeHandler->getName($name); - break; - } - - $element['name'] = [ - 'data' => [ - '#type' => 'html_tag', - '#tag' => 'h3', - '#value' => $label, - ], - 'class' => ['config-sync-extension-name'], - ]; - - foreach ($collection_changelists as $collection => $changelist) { - $extension_config = []; - foreach (['create', 'update'] as $change_type) { - if (isset($changelist[$change_type])) { - $extension_config[$change_type] = []; - foreach ($changelist[$change_type] as $item_name => $item_label) { - $config_type = $this->configUpdateLister->getTypeNameByConfigName($item_name); - if (!$config_type) { - $config_type = 'system_simple'; - } - - if ($change_type == 'rename') { - $names = $storage_comparer->extractRenameNames($item_name); - $route_options = array('source_name' => $names['old_name'], 'target_name' => $names['new_name']); - } - else { - $route_options = array('source_name' => $item_name); - } - if ($collection != StorageInterface::DEFAULT_COLLECTION) { - $route_name = 'config_distro.diff_collection'; - $route_options['collection'] = $collection; - } - else { - $route_name = 'config_distro.diff'; - } - if (!isset($extension_config[$change_type][$config_type])) { - $extension_config[$change_type][$config_type] = []; - } - $extension_config[$change_type][$config_type][$item_name] = [ - '#type' => 'link', - '#title' => $item_label, - '#url' => Url::fromRoute($route_name, $route_options), - '#options' => [ - 'attributes' => [ - 'class' => ['use-ajax'], - 'data-dialog-type' => 'modal', - 'data-dialog-options' => json_encode([ - 'width' => 700 - ]), - ], - ], - ]; - } - } - } - - $rows = []; - - if ($collection !== StorageInterface::DEFAULT_COLLECTION) { - $rows[] = [ - [ - 'data' => [ - '#type' => 'html_tag', - '#tag' => 'h2', - '#value' => $this->t('@collection configuration collection', ['@collection' => $collection]), - '#colspan' => 2, - ], - ], - ]; - } - - $change_type_labels = [ - // Match the labels used by core. - // @see ConfigSync::buildForm(). - 'create' => $this->t('New'), - 'update' => $this->t('Changed'), - ]; - - // List config types for order. - $config_types = $this->configSyncLister->listConfigTypes(); - - foreach ($extension_config as $change_type => $change_type_data) { - $rows[] = [ - [ - 'data' => [ - '#type' => 'html_tag', - '#tag' => 'strong', - '#value' => $change_type_labels[$change_type], - ], - ], - [ - 'data' => [ - '#type' => 'html_tag', - '#tag' => 'strong', - '#value' => $this->t('View differences'), - ], - ], - ]; - - foreach ($config_types as $config_type => $config_type_label) { - if (isset($change_type_data[$config_type])) { - $row = []; - $row[] = [ - 'data' => [ - '#type' => 'html_tag', - '#tag' => 'span', - '#value' => $config_type_label, - '#attributes' => [ - 'title' => $config_type, - 'class' => ['config-sync-item-type-label'], - ], - ], - ]; - $row[] = [ - 'data' => [ - '#theme' => 'item_list', - '#items' => $change_type_data[$config_type], - '#context' => [ - 'list_style' => 'comma-list', - ], - ], - 'class' => ['item'], - ]; - $rows[] = $row; - } - } - } - - } - - $element['details'] = [ - 'data' => [ - '#type' => 'table', - '#rows' => $rows, - ], - ]; - - return $element; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // Save data on selected modules and themes to the system state. - $plugin_data = []; - foreach (['module', 'theme'] as $type) { - if ($names = $form_state->getValue($type)) { - // Convert data to boolean values. - array_walk($names, function($value, $key) use($type, &$plugin_data) { - $value = (bool) $value; - $plugin_data[$type][$key]['status'] = $value; - }); - } - } - - $this->state->set('config_sync.plugins', $plugin_data); - $this->state->set('config_sync.plugins_previous', $plugin_data); - $this->configFilterManager->clearCachedDefinitions(); - - parent::submitForm($form, $form_state); - } - -} diff --git a/web/modules/config_sync/src/Plugin/ConfigFilter/SyncFilter.php b/web/modules/config_sync/src/Plugin/ConfigFilter/SyncFilter.php deleted file mode 100644 index 0b0a3b6839..0000000000 --- a/web/modules/config_sync/src/Plugin/ConfigFilter/SyncFilter.php +++ /dev/null @@ -1,212 +0,0 @@ -<?php - -namespace Drupal\config_sync\Plugin\ConfigFilter; - -use Drupal\config_filter\Plugin\ConfigFilterBase; -use Drupal\config_merge\ConfigMerger; -use Drupal\config_provider\InMemoryStorage; -use Drupal\config_sync\ConfigSyncListerInterface; -use Drupal\Core\Config\ConfigManagerInterface; -use Drupal\Core\Config\StorageInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides a sync filter that brings in updates from installed extensions. - * - * @ConfigFilter( - * id = "config_sync", - * label = "Config Sync", - * storages = {"config_distro.storage.distro"}, - * weight = 10, - * deriver = "\Drupal\config_sync\Plugin\ConfigFilter\SyncFilterDeriver" - * ) - */ -class SyncFilter extends ConfigFilterBase implements ContainerFactoryPluginInterface { - - /** - * The sync source configuration storage. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $syncSourceStorage; - - /** - * Constructs a new SyncFilter. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param array $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Config\StorageInterface $sync_source_storage - * The sync source configuration storage. - */ - public function __construct(array $configuration, $plugin_id, array $plugin_definition, StorageInterface $sync_source_storage) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->syncSourceStorage = $sync_source_storage; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - $sync_source_storage = self::initSyncSourceStorage( - $configuration, - $container->get('config_sync.lister'), - $container->get('config_sync.snapshot_storage'), - $container->get('config_provider.storage'), - $container->get('config.storage') - ); - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $sync_source_storage - ); - } - - /** - * Initializes the sync source storage. - * - * @param array $configuration - * The plugin configuration. - * @param \Drupal\Core\Config\StorageInterface $snapshot_storage - * The snapshot extension storage. - * @param \Drupal\Core\Config\StorageInterface $provider_storage - * The configuration provider storage. - * @param \Drupal\Core\Config\StorageInterface $active_storage - * The active configuration storage. - * - * @return \Drupal\Core\Config\StorageInterface - * The initialised sync source storage - */ - protected static function initSyncSourceStorage(array $configuration, ConfigSyncListerInterface $config_sync_lister, StorageInterface $snapshot_storage, StorageInterface $provider_storage, StorageInterface $active_storage) { - $changelists = $config_sync_lister->getExtensionChangelist($configuration['extension_type'], $configuration['extension_name']); - $sync_source_storage = new InMemoryStorage(); - - foreach ($changelists as $collection => $changelist) { - // Ensure storages are using the specified collection. - foreach (['snapshot', 'provider', 'active', 'sync_source'] as $storage_prefix) { - if ($collection !== ${$storage_prefix . '_storage'}->getCollectionName()) { - ${$storage_prefix . '_storage'} = ${$storage_prefix . '_storage'}->getCollection($collection); - } - } - // Process changes. - if (!empty($changelist['create'])) { - // To create, we simply save the new item to the merge storage. - foreach (array_keys($changelist['create']) as $item_name) { - $sync_source_storage->write($item_name, $provider_storage->read($item_name)); - } - } - // Process update changes. - if (!empty($changelist['update'])) { - $config_merger = new ConfigMerger(); - // To update, we merge the value into that of the active storage. - foreach (array_keys($changelist['update']) as $item_name) { - $current = $provider_storage->read($item_name); - $previous = $snapshot_storage->read($item_name); - $active = $active_storage->read($item_name); - $merged = $config_merger->mergeConfigItemStates($previous, $current, $active); - - $sync_source_storage->write($item_name, $merged); - } - } - } - - return $sync_source_storage; - } - - /** - * Reads from the sync source configuration. - * - * @param string $name - * The name of the configuration to read. - * @param mixed $data - * The data to be filtered. - * - * @return mixed - * The data filtered or read from the sync source storage. - */ - protected function syncSourceStorageRead($name, $data) { - if ($sync = $this->syncSourceStorage->read($name)) { - if (!isset($sync['_core']) && !empty($data['_core'])) { - // Merge in uuid and _core while retaining the key order. - $merged = array_replace($data, $sync); - $sync = array_intersect_key($merged, array_flip(array_merge(array_keys($sync), ['uuid', '_core']))); - } - return $sync; - } - - return $data; - } - - /** - * Reads multiple from the sync source storage. - * - * @param array $names - * The names of the configuration to read. - * @param array $data - * The data to filter. - * - * @return array - * The new data. - */ - protected function syncSourceStorageReadMultiple(array $names, array $data) { - $filtered_data = []; - foreach ($names as $name) { - $filtered_data[$name] = $this->syncSourceStorageRead($name, isset($data[$name]) ? $data[$name] : []); - } - - return $filtered_data; - } - - /** - * {@inheritdoc} - */ - public function filterRead($name, $data) { - return $this->syncSourceStorageRead($name, $data); - } - - /** - * {@inheritdoc} - */ - public function filterExists($name, $exists) { - return $exists || $this->syncSourceStorage->exists($name); - } - - /** - * {@inheritdoc} - */ - public function filterReadMultiple(array $names, array $data) { - $sync_data = $this->syncSourceStorageReadMultiple($names, $data); - - // Return the data with merged in sync source data. - return array_merge($data, $sync_data); - } - - /** - * {@inheritdoc} - */ - public function filterListAll($prefix, array $data) { - $sync_names = $this->syncSourceStorage->listAll($prefix); - - return array_unique(array_merge($data, $sync_names)); - } - - /** - * {@inheritdoc} - */ - public function filterCreateCollection($collection) { - return new static($this->configuration, $this->pluginId, $this->pluginDefinition, $this->syncSourceStorage->createCollection($collection)); - } - - /** - * {@inheritdoc} - */ - public function filterGetAllCollectionNames(array $collections) { - return array_merge($collections, $this->syncSourceStorage->getAllCollectionNames()); - } - -} diff --git a/web/modules/config_sync/src/Plugin/ConfigFilter/SyncFilterDeriver.php b/web/modules/config_sync/src/Plugin/ConfigFilter/SyncFilterDeriver.php deleted file mode 100644 index 6cfadcb917..0000000000 --- a/web/modules/config_sync/src/Plugin/ConfigFilter/SyncFilterDeriver.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -namespace Drupal\config_sync\Plugin\ConfigFilter; - -use Drupal\config_sync\ConfigSyncListerInterface; -use Drupal\Component\Plugin\Derivative\DeriverBase; -use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Extension\ThemeHandlerInterface; -use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; -use Drupal\Core\State\StateInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Deriver for SyncFilter filters. - */ -class SyncFilterDeriver extends DeriverBase implements ContainerDeriverInterface { - - use StringTranslationTrait; - - /** - * The configuration synchronizer lister. - * - * @var \Drupal\config_sync\configSyncListerInterface - */ - protected $configSyncLister; - - /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * The theme handler. - * - * @var \Drupal\Core\Extension\ThemeHandlerInterface - */ - protected $themeHandler; - - /** - * The state storage object. - * - * @var \Drupal\Core\State\StateInterface - */ - protected $state; - - /** - * SyncFilter constructor. - * - * @param \Drupal\config_sync\ConfigSyncListerInterface $config_sync_lister - * The configuration synchronizer lister. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler. - * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler - * The theme handler. - * @param \Drupal\Core\State\StateInterface $state - * The state storage object. - */ - public function __construct(ConfigSyncListerInterface $config_sync_lister, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, StateInterface $state) { - $this->configSyncLister = $config_sync_lister; - $this->moduleHandler = $module_handler; - $this->themeHandler = $theme_handler; - $this->state = $state; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, $base_plugin_id) { - return new static( - $container->get('config_sync.lister'), - $container->get('module_handler'), - $container->get('theme_handler'), - $container->get('state') - ); - } - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinitions($base_plugin_definition) { - $plugin_data = $this->state->get('config_sync.plugins'); - $type_labels = [ - 'module' => $this->t('Module'), - 'theme' => $this->t('Theme'), - ]; - foreach ($this->configSyncLister->getExtensionChangelists() as $type => $extension_changelists) { - foreach (array_keys($extension_changelists) as $name) { - $key = $type . '_' . $name; - $this->derivatives[$key] = $base_plugin_definition; - $this->derivatives[$key]['extension_type'] = $type; - $this->derivatives[$key]['extension_name'] = $name; - switch ($type) { - case 'module': - $label = $this->moduleHandler->getName($name); - $type_label = $this->t('Module'); - break; - case 'theme': - $label = $this->themeHandler->getName($name); - $type_label = $this->t('Theme'); - break; - } - $this->derivatives[$key]['label'] = $this->t('@type_label: @label', ['@type_label' => $type_label, '@label' => $label]); - // Status can be overridden in the state. - $this->derivatives[$key]['status'] = !isset($plugin_data[$type][$name]['status']) || ($plugin_data[$type][$name]['status'] === TRUE); - } - } - - return $this->derivatives; - } - -} diff --git a/web/modules/config_sync/src/Plugin/SyncConfigCollector.php b/web/modules/config_sync/src/Plugin/SyncConfigCollector.php deleted file mode 100644 index 26dd758b17..0000000000 --- a/web/modules/config_sync/src/Plugin/SyncConfigCollector.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -namespace Drupal\config_sync\Plugin; - -use Drupal\config_provider\Plugin\ConfigCollector; - -/** - * Class for invoking configuration providers. - */ -class SyncConfigCollector extends ConfigCollector implements SyncConfigCollectorInterface { - - /** - * {@inheritdoc} - */ - public function addConfigForSnapshotting(array $extensions = []) { - /* @var \Drupal\config_provider\Plugin\ConfigProviderInterface[] $providers */ - $providers = $this->getConfigProviders(); - - foreach ($providers as $provider) { - if (!$provider instanceof SyncConfigProviderInterface) { - $provider->addInstallableConfig($extensions); - } - } - } - - /** - * {@inheritdoc} - */ - public function alterConfigForSnapshotting(array $extensions = []) { - /* @var \Drupal\config_provider\Plugin\ConfigProviderInterface[] $providers */ - $providers = $this->getConfigProviders(); - - foreach ($providers as $provider) { - if ($provider instanceof SyncConfigProviderInterface) { - $provider->alterConfigForSnapshotting($extensions); - } - } - } - -} diff --git a/web/modules/config_sync/src/Plugin/SyncConfigCollectorInterface.php b/web/modules/config_sync/src/Plugin/SyncConfigCollectorInterface.php deleted file mode 100644 index c125919a91..0000000000 --- a/web/modules/config_sync/src/Plugin/SyncConfigCollectorInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Drupal\config_sync\Plugin; - -use Drupal\config_provider\Plugin\ConfigCollectorInterface; - -/** - * Class for invoking configuration providers. - */ -interface SyncConfigCollectorInterface extends ConfigCollectorInterface { - - /** - * Adds configuration for snapshotting. - * - * Call this method instead of ::addInstallableConfig() to add only unaltered - * configuration. - * - * @param \Drupal\Core\Extension\Extension[] $extensions - * (Optional) An associative array of Extension objects, keyed by extension - * name. If provided, data loaded will be limited to these extensions. - */ - public function addConfigForSnapshotting(array $extensions = []); - - /** - * Alters configuration for snapshotting. - * - * In certain cases, the configuration suitable for snapshotting will differ - * from that suitable for comparing to a snapshot. The snapshot should - * reflect the current installed state. If alters are in effect, the - * snapshot should be updated accordingly as a new module is installed or - * updated. - * - * @param \Drupal\Core\Extension\Extension[] $extensions - * (Optional) An associative array of Extension objects, keyed by extension - * name. If provided, data loaded will be limited to these extensions. - */ - public function alterConfigForSnapshotting(array $extensions = []); - -} diff --git a/web/modules/config_sync/src/Plugin/SyncConfigProviderInterface.php b/web/modules/config_sync/src/Plugin/SyncConfigProviderInterface.php deleted file mode 100644 index 57f10330e0..0000000000 --- a/web/modules/config_sync/src/Plugin/SyncConfigProviderInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -namespace Drupal\config_sync\Plugin; - -use Drupal\config_provider\InMemoryStorage; -use Drupal\config_provider\Plugin\ConfigProviderInterface; - -/** - * Class for invoking configuration providers for snapshotting. - */ -interface SyncConfigProviderInterface extends ConfigProviderInterface { - - /** - * Alters configuration to be used for snapshotting. - * - * Not intended to be called an install time, this method instead facilitates - * determining what configuration updates are available. - * - * Implementing plugins should write configuration as appropriate to the - * ::providerStorage storage. - * - * @param \Drupal\Core\Extension\Extension[] $extensions - * (Optional) An associative array of Extension objects, keyed by extension - * name. If provided, data loaded will be limited to these extensions. - * - * @see \Drupal\config_provider\Plugin\ConfigProviderInterface\addInstallableConfig() - */ - public function alterConfigForSnapshotting(array $extensions = []); - -} diff --git a/web/modules/config_sync/src/Routing/RouteSubscriber.php b/web/modules/config_sync/src/Routing/RouteSubscriber.php deleted file mode 100644 index e1597c8c8f..0000000000 --- a/web/modules/config_sync/src/Routing/RouteSubscriber.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -namespace Drupal\config_sync\Routing; - -use Drupal\Core\Routing\RouteSubscriberBase; -use Symfony\Component\Routing\RouteCollection; - -/** - * Listens to the dynamic route events. - */ -class RouteSubscriber extends RouteSubscriberBase { - - /** - * {@inheritdoc} - */ - protected function alterRoutes(RouteCollection $collection) { - // Use our form for distribution imports. - if ($route = $collection->get('config_distro.import')) { - $route->setDefault('_form', '\Drupal\config_sync\Form\ConfigSyncImportForm'); - } - } - -} -- GitLab