@@ -1650,7 +1650,13 @@ public function install_wp( $subdir = '', $version = '' ): void {
16501650
16511651 // This is the sqlite equivalent of restoring a database dump in MySQL
16521652 if ( 'sqlite ' === self ::$ db_type ) {
1653- copy ( "{$ install_cache_path }.sqlite " , "$ run_dir/wp-content/database/.ht.sqlite " );
1653+ $ sqlite_dest_dir = "$ run_dir/wp-content/database " ;
1654+ if ( ! is_dir ( $ sqlite_dest_dir ) ) {
1655+ mkdir ( $ sqlite_dest_dir , 0755 , true );
1656+ }
1657+ if ( file_exists ( "{$ install_cache_path }.sqlite " ) ) {
1658+ copy ( "{$ install_cache_path }.sqlite " , "$ sqlite_dest_dir/.ht.sqlite.php " );
1659+ }
16541660 } else {
16551661 $ ssl_flag = 'mariadb ' === self ::$ db_type ? ' --ssl-verify-server-cert ' : '' ;
16561662 self ::run_sql ( self ::$ mysql_binary . ' --no-defaults ' . $ ssl_flag , [ 'execute ' => "source {$ install_cache_path }.sql " ], true /*add_database*/ );
@@ -1679,7 +1685,11 @@ public function install_wp( $subdir = '', $version = '' ): void {
16791685
16801686 if ( 'sqlite ' === self ::$ db_type ) {
16811687 // This is the sqlite equivalent of creating a database dump in MySQL
1682- $ sqlite_source = "$ run_dir/wp-content/database/.ht.sqlite " ;
1688+ // Support both the new (.ht.sqlite.php) and legacy (.ht.sqlite) file names.
1689+ $ sqlite_source = "$ run_dir/wp-content/database/.ht.sqlite.php " ;
1690+ if ( ! file_exists ( $ sqlite_source ) ) {
1691+ $ sqlite_source = "$ run_dir/wp-content/database/.ht.sqlite " ;
1692+ }
16831693 if ( file_exists ( $ sqlite_source ) ) {
16841694 copy ( $ sqlite_source , "{$ install_cache_path }.sqlite " );
16851695 } elseif ( file_exists ( "{$ install_cache_path }.sqlite " ) ) {
0 commit comments