Initial win-port

This commit is contained in:
3wc 2021-12-03 14:19:23 +02:00
commit 6572811159
20 changed files with 2484 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Application
/bedrock/web/app/plugins/*
/bedrock/!web/app/plugins/.gitkeep
/bedrock/web/app/mu-plugins/*/
/bedrock/web/app/upgrade
/bedrock/web/app/uploads/*
/bedrock/!web/app/uploads/.gitkeep
# WordPress
/bedrock/web/wp
/bedrock/web/.htaccess
# Logs
*.log
# Dotenv
.env
.env.*
!.env.example
/bedrock/.env
/bedrock/.env.*
/bedrock/!.env.example
# Composer
/bedrock/vendor
# WP-CLI
wp-cli.local.yml

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM php:8.1-apache
COPY entrypoint-wordpress.sh /usr/local/bin/
COPY apache-docker.conf /etc/apache2/sites-enabled/
ENTRYPOINT /usr/local/bin/entrypoint-wordpress.sh

17
apache-docker.conf Normal file
View File

@ -0,0 +1,17 @@
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/web
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

458
bedrock/CHANGELOG.md Normal file
View File

@ -0,0 +1,458 @@
### 1.17.1: 2021-11-16
* Bump roots/wordpress from 5.8.1 to 5.8.2 ([#615](https://github.com/roots/bedrock/pull/615))
### 1.17.0: 2021-11-03
* Bump roots/wp-password-bcrypt from 1.0.0 to 1.1.0 ([#613](https://github.com/roots/bedrock/pull/613))
* CI: Check Composer lock file is up to date ([#612](https://github.com/roots/bedrock/pull/612))
* Update composer.lock file ([#611](https://github.com/roots/bedrock/pull/611))
### 1.16.2: 2021-10-21
* Update `roave/security-advisories` default branch ([#609](https://github.com/roots/bedrock/pull/609))
* Bump composer/installers from 1.11.0 to 1.12.0 ([#606](https://github.com/roots/bedrock/pull/606))
* Bump roots/wordpress from 5.8 to 5.8.1 ([#605](https://github.com/roots/bedrock/pull/605))
### 1.16.1: 2021-07-30
* Check if `.env.local` exists before loading it ([#603](https://github.com/roots/bedrock/pull/603))
### 1.16.0: 2021-07-22
* Bump roots/wordpress from 5.7.2 to 5.8 ([#600](https://github.com/roots/bedrock/pull/600))
* Default to `WP_DEBUG_LOG=true` in development ([#505](https://github.com/roots/bedrock/pull/505))
* Support `.env.local` config override ([#594](https://github.com/roots/bedrock/pull/594))
* Use Bedrock disallow indexing package ([#521](https://github.com/roots/bedrock/pull/521))
### 1.15.4: 2021-05-19
* Bump roots/wordpress from 5.7 to 5.7.2 ([#593](https://github.com/roots/bedrock/pull/593))
* Bump composer/installers from 1.10.0 to 1.11.0 ([#592](https://github.com/roots/bedrock/pull/592))
* chore(deps-dev): Bump squizlabs/php_codesniffer from 3.5.8 to 3.6.0 ([#588](https://github.com/roots/bedrock/pull/588))
### 1.15.3: 2021-03-12
* chore(deps): Bump roots/wordpress from 5.6.2 to 5.7 ([#578](https://github.com/roots/bedrock/pull/578))
### 1.15.2: 2021-02-11
* chore(deps): Bump roots/wordpress from 5.5.3 to 5.6.1 ([#573](https://github.com/roots/bedrock/pull/573))
* chore(deps): Bump composer/installers from 1.9.0 to 1.10.0 ([#569](https://github.com/roots/bedrock/pull/569))
* chore(deps): Bump vlucas/phpdotenv from 5.2.0 to 5.3.0 ([#570 ](https://github.com/roots/bedrock/pull/570))
* Add WP_POST_REVISIONS as an option ([#572](https://github.com/roots/bedrock/pull/572))
### 1.15.1: 2020-12-08
* chore(deps): Bump roots/wordpress from 5.5.3 to 5.6 ([#567](https://github.com/roots/bedrock/pull/567))
### 1.15.0: 2020-12-04
* chore(deps): Bump roots/bedrock-autoloader from 1.0.3 to 1.0.4 ([#564](https://github.com/roots/bedrock/pull/564))
* Upgrade to vlucas/phpdotenv:5.2 ([#563](https://github.com/roots/bedrock/pull/563))
* chore(deps-dev): Bump squizlabs/php_codesniffer from 3.5.6 to 3.5.8 ([#550](https://github.com/roots/bedrock/pull/550))
### 1.14.4: 2020-11-13
* chore(deps): Bump roots/wordpress from 5.5.1 to 5.5.3 ([#556](https://github.com/roots/bedrock/pull/556))
### 1.14.3: 2020-10-28
* Bump `roots/wordpress-core-installer` for Composer 2 compatibility([#552](https://github.com/roots/bedrock/pull/552))
### 1.14.2: 2020-09-04
* chore(deps): Bump roots/wordpress from 5.5 to 5.5.1 ([#545](https://github.com/roots/bedrock/pull/545))
### 1.14.1: 2020-08-11
* chore(deps): Bump roots/wordpress from 5.4.1 to 5.5 ([#542](https://github.com/roots/bedrock/pull/542))
* chore(deps-dev): Bump squizlabs/php_codesniffer from 3.5.5 to 3.5.6 ([#541](https://github.com/roots/bedrock/pull/541))
* chore(deps): Bump vlucas/phpdotenv from 4.1.5 to 4.1.8 ([#536](https://github.com/roots/bedrock/pull/536))
* chore(deps): Bump oscarotero/env from 2.0.0 to 2.1.0 ([#531](https://github.com/roots/bedrock/pull/531))
* CircleCI: Use offical CircleCI PHP orb and next-gen docker images ([#520](https://github.com/roots/bedrock/pull/520))
### 1.14.0: 2020-08-11
* Upgrade `oscarotero/env` to `^2.0` ([#530](https://github.com/roots/bedrock/pull/530))
* chore(deps): Bump vlucas/phpdotenv from 4.1.4 to 4.1.5 ([#518](https://github.com/roots/bedrock/pull/518))
* Use Bedrock Autoloader package ([#519](https://github.com/roots/bedrock/pull/519))
### 1.13.5: 2020-05-11
* chore(deps): Bump roots/wordpress from 5.4 to 5.4.1 ([#517](https://github.com/roots/bedrock/pull/517))
### 1.13.4: 2020-04-24
* fix(mu-plugins): Bump bedrock-autoloader version ([#512](https://github.com/roots/bedrock/pull/512))
* fix(mu-plugins): A more sane fix for #510 ([#512](https://github.com/roots/bedrock/pull/512))
### 1.13.3: 2020-04-24
* enhance(ci): Add CircleCI workflow for PHP 7.4 ([#510](https://github.com/roots/bedrock/pull/511))
* fix(mu-plugins): Fix invalid array access notice on 7.4 ([#510](https://github.com/roots/bedrock/pull/510))
* enhance(composer): Add `only` option to wpackagist.org repository ([#508](https://github.com/roots/bedrock/pull/508))
### 1.13.2: 2020-04-01
* chore(deps): Bump WordPress to 5.4 ([#502](https://github.com/roots/bedrock/pull/502))
* chore(deps): Bump vlucas/phpdotenv ([#501](https://github.com/roots/bedrock/pull/502))
* enhance(config): Add `WP_DEBUG_LOG` ([#499](https://github.com/roots/bedrock/pull/499))
### 1.13.1: 2020-02-19
* fix(env): Makes .env.example compatible with breaking changes from vlucas/phpdotenv 4.x ([#493](https://github.com/roots/bedrock/pull/493))
### 1.13.0: 2020-02-17
* Update to WordPress 5.3.2 ([#489](https://github.com/roots/bedrock/pull/489))
* chore(deps): Bump vlucas/phpdotenv from 4.0.1 to 4.1.0 ([#487](https://github.com/roots/bedrock/pull/487))
* chore(deps): Bump vlucas/phpdotenv from 3.6.0 to 4.0.1 ([#485](https://github.com/roots/bedrock/pull/485))
* chore(deps): Bump composer/installers from 1.7.0 to 1.8.0 ([#492](https://github.com/roots/bedrock/pull/492))
* chore(deps-dev): Bump squizlabs/php_codesniffer from 3.4.2 to 3.5.4 ([#490](https://github.com/roots/bedrock/pull/490))
* Clean up docblocks & commenting ([#459](https://github.com/roots/bedrock/pull/459))
### 1.12.8: 2019-09-05
* Update to WordPress 5.2.3 ([#466](https://github.com/roots/bedrock/pull/466))
* Remove `phpcs.xml` from `.gitattributes` ([#464](https://github.com/roots/bedrock/pull/464))
* `ini_set()` fixes ([#463](https://github.com/roots/bedrock/pull/463))
* Editorconfig updates ([#457](https://github.com/roots/bedrock/pull/457))
* Bump `composer/installers` ([#462](https://github.com/roots/bedrock/pull/462))
* Better default composer options ([#456](https://github.com/roots/bedrock/pull/456))
* Ignore `.log` files ([#440](https://github.com/roots/bedrock/pull/440))
* Change to CircleCI ([82945d8](https://github.com/roots/bedrock/commit/82945d803d10cb072b7e786e0a81094ccb2d067b), [#460](https://github.com/roots/bedrock/pull/460))
### 1.12.7: 2019-06-19
* Update to WordPress 5.2.2 ([#444](https://github.com/roots/bedrock/pull/444))
* Bump `oscarotero/env` ([#443](https://github.com/roots/bedrock/pull/443))
* Bump `vlucas/phpdotenv` ([#442](https://github.com/roots/bedrock/pull/442))
* Bump `squizlabs/php_codesniffer` ([#441](https://github.com/roots/bedrock/pull/441))
* Remove unnecessary static variables ([#437](https://github.com/roots/bedrock/pull/437))
### 1.12.6: 2019-05-21
* Update to WordPress 5.2.1 ([#436](https://github.com/roots/bedrock/pull/436))
### 1.12.5: 2019-05-14
* Disable WordPress' built-in fatal error handler on development ([#432](https://github.com/roots/bedrock/pull/434))
### 1.12.4: 2019-05-07
* Update to WordPress 5.2 ([#432](https://github.com/roots/bedrock/pull/432))
* Configure WP-CLI `wp server` webroot ([#427](https://github.com/roots/bedrock/pull/427))
* Fix issue with `bedrock_autoloader` option ([#386](https://github.com/roots/bedrock/pull/386))
### 1.12.3: 2019-03-13
* Update to WordPress 5.1.1 ([#426](https://github.com/roots/bedrock/pull/426))
### 1.12.2: 2019-02-21
* Update to WordPress 5.1 ([#420](https://github.com/roots/bedrock/pull/420))
### 1.12.1: 2019-02-14
* Update `vlucas/phpdotenv` ([#417](https://github.com/roots/bedrock/pull/417))
* Make DSN implementation more uniform ([#415](https://github.com/roots/bedrock/pull/415))
### 1.12.0: 2019-02-07
* Support database DSN ([#414](https://github.com/roots/bedrock/pull/414))
* Detect HTTPS if WordPress is behind a reverse proxy ([#413](https://github.com/roots/bedrock/pull/413))
* Update `vlucas/phpdotenv` to `^3` ([#412](https://github.com/roots/bedrock/pull/412))
### 1.11.1: 2019-01-09
* Update to WordPress 5.0.3 ([#408](https://github.com/roots/bedrock/pull/408))
### 1.11.0: 2018-12-19
* Bump PHP requirement to >= 7.1 ([#405](https://github.com/roots/bedrock/pull/405))
### 1.10.2: 2018-12-19
* Update to WordPress 5.0.2 ([#406](https://github.com/roots/bedrock/pull/406))
### 1.10.1: 2018-12-12
* Update to WordPress 5.0.1 ([#403](https://github.com/roots/bedrock/pull/403))
### 1.10.0: 2018-12-09
* Update to WordPress 5.0, switch from `johnpbloch/wordpress` to `roots/wordpress` package ([#395](https://github.com/roots/bedrock/pull/395))
### 1.9.0: 2018-09-17
* Fix error display in development environments ([c457082](https://github.com/roots/bedrock/commit/c457082cf4b153400d3e34f4f68a30eea4cc7c38))
* --prefer-dist on roave/security-advisories ([#381](https://github.com/roots/bedrock/pull/381))
* New Bedrock Configuration Model ([#380](https://github.com/roots/bedrock/pull/380))
* Remove vendor/.gitkeep ([#379](https://github.com/roots/bedrock/pull/379))
* Composer 1.7.0 lockfile ([#378](https://github.com/roots/bedrock/pull/378))
* Adds roave/security-advisories to composer dev deps ([#376](https://github.com/roots/bedrock/pull/376))
### 1.8.12: 2018-08-03
* Update to WordPress 4.9.8
### 1.8.11: 2018-07-09
* Update to WordPress 4.9.7
### 1.8.10: 2018-05-18
* Update to WordPress 4.9.6
### 1.8.9: 2018-04-04
* Update to WordPress 4.9.5
### 1.8.8: 2018-02-06
* Update to WordPress 4.9.4
### 1.8.7: 2018-02-05
* Update to WordPress 4.9.3
### 1.8.6: 2018-01-16
* Update to WordPress 4.9.2
### 1.8.5: 2017-11-29
* Update to WordPress 4.9.1
### 1.8.4: 2017-11-16
* Update to WordPress 4.9.0
### 1.8.3: 2017-10-31
* Update to WordPress 4.8.3
### 1.8.2: 2017-09-19
* Update to WordPress 4.8.2
### 1.8.1: 2017-08-02
* Update to WordPress 4.8.1
### 1.8.0: 2017-06-08
* Update to WordPress 4.8.0
### 1.7.9: 2017-05-16
* Update to WordPress 4.7.5
### 1.7.8: 2017-05-03
* Update `johnpbloch/wordpress` to 4.7.4.1 (see https://github.com/johnpbloch/wordpress/issues/32)
### 1.7.7: 2017-04-20
* Update to WordPress 4.7.4
### 1.7.6: 2017-03-06
* Update to WordPress 4.7.3
### 1.7.5: 2017-01-26
* Update to WordPress 4.7.2
### 1.7.4: 2017-01-11
* Update to WordPress 4.7.1
* Add Optional variables to `.env.example`
* Remove unnecessary gitignore rules ([#286](https://github.com/roots/bedrock/pull/286))
### 1.7.3: 2016-12-06
* Update to WordPress 4.7
* Default `WP_ENV` to `production` instead of `development` ([#277](https://github.com/roots/bedrock/pull/277))
### 1.7.2: 2016-09-07
* Update to WordPress 4.6.1
### 1.7.1: 2016-08-16
* Update to WordPress 4.6
### 1.7.0: 2016-07-10
* Bump PHP requirement to >= 5.6 (5.5 is no longer supported)
### 1.6.4: 2016-06-21
* Update to WordPress 4.5.3
### 1.6.3: 2016-05-06
* Update to WordPress 4.5.2
### 1.6.2: 2016-04-26
* Update to WordPress 4.5.1
### 1.6.1: 2016-04-12
* Update to WordPress 4.5
* Update coding standards (PSR-2) ([#244](https://github.com/roots/bedrock/pull/244))
### 1.6.0: 2016-03-03
* Add wp-password-bcrypt for more secure passwords ([#243](https://github.com/roots/bedrock/pull/243))
### 1.5.4: 2016-02-29
* Use HTTPS for wpackagist.org
### 1.5.3: 2016-02-03
* Update to WordPress 4.4.2
### 1.5.2: 2016-02-01
* Bump `composer/installers` dependency to 1.0.23 to fix deprecation notice
### 1.5.1: 2016-01-27
* Use [oscarotero/env](https://github.com/oscarotero/env) instead of `getenv` ([#229](https://github.com/roots/bedrock/pull/233))
### 1.5.0: 2016-01-17
* Fix `DISABLE_WP_CRON` setting via ENV variable ([#229](https://github.com/roots/bedrock/pull/229))
* Set default `DB_CHARSET` to `utf8mb4`
### 1.4.7: 2016-01-07
* Update to WordPress 4.4.1
### 1.4.6: 2015-12-09
* Update to WordPress 4.4
### 1.4.5: 2015-09-16
* Update to WordPress 4.3.1
* Bump minimum required PHP version to 5.5 ([#201](https://github.com/roots/bedrock/pull/201))
### 1.4.4: 2015-08-18
* Update to WordPress 4.3
### 1.4.3: 2015-08-04
* Update to WordPress 4.2.4
### 1.4.2: 2015-07-24
* Update to WordPress 4.2.3
### 1.4.1: 2015-06-30
* Dotenv 2.0.1 update
### 1.4.0: 2015-06-07
* Removed .env generation script
### 1.3.7: 2015-05-07
* Update to WordPress 4.2.2
### 1.3.6: 2015-04-27
* Update to WordPress 4.2.1
### 1.3.5: 2015-04-23
* Update to WordPress 4.2
* Update to WordPress 4.1.2
* Don't register theme directory if `WP_DEFAULT_THEME` is defined
* Move Capistrano configs to https://github.com/roots/bedrock-capistrano
### 1.3.4: 2015-02-18
* WordPress 4.1.1 fix
### 1.3.3: 2015-02-18
* Update to WordPress 4.1.1
* mu-plugins autoloader Multisite fix
* Coding standards update + TravisCI integration
### 1.3.2: 2014-12-18
* Update to WordPress 4.1
* Remove WPLANG constant
### 1.3.1: 2014-11-28
* Add Capistrano task to fix/update WP theme paths after deploys
### 1.3.0: 2014-11-20
* Update to WordPress 4.0.1
* Use johnpbloch/wordpress package instead of custom repository
* Update default deploy.rb
* Require PHP >= 5.4 in composer.json
* Better PSR-1 adherence
* Update phpdotenv dependency to 1.0.9
* Fix Composer installer path plugin order
* Add bedrock-autoloader mu-plugin
### 1.2.7: 2014-09-04
* Update to WordPress 4.0
### 1.2.6: 2014-08-06
* Update to WordPress 3.9.2
* Minor deploy fix
* Doc updates
### 1.2.5: 2014-07-16
* Update to WordPress 3.9.1
* Doc updates
* Add `DB_PREFIX` constant
* Update Gem versions
* Disallow indexing in non-production environments
### 1.2.4: 2014-04-17
* Fixes issue with 3.9 update (`composer.lock` wasn't updated)
### 1.2.3: 2014-04-16
* Update to WordPress 3.9
### 1.2.2: 2014-04-14
* Update to WordPress 3.8.3
* Only run `Dotenv::load` if `.env` file exists
### 1.2.1: 2014-04-08
* Update to WordPress 3.8.2
### 1.2.0: 2014-04-07
* WP package now has `wordpress` vendor name: `wordpress/wordpress`
* Remove wp-cli and add `wp-cli.yml` config
### 1.1.1: 2014-03-11
* Update phpdotenv to 1.0.6
* Update wp-cli to v0.14.1
* Update README to refence new WordPress Packagist namespaces
* Fix uploads path in `linked_dirs` for Capistrano deploys
### 1.1.0: 2014-03-01
* Update to Capistrano 3.1.0: `deploy:restart` is no longer run by default
* Better webroot structure: introduces the `/web` directory as the document/web root for web server vhosts
### 1.0.0: 2013-12-18
* Initial release

19
bedrock/LICENSE.md Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) Roots
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

115
bedrock/README.md Normal file
View File

@ -0,0 +1,115 @@
<p align="center">
<a href="https://roots.io/bedrock/">
<img alt="Bedrock" src="https://cdn.roots.io/app/uploads/logo-bedrock.svg" height="100">
</a>
</p>
<p align="center">
<a href="LICENSE.md">
<img alt="MIT License" src="https://img.shields.io/github/license/roots/bedrock?color=%23525ddc&style=flat-square" />
</a>
<a href="https://packagist.org/packages/roots/bedrock">
<img alt="Packagist" src="https://img.shields.io/packagist/v/roots/bedrock.svg?style=flat-square" />
</a>
<a href="https://github.com/roots/bedrock/actions/workflows/ci.yml">
<img alt="Build Status" src="https://img.shields.io/github/workflow/status/roots/bedrock/CI?style=flat-square" />
</a>
<a href="https://twitter.com/rootswp">
<img alt="Follow Roots" src="https://img.shields.io/twitter/follow/rootswp.svg?style=flat-square&color=1da1f2" />
</a>
</p>
<p align="center">
<strong>A modern WordPress stack</strong>
<br />
Built with ❤️
</p>
<p align="center">
<a href="https://roots.io">Official Website</a> | <a href="https://roots.io/docs/bedrock/master/installation/">Documentation</a> | <a href="CHANGELOG.md">Change Log</a>
</p>
## Supporting
**Bedrock** is an open source project and completely free to use.
However, the amount of effort needed to maintain and develop new features and products within the Roots ecosystem is not sustainable without proper financial backing. If you have the capability, please consider donating using the links below:
<div align="center">
[![Donate via Patreon](https://img.shields.io/badge/donate-patreon-orange.svg?style=flat-square&logo=patreon")](https://www.patreon.com/rootsdev)
[![Donate via PayPal](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square&logo=paypal)](https://www.paypal.me/rootsdev)
</div>
## Overview
Bedrock is a modern WordPress stack that helps you get started with the best development tools and project structure.
Much of the philosophy behind Bedrock is inspired by the [Twelve-Factor App](http://12factor.net/) methodology including the [WordPress specific version](https://roots.io/twelve-factor-wordpress/).
## Features
- Better folder structure
- Dependency management with [Composer](https://getcomposer.org)
- Easy WordPress configuration with environment specific files
- Environment variables with [Dotenv](https://github.com/vlucas/phpdotenv)
- Autoloader for mu-plugins (use regular plugins as mu-plugins)
- Enhanced security (separated web root and secure passwords with [wp-password-bcrypt](https://github.com/roots/wp-password-bcrypt))
## Requirements
- PHP >= 7.1
- Composer - [Install](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx)
## Installation
1. Create a new project:
```sh
$ composer create-project roots/bedrock
```
2. Update environment variables in the `.env` file. Wrap values that may contain non-alphanumeric characters with quotes, or they may be incorrectly parsed.
- Database variables
- `DB_NAME` - Database name
- `DB_USER` - Database user
- `DB_PASSWORD` - Database password
- `DB_HOST` - Database host
- Optionally, you can define `DATABASE_URL` for using a DSN instead of using the variables above (e.g. `mysql://user:password@127.0.0.1:3306/db_name`)
- `WP_ENV` - Set to environment (`development`, `staging`, `production`)
- `WP_HOME` - Full URL to WordPress home (https://example.com)
- `WP_SITEURL` - Full URL to WordPress including subdirectory (https://example.com/wp)
- `AUTH_KEY`, `SECURE_AUTH_KEY`, `LOGGED_IN_KEY`, `NONCE_KEY`, `AUTH_SALT`, `SECURE_AUTH_SALT`, `LOGGED_IN_SALT`, `NONCE_SALT`
- Generate with [wp-cli-dotenv-command](https://github.com/aaemnnosttv/wp-cli-dotenv-command)
- Generate with [our WordPress salts generator](https://roots.io/salts.html)
3. Add theme(s) in `web/app/themes/` as you would for a normal WordPress site
4. Set the document root on your webserver to Bedrock's `web` folder: `/path/to/site/web/`
5. Access WordPress admin at `https://example.com/wp/wp-admin/`
## Documentation
Bedrock documentation is available at [https://roots.io/docs/bedrock/master/installation/](https://roots.io/docs/bedrock/master/installation/).
## Contributing
Contributions are welcome from everyone. We have [contributing guidelines](https://github.com/roots/guidelines/blob/master/CONTRIBUTING.md) to help you get started.
## Bedrock sponsors
Help support our open-source development efforts by [becoming a patron](https://www.patreon.com/rootsdev).
<a href="https://kinsta.com/?kaid=OFDHAJIXUDIV"><img src="https://cdn.roots.io/app/uploads/kinsta.svg" alt="Kinsta" width="200" height="150"></a> <a href="https://k-m.com/"><img src="https://cdn.roots.io/app/uploads/km-digital.svg" alt="KM Digital" width="200" height="150"></a> <a href="https://carrot.com/"><img src="https://cdn.roots.io/app/uploads/carrot.svg" alt="Carrot" width="200" height="150"></a> <a href="https://www.c21redwood.com/"><img src="https://cdn.roots.io/app/uploads/c21redwood.svg" alt="C21 Redwood Realty" width="200" height="150"></a> <a href="https://wordpress.com/"><img src="https://cdn.roots.io/app/uploads/wordpress.svg" alt="WordPress.com" width="200" height="150"></a> <a href="https://pantheon.io/"><img src="https://cdn.roots.io/app/uploads/pantheon.svg" alt="Pantheon" width="200" height="150"></a>
## Community
Keep track of development and community news.
- Participate on the [Roots Discourse](https://discourse.roots.io/)
- Follow [@rootswp on Twitter](https://twitter.com/rootswp)
- Read and subscribe to the [Roots Blog](https://roots.io/blog/)
- Subscribe to the [Roots Newsletter](https://roots.io/subscribe/)
- Listen to the [Roots Radio podcast](https://roots.io/podcast/)

70
bedrock/composer.json Normal file
View File

@ -0,0 +1,70 @@
{
"name": "roots/bedrock",
"type": "project",
"license": "MIT",
"description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
"homepage": "https://roots.io/bedrock/",
"authors": [
{
"name": "Scott Walkinshaw",
"email": "scott.walkinshaw@gmail.com",
"homepage": "https://github.com/swalkinshaw"
},
{
"name": "Ben Word",
"email": "ben@benword.com",
"homepage": "https://github.com/retlehs"
}
],
"keywords": [
"bedrock", "composer", "roots", "wordpress", "wp", "wp-config"
],
"support": {
"issues": "https://github.com/roots/bedrock/issues",
"forum": "https://discourse.roots.io/category/bedrock"
},
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org",
"only": ["wpackagist-plugin/*", "wpackagist-theme/*"]
}
],
"require": {
"php": ">=7.1",
"composer/installers": "^1.12",
"vlucas/phpdotenv": "^5.3",
"oscarotero/env": "^2.1",
"roots/bedrock-autoloader": "^1.0",
"roots/bedrock-disallow-indexing": "^2.0",
"roots/wordpress": "5.8.2",
"roots/wp-config": "1.0.0",
"roots/wp-password-bcrypt": "1.1.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.6.0",
"roave/security-advisories": "dev-latest"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"installer-paths": {
"web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"web/app/plugins/{$name}/": ["type:wordpress-plugin"],
"web/app/themes/{$name}/": ["type:wordpress-theme"]
},
"wordpress-install-dir": "web/wp"
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"test": [
"phpcs"
]
}
}

1472
bedrock/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,137 @@
<?php
/**
* Your base production configuration goes in this file. Environment-specific
* overrides go in their respective config/environments/{{WP_ENV}}.php file.
*
* A good default policy is to deviate from the production config as little as
* possible. Try to define as much of your configuration in this file as you
* can.
*/
use Roots\WPConfig\Config;
use function Env\env;
/**
* Directory containing all of the site's files
*
* @var string
*/
$root_dir = dirname(__DIR__);
/**
* Document Root
*
* @var string
*/
$webroot_dir = $root_dir . '/web';
/**
* Use Dotenv to set required environment variables and load .env file in root
* .env.local will override .env if it exists
*/
$env_files = file_exists($root_dir . '/.env.local')
? ['.env', '.env.local']
: ['.env'];
$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir, $env_files, false);
if (file_exists($root_dir . '/.env')) {
$dotenv->load();
$dotenv->required(['WP_HOME', 'WP_SITEURL']);
if (!env('DATABASE_URL')) {
$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD']);
}
}
/**
* Set up our global environment constant and load its config first
* Default: production
*/
define('WP_ENV', env('WP_ENV') ?: 'production');
/**
* URLs
*/
Config::define('WP_HOME', env('WP_HOME'));
Config::define('WP_SITEURL', env('WP_SITEURL'));
/**
* Custom Content Directory
*/
Config::define('CONTENT_DIR', '/app');
Config::define('WP_CONTENT_DIR', $webroot_dir . Config::get('CONTENT_DIR'));
Config::define('WP_CONTENT_URL', Config::get('WP_HOME') . Config::get('CONTENT_DIR'));
/**
* DB settings
*/
Config::define('DB_NAME', env('DB_NAME'));
Config::define('DB_USER', env('DB_USER'));
Config::define('DB_PASSWORD', env('DB_PASSWORD'));
Config::define('DB_HOST', env('DB_HOST') ?: 'localhost');
Config::define('DB_CHARSET', 'utf8mb4');
Config::define('DB_COLLATE', '');
$table_prefix = env('DB_PREFIX') ?: 'wp_';
if (env('DATABASE_URL')) {
$dsn = (object) parse_url(env('DATABASE_URL'));
Config::define('DB_NAME', substr($dsn->path, 1));
Config::define('DB_USER', $dsn->user);
Config::define('DB_PASSWORD', isset($dsn->pass) ? $dsn->pass : null);
Config::define('DB_HOST', isset($dsn->port) ? "{$dsn->host}:{$dsn->port}" : $dsn->host);
}
/**
* Authentication Unique Keys and Salts
*/
Config::define('AUTH_KEY', env('AUTH_KEY'));
Config::define('SECURE_AUTH_KEY', env('SECURE_AUTH_KEY'));
Config::define('LOGGED_IN_KEY', env('LOGGED_IN_KEY'));
Config::define('NONCE_KEY', env('NONCE_KEY'));
Config::define('AUTH_SALT', env('AUTH_SALT'));
Config::define('SECURE_AUTH_SALT', env('SECURE_AUTH_SALT'));
Config::define('LOGGED_IN_SALT', env('LOGGED_IN_SALT'));
Config::define('NONCE_SALT', env('NONCE_SALT'));
/**
* Custom Settings
*/
Config::define('AUTOMATIC_UPDATER_DISABLED', true);
Config::define('DISABLE_WP_CRON', env('DISABLE_WP_CRON') ?: false);
// Disable the plugin and theme file editor in the admin
Config::define('DISALLOW_FILE_EDIT', true);
// Disable plugin and theme updates and installation from the admin
Config::define('DISALLOW_FILE_MODS', true);
// Limit the number of post revisions that Wordpress stores (true (default WP): store every revision)
Config::define('WP_POST_REVISIONS', env('WP_POST_REVISIONS') ?: true);
/**
* Debugging Settings
*/
Config::define('WP_DEBUG_DISPLAY', false);
Config::define('WP_DEBUG_LOG', false);
Config::define('SCRIPT_DEBUG', false);
ini_set('display_errors', '0');
/**
* Allow WordPress to detect HTTPS when used behind a reverse proxy or a load balancer
* See https://codex.wordpress.org/Function_Reference/is_ssl#Notes
*/
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}
$env_config = __DIR__ . '/environments/' . WP_ENV . '.php';
if (file_exists($env_config)) {
require_once $env_config;
}
Config::apply();
/**
* Bootstrap WordPress
*/
if (!defined('ABSPATH')) {
define('ABSPATH', $webroot_dir . '/wp/');
}

