From 195fb9a359eb5a81900dda7e4a62576448f4684a Mon Sep 17 00:00:00 2001 From: Brian Weaver <weaver.299@osu.edu> Date: Tue, 11 May 2021 13:56:00 -0400 Subject: [PATCH] Remove config_installer --- composer.json | 1 - composer.lock | 45 +-- vendor/composer/InstalledVersions.php | 13 +- vendor/composer/installed.json | 49 --- vendor/composer/installed.php | 13 +- .../contrib/config_installer/LICENSE.txt | 339 ----------------- .../contrib/config_installer/README.md | 72 ---- .../config_installer.info.yml | 12 - .../config_installer/config_installer.install | 20 - .../config_installer/config_installer.profile | 353 ------------------ .../src/Form/SiteConfigureForm.php | 236 ------------ .../src/Form/SyncConfigureForm.php | 220 ----------- .../src/Storage/SourceStorage.php | 144 ------- .../src/Tests/ConfigInstallerEnSecondTest.php | 77 ---- .../ConfigInstallerFrDirectorySyncTest.php | 80 ---- .../Tests/ConfigInstallerFrTarballTest.php | 74 ---- ...InstallerNestedDependenciesProfileTest.php | 56 --- ...nfigInstallerNoDependenciesProfileTest.php | 37 -- .../src/Tests/ConfigInstallerSyncTest.php | 70 ---- .../src/Tests/ConfigInstallerTarballTest.php | 35 -- .../src/Tests/ConfigInstallerTestBase.php | 210 ----------- .../Tests/UninstalledProfileModulesTest.php | 45 --- 22 files changed, 5 insertions(+), 2196 deletions(-) delete mode 100644 web/profiles/contrib/config_installer/LICENSE.txt delete mode 100644 web/profiles/contrib/config_installer/README.md delete mode 100644 web/profiles/contrib/config_installer/config_installer.info.yml delete mode 100644 web/profiles/contrib/config_installer/config_installer.install delete mode 100644 web/profiles/contrib/config_installer/config_installer.profile delete mode 100644 web/profiles/contrib/config_installer/src/Form/SiteConfigureForm.php delete mode 100644 web/profiles/contrib/config_installer/src/Form/SyncConfigureForm.php delete mode 100644 web/profiles/contrib/config_installer/src/Storage/SourceStorage.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/ConfigInstallerEnSecondTest.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/ConfigInstallerFrDirectorySyncTest.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/ConfigInstallerFrTarballTest.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/ConfigInstallerNestedDependenciesProfileTest.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/ConfigInstallerNoDependenciesProfileTest.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/ConfigInstallerSyncTest.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/ConfigInstallerTarballTest.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/ConfigInstallerTestBase.php delete mode 100644 web/profiles/contrib/config_installer/src/Tests/UninstalledProfileModulesTest.php diff --git a/composer.json b/composer.json index fea0dc101c..7d73ef0525 100644 --- a/composer.json +++ b/composer.json @@ -100,7 +100,6 @@ "drupal/ckeditor_indentblock": "1.0.0-beta2", "drupal/config_direct_save": "2.1", "drupal/config_ignore": "2.3", - "drupal/config_installer": "1.8", "drupal/config_update": "1.7", "drupal/console": "1.9.7", "drupal/content_access": "1.0-alpha3", diff --git a/composer.lock b/composer.lock index 1ee2ae1b6e..04e28c240a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "001c1eae2c187f29ccc796632ebff4dd", + "content-hash": "140f57e2083e550cfd33901994e0bbf8", "packages": [ { "name": "alchemy/zippy", @@ -2895,49 +2895,6 @@ "irc": "irc://irc.freenode.org/drupal-contribute" } }, - { - "name": "drupal/config_installer", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/config_installer.git", - "reference": "8.x-1.8" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.8.zip", - "reference": "8.x-1.8", - "shasum": "43d7af76a3f00d074161e242ddf94d942d256250" - }, - "require": { - "drupal/core": "~8.0" - }, - "type": "drupal-profile", - "extra": { - "drupal": { - "version": "8.x-1.8", - "datestamp": "1524572284", - "security-coverage": { - "status": "covered", - "message": "Covered by Drupal's security advisory policy" - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "alexpott", - "homepage": "https://www.drupal.org/user/157725" - } - ], - "homepage": "https://www.drupal.org/project/config_installer", - "support": { - "source": "https://git.drupalcode.org/project/config_installer" - } - }, { "name": "drupal/config_update", "version": "1.7.0", diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 613816230d..8b6a299b2c 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -30,7 +30,7 @@ class InstalledVersions 'aliases' => array ( ), - 'reference' => 'c35d10c1342ba61e69db11e499f85dd0b8acdd9f', + 'reference' => '6fd6a97f4c74f5ed4a341bbff84477a2650d3a78', 'name' => 'osu-asc-webservices/d8-upstream', ), 'versions' => @@ -598,15 +598,6 @@ class InstalledVersions ), 'reference' => '8.x-2.3', ), - 'drupal/config_installer' => - array ( - 'pretty_version' => '1.8.0', - 'version' => '1.8.0.0', - 'aliases' => - array ( - ), - 'reference' => '8.x-1.8', - ), 'drupal/config_translation' => array ( 'replaced' => @@ -2305,7 +2296,7 @@ class InstalledVersions 'aliases' => array ( ), - 'reference' => 'c35d10c1342ba61e69db11e499f85dd0b8acdd9f', + 'reference' => '6fd6a97f4c74f5ed4a341bbff84477a2650d3a78', ), 'pantheon-systems/quicksilver-pushback' => array ( diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index d9f169501f..b5ee03d7bd 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2929,55 +2929,6 @@ }, "install-path": "../../web/modules/config_ignore" }, - { - "name": "drupal/config_installer", - "version": "1.8.0", - "version_normalized": "1.8.0.0", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/config_installer.git", - "reference": "8.x-1.8" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_installer-8.x-1.8.zip", - "reference": "8.x-1.8", - "shasum": "43d7af76a3f00d074161e242ddf94d942d256250" - }, - "require": { - "drupal/core": "~8.0" - }, - "type": "drupal-profile", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.8", - "datestamp": "1524572284", - "security-coverage": { - "status": "covered", - "message": "Covered by Drupal's security advisory policy" - } - } - }, - "installation-source": "dist", - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "alexpott", - "homepage": "https://www.drupal.org/user/157725" - } - ], - "homepage": "https://www.drupal.org/project/config_installer", - "support": { - "source": "http://cgit.drupalcode.org/config_installer" - }, - "install-path": "../../web/profiles/contrib/config_installer" - }, { "name": "drupal/config_update", "version": "1.7.0", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index fb9eba9172..3d39cc0516 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -6,7 +6,7 @@ 'aliases' => array ( ), - 'reference' => 'c35d10c1342ba61e69db11e499f85dd0b8acdd9f', + 'reference' => '6fd6a97f4c74f5ed4a341bbff84477a2650d3a78', 'name' => 'osu-asc-webservices/d8-upstream', ), 'versions' => @@ -574,15 +574,6 @@ ), 'reference' => '8.x-2.3', ), - 'drupal/config_installer' => - array ( - 'pretty_version' => '1.8.0', - 'version' => '1.8.0.0', - 'aliases' => - array ( - ), - 'reference' => '8.x-1.8', - ), 'drupal/config_translation' => array ( 'replaced' => @@ -2281,7 +2272,7 @@ 'aliases' => array ( ), - 'reference' => 'c35d10c1342ba61e69db11e499f85dd0b8acdd9f', + 'reference' => '6fd6a97f4c74f5ed4a341bbff84477a2650d3a78', ), 'pantheon-systems/quicksilver-pushback' => array ( diff --git a/web/profiles/contrib/config_installer/LICENSE.txt b/web/profiles/contrib/config_installer/LICENSE.txt deleted file mode 100644 index d159169d10..0000000000 --- a/web/profiles/contrib/config_installer/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/profiles/contrib/config_installer/README.md b/web/profiles/contrib/config_installer/README.md deleted file mode 100644 index 16466d60fb..0000000000 --- a/web/profiles/contrib/config_installer/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# Configuration Installer - -* Introduction -* Installation -* Usage -* Known issues - - -## Introduction - -The Configuration Installer project provides a means to install a Drupal 8 site -using existing configuration. - -This is not a module, Configuration Installer is an installation profile that -loads configuration from a specified folder to 'install' the site. -This is not a real installation profile either, it helps to install a real -installation profile (e.g. minimal) along with an existing set of configuration. - - -## Installation - -Download the archive from the Drupal.org project page (or use Composer). - -- https://www.drupal.org/project/config_installer -- `composer require drupal/config_installer` - -The folder should be placed in the Drupal website root folder in: - -`/profiles/contrib` - - -## Usage - -Install the site like you normally would (e.g. through the UI, using drush -or drupal console). Note that it's probably better to install Drupal the first -time using the minimal profile. This will avoid conflicts when importing -the configuration (e.g. existing entities). - -Edit the `sites/[yoursite]/settings.php` file and add the following line at the -bottom if it does not exist yet, or change the existing line to match: - -```php -$config_directories['sync'] = '/path/to/folder/with/configuration'; -``` - -Make sure user running the drush commands has read and write permissions -to the folder. If you are installing via the web, the webserver will need read -permissions as well. - -You can now choose to change any configuration value in the administration -user interface (e.g. the site name) or create new configuration (e.g. a content -type or a view). - -You can export your current configuration via drush: - -```bash -drush config-export -``` - -Make sure to create a backup before dropping all tables from the database. - -Then re-install the site with the following command: - -```bash -drush site-install --verbose config_installer config_installer_sync_configure_form.sync_directory=/path/to/folder/with/configuration --yes -``` - -Once Drush completes the installation visit the site to confirm the -configuration has been used to install the site. - - -@TODO: add some (more) tips for install hooks, etc? diff --git a/web/profiles/contrib/config_installer/config_installer.info.yml b/web/profiles/contrib/config_installer/config_installer.info.yml deleted file mode 100644 index 1c9d3cee5d..0000000000 --- a/web/profiles/contrib/config_installer/config_installer.info.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'Configuration installer' -type: profile -description: 'Use configuration from another Drupal site to install a Drupal instance. Suitable for advanced users.' -# core: 8.x -# Un comment to completely remove profile selection. -#distribution: TRUE - -# Information added by Drupal.org packaging script on 2018-04-24 -version: '8.x-1.8' -core: '8.x' -project: 'config_installer' -datestamp: 1524572286 diff --git a/web/profiles/contrib/config_installer/config_installer.install b/web/profiles/contrib/config_installer/config_installer.install deleted file mode 100644 index 9a6921f91c..0000000000 --- a/web/profiles/contrib/config_installer/config_installer.install +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * @file - * Install, update and uninstall functions for the minimal installation profile. - */ - -///** -// * Implements hook_install(). -// * -// * Performs actions to set up the site for this profile. -// * -// * @see system_install() -// */ -//function minimal_install() { -// // Disable the user pictures on nodes. -// \Drupal::config('system.theme.global')->set('features.node_user_picture', FALSE)->save(); -// -// // Allow visitor account creation, but with administrative approval. -// \Drupal::config('user.settings')->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(); -//} diff --git a/web/profiles/contrib/config_installer/config_installer.profile b/web/profiles/contrib/config_installer/config_installer.profile deleted file mode 100644 index 610282ba38..0000000000 --- a/web/profiles/contrib/config_installer/config_installer.profile +++ /dev/null @@ -1,353 +0,0 @@ -<?php -/** - * @file - * Enables modules and site configuration for a minimal site installation. - */ - -use Drupal\Core\Config\StorageComparer; -use Drupal\Core\Config\ConfigImporter; -use Drupal\Core\Config\ConfigImporterException; -use Drupal\Core\Site\Settings; -use Drupal\config_installer\Storage\SourceStorage; -use Drupal\language\Entity\ConfigurableLanguage; - -/** - * Need to do a manual include since this install profile never actually gets - * installed so therefore its code cannot be autoloaded. - */ -include_once __DIR__ . '/src/Form/SiteConfigureForm.php'; -include_once __DIR__ . '/src/Form/SyncConfigureForm.php'; -include_once __DIR__ . '/src/Storage/SourceStorage.php'; - -/** - * Implements hook_install_tasks_alter(). - */ -function config_installer_install_tasks_alter(&$tasks, $install_state) { - unset($tasks['install_download_translation']); - $key = array_search('install_profile_modules', array_keys($tasks), TRUE); - unset($tasks['install_profile_modules']); - unset($tasks['install_profile_themes']); - unset($tasks['install_install_profile']); - $config_tasks = [ - 'config_installer_upload' => [ - 'display_name' => t('Upload config'), - 'type' => 'form', - 'function' => 'Drupal\config_installer\Form\SyncConfigureForm' - ], - 'config_install_batch' => [ - 'display_name' => t('Install configuration'), - 'type' => 'batch', - ], - 'config_download_translations' => [], - 'config_installer_fix_profile' => [], - ]; - $tasks = array_slice($tasks, 0, $key, true) + - $config_tasks + - array_slice($tasks, $key, NULL , true); - $tasks['install_configure_form']['function'] = 'Drupal\config_installer\Form\SiteConfigureForm'; -} - -/** - * Creates a batch for the config importer to process. - * - * @see config_installer_install_tasks_alter() - */ -function config_install_batch() { - // We need to manually trigger the installation of core-provided entity types, - // as those will not be handled by the module installer. - // @see install_profile_modules() - install_core_entity_type_definitions(); - - // Create a source storage that reads from sync. - $listing = new \Drupal\Core\Extension\ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - $sync = new SourceStorage(\Drupal::service('config.storage.sync'), $listing->scan('profile')); - - // Match up the site uuids, the install_base_system install task will have - // installed the system module and created a new UUID. - $system_site = $sync->read('system.site'); - \Drupal::configFactory()->getEditable('system.site')->set('uuid', $system_site['uuid'])->save(); - - // Create the storage comparer and the config importer. - $config_manager = \Drupal::service('config.manager'); - $storage_comparer = new StorageComparer($sync, \Drupal::service('config.storage'), $config_manager); - $storage_comparer->createChangelist(); - $config_importer = new ConfigImporter( - $storage_comparer, - \Drupal::service('event_dispatcher'), - $config_manager, - \Drupal::service('lock.persistent'), - \Drupal::service('config.typed'), - \Drupal::service('module_handler'), - \Drupal::service('module_installer'), - \Drupal::service('theme_handler'), - \Drupal::service('string_translation') - ); - - try { - $sync_steps = $config_importer->initialize(); - - // Implementing hook_config_import_steps_alter() in this file does not work - // if using the 'drush site-install' command. Add the step to fix the import - // profile before the last step of the configuration import. - $last = array_pop($sync_steps); - $sync_steps[] = 'config_installer_install_uninstalled_profile_dependencies'; - $sync_steps[] = 'config_installer_config_import_profile'; - $sync_steps[] = $last; - - $batch = [ - 'operations' => [], - 'finished' => 'config_install_batch_finish', - 'title' => t('Synchronizing configuration'), - 'init_message' => t('Starting configuration synchronization.'), - 'progress_message' => t('Completed @current step of @total.'), - 'error_message' => t('Configuration synchronization has encountered an error.'), - 'file' => drupal_get_path('module', 'config') . '/config.admin.inc', - ]; - foreach ($sync_steps as $sync_step) { - $batch['operations'][] = ['config_install_batch_process', [$config_importer, $sync_step]]; - } - - return $batch; - } - catch (ConfigImporterException $e) { - // There are validation errors. - drupal_set_message(\Drupal::translation()->translate('The configuration synchronization failed validation.')); - foreach ($config_importer->getErrors() as $message) { - drupal_set_message($message, 'error'); - } - } -} - -/** - * Processes the config import batch and persists the importer. - * - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The batch config importer object to persist. - * @param string $sync_step - * The synchronisation step to do. - * @param $context - * The batch context. - * - * @see config_install_batch() - */ -function config_install_batch_process(ConfigImporter $config_importer, $sync_step, &$context) { - if (!isset($context['sandbox']['config_importer'])) { - $context['sandbox']['config_importer'] = $config_importer; - } - - $config_importer = $context['sandbox']['config_importer']; - $config_importer->doSyncStep($sync_step, $context); - if ($errors = $config_importer->getErrors()) { - if (!isset($context['results']['errors'])) { - $context['results']['errors'] = []; - } - $context['results']['errors'] += $errors; - } -} - -/** - * Finish config importer batch. - * - * @see config_install_batch() - */ -function config_install_batch_finish($success, $results, $operations) { - if ($success) { - if (!empty($results['errors'])) { - foreach ($results['errors'] as $error) { - drupal_set_message($error, 'error'); - \Drupal::logger('config_sync')->error($error); - } - drupal_set_message(\Drupal::translation()->translate('The configuration was imported with errors.'), 'warning'); - } - else { - // Configuration sync needs a complete cache flush. - drupal_flush_all_caches(); - } - } - else { - // An error occurred. - // $operations contains the operations that remained unprocessed. - $error_operation = reset($operations); - $message = \Drupal::translation() - ->translate('An error occurred while processing %error_operation with arguments: @arguments', [ - '%error_operation' => $error_operation[0], - '@arguments' => print_r($error_operation[1], TRUE) - ]); - drupal_set_message($message, 'error'); - } -} - -/** - * Ensures all profile dependencies are created. - * - * @param array $context. - * The batch context. - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The config importer. - * - * @see config_install_batch() - */ -function config_installer_install_uninstalled_profile_dependencies(array &$context, ConfigImporter $config_importer) { - if (!array_key_exists('missing_profile_dependencies', $context)) { - $profile = _config_installer_get_original_install_profile(); - $profile_file = drupal_get_path('profile', $profile) . "/$profile.info.yml"; - $info = \Drupal::service('info_parser')->parse($profile_file); - $dependencies = isset($info['dependencies']) ? $info['dependencies'] : []; - $context['missing_profile_dependencies'] = array_diff($dependencies, array_keys(\Drupal::moduleHandler()->getModuleList())); - if (count($context['missing_profile_dependencies']) === 0) { - $context['finished'] = 1; - return; - } - // @todo Need to dependency sort them... - } - - $still_missing = array_diff($context['missing_profile_dependencies'], array_keys(\Drupal::moduleHandler()->getModuleList())); - if (!empty($still_missing)) { - $missing_module = array_shift($still_missing); - // This is not a config sync module install... fun! - \Drupal::service('config.installer')->setSyncing(FALSE); - \Drupal::service('module_installer')->install([$missing_module]); - $context['message'] = t('Installed @module. This will be uninstalled after the profile has been installed.', ['@module' => $missing_module]); - } - $context['finished'] = (count($context['missing_profile_dependencies']) - count($still_missing)) / count($context['missing_profile_dependencies']); -} - -/** - * Processes profile as part of configuration sync. - * - * @param array $context. - * The batch context. - * @param \Drupal\Core\Config\ConfigImporter $config_importer - * The config importer. - * - * @see config_install_batch() - */ -function config_installer_config_import_profile(array &$context, ConfigImporter $config_importer) { - $orginal_profile = _config_installer_get_original_install_profile(); - if ($orginal_profile) { - \Drupal::service('config.installer') - ->setSyncing(TRUE) - ->setSourceStorage($config_importer->getStorageComparer()->getSourceStorage()); - \Drupal::service('module_installer')->install([$orginal_profile], FALSE); - module_set_weight($orginal_profile, 1000); - $context['message'] = t('Synchronising install profile: @name.', ['@name' => $orginal_profile]); - } - $context['finished'] = 1; -} - -/** - * Fixes configuration if the install profile has made changes in hook_install(). - * - * @see config_installer_install_tasks_alter() - */ -function config_installer_fix_profile() { - global $install_state; - // It is possible that installing the profile makes unintended configuration - // changes. - $config_manager = \Drupal::service('config.manager'); - $storage_comparer = new StorageComparer(\Drupal::service('config.storage.sync'), \Drupal::service('config.storage'), $config_manager); - $storage_comparer->createChangelist(); - if ($storage_comparer->hasChanges()) { - // Swap out the install profile so that the profile module exists. - _config_installer_switch_profile(_config_installer_get_original_install_profile()); - system_list_reset(); - $config_importer = new ConfigImporter( - $storage_comparer, - \Drupal::service('event_dispatcher'), - $config_manager, - \Drupal::service('lock.persistent'), - \Drupal::service('config.typed'), - \Drupal::service('module_handler'), - \Drupal::service('module_installer'), - \Drupal::service('theme_handler'), - \Drupal::service('string_translation') - ); - try { - $config_importer->import(); - } - catch (ConfigImporterException $e) { - // There are validation errors. - drupal_set_message(\Drupal::translation()->translate('The configuration synchronization failed validation.')); - foreach ($config_importer->getErrors() as $message) { - drupal_set_message($message, 'error'); - } - } - - // At this point the configuration should match completely. - if (\Drupal::moduleHandler()->moduleExists('language')) { - // If the English language exists at this point we need to ensure - // install_download_additional_translations_operations() does not delete - // it. - if (\Drupal\language\Entity\ConfigurableLanguage::load('en')) { - $install_state['profile_info']['keep_english'] = TRUE; - } - } - // Replace the install profile so that the config_installer still works. - _config_installer_switch_profile('config_installer'); - system_list_reset(); - } -} - -/** - * Switch the currently active profile in the installer. - * - * @param string $profile - * The profile to switch to. - */ -function _config_installer_switch_profile($profile) { - global $install_state; - $install_state['parameters']['profile'] = $profile; - $settings = Settings::getAll(); - $settings['install_profile'] = $profile; - new Settings($settings); -} - -/** - * Gets the original install profile name. - * - * @return string|null - * The name of the install profile from the sync configuration. - */ -function _config_installer_get_original_install_profile() { - // In Drupal 8.3 the profile is written to config and not settings. - $core = \Drupal::service('config.storage.sync')->read('core.extension'); - if (isset($core['profile'])) { - return $core['profile']; - } - - $original_profile = NULL; - // Profiles need to be extracted from the install list if they are there. - // This is because profiles need to be installed after all the configuration - // has been processed. - $listing = new \Drupal\Core\Extension\ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - // Read directly from disk since the source storage in the config importer is - // being altered to exclude profiles. - $profiles = array_intersect_key($listing->scan('profile'), $core['module']); - - if (!empty($profiles)) { - // There can be only one. - $original_profile = key($profiles); - } - return $original_profile; -} - -/** - * Replaces install_download_translation() during config_installer installs. - * - * @param array $install_state - * An array of information about the current installation state. - * - * @return string - * A themed status report, or an exception if there are requirement errors. - * Upon successful download the page is reloaded and no output is returned. - * - * @see install_download_translation() - */ -function config_download_translations(&$install_state) { - $needs_download = isset($install_state['parameters']['langcode']) && !isset($install_state['translations'][$install_state['parameters']['langcode']]) && $install_state['parameters']['langcode'] !== 'en'; - if ($needs_download) { - return install_download_translation($install_state); - } -} diff --git a/web/profiles/contrib/config_installer/src/Form/SiteConfigureForm.php b/web/profiles/contrib/config_installer/src/Form/SiteConfigureForm.php deleted file mode 100644 index 7e93ab8459..0000000000 --- a/web/profiles/contrib/config_installer/src/Form/SiteConfigureForm.php +++ /dev/null @@ -1,236 +0,0 @@ -<?php - -namespace Drupal\config_installer\Form; - -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Form\FormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Site\Settings; -use Drupal\Core\State\StateInterface; -use Drupal\user\UserStorageInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Updates the user 1 account. - * - * This is based on the install_configure_form provided by core. - * - * @see \Drupal\Core\Installer\Form\SiteConfigureForm - */ -class SiteConfigureForm extends FormBase { - - /** - * The user storage. - * - * @var \Drupal\user\UserStorageInterface - */ - protected $userStorage; - - /** - * The state service. - * - * @var \Drupal\Core\State\StateInterface - */ - protected $state; - - /** - * The app root. - * - * @var string - */ - protected $root; - - /** - * The site path. - * - * @var string - */ - protected $sitePath; - - /** - * The module handler. - * - * @var ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * Constructs a new SiteConfigureForm. - * - * @param string $root - * The app root. - * @param string $site_path - * The site path. - * @param \Drupal\user\UserStorageInterface $user_storage - * The user storage. - * @param \Drupal\Core\State\StateInterface $state - * The state service. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler. - */ - public function __construct($root, $site_path, UserStorageInterface $user_storage, StateInterface $state, ModuleHandlerInterface $module_handler) { - $this->root = $root; - $this->sitePath = $site_path; - $this->userStorage = $user_storage; - $this->state = $state; - $this->moduleHandler = $module_handler; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('app.root'), - $container->get('site.path'), - $container->get('entity.manager')->getStorage('user'), - $container->get('state'), - $container->get('module_handler') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'config_installer_site_configure_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $form['#title'] = $this->t('Configure site'); - - // Warn about settings.php permissions risk. - $settings_file = $this->sitePath . '/settings.php'; - // Check that $_POST is empty so we only show this message when the form is - // first displayed, not on the next page after it is submitted. We do not - // want to repeat it multiple times because it is a general warning that is - // not related to the rest of the installation process; it would also be - // especially out of place on the last page of the installer, where it would - // distract from the message that the Drupal installation has completed - // successfully. - $post_params = $this->getRequest()->request->all(); - if (empty($post_params)) { - $original_profile_name = _config_installer_get_original_install_profile(); - $need_to_write_settings = $original_profile_name !== Settings::get('install_profile'); - // In Drupal 8.3.x it is not necessary to have an install profile written - // to settings.php. - if (version_compare(\Drupal::VERSION, '8.3', '>=') && !is_writable(\Drupal::service('site.path') . '/settings.php')) { - \Drupal::service('kernel')->invalidateContainer(); - $need_to_write_settings = FALSE; - } - if ($need_to_write_settings) { - $settings['settings']['install_profile'] = (object) [ - 'value' => $original_profile_name, - 'required' => TRUE, - ]; - drupal_rewrite_settings($settings); - } - - if (!drupal_verify_install_file($this->root . '/' . $settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE) || !drupal_verify_install_file($this->root . '/' . $this->sitePath, FILE_NOT_WRITABLE, 'dir')) { - drupal_set_message(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href="@handbook_url">online handbook</a>.', [ - '%dir' => $this->sitePath, - '%file' => $settings_file, - '@handbook_url' => 'http://drupal.org/server-permissions', - ]), 'warning'); - } - } - - $form['#attached']['library'][] = 'system/drupal.system'; - - $form['admin_account'] = [ - '#type' => 'fieldgroup', - '#title' => $this->t('Site maintenance account'), - ]; - $form['admin_account']['account']['name'] = [ - '#type' => 'textfield', - '#title' => $this->t('Username'), - '#maxlength' => USERNAME_MAX_LENGTH, - '#description' => $this->t('Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.'), - '#required' => TRUE, - '#attributes' => ['class' => ['username']], - ]; - $form['admin_account']['account']['pass'] = [ - '#type' => 'password_confirm', - '#required' => TRUE, - '#size' => 25, - ]; - $form['admin_account']['account']['#tree'] = TRUE; - $form['admin_account']['account']['mail'] = [ - '#type' => 'email', - '#title' => $this->t('Email address'), - '#required' => TRUE, - ]; - - // Use default drush options if available whilst running a site install. - // Targets Drush 9 or higher. - if (class_exists('\Drush\Drush')) { - $input = \Drush\Drush::redispatchOptions(); - $input += [ - 'account-name' => 'admin', - 'account-pass' => \Drush\Utils\StringUtils::generatePassword(), - 'account-mail' => 'admin@example.com', - ]; - $form['admin_account']['account']['name']['#default_value'] = $input['account-name']; - $form['admin_account']['account']['pass']['#type'] = 'textfield'; - $form['admin_account']['account']['pass']['#default_value'] = $input['account-pass']; - $form['admin_account']['account']['mail']['#default_value'] = $input['account-mail']; - } - // Targets Drush 8 or lower. - elseif (function_exists('drush_get_option') && function_exists('drush_generate_password')) { - $form['admin_account']['account']['name']['#default_value'] = drush_get_option('account-name', 'admin'); - $form['admin_account']['account']['pass']['#type'] = 'textfield'; - $form['admin_account']['account']['pass']['#default_value'] = drush_get_option('account-pass', drush_generate_password()); - $form['admin_account']['account']['mail']['#default_value'] = drush_get_option('account-mail', 'admin@example.com'); - } - - $form['actions'] = ['#type' => 'actions']; - $form['actions']['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Save and continue'), - '#weight' => 15, - '#button_type' => 'primary', - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, FormStateInterface $form_state) { - if ($error = user_validate_name($form_state->getValue(['account', 'name']))) { - $form_state->setErrorByName('account][name', $error); - } - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - - $account_values = $form_state->getValue('account'); - - // We precreated user 1 with placeholder values. Let's save the real values. - $account = $this->userStorage->load(1); - $account->init = $account->mail = $account_values['mail']; - $account->roles = $account->getRoles(); - $account->activate(); - $account->timezone = $form_state->getValue('date_default_timezone'); - $account->pass = $account_values['pass']; - $account->name = $account_values['name']; - $account->save(); - - // Record when this install ran. - $this->state->set('install_time', $_SERVER['REQUEST_TIME']); - - if (version_compare(\Drupal::VERSION, '8.3', '>=')) { - // We need to invalidate the container to ensure that the correct profile - // is used on after installation. - \Drupal::service('kernel')->invalidateContainer(); - } - } - -} diff --git a/web/profiles/contrib/config_installer/src/Form/SyncConfigureForm.php b/web/profiles/contrib/config_installer/src/Form/SyncConfigureForm.php deleted file mode 100644 index 7ca409988c..0000000000 --- a/web/profiles/contrib/config_installer/src/Form/SyncConfigureForm.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php - -namespace Drupal\config_installer\Form; - -use Drupal\Core\Archiver\ArchiveTar; -use Drupal\Core\Config\ConfigImporter; -use Drupal\Core\Config\ConfigImporterException; -use Drupal\Core\Config\FileStorage; -use Drupal\Core\Config\StorageComparer; -use Drupal\Core\Extension\ExtensionDiscovery; -use Drupal\Core\Form\FormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\config_installer\Storage\SourceStorage; - -/** - * Inline include as this install profile code cannot be autoloaded. - */ -include_once __DIR__ . '/../Storage/SourceStorage.php'; - -/** - * Installation step to configure sync directory or upload a tarball. - */ -class SyncConfigureForm extends FormBase { - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'config_installer_sync_configure_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $form['#title'] = $this->t('Configure configuration import location'); - - $form['sync_directory'] = [ - '#type' => 'textfield', - '#title' => $this->t('Synchronisation directory'), - '#default_value' => config_get_config_directory(CONFIG_SYNC_DIRECTORY), - '#maxlength' => 255, - '#description' => $this->t('Path to the config directory you wish to import, can be relative to document root or an absolute path.'), - '#required' => TRUE, - // This value can only be changed if settngs.php is writable. - '#disabled' => !is_writable(\Drupal::service('site.path') . '/settings.php') - ]; - - $form['import_tarball'] = [ - '#type' => 'file', - '#title' => $this->t('Select your configuration export file'), - '#description' => $this->t('If the sync directory is empty you can upload a configuration export file.'), - ]; - - $form['actions'] = ['#type' => 'actions']; - $form['actions']['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Save and continue'), - '#weight' => 15, - '#button_type' => 'primary', - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, FormStateInterface $form_state) { - global $config_directories; - global $install_state; - - $file_upload = $this->getRequest()->files->get('files', NULL, TRUE); - $has_upload = FALSE; - if (!empty($file_upload['import_tarball']) && $file_upload['import_tarball']->isValid()) { - // The sync directory must be empty if we are doing an upload. - $form_state->setValue('import_tarball', $file_upload['import_tarball']->getRealPath()); - $has_upload = TRUE; - } - $sync_directory = $form_state->getValue('sync_directory'); - // If we've customised the sync directory ensure its good to go. - if ($sync_directory !== config_get_config_directory(CONFIG_SYNC_DIRECTORY)) { - // We have to create the directory if it does not exist. If it exists we - // need to ensure it is writeable is we are processing an upload. - $create_directory = !is_dir($sync_directory) || $has_upload; - if ($create_directory && !file_prepare_directory($sync_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { - $form_state->setErrorByName('sync_directory', t('The directory %directory could not be created or could not be made writable. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see the <a href="@handbook_url">online handbook</a>.', [ - '%directory' => $sync_directory, - '@handbook_url' => 'http://drupal.org/server-permissions', - ])); - } - } - - // If no tarball ensure we have files. - if (!$has_upload && !$form_state->hasAnyErrors()) { - $sync = new FileStorage($sync_directory); - if (count($sync->listAll()) === 0) { - $form_state->setErrorByName('sync_directory', $this->t('No file upload provided and the sync directory is empty')); - } - } - - // Early exit if we have errors. - if ($form_state->hasAnyErrors()) { - return; - } - - // Update the sync directory setting if required. - if ($sync_directory !== config_get_config_directory(CONFIG_SYNC_DIRECTORY)) { - $settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [ - 'value' => $sync_directory, - 'required' => TRUE, - ]; - drupal_rewrite_settings($settings); - $config_directories[CONFIG_SYNC_DIRECTORY] = $sync_directory; - } - - // Upload tarball if provided so we can validate the files. - if ($tarball_path = $form_state->getValue('import_tarball')) { - // Ensure that we have an empty directory if we're going. - $sync = new FileStorage($sync_directory); - $sync->deleteAll(); - try { - $archiver = new ArchiveTar($tarball_path, 'gz'); - $files = []; - $list = $archiver->listContent(); - if (is_array($list)) { - /** @var array $list */ - foreach ($list as $file) { - $files[] = $file['filename']; - } - $archiver->extractList($files, config_get_config_directory(CONFIG_SYNC_DIRECTORY)); - } - } - catch (\Exception $e) { - $form_state->setErrorByName('import_tarball', $this->t('Could not extract the contents of the tar file. The error message is <em>@message</em>', ['@message' => $e->getMessage()])); - } - drupal_unlink($tarball_path); - if (empty($files)) { - $form_state->setErrorByName('import_tarball', $this->t('The tar file contoins no files.')); - } - } - - // Early exit if we have errors. - if ($form_state->hasAnyErrors()) { - return; - } - - // Create a source storage that reads from sync. - $listing = new ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - $sync = new SourceStorage(\Drupal::service('config.storage.sync'), $listing->scan('profile')); - - // Match up the site uuids, the install_base_system install task will have - // installed the system module and created a new UUID. - $system_site = $sync->read('system.site'); - \Drupal::configFactory()->getEditable('system.site')->set('uuid', $system_site['uuid'])->save(); - - if (version_compare(\Drupal::VERSION, '8.3', '>=')){ - // In Drupal 8.3.x the install profile has moved to configuration. - // @see https://www.drupal.org/node/2156401 - \Drupal::configFactory() - ->getEditable('core.extension') - ->set('profile', _config_installer_get_original_install_profile()) - ->save(); - } - - // Create the storage comparer and the config importer. - $config_manager = \Drupal::service('config.manager'); - $storage_comparer = new StorageComparer($sync, \Drupal::service('config.storage'), $config_manager); - $storage_comparer->createChangelist(); - $config_importer = new ConfigImporter( - $storage_comparer, - \Drupal::service('event_dispatcher'), - $config_manager, - \Drupal::service('lock.persistent'), - \Drupal::service('config.typed'), - \Drupal::service('module_handler'), - \Drupal::service('module_installer'), - \Drupal::service('theme_handler'), - \Drupal::service('string_translation') - ); - - // Change $install_state profile to find profile modules during validation. - $install_state['parameters']['profile'] = _config_installer_get_original_install_profile(); - - try { - $config_importer->validate(); - } - catch (ConfigImporterException $e) { - $error_message = [ - '#type' => 'inline_template', - '#template' => '{% trans %}The configuration cannot be imported because it failed validation for the following reasons:{% endtrans%}{{ errors }}', - '#context' => [ - 'errors' => [ - '#theme' => 'item_list', - '#items' => $config_importer->getErrors(), - ], - ], - ]; - - $field_name = $has_upload ? 'import_tarball' : 'sync_directory'; - $form_state->setErrorByName($field_name, \Drupal::service('renderer')->renderPlain($error_message)); - } - - // Revert $install_state profie to continue with the regular process. - $install_state['parameters']['profile'] = 'config_installer'; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - global $install_state; - // Change the langcode to the site default langcode provided by the - // configuration. - $config_storage = new FileStorage(config_get_config_directory(CONFIG_SYNC_DIRECTORY)); - $install_state['parameters']['langcode'] = $config_storage->read('system.site')['langcode']; - } - -} diff --git a/web/profiles/contrib/config_installer/src/Storage/SourceStorage.php b/web/profiles/contrib/config_installer/src/Storage/SourceStorage.php deleted file mode 100644 index 0a9b644cb7..0000000000 --- a/web/profiles/contrib/config_installer/src/Storage/SourceStorage.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php - -namespace Drupal\config_installer\Storage; - -use Drupal\Core\Config\StorageInterface; -use Drupal\Core\DependencyInjection\DependencySerializationTrait; - -/** - * Wraps the sync storage so the config_installer can make modifications. - */ -class SourceStorage implements StorageInterface { - use DependencySerializationTrait; - - /** - * The configuration storage to wrap. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $baseStorage; - - /** - * The available install profiles. - * - * @var array - */ - protected $profiles; - - /** - * Constructs a SourceStorage object. - * - * @param \Drupal\Core\Config\StorageInterface $base_storage - * The configuration storage to wrap. - * @param array $profiles - * The available install profiles. - */ - public function __construct(StorageInterface $base_storage, array $profiles) { - $this->baseStorage = $base_storage; - $this->profiles = $profiles; - } - - /** - * {@inheritdoc} - */ - public function exists($name) { - return $this->baseStorage->exists($name); - } - - /** - * {@inheritdoc} - */ - public function read($name) { - $data = $this->baseStorage->read($name); - if ($name === 'core.extension' && isset($data['module'])) { - // Remove any profiles from the list. These will be installed later. - // @see config_installer_config_import_profile() - $data['module'] = array_diff_key($data['module'], $this->profiles); - } - return $data; - } - - /** - * {@inheritdoc} - */ - public function readMultiple(array $names) { - $list = []; - foreach ($names as $name) { - if ($data = $this->read($name)) { - $list[$name] = $data; - } - } - return $list; - } - - /** - * {@inheritdoc} - */ - public function write($name, array $data) { - return $this->baseStorage->write($name, $data); - } - - /** - * {@inheritdoc} - */ - public function delete($name) { - return $this->baseStorage->delete($name); - } - - /** - * {@inheritdoc} - */ - public function rename($name, $new_name) { - return $this->baseStorage->rename($name, $new_name); - } - - /** - * {@inheritdoc} - */ - public function encode($data) { - return $this->baseStorage->encode($data); - } - - /** - * {@inheritdoc} - */ - public function decode($raw) { - return $this->baseStorage->decode($raw); - } - - /** - * {@inheritdoc} - */ - public function listAll($prefix = '') { - return $this->baseStorage->listAll($prefix); - } - - /** - * {@inheritdoc} - */ - public function deleteAll($prefix = '') { - return $this->baseStorage->deleteAll($prefix); - } - - /** - * {@inheritdoc} - */ - public function createCollection($collection) { - return new static($this->baseStorage->createCollection($collection), $this->profiles); - } - - /** - * {@inheritdoc} - */ - public function getAllCollectionNames() { - return $this->baseStorage->getAllCollectionNames(); - } - - /** - * {@inheritdoc} - */ - public function getCollectionName() { - return $this->baseStorage->getCollectionName(); - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerEnSecondTest.php b/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerEnSecondTest.php deleted file mode 100644 index 254ab6240e..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerEnSecondTest.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -use Drupal\language\Entity\ConfigurableLanguage; - -/** - * Tests the config installer profile by uploading a tarball. - * - * @group ConfigInstaller - */ -class ConfigInstallerEnSecondTest extends ConfigInstallerTestBase { - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - // Upload the tarball. - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->getTarball()], 'Save and continue'); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - // Do assertions from parent. - require_once \Drupal::root() . '/core/includes/install.inc'; - $this->assertRaw(t('Congratulations, you installed @drupal fr!', [ - '@drupal' => drupal_install_profile_distribution_name(), - ])); - // Even though we began the install in English the configuration is French - // so that takes precedence. - $this->assertEqual('fr', \Drupal::config('system.site')->get('default_langcode')); - $this->assertTrue(ConfigurableLanguage::load('en'), "The language 'en' exists"); - $this->assertTrue(\Drupal::service('language_manager')->isMultilingual()); - } - - /** - * {@inheritdoc} - */ - protected function setUpLanguage() { - // Place custom local translations in the translations directory so that we - // don't go and translate everything. - mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); - file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.fr.po', $this->getPo('fr')); - - parent::setUpLanguage(); - } - - /** - * Returns the string for the test .po file. - * - * @param string $langcode - * The language code. - * - * @return string - * Contents for the test .po file. - */ - protected function getPo($langcode) { - return <<<ENDPO -msgid "" -msgstr "" - -msgid "Congratulations, you installed @drupal!" -msgstr "Congratulations, you installed @drupal $langcode!" -ENDPO; - } - - /** - * {@inheritdoc} - */ - protected function getTarball() { - // Exported configuration after a minimal profile install in French. - return $this->versionTarball('english-second.tar.gz'); - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerFrDirectorySyncTest.php b/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerFrDirectorySyncTest.php deleted file mode 100644 index aaf855b692..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerFrDirectorySyncTest.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -/** - * Tests the config installer profile by linking to a directory. - * - * Note this test requires access to localise.drupal.org. Not managed to break - * it any other way. - * - * @group ConfigInstaller - */ -class ConfigInstallerFrDirectorySyncTest extends ConfigInstallerTestBase { - - /** - * The directory where the configuration to install is stored. - * - * @var string - */ - protected $syncDir; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->syncDir = 'public://' . $this->randomMachineName(128); - parent::setUp(); - } - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - // Create a new sync directory. - drupal_mkdir($this->syncDir); - - // Extract the tarball into the sync directory. - $this->extractTarball($this->getTarball(), $this->syncDir); - - $this->drupalPostForm(NULL, ['sync_directory' => drupal_realpath($this->syncDir)], 'Save and continue'); - } - - /** - * Submit the config_installer_site_configure_form. - * - * @see \Drupal\config_installer\Form\SiteConfigureForm - */ - protected function setUpInstallConfigureForm() { - $params = $this->parameters['forms']['install_configure_form']; - unset($params['site_name']); - unset($params['site_mail']); - unset($params['update_status_module']); - $edit = $this->translatePostValues($params); - $this->drupalPostForm(NULL, $edit, 'Enregistrer et continuer'); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - // Do assertions from parent. - require_once \Drupal::root() . '/core/includes/install.inc'; - $this->assertText('Félicitations, vous avez installé'); - $this->assertText(drupal_install_profile_distribution_name()); - - // Even though we began the install in English the configuration is French - // so that takes precedence. - $this->assertEqual('fr', \Drupal::config('system.site')->get('default_langcode')); - $this->assertFalse(\Drupal::service('language_manager')->isMultilingual()); - } - - /** - * {@inheritdoc} - */ - protected function getTarball() { - // Exported configuration after a minimal profile install in French. - return $this->versionTarball('missing-language-entity.tar.gz'); - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerFrTarballTest.php b/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerFrTarballTest.php deleted file mode 100644 index a668b2e619..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerFrTarballTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -/** - * Tests the config installer profile by uploading a tarball. - * - * @group ConfigInstaller - */ -class ConfigInstallerFrTarballTest extends ConfigInstallerTestBase { - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - // Upload the tarball. - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->getTarball()], 'Save and continue'); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - // Do assertions from parent. - require_once \Drupal::root() . '/core/includes/install.inc'; - $this->assertRaw(t('Congratulations, you installed @drupal fr!', [ - '@drupal' => drupal_install_profile_distribution_name(), - ])); - // Even though we began the install in English the configuration is French - // so that takes precedence. - $this->assertEqual('fr', \Drupal::config('system.site')->get('default_langcode')); - $this->assertFalse(\Drupal::service('language_manager')->isMultilingual()); - } - - /** - * {@inheritdoc} - */ - protected function setUpLanguage() { - // Place custom local translations in the translations directory so that we - // don't go and translate everything. - mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); - file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.fr.po', $this->getPo('fr')); - - parent::setUpLanguage(); - } - - /** - * Returns the string for the test .po file. - * - * @param string $langcode - * The language code. - * - * @return string - * Contents for the test .po file. - */ - protected function getPo($langcode) { - return <<<ENDPO -msgid "" -msgstr "" - -msgid "Congratulations, you installed @drupal!" -msgstr "Congratulations, you installed @drupal $langcode!" -ENDPO; - } - - /** - * {@inheritdoc} - */ - protected function getTarball() { - // Exported configuration after a minimal profile install in French. - return $this->versionTarball('minimal-fr.tar.gz'); - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerNestedDependenciesProfileTest.php b/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerNestedDependenciesProfileTest.php deleted file mode 100644 index aa1540c7d9..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerNestedDependenciesProfileTest.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -use Drupal\Component\Serialization\Yaml; -use Drupal\Core\Archiver\ArchiveTar; -use Drupal\Core\Config\FileStorage; - -/** - * Tests the config installer profile with a profile with nested dependencies. - * - * @group ConfigInstaller - */ -class ConfigInstallerNestedDependenciesProfileTest extends ConfigInstallerTestBase { - - protected function setUp() { - $this->info = [ - 'type' => 'profile', - 'core' => \Drupal::CORE_COMPATIBILITY, - 'name' => 'Profile with nested dependencies', - 'dependencies' => ['nested'] - ]; - // File API functions are not available yet. - $path = $this->siteDirectory . '/profiles/nested_dependencies_profile'; - mkdir($path, 0777, TRUE); - file_put_contents("$path/nested_dependencies_profile.info.yml", Yaml::encode($this->info)); - - // Add a required nested module to the profile. - $this->nested = [ - 'type' => 'module', - 'core' => \Drupal::CORE_COMPATIBILITY, - 'name' => 'Nested module', - ]; - $nested_path = $path . '/modules/nested'; - mkdir($nested_path, 0777, TRUE); - file_put_contents("$nested_path/nested.info.yml", Yaml::encode($this->nested)); - - parent::setUp(); - } - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('nested_dependencies_profile.tar.gz')], 'Save and continue'); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - parent::testInstaller(); - $this->assertTrue($this->container->get('module_handler')->moduleExists('nested'), 'A module provided by the profile is installed.'); - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerNoDependenciesProfileTest.php b/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerNoDependenciesProfileTest.php deleted file mode 100644 index 06f62be4c6..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerNoDependenciesProfileTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -use Drupal\Component\Serialization\Yaml; -use Drupal\Core\Archiver\ArchiveTar; -use Drupal\Core\Config\FileStorage; - -/** - * Tests the config installer profile with a profile with no dependencies. - * - * @group ConfigInstaller - */ -class ConfigInstallerNoDependenciesProfileTest extends ConfigInstallerTestBase { - - protected function setUp() { - $this->info = [ - 'type' => 'profile', - 'core' => \Drupal::CORE_COMPATIBILITY, - 'name' => 'Profile with no dependencies', - ]; - // File API functions are not available yet. - $path = $this->siteDirectory . '/profiles/no_dependencies_profile'; - mkdir($path, 0777, TRUE); - file_put_contents("$path/no_dependencies_profile.info.yml", Yaml::encode($this->info)); - - parent::setUp(); - } - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('no_dependencies_profile.tar.gz')], 'Save and continue'); - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerSyncTest.php b/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerSyncTest.php deleted file mode 100644 index 08839f26a6..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerSyncTest.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -use Drupal\Core\Config\FileStorage; - -/** - * Tests the config installer profile by having files in a sync directory. - * - * @group ConfigInstaller - */ -class ConfigInstallerSyncTest extends ConfigInstallerTestBase { - - /** - * The directory where the configuration to install is stored. - * - * @var string - */ - protected $syncDir; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->syncDir = 'public://' . $this->randomMachineName(128); - parent::setUp(); - } - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - // Do assertions from parent. - parent::testInstaller(); - - // Do assertions specific to test. - $this->assertEqual(drupal_realpath($this->syncDir), config_get_config_directory(CONFIG_SYNC_DIRECTORY), 'The sync directory has been updated during the installation.'); - $this->assertEqual(USER_REGISTER_ADMINISTRATORS_ONLY, \Drupal::config('user.settings')->get('register'), 'Ensure standard_install() does not overwrite user.settings::register.'); - $this->assertEqual([], \Drupal::entityDefinitionUpdateManager()->getChangeSummary(), 'There are no entity or field definition updates.'); - } - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - // Create a new sync directory. - drupal_mkdir($this->syncDir); - - // Extract the tarball into the sync directory. - $this->extractTarball($this->getTarball(), $this->syncDir); - - // Change the user.settings::register so that we can test that - // standard_install() does not override it. - $sync = new FileStorage($this->syncDir); - $user_settings = $sync->read('user.settings'); - $user_settings['register'] = USER_REGISTER_ADMINISTRATORS_ONLY; - $sync->write('user.settings', $user_settings); - - // Create config for a module that will not be enabled. - $sync->write('foo.bar', []); - $this->drupalPostForm(NULL, ['sync_directory' => drupal_realpath($this->syncDir)], 'Save and continue'); - $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:'); - $this->assertText('Configuration foo.bar depends on the foo extension that will not be installed after import.'); - - // Remove incorrect config and continue on. - $sync->delete('foo.bar'); - $this->drupalPostForm(NULL, ['sync_directory' => drupal_realpath($this->syncDir)], 'Save and continue'); - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerTarballTest.php b/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerTarballTest.php deleted file mode 100644 index 286e75f53b..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerTarballTest.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -/** - * Tests the config installer profile by uploading a tarball. - * - * @group ConfigInstaller - */ -class ConfigInstallerTarballTest extends ConfigInstallerTestBase { - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - // Test some error situations. - $this->drupalPostForm(NULL, ['files[import_tarball]' => ''], 'Save and continue'); - $this->assertText('No file upload provided and the sync directory is empty'); - - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('broken.tar.gz')], 'Save and continue'); - $this->assertText('Could not extract the contents of the tar file.'); - - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('empty.tar.gz')], 'Save and continue'); - $this->assertText('The tar file contoins no files.'); - - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->versionTarball('minimal-validation-fail.tar.gz')], 'Save and continue'); - $this->assertText('The tar file contoins no files.'); - $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:'); - $this->assertText('Configuration foo.bar depends on the foo extension that will not be installed after import.'); - - // Upload the tarball. - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->getTarball()], 'Save and continue'); - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerTestBase.php b/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerTestBase.php deleted file mode 100644 index ab02a8753f..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/ConfigInstallerTestBase.php +++ /dev/null @@ -1,210 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -use Drupal\config\Controller\ConfigController; -use Drupal\Core\Archiver\ArchiveTar; -use Drupal\Core\Config\StorageComparer; -use Drupal\Core\DrupalKernel; -use Drupal\Core\Extension\ExtensionDiscovery; -use Drupal\Core\Site\Settings; -use Drupal\simpletest\InstallerTestBase; -use Symfony\Component\HttpFoundation\Request; - -/** - * Provides functionality for testing the config_installer profile. - */ -abstract class ConfigInstallerTestBase extends InstallerTestBase { - - /** - * The installation profile to install. - * - * @var string - */ - protected $profile = 'config_installer'; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Drupal is installed perform some basic assertions that all - // config_installer tests need. - if ($this->isInstalled) { - // Ensure the test environment has the latest container. - $this->rebuildAll(); - - $sync = \Drupal::service('config.storage.sync'); - $sync_core_extension = $sync->read('core.extension'); - // Ensure that the correct install profile is active. - if (version_compare(\Drupal::VERSION, '8.3', '>=')) { - $this->assertEqual($sync_core_extension['profile'], \Drupal::installProfile()); - } - else { - $listing = new ExtensionDiscovery(\Drupal::root()); - $listing->setProfileDirectories([]); - $profiles = array_intersect_key($listing->scan('profile'), $sync_core_extension['module']); - $current_profile = Settings::get('install_profile'); - $this->assertFalse(empty($current_profile), 'The $install_profile setting exists'); - $this->assertEqual($current_profile, key($profiles)); - } - - // Ensure that the configuration has been completely synced. - $this->assertNoSynDifferences(); - } - } - - - /** - * Ensures that the user page is available after installation. - */ - public function testInstaller() { - $this->assertUrl('user/1'); - $this->assertResponse(200); - // Confirm that we are logged-in after installation. - $this->assertText($this->rootUser->getUsername()); - - // @todo hmmm this message is wrong! - // Verify that the confirmation message appears. - require_once \Drupal::root() . '/core/includes/install.inc'; - $this->assertRaw(t('Congratulations, you installed @drupal!', [ - '@drupal' => drupal_install_profile_distribution_name(), - ])); - } - - /** - * Overrides method. - * - * We have several forms to navigate through. - */ - protected function setUpSite() { - // Recreate the container so that we can simulate the submission of the - // SyncConfigureForm after the full bootstrap has occurred. Without out this - // drupal_realpath() does not work so uploading files through - // WebTestBase::postForm() is impossible. - $request = Request::createFromGlobals(); - $class_loader = require $this->container->get('app.root') . '/vendor/autoload.php'; - Settings::initialize($this->container->get('app.root'), DrupalKernel::findSitePath($request), $class_loader); - foreach ($GLOBALS['config_directories'] as $type => $path) { - $this->configDirectories[$type] = $path; - } - $this->kernel = DrupalKernel::createFromRequest($request, $class_loader, 'prod', FALSE); - $this->kernel->prepareLegacyRequest($request); - $this->container = $this->kernel->getContainer(); - - $this->setUpSyncForm(); - $this->setUpInstallConfigureForm(); - // If we've got to this point the site is installed using the regular - // installation workflow. - $this->isInstalled = TRUE; - } - - /** - * Submit the config_installer_sync_configure_form. - * - * @see \Drupal\config_installer\Form\SyncConfigureForm - */ - abstract protected function setUpSyncForm(); - - /** - * Submit the config_installer_site_configure_form. - * - * @see \Drupal\config_installer\Form\SiteConfigureForm - */ - protected function setUpInstallConfigureForm() { - $params = $this->parameters['forms']['install_configure_form']; - unset($params['site_name']); - unset($params['site_mail']); - unset($params['update_status_module']); - $edit = $this->translatePostValues($params); - $this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']); - } - - /** - * Gets the tarball for testing. - * - * @var string - */ - protected function getTarball() { - // Exported configuration after a minimal profile install. - return $this->versionTarball('minimal.tar.gz'); - } - - /** - * Gets a tarball for the right version of Drupal. - * - * @param $tarball - * The tarball filename. - * - * @return string - * The fullpath to the tarball. - */ - protected function versionTarball($tarball) { - include_once \Drupal::root() . '/core/includes/install.core.inc'; - $version = _install_get_version_info(\Drupal::VERSION); - $versioned_file = __DIR__ . '/Fixtures/' . $version['major'] . '.' . $version['minor'] . '/' . $tarball; - if (file_exists($versioned_file)) { - return $versioned_file; - } - return __DIR__ . '/Fixtures/' . $tarball; - } - - /** - * Extracts a tarball to a directory. - * - * @param string $tarball_path - * The path to a tarball to extract. - * @param string $directory - * The directory to extract to. - * - * @return string[] - * The list files extracted. - */ - protected function extractTarball($tarball_path, $directory) { - $archiver = new ArchiveTar($tarball_path, 'gz'); - $files = []; - $list = $archiver->listContent(); - if (is_array($list)) { - /** @var array $list */ - foreach ($list as $file) { - $files[] = $file['filename']; - } - } - $archiver->extractList($files, $directory); - return $files; - } - - /** - * Ensures that the sync and active configuration match. - * - * @return bool - * TRUE if sync and active configuration match, FALSE if not. - */ - protected function assertNoSynDifferences() { - $sync = $this->container->get('config.storage.sync'); - $active = $this->container->get('config.storage'); - // Ensure that we have no configuration changes to import. - $storage_comparer = new StorageComparer( - $sync, - $active, - $this->container->get('config.manager') - ); - $changelist = $storage_comparer->createChangelist()->getChangelist(); - // system.mail is changed by \Drupal\simpletest\InstallerTestBase::setUp() - // this is a good idea because it prevents tests emailling. - $key = array_search('system.mail', $changelist['update'], TRUE); - if ($key !== FALSE) { - unset($changelist['update'][$key]); - } - $return = $this->assertIdentical($changelist, $storage_comparer->getEmptyChangelist()); - // Output proper diffs. - $controller = ConfigController::create($this->container); - foreach ($changelist['update'] as $config_name) { - $diff = $controller->diff($config_name); - $this->verbose(\Drupal::service('renderer')->renderPlain($diff)); - } - return $return; - } - -} diff --git a/web/profiles/contrib/config_installer/src/Tests/UninstalledProfileModulesTest.php b/web/profiles/contrib/config_installer/src/Tests/UninstalledProfileModulesTest.php deleted file mode 100644 index 13be67fe03..0000000000 --- a/web/profiles/contrib/config_installer/src/Tests/UninstalledProfileModulesTest.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -namespace Drupal\config_installer\Tests; - -/** - * Tests config installer when module dependencies of a profile are uninstalled. - * - * Profile dependencies are not true dependencies. After the Standard profile - * has been installed it is possible to uninstall the Contact module even though - * it is listed in the dependencies. Install profiles are special. - * - * @group ConfigInstaller - */ -class UninstalledProfileModulesTest extends ConfigInstallerTestBase { - - /** - * {@inheritdoc} - */ - protected function setUpSyncForm() { - // Upload the tarball. - $this->drupalPostForm(NULL, ['files[import_tarball]' => $this->getTarball()], 'Save and continue'); - } - - /** - * {@inheritdoc} - */ - protected function getTarball() { - // Exported configuration after a minimal profile install. - return $this->versionTarball('standard-without-contact.tar.gz'); - } - - /** - * Runs tests after install. - */ - public function testInstaller() { - $this->assertResponse(200); - // Ensure that all modules, profile and themes have been installed and have - // expected weights. - $sync = \Drupal::service('config.storage.sync'); - $sync_core_extension = $sync->read('core.extension'); - $this->assertIdentical($sync_core_extension, \Drupal::config('core.extension')->get()); - $this->assertFalse(\Drupal::moduleHandler()->moduleExists('contact'), 'Contact module is not installed.'); - } - -} -- GitLab