Skip to content

Commit

Permalink
WordPress: In unzipWordPress(), confirm wp-config-sample.php exists b…
Browse files Browse the repository at this point in the history
 …efore trying to use it as a template for wp-config.php
  • Loading branch information
adamziel committed May 21, 2024
1 parent 01abfbf commit 21008e7
Showing 1 changed file with 11 additions and 4 deletions .
15 changes: 11 additions & 4 deletions packages/playground/wordpress/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,15 @@ export async function unzipWordPress(php: BasePHP, wpZip: File) {
: '/tmp/unzipped-wordpress' ;

php . mv ( wpPath , php . documentRoot ) ;
php . writeFile (
'/wp-config.php' ,
php . readFileAsText ( php . documentRoot + '/wp-config-sample.php' )
) ;
if (
! php . fileExists ( joinPaths ( php . documentRoot , 'wp-config.php' ) ) &&
php . fileExists ( joinPaths ( php . documentRoot , 'wp-config-sample.php' ) )
) {
php . writeFile (
joinPaths ( php . documentRoot , 'wp-config.php' ) ,
php . readFileAsText (
joinPaths ( php . documentRoot , '/wp-config-sample.php' )
)
) ;
}
}

0 comments on commit 21008e7

Please sign in to comment.