Skip to content

Commit b7593cf

Browse files
authored
Merge pull request #11 from Automattic/fix-missing-db-name-constant
Add a fallback for missing `DB_NAME` constant
2 parents d426211 + 3829390 commit b7593cf

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/SQLiteDriverFactory.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ public static function create_driver() {
2121
'path' => FQDB,
2222
)
2323
);
24-
return new WP_SQLite_Driver( $connection, DB_NAME );
24+
if ( defined( 'DB_NAME' ) && '' !== DB_NAME ) {
25+
$db_name = DB_NAME;
26+
} else {
27+
$db_name = 'database_name_here';
28+
}
29+
return new WP_SQLite_Driver( $connection, $db_name );
2530
}
2631

2732
return new WP_SQLite_Translator();

0 commit comments

Comments
 (0)