diff --git a/.travis.yml b/.travis.yml index 95e5f55d08..ac51e49242 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,10 @@ dist: trusty sudo: false php: - - 5.6 - 7.0 - 7.1 - 7.2 + - 7.3 env: global: @@ -17,13 +17,6 @@ env: - RELEASE=dev COMPOSER_CHANNEL=stable - RELEASE=stable COMPOSER_CHANNEL=snapshot -matrix: - exclude: - - php: 7.2 - env: RELEASE=stable COMPOSER_CHANNEL=stable - - php: 7.2 - env: RELEASE=stable COMPOSER_CHANNEL=snapshot - before_install: - echo 'sendmail_path = /bin/true' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - phpenv config-rm xdebug.ini @@ -36,14 +29,12 @@ install: script: - if [[ $RELEASE = dev ]]; then composer --verbose remove --no-update drupal/console; fi; - - if [[ $RELEASE = dev ]]; then composer --verbose require --no-update drupal/core:8.6.x-dev webflo/drupal-core-require-dev:8.6.x-dev; fi; + - if [[ $RELEASE = dev ]]; then composer --verbose require --no-update drupal/core:8.8.x-dev; composer --verbose require --no-update --dev drupal/core-dev:8.8.x-dev; fi; - if [[ $RELEASE = dev ]]; then composer --verbose update; fi; - - cd $TRAVIS_BUILD_DIR/web - - ./../vendor/bin/drush site-install --verbose --yes --db-url=sqlite://tmp/site.sqlite - - ./../vendor/bin/drush runserver $SIMPLETEST_BASE_URL & + - ./vendor/bin/drush site-install --verbose --yes --db-url=sqlite://tmp/site.sqlite + - ./vendor/bin/drush runserver $SIMPLETEST_BASE_URL & - until curl -s $SIMPLETEST_BASE_URL; do true; done > /dev/null - # Skip core/tests/Drupal/Tests/ComposerIntegrationTest.php because web/ has no composer.json - # Ignore PageCache group temporarily, @see https://www.drupal.org/node/2770673 - - ./../vendor/bin/phpunit -c core --testsuite unit --exclude-group Composer,DependencyInjection,PageCache - - ./../vendor/bin/drush - - if [[ $RELEASE = stable ]]; then ./../vendor/bin/drupal; fi; + # Run a single unit test to verfiy the testing setup. + - ./vendor/bin/phpunit -c ./web/core ./web/core/modules/system/tests/src/Unit/SystemRequirementsTest.php + - ./vendor/bin/drush + - if [[ $RELEASE = stable ]]; then ./vendor/bin/drupal; fi; diff --git a/README.md b/README.md index dff0566bfa..2c40e4384f 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,16 @@ the [Documentation on drupal.org](https://www.drupal.org/node/2471553). First you need to [install composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx). > Note: The instructions below refer to the [global composer installation](https://getcomposer.org/doc/00-intro.md#globally). -You might need to replace `composer` with `php composer.phar` (or similar) +You might need to replace `composer` with `php composer.phar` (or similar) for your setup. After that you can create the project: ``` -composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction +composer create-project drupal-composer/drupal-project:8.x-dev some-dir --no-interaction ``` -With `composer require ...` you can download new dependencies to your +With `composer require ...` you can download new dependencies to your installation. ``` @@ -31,8 +31,8 @@ cd some-dir composer require drupal/devel:~1.0 ``` -The `composer create-project` command passes ownership of all files to the -project that is created. You should create a new git repository, and commit +The `composer create-project` command passes ownership of all files to the +project that is created. You should create a new git repository, and commit all files not excluded by the .gitignore file. ## What does the template do? @@ -53,26 +53,26 @@ When installing the given `composer.json` some tasks are taken care of: ## Updating Drupal Core -This project will attempt to keep all of your Drupal Core files up-to-date; the -project [drupal-composer/drupal-scaffold](https://github.com/drupal-composer/drupal-scaffold) -is used to ensure that your scaffold files are updated every time drupal/core is -updated. If you customize any of the "scaffolding" files (commonly .htaccess), -you may need to merge conflicts if any of your modified files are updated in a +This project will attempt to keep all of your Drupal Core files up-to-date; the +project [drupal/core-composer-scaffold](https://github.com/drupal/core-composer-scaffold) +is used to ensure that your scaffold files are updated every time drupal/core is +updated. If you customize any of the "scaffolding" files (commonly .htaccess), +you may need to merge conflicts if any of your modified files are updated in a new release of Drupal core. Follow the steps below to update your core files. -1. Run `composer update drupal/core webflo/drupal-core-require-dev symfony/* --with-dependencies` to update Drupal Core and its dependencies. -1. Run `git diff` to determine if any of the scaffolding files have changed. - Review the files for any changes and restore any customizations to +1. Run `composer update drupal/core drupal/core-dev --with-dependencies` to update Drupal Core and its dependencies. +2. Run `git diff` to determine if any of the scaffolding files have changed. + Review the files for any changes and restore any customizations to `.htaccess` or `robots.txt`. 1. Commit everything all together in a single commit, so `web` will remain in sync with the `core` when checking out branches or running `git bisect`. -1. In the event that there are non-trivial conflicts in step 2, you may wish - to perform these steps on a branch, and use `git merge` to combine the - updated core files with your customized files. This facilitates the use - of a [three-way merge tool such as kdiff3](http://www.gitshah.com/2010/12/how-to-setup-kdiff-as-diff-tool-for-git.html). This setup is not necessary if your changes are simple; - keeping all of your modifications at the beginning or end of the file is a +1. In the event that there are non-trivial conflicts in step 2, you may wish + to perform these steps on a branch, and use `git merge` to combine the + updated core files with your customized files. This facilitates the use + of a [three-way merge tool such as kdiff3](http://www.gitshah.com/2010/12/how-to-setup-kdiff-as-diff-tool-for-git.html). This setup is not necessary if your changes are simple; + keeping all of your modifications at the beginning or end of the file is a good strategy to keep merges easy. ## Generate composer.json from existing project @@ -86,37 +86,36 @@ that the generated `composer.json` might differ from this project's file. ### Should I commit the contrib modules I download? -Composer recommends **no**. They provide [argumentation against but also +Composer recommends **no**. They provide [argumentation against but also workrounds if a project decides to do it anyway](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md). ### Should I commit the scaffolding files? -The [drupal-scaffold](https://github.com/drupal-composer/drupal-scaffold) plugin can download the scaffold files (like +The [Drupal Composer Scaffold](https://github.com/drupal/core-composer-scaffold) plugin can download the scaffold files (like index.php, update.php, …) to the web/ directory of your project. If you have not customized those files you could choose to not check them into your version control system (e.g. git). If that is the case for your project it might be convenient to automatically run the drupal-scaffold plugin after every install or update of your project. You can -achieve that by registering `@drupal-scaffold` as post-install and post-update command in your composer.json: +achieve that by registering `@composer drupal:scaffold` as post-install and post-update command in your composer.json: ```json "scripts": { - "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold", "post-install-cmd": [ - "@drupal-scaffold", + "@composer drupal:scaffold", "..." ], "post-update-cmd": [ - "@drupal-scaffold", + "@composer drupal:scaffold", "..." ] }, ``` ### How can I apply patches to downloaded modules? -If you need to apply patches (depending on the project being modified, a pull -request is often a better solution), you can do so with the +If you need to apply patches (depending on the project being modified, a pull +request is often a better solution), you can do so with the [composer-patches](https://github.com/cweagans/composer-patches) plugin. -To add a patch to drupal module foobar insert the patches section in the extra +To add a patch to drupal module foobar insert the patches section in the extra section of composer.json: ```json "extra": { @@ -133,12 +132,14 @@ Follow the instructions in the [documentation on drupal.org](https://www.drupal. ### How do I specify a PHP version ? -Currently Drupal 8 supports PHP 5.5.9 as minimum version (see [Drupal 8 PHP requirements](https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements)), however it's possible that a `composer update` will upgrade some package that will then require PHP 7+. +This project supports PHP 7.0 as minimum version (see [Drupal 8 PHP requirements](https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements)), however it's possible that a `composer update` will upgrade some package that will then require PHP 7+. To prevent this you can add this code to specify the PHP version you want to use in the `config` section of `composer.json`: ```json "config": { "sort-packages": true, - "platform": {"php": "5.5.9"} + "platform": { + "php": "7.0.33" + } }, ``` diff --git a/composer.json b/composer.json index bf513b3f6a..b29500cc0c 100644 --- a/composer.json +++ b/composer.json @@ -16,18 +16,19 @@ } ], "require": { + "php": ">=7.0.8", "composer/installers": "^1.2", - "cweagans/composer-patches": "^1.6", - "drupal-composer/drupal-scaffold": "^2.5", + "cweagans/composer-patches": "^1.6.5", "drupal/console": "^1.0.2", - "drupal/core": "~8.5.3", - "drush/drush": "^9.0.0", - "vlucas/phpdotenv": "^2.4", + "drupal/core": "^8.8.0", + "drupal/core-composer-scaffold": "^8.8.0", + "drush/drush": "^9.7.1 | ^10.0.0", + "vlucas/phpdotenv": "^4.0", "webflo/drupal-finder": "^1.0.0", - "webmozart/path-util": "^2.3" + "zaporylie/composer-drupal-optimizations": "^1.0" }, "require-dev": { - "webflo/drupal-core-require-dev": "~8.5.3" + "drupal/core-dev": "^8.8.0" }, "conflict": { "drupal/drupal": "*" @@ -58,13 +59,22 @@ ] }, "extra": { + "composer-exit-on-patch-failure": true, + "patchLevel": { + "drupal/core": "-p2" + }, + "drupal-scaffold": { + "locations": { + "web-root": "web/" + } + }, "installer-paths": { "web/core": ["type:drupal-core"], "web/libraries/{$name}": ["type:drupal-library"], "web/modules/contrib/{$name}": ["type:drupal-module"], "web/profiles/contrib/{$name}": ["type:drupal-profile"], "web/themes/contrib/{$name}": ["type:drupal-theme"], - "drush/Commands/{$name}": ["type:drupal-drush"] + "drush/Commands/contrib/{$name}": ["type:drupal-drush"] } } } diff --git a/drush/Commands/PolicyCommands.php b/drush/Commands/PolicyCommands.php index b5bdec6cd6..290b4e0331 100644 --- a/drush/Commands/PolicyCommands.php +++ b/drush/Commands/PolicyCommands.php @@ -3,7 +3,6 @@ namespace Drush\Commands; use Consolidation\AnnotatedCommand\CommandData; -use Drush\Commands\DrushCommands; /** * Edit this file to reflect your organization's needs. diff --git a/drush/drush.yml b/drush/drush.yml index de78500f05..a8cbd00730 100644 --- a/drush/drush.yml +++ b/drush/drush.yml @@ -3,4 +3,4 @@ # # Docs at https://github.com/drush-ops/drush/blob/master/examples/example.drush.yml # -# Edit or remove this file as needed. \ No newline at end of file +# Edit or remove this file as needed. diff --git a/drush/sites/self.site.yml b/drush/sites/self.site.yml index cf57d09cf5..fda7194097 100644 --- a/drush/sites/self.site.yml +++ b/drush/sites/self.site.yml @@ -11,4 +11,4 @@ # host: stage.domain.com # user: www-admin # root: /path/to/drupal -# uri: http://stage.example.com \ No newline at end of file +# uri: http://stage.example.com diff --git a/load.environment.php b/load.environment.php index 769343fd6f..eef1d28d07 100644 --- a/load.environment.php +++ b/load.environment.php @@ -11,10 +11,5 @@ /** * Load any .env file. See /.env.example. */ -$dotenv = new Dotenv(__DIR__); -try { - $dotenv->load(); -} -catch (InvalidPathException $e) { - // Do nothing. Production environments rarely use .env files. -} +$dotenv = Dotenv::createImmutable(__DIR__); +$dotenv->safeLoad(); diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php index a75e4d34ee..51026d38a1 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -9,6 +9,7 @@ use Composer\Script\Event; use Composer\Semver\Comparator; +use Drupal\Core\Site\Settings; use DrupalFinder\DrupalFinder; use Symfony\Component\Filesystem\Filesystem; use Webmozart\PathUtil\Path; @@ -36,19 +37,18 @@ public static function createRequiredFiles(Event $event) { } // Prepare the settings file for installation - if (!$fs->exists($drupalRoot . '/sites/default/settings.php') and $fs->exists($drupalRoot . '/sites/default/default.settings.php')) { + if (!$fs->exists($drupalRoot . '/sites/default/settings.php') && $fs->exists($drupalRoot . '/sites/default/default.settings.php')) { $fs->copy($drupalRoot . '/sites/default/default.settings.php', $drupalRoot . '/sites/default/settings.php'); require_once $drupalRoot . '/core/includes/bootstrap.inc'; require_once $drupalRoot . '/core/includes/install.inc'; - $settings['config_directories'] = [ - CONFIG_SYNC_DIRECTORY => (object) [ - 'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot), - 'required' => TRUE, - ], + new Settings([]); + $settings['settings']['config_sync_directory'] = (object) [ + 'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot), + 'required' => TRUE, ]; drupal_rewrite_settings($settings, $drupalRoot . '/sites/default/settings.php'); $fs->chmod($drupalRoot . '/sites/default/settings.php', 0666); - $event->getIO()->write("Create a sites/default/settings.php file with chmod 0666"); + $event->getIO()->write("Created a sites/default/settings.php file with chmod 0666"); } // Create the files directory with chmod 0777 @@ -56,7 +56,7 @@ public static function createRequiredFiles(Event $event) { $oldmask = umask(0); $fs->mkdir($drupalRoot . '/sites/default/files', 0777); umask($oldmask); - $event->getIO()->write("Create a sites/default/files directory with chmod 0777"); + $event->getIO()->write("Created a sites/default/files directory with chmod 0777"); } }