Skip to content

Commit 4123df6

Browse files
authored
Merge pull request #191 from wp-cli/must-use-sqlite
2 parents 560ed5c + 61d8caf commit 4123df6

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/Context/FeatureContext.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,18 +371,20 @@ private static function download_sqlite_plugin( $dir ) {
371371
* configure it to use SQLite as the database by placing the db.php dropin file
372372
*/
373373
private static function configure_sqlite( $dir ) {
374-
$db_copy = $dir . '/wp-content/plugins/sqlite-database-integration/db.copy';
374+
$db_copy = $dir . '/wp-content/mu-plugins/sqlite-database-integration/db.copy';
375375
$db_dropin = $dir . '/wp-content/db.php';
376376

377377
/* similar to https://github.com/WordPress/sqlite-database-integration/blob/3306576c9b606bc23bbb26c15383fef08e03ab11/activate.php#L95 */
378378
$file_contents = str_replace(
379379
array(
380380
'\'{SQLITE_IMPLEMENTATION_FOLDER_PATH}\'',
381381
'{SQLITE_PLUGIN}',
382+
'/plugins/',
382383
),
383384
array(
384-
'__DIR__ . \'plugins/sqlite-database-integration\'',
385+
'__DIR__ . \'mu-plugins/sqlite-database-integration\'',
385386
'sqlite-database-integration/load.php',
387+
'/mu-plugins/',
386388
),
387389
file_get_contents( $db_copy )
388390
);
@@ -949,7 +951,7 @@ public function download_wp( $subdir = '' ) {
949951
copy( dirname( dirname( __DIR__ ) ) . '/utils/polyfills.php', $dest_dir . '/wp-content/mu-plugins/polyfills.php' );
950952

951953
if ( 'sqlite' === self::$db_type ) {
952-
self::copy_dir( self::$sqlite_cache_dir, $dest_dir . '/wp-content/plugins' );
954+
self::copy_dir( self::$sqlite_cache_dir, $dest_dir . '/wp-content/mu-plugins' );
953955
self::configure_sqlite( $dest_dir );
954956
}
955957
}
@@ -1090,7 +1092,7 @@ public function install_wp_with_composer( $vendor_directory = 'vendor' ) {
10901092
];
10911093

10921094
if ( 'sqlite' === self::$db_type ) {
1093-
self::copy_dir( self::$sqlite_cache_dir, $this->variables['RUN_DIR'] . '/WordPress/wp-content/plugins' );
1095+
self::copy_dir( self::$sqlite_cache_dir, $this->variables['RUN_DIR'] . '/WordPress/wp-content/mu-plugins' );
10941096
self::configure_sqlite( $this->variables['RUN_DIR'] . '/WordPress' );
10951097
}
10961098

src/Context/GivenStepDefinitions.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,21 @@ public function given_a_custom_wp_directory() {
175175
"define( 'WP_PLUGIN_DIR', __DIR__ . '/my-plugins' );"
176176
);
177177

178+
$this->move_files( 'my-content/mu-plugins', 'my-mu-plugins' );
179+
$this->add_line_to_wp_config(
180+
$wp_config_code,
181+
"define( 'WPMU_PLUGIN_DIR', __DIR__ . '/my-mu-plugins' );"
182+
);
183+
178184
file_put_contents( $wp_config_path, $wp_config_code );
179185

180186
if ( 'sqlite' === self::$db_type ) {
181187
$db_dropin = $this->variables['RUN_DIR'] . '/my-content/db.php';
182188

183189
/* similar to https://github.com/WordPress/sqlite-database-integration/blob/3306576c9b606bc23bbb26c15383fef08e03ab11/activate.php#L95 */
184190
$file_contents = str_replace(
185-
'plugins/',
186-
'../my-plugins/',
191+
'mu-plugins/',
192+
'../my-mu-plugins/',
187193
file_get_contents( $db_dropin )
188194
);
189195

0 commit comments

Comments
 (0)