Skip to content

Commit 5e17388

Browse files
committed
Add errors when rename function generate errors
1 parent 3fa8152 commit 5e17388

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

wp-includes/sqlite/class-wp-sqlite-db.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,15 @@ public function db_connect( $allow_bail = true ) {
314314
$old_db_path = FQDBDIR . '.ht.sqlite';
315315

316316
if ( file_exists( $old_db_path ) ) {
317-
rename( $old_db_path, FQDB );
317+
if ( ! rename( $old_db_path, FQDB ) ) {
318+
wp_die( 'Failed to rename database file.', 'Error!' );
319+
}
318320

319321
foreach ( array( '-wal', '-shm' ) as $suffix ) {
320322
if ( file_exists( $old_db_path . $suffix ) ) {
321-
rename( $old_db_path . $suffix, FQDB . $suffix );
323+
if ( ! rename( $old_db_path . $suffix, FQDB . $suffix ) ) {
324+
wp_die( 'Failed to rename database file.', 'Error!' );
325+
}
322326
}
323327
}
324328
}

0 commit comments

Comments
 (0)