@@ -1614,7 +1614,10 @@ public function install_wp( $subdir = '', $version = '' ): void {
16141614
16151615 $ install_cache_path = self ::$ install_cache_dir . '/install_ ' . md5 ( implode ( ': ' , $ install_args ) . ':subdir= ' . $ subdir );
16161616
1617- if ( file_exists ( $ install_cache_path ) ) {
1617+ $ install_cache_is_valid = file_exists ( $ install_cache_path )
1618+ && ( 'sqlite ' !== self ::$ db_type || file_exists ( "{$ install_cache_path }.sqlite " ) );
1619+
1620+ if ( $ install_cache_is_valid ) {
16181621 self ::copy_dir ( $ install_cache_path , $ run_dir );
16191622
16201623 // This is the sqlite equivalent of restoring a database dump in MySQL
@@ -1627,7 +1630,9 @@ public function install_wp( $subdir = '', $version = '' ): void {
16271630 } else {
16281631 $ this ->proc ( 'wp core install ' , $ install_args , $ subdir )->run_check ();
16291632
1630- mkdir ( $ install_cache_path );
1633+ if ( ! is_dir ( $ install_cache_path ) ) {
1634+ mkdir ( $ install_cache_path );
1635+ }
16311636
16321637 self ::dir_diff_copy ( $ run_dir , self ::$ cache_dir , $ install_cache_path );
16331638
@@ -1646,7 +1651,10 @@ public function install_wp( $subdir = '', $version = '' ): void {
16461651
16471652 if ( 'sqlite ' === self ::$ db_type ) {
16481653 // This is the sqlite equivalent of creating a database dump in MySQL
1649- copy ( "$ run_dir/wp-content/database/.ht.sqlite " , "{$ install_cache_path }.sqlite " );
1654+ $ sqlite_source = "$ run_dir/wp-content/database/.ht.sqlite " ;
1655+ if ( file_exists ( $ sqlite_source ) ) {
1656+ copy ( $ sqlite_source , "{$ install_cache_path }.sqlite " );
1657+ }
16501658 }
16511659 }
16521660 }
0 commit comments