View File

@ -0,0 +1,20 @@
<?php
/**
* Configuration overrides for WP_ENV === 'development'
*/
use Roots\WPConfig\Config;
use function Env\env;
Config::define('SAVEQUERIES', true);
Config::define('WP_DEBUG', true);
Config::define('WP_DEBUG_DISPLAY', true);
Config::define('WP_DEBUG_LOG', env('WP_DEBUG_LOG') ?? true);
Config::define('WP_DISABLE_FATAL_ERROR_HANDLER', true);
Config::define('SCRIPT_DEBUG', true);
Config::define('DISALLOW_INDEXING', true);
ini_set('display_errors', '1');
// Enable plugin and theme updates and installation from the admin
Config::define('DISALLOW_FILE_MODS', false);

View File

@ -0,0 +1,17 @@
<?php
/**
* Configuration overrides for WP_ENV === 'staging'
*/
use Roots\WPConfig\Config;
/**
* You should try to keep staging as close to production as possible. However,
* should you need to, you can always override production configuration values
* with `Config::define`.
*
* Example: `Config::define('WP_DEBUG', true);`
* Example: `Config::define('DISALLOW_FILE_MODS', false);`
*/
Config::define('DISALLOW_INDEXING', true);

23
bedrock/phpcs.xml Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<ruleset name="Roots">
<description>Roots Coding Standards</description>
<!-- Scan all files in directory -->
<file>.</file>
<!-- Scan only PHP files -->
<arg name="extensions" value="php"/>
<!-- Ignore WordPress and Composer dependencies -->
<exclude-pattern>web/wp</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>
<!-- Show colors in console -->
<arg value="-colors"/>
<!-- Show sniff codes in all reports -->
<arg value="ns"/>
<!-- Use PSR-2 as a base -->
<rule ref="PSR2"/>
</ruleset>

