2013-07-07 06:49:38 +00:00
< ? php
/**
2014-01-29 09:35:06 +00:00
* This file defines some constant required for SQLite Integration .
2014-07-14 08:46:32 +00:00
*
2014-01-29 09:35:06 +00:00
* This file must be placed in the directory wordpress / wp - content / db . php .
* WordPress loads this file automatically .
2014-07-14 08:46:32 +00:00
*
2014-05-05 03:38:15 +00:00
* @ version 1.6 . 2
2013-07-07 06:49:38 +00:00
* @ package SQLite Integration
2014-01-29 09:35:06 +00:00
* @ author Kojima Toshiyasu
2013-07-07 06:49:38 +00:00
*
*/
2013-12-17 02:46:42 +00:00
if ( ! defined ( 'ABSPATH' )) { // Oh, you are not WordPress!
echo 'Thank you, but you are not allowed to access here.' ;
die ();
}
2014-01-29 09:35:06 +00:00
/*
* USE_MYSQL is a directive for using MySQL for database .
2013-12-17 02:46:42 +00:00
* If you want to change the database from SQLite to MySQL or from MySQL to SQLite ,
* the line below in the wp - config . php will enable you to use MySQL .
2014-07-14 08:46:32 +00:00
*
2014-01-29 09:35:06 +00:00
* < code >
2013-12-17 02:46:42 +00:00
* define ( 'USE_MYSQL' , true );
2014-01-29 09:35:06 +00:00
* </ code >
2014-07-14 08:46:32 +00:00
*
2014-02-05 19:29:23 +00:00
* If you want to use SQLite , the line below will do . Or simply removing the line will
* be enough .
2014-07-14 08:46:32 +00:00
*
2014-02-05 19:29:23 +00:00
* < code >
* define ( 'USE_MYSQL' , false );
* </ code >
2013-12-17 02:46:42 +00:00
*/
2014-04-17 02:45:32 +00:00
if ( defined ( 'USE_MYSQL' ) && USE_MYSQL ) return ;
2013-07-07 06:49:38 +00:00
2013-08-13 00:34:40 +00:00
function pdo_log_error ( $message , $data = null ) {
2014-07-14 08:46:32 +00:00
if ( strpos ( $_SERVER [ 'SCRIPT_NAME' ], 'wp-admin' ) !== false ) {
$admin_dir = '' ;
} else {
$admin_dir = 'wp-admin/' ;
}
die ( <<< HTML
2013-07-07 06:49:38 +00:00
<! DOCTYPE html PUBLIC " -//W3C//DTD XHTML 1.0 Transitional//EN "
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< html xmlns = " http://www.w3.org/1999/xhtml " >
< head >
< title > WordPress & rsaquo ; Error </ title >
< meta http - equiv = " Content-Type " content = " text/html; charset=utf-8 " />
2014-01-29 09:35:06 +00:00
< link rel = " stylesheet " href = " { $admin_dir } css/install.css " type = " text/css " />
2013-07-07 06:49:38 +00:00
</ head >
< body >
< h1 id = " logo " >< img alt = " WordPress " src = " { $admin_dir } images/wordpress-logo.png " /></ h1 >
< p > $message </ p >
< p > $data </ p >
</ body >
< html >
HTML
);
}
if ( version_compare ( PHP_VERSION , '5.2.4' , '<' )) {
2013-08-13 00:34:40 +00:00
pdo_log_error ( 'PHP version on this server is too old.' , sprinf ( " Your server is running PHP version %d but this version of WordPress requires at least 5.2.4 " , phpversion ()));
2013-07-07 06:49:38 +00:00
}
if ( ! extension_loaded ( 'pdo' )) {
2013-08-13 00:34:40 +00:00
pdo_log_error ( 'PHP PDO Extension is not loaded.' , 'Your PHP installation appears to be missing the PDO extension which is required for this version of WordPress.' );
2013-07-07 06:49:38 +00:00
}
if ( ! extension_loaded ( 'pdo_sqlite' )) {
2013-08-13 00:34:40 +00:00
pdo_log_error ( 'PDO Driver for SQLite is missing.' , 'Your PHP installtion appears not to have the right PDO drivers loaded. These are required for this version of WordPress and the type of database you have specified.' );
2013-07-07 06:49:38 +00:00
}
2014-01-29 09:35:06 +00:00
/*
2013-07-07 06:49:38 +00:00
* Notice :
* Your scripts have the permission to create directories or files on your server .
* If you write in your wp - config . php like below , we take these definitions .
* define ( 'DB_DIR' , '/full_path_to_the_database_directory/' );
* define ( 'DB_FILE' , 'database_file_name' );
*/
2014-01-29 09:35:06 +00:00
/*
* PDODIR is SQLite Integration installed directory .
*/
2013-07-07 06:49:38 +00:00
if ( defined ( 'WP_PLUGIN_DIR' )) {
2014-07-14 08:46:32 +00:00
define ( 'PDODIR' , WP_PLUGIN_DIR . '/sqlite-integration/' );
2013-07-07 06:49:38 +00:00
} else {
2014-07-14 08:46:32 +00:00
if ( defined ( 'WP_CONTENT_DIR' )) {
define ( 'PDODIR' , WP_CONTENT_DIR . '/plugins/sqlite-integration/' );
} else {
define ( 'PDODIR' , ABSPATH . 'wp-content/plugins/sqlite-integration/' );
}
2013-07-07 06:49:38 +00:00
}
2014-01-29 09:35:06 +00:00
/*
* FQDBDIR is a directory where the sqlite database file is placed .
* If DB_DIR is defined , it is used as FQDBDIR .
*/
2013-07-07 06:49:38 +00:00
if ( defined ( 'DB_DIR' )) {
2014-07-14 08:46:32 +00:00
if ( substr ( DB_DIR , - 1 , 1 ) != '/' ) {
define ( 'FQDBDIR' , DB_DIR . '/' );
} else {
define ( 'FQDBDIR' , DB_DIR );
}
2013-07-07 06:49:38 +00:00
} else {
2014-07-14 08:46:32 +00:00
if ( defined ( 'WP_CONTENT_DIR' )) {
define ( 'FQDBDIR' , WP_CONTENT_DIR . '/database/' );
} else {
define ( 'FQDBDIR' , ABSPATH . 'wp-content/database/' );
}
2013-07-07 06:49:38 +00:00
}
2014-01-29 09:35:06 +00:00
/*
* FQDB is a database file name . If DB_FILE is defined , it is used
* as FQDB .
*/
2013-07-07 06:49:38 +00:00
if ( defined ( 'DB_FILE' )) {
2014-07-14 08:46:32 +00:00
define ( 'FQDB' , FQDBDIR . DB_FILE );
2013-07-07 06:49:38 +00:00
} else {
2014-07-14 08:46:32 +00:00
define ( 'FQDB' , FQDBDIR . '.ht.sqlite' );
2013-07-07 06:49:38 +00:00
}
2014-01-29 09:35:06 +00:00
/*
* UDF_FILE is a file that contains user defined functions .
*/
2013-07-07 06:49:38 +00:00
if ( version_compare ( PHP_VERSION , '5.3' , '<' )) {
2014-07-14 08:46:32 +00:00
define ( 'UDF_FILE' , PDODIR . 'functions-5-2.php' );
2013-07-07 06:49:38 +00:00
} elseif ( version_compare ( PHP_VERSION , '5.3' , '>=' )) {
2014-07-14 08:46:32 +00:00
define ( 'UDF_FILE' , PDODIR . 'functions.php' );
2013-07-07 06:49:38 +00:00
}
require_once PDODIR . 'pdodb.class.php' ;
?>