Skip to content

Commit

Permalink
backport more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Feb 23, 2023
1 parent 013f48b commit c093eb3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ wp-tests-config.php

# Visual regression test diffs
tests/visual-regression/specs/__image_snapshots__

src/wp-content/database/.ht.sqlite

src/wp-content/database/
31 changes: 27 additions & 4 deletions src/wp-includes/sqlite/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,38 @@
* @since 1.0.0
*/

// Require the constants file.
require_once dirname( dirname( __DIR__ ) ) . '/constants.php';

// Bail early if DATABASE_TYPE is not defined as sqlite.
if ( ! defined( 'DATABASE_TYPE' ) || 'sqlite' !== DATABASE_TYPE ) {
return;
}

/**
* FQDBDIR is a directory where the sqlite database file is placed.
* If DB_DIR is defined, it is used as FQDBDIR.
*/
if ( ! defined( 'FQDBDIR' ) ) {
if ( defined( 'DB_DIR' ) ) {
define( 'FQDBDIR', trailingslashit( DB_DIR ) );
} elseif ( defined( 'WP_CONTENT_DIR' ) ) {
define( 'FQDBDIR', WP_CONTENT_DIR . '/database/' );
} else {
define( 'FQDBDIR', ABSPATH . 'wp-content/database/' );
}
}

/**
* FQDB is a database file name. If DB_FILE is defined, it is used
* as FQDB.
*/
if ( ! defined( 'FQDB' ) ) {
if ( defined( 'DB_FILE' ) ) {
define( 'FQDB', FQDBDIR . DB_FILE );
} else {
define( 'FQDB', FQDBDIR . '.ht.sqlite' );
}
}


if ( ! extension_loaded( 'pdo' ) ) {
wp_die(
new WP_Error(
Expand Down Expand Up @@ -48,6 +72,5 @@
require_once __DIR__ . '/class-wp-sqlite-token.php';
require_once __DIR__ . '/class-wp-sqlite-pdo-user-defined-functions.php';
require_once __DIR__ . '/class-wp-sqlite-db.php';
require_once __DIR__ . '/install-functions.php';

$GLOBALS['wpdb'] = new WP_SQLite_DB();

0 comments on commit c093eb3

Please sign in to comment.