View File

@ -0,0 +1,16 @@
<?php
/**
* Plugin Name: Bedrock Autoloader
* Plugin URI: https://github.com/roots/bedrock-autoloader
* Description: An autoloader that enables standard plugins to be required just like must-use plugins. The autoloaded plugins are included during mu-plugin loading. An asterisk (*) next to the name of the plugin designates the plugins that have been autoloaded.
* Version: 1.0.3
* Author: Roots
* Author URI: https://roots.io/
* License: MIT License
*/
namespace Roots\Bedrock;
if (is_blog_installed() && class_exists(Autoloader::class)) {
new Autoloader();
}

View File

@ -0,0 +1,14 @@
<?php
/**
* Plugin Name: Register Theme Directory
* Plugin URI: https://github.com/roots/bedrock/
* Description: Register default theme directory
* Version: 1.0.0
* Author: Roots
* Author URI: https://roots.io/
* License: MIT License
*/
if (!defined('WP_DEFAULT_THEME')) {
register_theme_directory(ABSPATH . 'wp-content/themes');
}

View File

6
bedrock/web/index.php Normal file
View File

@ -0,0 +1,6 @@
<?php
/**
* WordPress View Bootstrapper
*/
define('WP_USE_THEMES', true);
require __DIR__ . '/wp/wp-blog-header.php';

