Skip to content

Commit

Permalink
Composer: Install full wporg-mu-plugins in local environments
Browse files Browse the repository at this point in the history
It's required as of 65b2f8d

It was moved to the regular composer file, because having a 2nd one complicates things and doesn't seem necessary for this package.
  • Loading branch information
iandunn committed Dec 23, 2023
1 parent 9ae4804 commit 0290020
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
12 changes: 0 additions & 12 deletions .docker/config/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
"type": "composer",
"url": "https://wpackagist.org/"
},
{
"type": "vcs",
"url": "https://github.com/WordPress/wporg-mu-plugins.git"
},
{
"type": "package",
"package": [
Expand Down Expand Up @@ -124,7 +120,6 @@
"wpackagist-plugin/wp-cldr": "*",
"wpackagist-plugin/wp-super-cache": "*",
"wordpress-meta/wporg-profiles-wp-activity-notifier": "1.1",
"wporg/wporg-mu-plugins": "dev-build",
"wpackagist-theme/p2": "*",
"wpackagist-theme/twentyten": "*",
"wpackagist-theme/twentyeleven": "*",
Expand All @@ -139,12 +134,5 @@
"wpackagist-theme/twentytwentyone": "*",
"wpackagist-theme/twentytwentytwo": "*",
"wpackagist-theme/twentytwentythree": "*"
},
"scripts": {
"post-update-cmd": [
"mkdir -p public_html/wp-content/mu-plugins-private/wporg-mu-plugins/pub-sync",
"mv public_html/wp-content/mu-plugins/wporg-mu-plugins/mu-plugins/utilities public_html/wp-content/mu-plugins-private/wporg-mu-plugins/pub-sync",
"rm -rf public_html/wp-content/mu-plugins/wporg-mu-plugins"
]
}
}
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@
},
"extra": {
"installer-paths": {
"public_html/wp-content/themes/{$name}": ["wporg/wporg-parent-2021"]
"public_html/wp-content/themes/{$name}": ["wporg/wporg-parent-2021"],
"public_html/wp-content/mu-plugins-private/{$name}": ["wporg/wporg-mu-plugins"]
}
},
"repositories": [
{
"type": "vcs",
"url": "[email protected]:WordPress/wporg-parent-2021.git"
},
{
"type": "vcs",
"url": "https://github.com/WordPress/wporg-mu-plugins.git"
}
],
"require": {
Expand All @@ -41,7 +46,8 @@
"sirbrillig/phpcs-changed": "2.10.0",
"spatie/phpunit-watcher": "^1.23",
"yoast/phpunit-polyfills": "^1.0",
"composer/installers": "^2.2"
"composer/installers": "^2.2",
"wporg/wporg-mu-plugins": "dev-build"
},
"scripts": {
"format": "phpcbf -p",
Expand Down
17 changes: 15 additions & 2 deletions public_html/wp-content/mu-plugins/load-other-mu-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Load mu-plugins that should run on all networks.
*/
function wcorg_include_common_plugins() {
// Include the private `wporg-mu-plugins` from `dotorg.svn`. These are different than the
// ones included in `wcorg_include_network_only_plugins()`.
if ( file_exists( dirname( __DIR__ ) . '/mu-plugins-private/wporg-mu-plugins.php' ) ) {
require_once dirname( __DIR__ ) . '/mu-plugins-private/wporg-mu-plugins.php';
}
Expand All @@ -25,8 +27,19 @@ function wcorg_include_network_only_plugins() {
if ( EVENTS_NETWORK_ID === SITE_ID_CURRENT_SITE ) {
$network_folder = 'events';

require_once dirname( __DIR__ ) . '/mu-plugins-private/wporg-mu-plugins/pub-sync/loader.php';

// Include the public `wporg-mu-plugins` that are synced from Git to SVN. These are different than the
// ones included in `wcorg_include_common_plugins()`.
// Production uses an `svn:external` to the sync directory, but the Docker environment can't install that
// because it's a private repository. It installs the open source repo, which has a slightly different
// path.
$wporg_mu_plugins_production_path = dirname( __DIR__ ) . '/mu-plugins-private/wporg-mu-plugins/pub-sync/loader.php';
$wporg_mu_plugins_dev_path = dirname( __DIR__ ) . '/mu-plugins-private/wporg-mu-plugins/mu-plugins/loader.php';

if ( file_exists( $wporg_mu_plugins_production_path ) ) {
require_once $wporg_mu_plugins_production_path;
} else {
require_once $wporg_mu_plugins_dev_path;
}
} else {
$network_folder = 'wordcamp';
}
Expand Down

0 comments on commit 0290020

Please sign in to comment.