Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
18 changes: 18 additions & 0 deletions .github/workflows/discourse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Post release topic on Discourse

on:
release:
types: [published]

jobs:
post:
runs-on: ubuntu-latest
steps:
- uses: roots/discourse-topic-github-release-action@main
with:
discourse-api-key: ${{ secrets.DISCOURSE_RELEASES_API_KEY }}
discourse-base-url: ${{ secrets.DISCOURSE_BASE_URL }}
github-token: ${{ github.token }}
discourse-category: 7
discourse-tags:
releases
43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PHP Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- '7.2'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: xdebug

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run tests
run: composer test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

64 changes: 22 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,40 @@
# WordPress Core Installer

[![Build Status](https://travis-ci.org/johnpbloch/wordpress-core-installer.svg?branch=master)](https://travis-ci.org/johnpbloch/wordpress-core-installer)
[![codecov](https://img.shields.io/codecov/c/github/johnpbloch/wordpress-core-installer/master.svg)](https://codecov.io/gh/johnpbloch/wordpress-core-installer)
[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
[![Packagist](https://img.shields.io/packagist/dt/johnpbloch/wordpress-core-installer.svg)](https://packagist.org/packages/johnpbloch/wordpress-core-installer)
![GitHub tag](https://img.shields.io/github/tag/johnpbloch/wordpress-core-installer.svg)
[![Tests](https://img.shields.io/github/actions/workflow/status/roots/wordpress-core-installer/tests.yml?branch=master&logo=github&label=CI&style=flat-square)](https://github.com/roots/wordpress-core-installer/actions/workflows/tests.yml)
[![Packagist Downloads](https://img.shields.io/packagist/dt/roots/wordpress-core-installer?label=downloads&colorB=2b3072&colorA=525ddc&style=flat-square)](https://packagist.org/packages/roots/wordpress-core-installer)
![GitHub tag](https://img.shields.io/github/tag/roots/wordpress-core-installer.svg?style=flat-square)
[![Follow Roots](https://img.shields.io/badge/follow%20@rootswp-1da1f2?logo=twitter&logoColor=ffffff&message=&style=flat-square)](https://twitter.com/rootswp)
[![Sponsor Roots](https://img.shields.io/badge/sponsor%20roots-525ddc?logo=github&style=flat-square&logoColor=ffffff&message=)](https://github.com/sponsors/roots)

*This is a fork of [johnpbloch/wordpress-core-installer](https://github.com/johnpbloch/wordpress-core-installer) with some fixes to enhance compatibility with [roots/wordpress](https://packagist.org/packages/roots/wordpress)*

A custom Composer plugin to install WordPress core outside of `vendor`.

This installer is meant to support a rather specific WordPress installation setup in which WordPress is installed in a subdirectory ([see the WordPress codex on that subject](https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)) and in which the location of `WP_CONTENT_DIR` and `WP_CONTENT_URL` have been customized to be outside of WordPress core ([see the WordPress codex on that subject](https://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content_folder)). This is because composer will delete your whole wp-content directory every time it updates core if you don't separate the two. If that installation setup isn't what you are looking for, then this installer is probably not something you will want to use.

For more information on this site setup and using Composer to manage a whole WordPress site, [check out @Rarst's informational website](https://composer.rarst.net/) which also includes [a site stack example using this package](https://composer.rarst.net/recipe/site-stack/).

### Usage
To set up a custom WordPress build package to use this as a custom installer, add the following to your package's composer file:

```json
"type": "wordpress-core",
"require": {
"johnpbloch/wordpress-core-installer": "^2.0"
}
```
## Requirements

If you need to maintain support for PHP versions lower than 5.6 (not recommended!), use `^1.0` as your version constraint in the above.
- Composer 2+
- PHP 7.2.24+

By default, this package will install a `wordpress-core` type package in the `wordpress` directory. To change this you can add the following to either your custom WordPress core type package or the root composer package:
Composer 2 requires explicitly allowing plugins. If needed, run:

```json
"extra": {
"wordpress-install-dir": "custom/path"
}
```bash
composer config --no-plugins allow-plugins.roots/wordpress-core-installer true
```

The root composer package can also declare custom paths as an object keyed by package name:

```json
"extra": {
"wordpress-install-dir": {
"wordpress/wordpress": "wordpress",
"johnpbloch/wordpress-core": "jpb-wordpress"
}
}
```
## Support us

### License
This is licensed under the GPL version 2 or later.
Roots is an independent open source org, supported only by developers like you. Your sponsorship funds [WP Packages](https://wp-packages.org/) and the entire Roots ecosystem, and keeps them independent. Support us by purchasing [Radicle](https://roots.io/radicle/) or [sponsoring us on GitHub](https://github.com/sponsors/roots) — sponsors get access to our private Discord.

### Changelog
## Community

##### 2.0.0
- Added support for Composer v2. Special thanks to @Ayesh for the original pull request to add this support.
- Bumped minimum required PHP version to 5.6 (same as WP). If you need to stick with an older PHP version, you're probably ok with also sticking with an older version of Composer and can continue to use `^1.0` as your version constraint.
- Other various fixes and improvements to README, tests, etc.
Keep track of development and community news.

##### 1.0.0
- Initial stable release
- Added tests and CI
- Support added for custom vendor directories
- Added sanity check for overwriting sensitive directories
- Join us on Discord by [sponsoring us on GitHub](https://github.com/sponsors/roots)
- Join us on [Roots Discourse](https://discourse.roots.io/)
- Follow [@rootswp on Twitter](https://twitter.com/rootswp)
- Follow the [Roots Blog](https://roots.io/blog/)
- Subscribe to the [Roots Newsletter](https://roots.io/subscribe/)
27 changes: 17 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "johnpbloch/wordpress-core-installer",
"description": "A custom installer to handle deploying WordPress with composer",
"name": "roots/wordpress-core-installer",
"description": "A Composer custom installer to handle installing WordPress as a dependency",
"keywords": [
"wordpress"
],
Expand All @@ -12,32 +12,39 @@
{
"name": "John P. Bloch",
"email": "me@johnpbloch.com"
},
{
"name": "Roots",
"email": "team@roots.io"
}
],
"autoload": {
"psr-0": {
"johnpbloch\\Composer\\": "src/"
"psr-4": {
"Roots\\Composer\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\JohnPBloch\\Composer\\": "tests/"
"Tests\\Roots\\Composer\\": "tests/"
}
},
"extra": {
"class": "johnpbloch\\Composer\\WordPressCorePlugin"
"class": "Roots\\Composer\\WordPressCorePlugin"
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.6.0"
"composer-plugin-api": "^2.0",
"php": ">=7.2.24"
},
"require-dev": {
"composer/composer": "^1.0 || ^2.0",
"phpunit/phpunit": ">=5.7.27"
"composer/composer": "^2.0",
"phpunit/phpunit": "^8.5"
},
"conflict": {
"composer/installers": "<1.0.6"
},
"replace": {
"johnpbloch/wordpress-core-installer": "*"
},
"scripts": {
"test:phpunit": "phpunit",
"test": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

namespace johnpbloch\Composer;
namespace Roots\Composer;

use Composer\Config;
use Composer\Installer\LibraryInstaller;
Expand Down Expand Up @@ -67,7 +67,8 @@ public function getInstallPath( PackageInterface $package ) {
}
if (
! empty( self::$_installedPaths[ $installationDir ] ) &&
$prettyName !== self::$_installedPaths[ $installationDir ]
$prettyName !== self::$_installedPaths[ $installationDir ] &&
$package->getType() !== self::TYPE
) {
$conflict_message = $this->getConflictMessage( $prettyName, self::$_installedPaths[ $installationDir ] );
throw new \InvalidArgumentException( $conflict_message );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

namespace johnpbloch\Composer;
namespace Roots\Composer;

use Composer\Composer;
use Composer\IO\IOInterface;
Expand Down
Loading