View File

@ -0,0 +1,9 @@
<?php
/**
* Do not edit this file. Edit the config files found in the config/ dir instead.
* This file is required in the root directory so WordPress can find it.
* WP is hardcoded to look in its own directory or one directory up for wp-config.php.
*/
require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once dirname(__DIR__) . '/config/application.php';
require_once ABSPATH . 'wp-settings.php';

3
bedrock/wp-cli.yml Normal file
View File

@ -0,0 +1,3 @@
path: web/wp
server:
docroot: web

38
docker-compose.yml Normal file
View File

@ -0,0 +1,38 @@
---
version: "3"
services:
wordpress:
image: "thecoopcloud/wordpress:5.8.2-php7.4"
build: .
ports:
- "80:80"
volumes:
- "./bedrock/:/var/www/html/"
- "./entrypoint-wordpress.sh:/usr/local/bin/entrypoint-wordpress.sh"
environment:
- WORDPRESS_DB_HOST=db
- WORDPRESS_DB_USER=wordpress
- WORDPRESS_DB_PASSWORD=wordpress
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_CONFIG_EXTRA=${WORDPRESS_CONFIG_EXTRA}
- WORDPRESS_DEBUG=${WORDPRESS_DEBUG}
- PHP_EXTENSIONS
container_name: "${PROJECT_NAME}_wordpress"
db:
image: "mariadb:10.6"
volumes:
- "mariadb:/var/lib/mysql"
environment:
- MYSQL_ROOT_PASSWORD=wordpress
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
container_name: "${PROJECT_NAME}_db"
volumes:
mariadb:
networks:
backend:

15
entrypoint-wordpress.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ -n "$PHP_EXTENSIONS" ]; then
docker-php-ext-install "$PHP_EXTENSIONS"
fi
chown -R www-data:www-data /var/www/html
if [ -n "$*" ]; then
"$@"
fi
# Upstream ENTRYPOINT
# https://github.com/docker-library/wordpress/blob/master/php7.4/apache/Dockerfile#L120
apache2-foreground