Compare commits
49 Commits
Author | SHA1 | Date |
---|---|---|
|
990297f6ac | |
|
1f2e8fc987 | |
|
54d9e1b02a | |
|
8235d4c4d8 | |
|
25cb914d6e | |
|
b0c959ba4f | |
|
5e95bc00c4 | |
|
d4b86db22e | |
|
907be4a3e4 | |
|
61e6960b40 | |
|
e5f495a745 | |
|
9fd9fd7bbd | |
|
ccf36c0dd9 | |
|
8286b0ac20 | |
|
7d94787d40 | |
|
4c4d7022a9 | |
|
f6859effd2 | |
|
862acb1899 | |
|
f0a5b97f3c | |
|
71a1df03db | |
|
22a658ac3a | |
|
8c2258e7ee | |
|
f41368010a | |
|
3f06610a5a | |
|
0f7f96848d | |
|
a5897b4369 | |
|
295ea862d2 | |
|
cfc1d0b2ef | |
|
d7f68d81a6 | |
|
c906f23f46 | |
|
faff964bcd | |
|
a6345fd8b3 | |
|
a246ffa700 | |
|
72bc68b45b | |
|
3ea3b0974d | |
|
bae9e47e0e | |
|
953f18e719 | |
|
be737aa08e | |
|
6401a9b0ec | |
|
ce9c138473 | |
|
aa897ce408 | |
|
4147af7334 | |
|
d48bb8ab28 | |
|
8b14aafcd2 | |
|
6e31b4e3ca | |
|
b1398156dc | |
|
0124a71687 | |
|
6b66c23718 | |
|
d8314baf48 |
|
@ -0,0 +1,8 @@
|
||||||
|
* Version 1.7 can't create wp-config.php when installing with WordPress 4.0
|
||||||
|
|
||||||
|
When install process notices that there's no wp-config.php, it tries to
|
||||||
|
create one from wp-config-sample.php. During that time, WordPress unsets
|
||||||
|
global $wpdb and calls require_wp_db() function.
|
||||||
|
That function newly instantiates wpdb class. SQLite Integration has no
|
||||||
|
way of intercepting that process.
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
2015-03-18 KOJIMA Toshiyasu
|
||||||
|
|
||||||
|
* version 1.8.1 bugfix release.
|
||||||
|
|
||||||
|
* pdoengine.class.php: bugfix. database file existent chech doesn't
|
||||||
|
work properly, which causes installation problem.
|
||||||
|
|
||||||
|
2015-03-06 KOJIMA Toshiyasu
|
||||||
|
|
||||||
|
* version 1.8 release.
|
||||||
|
|
||||||
|
* readme.txt, readme-ja.txt: updated.
|
||||||
|
|
||||||
|
* query_create.class.php: fixed the index query regexp.
|
||||||
|
|
||||||
|
* query.class.php: added 'orderby_callback' method.
|
||||||
|
This is a workaround for PHP 5.2.x compatibility issue.
|
||||||
|
|
||||||
|
2015-03-05 KOJIMA Toshiyasu
|
||||||
|
|
||||||
|
* pdodb.class.php: removed the unnecessary require directive.
|
||||||
|
|
||||||
|
* pdoengin.class.php: revised install process algorithm.
|
||||||
|
Database directory and file check was too late.
|
||||||
|
Changed the database directory permission.
|
||||||
|
|
||||||
|
2014-10-01 KOJIMA Toshiyasu
|
||||||
|
|
||||||
|
* pdoengine.class.php: revised pdoengine class constructor definition
|
||||||
|
in order to reuse the PDO instance.
|
||||||
|
|
||||||
|
* pdodb.class.php, pdoengine.class.php: moved the foreign key check
|
||||||
|
from PDODB class to PDOEngine class init() method.
|
||||||
|
|
||||||
|
* functions.php, functions-5-2.php: check if PDO instance is not null
|
||||||
|
to avoid displaying Zend debugger/Xdebug messages. If null, constructor
|
||||||
|
executes wp_die() function.
|
||||||
|
|
||||||
|
* query_create.class.php: changed the data type rewriting method.
|
||||||
|
When a field name is the same as data type, e.g. "date" or "timestamp",
|
||||||
|
add a single quote to the field name and avoid to be rewritten.
|
||||||
|
This works only if the field name is on the top of the line, according
|
||||||
|
to the rule of dbDelta() function.
|
||||||
|
|
||||||
|
Added the new function to quote illegal field name, e.g. "default" or
|
||||||
|
"values", for SQLite. This is for the plugins that use those names to
|
||||||
|
create tables without errors.
|
||||||
|
|
||||||
|
2014-09-05 KOJIMA Toshiyasu
|
||||||
|
|
||||||
|
* version 1.7 release.
|
||||||
|
* update readme.txt and readme-ja.txt.
|
||||||
|
|
||||||
|
2014-08-29 KOJIMA Toshiyasu
|
||||||
|
|
||||||
|
* Added ChangeLog and BUGS files.
|
53
db.php
53
db.php
|
@ -1,16 +1,39 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* This file must be placed in the directory
|
* This file defines some constant required for SQLite Integration.
|
||||||
*
|
*
|
||||||
* wordpress/wp-content/db.php
|
* This file must be placed in the directory wordpress/wp-content/db.php.
|
||||||
|
* WordPress loads this file automatically.
|
||||||
*
|
*
|
||||||
|
* @version 1.8.1
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu, Justin Adie
|
* @author Kojima Toshiyasu
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
if (!defined('ABSPATH')) { // Oh, you are not WordPress!
|
||||||
|
echo 'Thank you, but you are not allowed to access here.';
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* USE_MYSQL is a directive for using MySQL for database.
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* define('USE_MYSQL', true);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* If you want to use SQLite, the line below will do. Or simply removing the line will
|
||||||
|
* be enough.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* define('USE_MYSQL', false);
|
||||||
|
* </code>
|
||||||
|
*/
|
||||||
|
if (defined('USE_MYSQL') && USE_MYSQL) return;
|
||||||
|
|
||||||
function pdo_log_error($message, $data = null) {
|
function pdo_log_error($message, $data = null) {
|
||||||
|
|
||||||
if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin') !== false) {
|
if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin') !== false) {
|
||||||
$admin_dir = '';
|
$admin_dir = '';
|
||||||
} else {
|
} else {
|
||||||
|
@ -23,7 +46,7 @@ function pdo_log_error($message, $data = null) {
|
||||||
<head>
|
<head>
|
||||||
<title>WordPress › Error</title>
|
<title>WordPress › Error</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<link rel="stylesheet" href="{$admin_dir}install.css" type="text/css" />
|
<link rel="stylesheet" href="{$admin_dir}css/install.css" type="text/css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="logo"><img alt="WordPress" src="{$admin_dir}images/wordpress-logo.png" /></h1>
|
<h1 id="logo"><img alt="WordPress" src="{$admin_dir}images/wordpress-logo.png" /></h1>
|
||||||
|
@ -48,13 +71,17 @@ if (!extension_loaded('pdo_sqlite')) {
|
||||||
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.');
|
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.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Notice:
|
* Notice:
|
||||||
* Your scripts have the permission to create directories or files on your server.
|
* 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.
|
* 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_DIR', '/full_path_to_the_database_directory/');
|
||||||
* define('DB_FILE', 'database_file_name');
|
* define('DB_FILE', 'database_file_name');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PDODIR is SQLite Integration installed directory.
|
||||||
|
*/
|
||||||
if (defined('WP_PLUGIN_DIR')) {
|
if (defined('WP_PLUGIN_DIR')) {
|
||||||
define('PDODIR', WP_PLUGIN_DIR . '/sqlite-integration/');
|
define('PDODIR', WP_PLUGIN_DIR . '/sqlite-integration/');
|
||||||
} else {
|
} else {
|
||||||
|
@ -64,7 +91,10 @@ if (defined('WP_PLUGIN_DIR')) {
|
||||||
define('PDODIR', ABSPATH . 'wp-content/plugins/sqlite-integration/');
|
define('PDODIR', ABSPATH . 'wp-content/plugins/sqlite-integration/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* FQDBDIR is a directory where the sqlite database file is placed.
|
||||||
|
* If DB_DIR is defined, it is used as FQDBDIR.
|
||||||
|
*/
|
||||||
if (defined('DB_DIR')) {
|
if (defined('DB_DIR')) {
|
||||||
if (substr(DB_DIR, -1, 1) != '/') {
|
if (substr(DB_DIR, -1, 1) != '/') {
|
||||||
define('FQDBDIR', DB_DIR . '/');
|
define('FQDBDIR', DB_DIR . '/');
|
||||||
|
@ -78,13 +108,18 @@ if (defined('DB_DIR')) {
|
||||||
define('FQDBDIR', ABSPATH . 'wp-content/database/');
|
define('FQDBDIR', ABSPATH . 'wp-content/database/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* FQDB is a database file name. If DB_FILE is defined, it is used
|
||||||
|
* as FQDB.
|
||||||
|
*/
|
||||||
if ( defined('DB_FILE' )) {
|
if ( defined('DB_FILE' )) {
|
||||||
define('FQDB', FQDBDIR . DB_FILE);
|
define('FQDB', FQDBDIR . DB_FILE);
|
||||||
} else {
|
} else {
|
||||||
define('FQDB', FQDBDIR . '.ht.sqlite');
|
define('FQDB', FQDBDIR . '.ht.sqlite');
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* UDF_FILE is a file that contains user defined functions.
|
||||||
|
*/
|
||||||
if (version_compare(PHP_VERSION, '5.3', '<')) {
|
if (version_compare(PHP_VERSION, '5.3', '<')) {
|
||||||
define('UDF_FILE', PDODIR . 'functions-5-2.php');
|
define('UDF_FILE', PDODIR . 'functions-5-2.php');
|
||||||
} elseif (version_compare(PHP_VERSION, '5.3', '>=')) {
|
} elseif (version_compare(PHP_VERSION, '5.3', '>=')) {
|
||||||
|
|
|
@ -1,23 +1,51 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file contains the class that defines user defined functions for PDO library.
|
||||||
|
*
|
||||||
|
* This file is for PHP 5.2.x or lesser. For PHP 5.3.x or later, functions.php is
|
||||||
|
* loaded. PHP version is checked in the db.php and that will load the apropriate
|
||||||
|
* one.
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu, Justin Adie
|
* @author Kojima Toshiyasu
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class defines user defined functions(UDFs) for PDO
|
* This class defines user defined functions(UDFs) for PDO library.
|
||||||
* This replaces the functions used in the SQL statement with the PHP functions.
|
*
|
||||||
* If you want another, add the name in the array and define the function with
|
* These functions replace those used in the SQL statement with the PHP functions.
|
||||||
* PHP script.
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* new PDOSQLiteUDFS(ref_to_pdo_obj);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* This automatically enables ref_to_pdo_obj to replace the function in the SQL statement
|
||||||
|
* to the ones defined here.
|
||||||
*/
|
*/
|
||||||
class PDOSQLiteUDFS {
|
class PDOSQLiteUDFS {
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* Initialize the user defined functions to the PDO object with PDO::sqliteCreateFunction().
|
||||||
|
*
|
||||||
|
* @param reference to PDO object $pdo
|
||||||
|
*/
|
||||||
public function __construct(&$pdo){
|
public function __construct(&$pdo){
|
||||||
|
if (!$pdo) {
|
||||||
|
wp_die('Database is not initialized.', 'Database Error');
|
||||||
|
}
|
||||||
foreach ($this->functions as $f=>$t) {
|
foreach ($this->functions as $f=>$t) {
|
||||||
$pdo->sqliteCreateFunction($f, array($this, $t));
|
$pdo->sqliteCreateFunction($f, array($this, $t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Array to associate MySQL function to the substituted one.
|
||||||
|
*
|
||||||
|
* @var associative array
|
||||||
|
*/
|
||||||
private $functions = array(
|
private $functions = array(
|
||||||
'month' => 'month',
|
'month' => 'month',
|
||||||
'year' => 'year',
|
'year' => 'year',
|
||||||
|
@ -41,7 +69,6 @@ class PDOSQLiteUDFS {
|
||||||
'subdate' => 'date_sub',
|
'subdate' => 'date_sub',
|
||||||
'localtime' => 'now',
|
'localtime' => 'now',
|
||||||
'localtimestamp' => 'now',
|
'localtimestamp' => 'now',
|
||||||
//'date'=>'date',
|
|
||||||
'isnull' => 'isnull',
|
'isnull' => 'isnull',
|
||||||
'if' => '_if',
|
'if' => '_if',
|
||||||
'regexpp' => 'regexp',
|
'regexpp' => 'regexp',
|
||||||
|
@ -49,6 +76,7 @@ class PDOSQLiteUDFS {
|
||||||
'field' => 'field',
|
'field' => 'field',
|
||||||
'log' => 'log',
|
'log' => 'log',
|
||||||
'least' => 'least',
|
'least' => 'least',
|
||||||
|
'greatest' => 'greatest',
|
||||||
'get_lock' => 'get_lock',
|
'get_lock' => 'get_lock',
|
||||||
'release_lock' => 'release_lock',
|
'release_lock' => 'release_lock',
|
||||||
'ucase' => 'ucase',
|
'ucase' => 'ucase',
|
||||||
|
@ -56,63 +84,169 @@ class PDOSQLiteUDFS {
|
||||||
'inet_ntoa' => 'inet_ntoa',
|
'inet_ntoa' => 'inet_ntoa',
|
||||||
'inet_aton' => 'inet_aton',
|
'inet_aton' => 'inet_aton',
|
||||||
'datediff' => 'datediff',
|
'datediff' => 'datediff',
|
||||||
'locate' => 'locate'
|
'locate' => 'locate',
|
||||||
|
'utc_date' => 'utc_date',
|
||||||
|
'utc_time' => 'utc_time',
|
||||||
|
'utc_timestamp' => 'utc_timestamp',
|
||||||
|
'version' => 'version'
|
||||||
);
|
);
|
||||||
|
/**
|
||||||
|
* Method to extract the month value from the date.
|
||||||
|
*
|
||||||
|
* @param string representing the date formated as 0000-00-00.
|
||||||
|
* @return string representing the number of the month between 1 and 12.
|
||||||
|
*/
|
||||||
public function month($field){
|
public function month($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return date('n', $t);
|
return date('n', $t);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to extract the year value from the date.
|
||||||
|
*
|
||||||
|
* @param string representing the date formated as 0000-00-00.
|
||||||
|
* @return string representing the number of the year.
|
||||||
|
*/
|
||||||
public function year($field){
|
public function year($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return date('Y', $t);
|
return date('Y', $t);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to extract the day value from the date.
|
||||||
|
*
|
||||||
|
* @param string representing the date formated as 0000-00-00.
|
||||||
|
* @return string representing the number of the day of the month from 1 and 31.
|
||||||
|
*/
|
||||||
public function day($field){
|
public function day($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return date('j', $t);
|
return date('j', $t);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to return the unix timestamp.
|
||||||
|
*
|
||||||
|
* Used without an argument, it returns PHP time() function (total seconds passed
|
||||||
|
* from '1970-01-01 00:00:00' GMT). Used with the argument, it changes the value
|
||||||
|
* to the timestamp.
|
||||||
|
*
|
||||||
|
* @param string representing the date formated as '0000-00-00 00:00:00'.
|
||||||
|
* @return number of unsigned integer
|
||||||
|
*/
|
||||||
public function unix_timestamp($field = null){
|
public function unix_timestamp($field = null){
|
||||||
return is_null($field) ? time() : strtotime($field);
|
return is_null($field) ? time() : strtotime($field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL SECOND() function.
|
||||||
|
*
|
||||||
|
* @param string representing the time formated as '00:00:00'.
|
||||||
|
* @return number of unsigned integer
|
||||||
|
*/
|
||||||
public function second($field){
|
public function second($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return intval( date("s", $t) );
|
return intval( date("s", $t) );
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL MINUTE() function.
|
||||||
|
*
|
||||||
|
* @param string representing the time formated as '00:00:00'.
|
||||||
|
* @return number of unsigned integer
|
||||||
|
*/
|
||||||
public function minute($field){
|
public function minute($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return intval(date("i", $t));
|
return intval(date("i", $t));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL HOUR() function.
|
||||||
|
*
|
||||||
|
* @param string representing the time formated as '00:00:00'.
|
||||||
|
* @return number
|
||||||
|
*/
|
||||||
public function hour($time){
|
public function hour($time){
|
||||||
list($hours, $minutes, $seconds) = explode(":", $time);
|
list($hours, $minutes, $seconds) = explode(":", $time);
|
||||||
return intval($hours);
|
return intval($hours);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL FROM_UNIXTIME() function.
|
||||||
|
*
|
||||||
|
* @param integer of unix timestamp
|
||||||
|
* @param string to indicate the way of formatting(optional)
|
||||||
|
* @return string formatted as '0000-00-00 00:00:00'.
|
||||||
|
*/
|
||||||
public function from_unixtime($field, $format=null){
|
public function from_unixtime($field, $format=null){
|
||||||
// $field is a timestamp
|
// $field is a timestamp
|
||||||
//convert to ISO time
|
//convert to ISO time
|
||||||
$date = date("Y-m-d H:i:s", $field);
|
$date = date("Y-m-d H:i:s", $field);
|
||||||
//now submit to dateformat
|
//now submit to dateformat
|
||||||
|
|
||||||
return is_null($format) ? $date : $self->dateformat($date, $format);
|
return is_null($format) ? $date : $self->dateformat($date, $format);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL NOW() function.
|
||||||
|
*
|
||||||
|
* @return string representing current time formatted as '0000-00-00 00:00:00'.
|
||||||
|
*/
|
||||||
public function now(){
|
public function now(){
|
||||||
return date("Y-m-d H:i:s");
|
return date("Y-m-d H:i:s");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL CURDATE() function.
|
||||||
|
*
|
||||||
|
* @return string representing current time formatted as '0000-00-00'.
|
||||||
|
*/
|
||||||
public function curdate() {
|
public function curdate() {
|
||||||
return date("Y-m-d");
|
return date("Y-m-d");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL CHAR_LENGTH() function.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return unsigned integer for the length of the argument.
|
||||||
|
*/
|
||||||
public function char_length($field){
|
public function char_length($field){
|
||||||
return strlen($field);
|
return strlen($field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL MD5() function.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string of the md5 hash value of the argument.
|
||||||
|
*/
|
||||||
public function md5($field){
|
public function md5($field){
|
||||||
return md5($field);
|
return md5($field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL RAND() function.
|
||||||
|
*
|
||||||
|
* SQLite does have a random generator, but it is called RANDOM() and returns random
|
||||||
|
* number between -9223372036854775808 and +9223372036854775807. So we substitute it
|
||||||
|
* with PHP random generator.
|
||||||
|
*
|
||||||
|
* This function uses mt_rand() which is four times faster than rand() and returns
|
||||||
|
* the random number between 0 and 1.
|
||||||
|
*
|
||||||
|
* @return unsigned integer
|
||||||
|
*/
|
||||||
public function rand(){
|
public function rand(){
|
||||||
return rand(0,1);
|
return mt_rand(0,1);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL SUBSTRING() function.
|
||||||
|
*
|
||||||
|
* This function rewrites the function name to SQLite compatible substr(),
|
||||||
|
* which can manipulate UTF-8 characters.
|
||||||
|
*
|
||||||
|
* @param string $text
|
||||||
|
* @param integer $pos representing the start point.
|
||||||
|
* @param integer $len representing the length of the substring(optional).
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function substring($text, $pos, $len=null){
|
public function substring($text, $pos, $len=null){
|
||||||
if (is_null($len)) return substr($text, $pos-1);
|
return "substr($text, $pos, $len)";
|
||||||
else return substr($text, $pos-1, $len);
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL DATEFORMAT() function.
|
||||||
|
*
|
||||||
|
* @param string date formatted as '0000-00-00' or datetime as '0000-00-00 00:00:00'.
|
||||||
|
* @param string $format
|
||||||
|
* @return string formatted according to $format
|
||||||
|
*/
|
||||||
public function dateformat($date, $format){
|
public function dateformat($date, $format){
|
||||||
$mysql_php_dateformats = array ( '%a' => 'D', '%b' => 'M', '%c' => 'n', '%D' => 'jS', '%d' => 'd', '%e' => 'j', '%H' => 'H', '%h' => 'h', '%I' => 'h', '%i' => 'i', '%j' => 'z', '%k' => 'G', '%l' => 'g', '%M' => 'F', '%m' => 'm', '%p' => 'A', '%r' => 'h:i:s A', '%S' => 's', '%s' => 's', '%T' => 'H:i:s', '%U' => 'W', '%u' => 'W', '%V' => 'W', '%v' => 'W', '%W' => 'l', '%w' => 'w', '%X' => 'Y', '%x' => 'o', '%Y' => 'Y', '%y' => 'y', );
|
$mysql_php_dateformats = array ( '%a' => 'D', '%b' => 'M', '%c' => 'n', '%D' => 'jS', '%d' => 'd', '%e' => 'j', '%H' => 'H', '%h' => 'h', '%I' => 'h', '%i' => 'i', '%j' => 'z', '%k' => 'G', '%l' => 'g', '%M' => 'F', '%m' => 'm', '%p' => 'A', '%r' => 'h:i:s A', '%S' => 's', '%s' => 's', '%T' => 'H:i:s', '%U' => 'W', '%u' => 'W', '%V' => 'W', '%v' => 'W', '%W' => 'l', '%w' => 'w', '%X' => 'Y', '%x' => 'o', '%Y' => 'Y', '%y' => 'y', );
|
||||||
$t = strtotime($date);
|
$t = strtotime($date);
|
||||||
|
@ -120,6 +254,17 @@ class PDOSQLiteUDFS {
|
||||||
$output = date($format, $t);
|
$output = date($format, $t);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL DATE_ADD() function.
|
||||||
|
*
|
||||||
|
* This function adds the time value of $interval expression to $date.
|
||||||
|
* $interval is a single quoted strings rewritten by SQLiteQueryDriver::rewrite_query().
|
||||||
|
* It is calculated in the private function deriveInterval().
|
||||||
|
*
|
||||||
|
* @param string $date representing the start date.
|
||||||
|
* @param string $interval representing the expression of the time to add.
|
||||||
|
* @return string date formated as '0000-00-00 00:00:00'.
|
||||||
|
*/
|
||||||
public function date_add($date, $interval) {
|
public function date_add($date, $interval) {
|
||||||
$interval = $this->deriveInterval($interval);
|
$interval = $this->deriveInterval($interval);
|
||||||
switch (strtolower($date)) {
|
switch (strtolower($date)) {
|
||||||
|
@ -140,6 +285,17 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL DATE_SUB() function.
|
||||||
|
*
|
||||||
|
* This function substracts the time value of $interval expression from $date.
|
||||||
|
* $interval is a single quoted strings rewritten by SQLiteQueryDriver::rewrite_query().
|
||||||
|
* It is calculated in the private function deriveInterval().
|
||||||
|
*
|
||||||
|
* @param string $date representing the start date.
|
||||||
|
* @param string $interval representing the expression of the time to substract.
|
||||||
|
* @return string date formated as '0000-00-00 00:00:00'.
|
||||||
|
*/
|
||||||
public function date_sub($date, $interval) {
|
public function date_sub($date, $interval) {
|
||||||
$interval = $this->deriveInterval($interval);
|
$interval = $this->deriveInterval($interval);
|
||||||
switch (strtolower($date)) {
|
switch (strtolower($date)) {
|
||||||
|
@ -160,7 +316,13 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to calculate the interval time between two dates value.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param string $interval white space separated expression.
|
||||||
|
* @return string representing the time to add or substract.
|
||||||
|
*/
|
||||||
private function deriveInterval($interval){
|
private function deriveInterval($interval){
|
||||||
$interval = trim(substr(trim($interval), 8));
|
$interval = trim(substr(trim($interval), 8));
|
||||||
$parts = explode(' ', $interval);
|
$parts = explode(' ', $interval);
|
||||||
|
@ -182,7 +344,6 @@ class PDOSQLiteUDFS {
|
||||||
$type .= 's';
|
$type .= 's';
|
||||||
}
|
}
|
||||||
return "$_parts[0] $_parts[1]";
|
return "$_parts[0] $_parts[1]";
|
||||||
break;
|
|
||||||
case "minute_second":
|
case "minute_second":
|
||||||
list($minutes, $seconds) = explode (':', $_parts[0]);
|
list($minutes, $seconds) = explode (':', $_parts[0]);
|
||||||
$minutes = intval($minutes);
|
$minutes = intval($minutes);
|
||||||
|
@ -190,8 +351,6 @@ class PDOSQLiteUDFS {
|
||||||
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
||||||
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
|
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
|
||||||
return "$minutes $seconds";
|
return "$minutes $seconds";
|
||||||
break;
|
|
||||||
|
|
||||||
case "hour_second":
|
case "hour_second":
|
||||||
list($hours, $minutes, $seconds) = explode (':', $_parts[0]);
|
list($hours, $minutes, $seconds) = explode (':', $_parts[0]);
|
||||||
$hours = intval($hours);
|
$hours = intval($hours);
|
||||||
|
@ -201,7 +360,6 @@ class PDOSQLiteUDFS {
|
||||||
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
||||||
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
|
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
|
||||||
return "$hours $minutes $seconds";
|
return "$hours $minutes $seconds";
|
||||||
break;
|
|
||||||
case "hour_minute":
|
case "hour_minute":
|
||||||
list($hours, $minutes) = explode (':', $_parts[0]);
|
list($hours, $minutes) = explode (':', $_parts[0]);
|
||||||
$hours = intval($hours);
|
$hours = intval($hours);
|
||||||
|
@ -209,7 +367,6 @@ class PDOSQLiteUDFS {
|
||||||
$hours = ($hours > 1) ? "$hours hours" : "$hours hour";
|
$hours = ($hours > 1) ? "$hours hours" : "$hours hour";
|
||||||
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
||||||
return "$hours $minutes";
|
return "$hours $minutes";
|
||||||
break;
|
|
||||||
case "day_second":
|
case "day_second":
|
||||||
$days = intval($_parts[0]);
|
$days = intval($_parts[0]);
|
||||||
list($hours, $minutes, $seconds) = explode (':', $_parts[1]);
|
list($hours, $minutes, $seconds) = explode (':', $_parts[1]);
|
||||||
|
@ -221,7 +378,6 @@ class PDOSQLiteUDFS {
|
||||||
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
||||||
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
|
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
|
||||||
return "$days $hours $minutes $seconds";
|
return "$days $hours $minutes $seconds";
|
||||||
break;
|
|
||||||
case "day_minute":
|
case "day_minute":
|
||||||
$days = intval($_parts[0]);
|
$days = intval($_parts[0]);
|
||||||
list($hours, $minutes) = explode (':', $_parts[1]);
|
list($hours, $minutes) = explode (':', $_parts[1]);
|
||||||
|
@ -231,14 +387,12 @@ class PDOSQLiteUDFS {
|
||||||
$hours = ($hours > 1) ? "$hours hours" : "$hours hour";
|
$hours = ($hours > 1) ? "$hours hours" : "$hours hour";
|
||||||
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
|
||||||
return "$days $hours $minutes";
|
return "$days $hours $minutes";
|
||||||
break;
|
|
||||||
case "day_hour":
|
case "day_hour":
|
||||||
$days = intval($_parts[0]);
|
$days = intval($_parts[0]);
|
||||||
$hours = intval($_parts[1]);
|
$hours = intval($_parts[1]);
|
||||||
$days = $days > 1 ? "$days days" : "$days day";
|
$days = $days > 1 ? "$days days" : "$days day";
|
||||||
$hours = ($hours > 1) ? "$hours hours" : "$hours hour";
|
$hours = ($hours > 1) ? "$hours hours" : "$hours hour";
|
||||||
return "$days $hours";
|
return "$days $hours";
|
||||||
break;
|
|
||||||
case "year_month":
|
case "year_month":
|
||||||
list($years, $months) = explode ('-', $_parts[0]);
|
list($years, $months) = explode ('-', $_parts[0]);
|
||||||
$years = intval($years);
|
$years = intval($years);
|
||||||
|
@ -246,30 +400,64 @@ class PDOSQLiteUDFS {
|
||||||
$years = ($years > 1) ? "$years years" : "$years year";
|
$years = ($years > 1) ? "$years years" : "$years year";
|
||||||
$months = ($months > 1) ? "$months months": "$months month";
|
$months = ($months > 1) ? "$months months": "$months month";
|
||||||
return "$years $months";
|
return "$years $months";
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL DATE() function.
|
||||||
|
*
|
||||||
|
* @param string $date formatted as unix time.
|
||||||
|
* @return string formatted as '0000-00-00'.
|
||||||
|
*/
|
||||||
public function date($date){
|
public function date($date){
|
||||||
return date("Y-m-d", strtotime($date));
|
return date("Y-m-d", strtotime($date));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL ISNULL() function.
|
||||||
|
*
|
||||||
|
* This function returns true if the argument is null, and true if not.
|
||||||
|
*
|
||||||
|
* @param various types $field
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function isnull($field){
|
public function isnull($field){
|
||||||
return is_null($field);
|
return is_null($field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL IF() function.
|
||||||
|
*
|
||||||
|
* As 'IF' is a reserved word for PHP, function name must be changed.
|
||||||
|
*
|
||||||
|
* @param unknonw $expression the statement to be evaluated as true or false.
|
||||||
|
* @param unknown $true statement or value returned if $expression is true.
|
||||||
|
* @param unknown $false statement or value returned if $expression is false.
|
||||||
|
* @return unknown
|
||||||
|
*/
|
||||||
public function _if($expression, $true, $false){
|
public function _if($expression, $true, $false){
|
||||||
return ($expression == true) ? $true : $false;
|
return ($expression == true) ? $true : $false;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL REGEXP() function.
|
||||||
|
*
|
||||||
|
* @param string $field haystack
|
||||||
|
* @param string $pattern: regular expression to match.
|
||||||
|
* @return integer 1 if matched, 0 if not matched.
|
||||||
|
*/
|
||||||
public function regexp($field, $pattern){
|
public function regexp($field, $pattern){
|
||||||
$pattern = str_replace('/', '\/', $pattern);
|
$pattern = str_replace('/', '\/', $pattern);
|
||||||
$pattern = "/" . $pattern ."/i";
|
$pattern = "/" . $pattern ."/i";
|
||||||
return preg_match ($pattern, $field);
|
return preg_match ($pattern, $field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL CONCAT() function.
|
||||||
|
*
|
||||||
|
* SQLite does have CONCAT() function, but it has a different syntax from MySQL.
|
||||||
|
* So this function must be manipulated here.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return NULL if the argument is null | string conatenated if the argument is given.
|
||||||
|
*/
|
||||||
public function concat() {
|
public function concat() {
|
||||||
$returnValue = "";
|
$returnValue = "";
|
||||||
$argsNum = func_num_args();
|
$argsNum = func_num_args();
|
||||||
|
@ -282,20 +470,55 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL FIELD() function.
|
||||||
|
*
|
||||||
|
* This function gets the list argument and compares the first item to all the others.
|
||||||
|
* If the same value is found, it returns the position of that value. If not, it
|
||||||
|
* returns 0.
|
||||||
|
*
|
||||||
|
* @param variable number of string, integer or double
|
||||||
|
* @return unsigned integer
|
||||||
|
*/
|
||||||
public function field() {
|
public function field() {
|
||||||
|
global $wpdb;
|
||||||
$numArgs = func_num_args();
|
$numArgs = func_num_args();
|
||||||
if ($numArgs < 2 or is_null(func_get_arg(0))) {
|
if ($numArgs < 2 or is_null(func_get_arg(0))) {
|
||||||
return null;
|
return 0;
|
||||||
|
} else {
|
||||||
|
$arg_list = func_get_args();
|
||||||
}
|
}
|
||||||
$arr = func_get_args();
|
$searchString = array_shift($arg_list);
|
||||||
$searchString = strtolower(array_shift($arr));
|
$str_to_check = substr($searchString, 0, strpos($searchString, '.'));
|
||||||
|
$str_to_check = str_replace($wpdb->prefix, '', $str_to_check);
|
||||||
|
if ($str_to_check && in_array(trim($str_to_check), $wpdb->tables)) return;
|
||||||
for ($i = 0; $i < $numArgs-1; $i++) {
|
for ($i = 0; $i < $numArgs-1; $i++) {
|
||||||
if ($searchString === strtolower($arr[$i])) return $i + 1;
|
if ($searchString === strtolower($arg_list[$i])) {
|
||||||
|
return $i + 1;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL LOG() function.
|
||||||
|
*
|
||||||
|
* Used with one argument, it returns the natural logarithm of X.
|
||||||
|
* <code>
|
||||||
|
* LOG(X)
|
||||||
|
* </code>
|
||||||
|
* Used with two arguments, it returns the natural logarithm of X base B.
|
||||||
|
* <code>
|
||||||
|
* LOG(B, X)
|
||||||
|
* </code>
|
||||||
|
* In this case, it returns the value of log(X) / log(B).
|
||||||
|
*
|
||||||
|
* Used without an argument, it returns false. This returned value will be
|
||||||
|
* rewritten to 0, because SQLite doesn't understand true/false value.
|
||||||
|
*
|
||||||
|
* @param integer representing the base of the logarithm, which is optional.
|
||||||
|
* @param double value to turn into logarithm.
|
||||||
|
* @return double | NULL
|
||||||
|
*/
|
||||||
public function log() {
|
public function log() {
|
||||||
$numArgs = func_num_args();
|
$numArgs = func_num_args();
|
||||||
if ($numArgs == 1) {
|
if ($numArgs == 1) {
|
||||||
|
@ -306,18 +529,36 @@ class PDOSQLiteUDFS {
|
||||||
$arg2 = func_get_arg(1);
|
$arg2 = func_get_arg(1);
|
||||||
return log($arg1)/log($arg2);
|
return log($arg1)/log($arg2);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function least() {
|
|
||||||
$arr = func_get_args();
|
|
||||||
return min($arr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These two functions are meaningless in SQLite
|
* Method to emulate MySQL LEAST() function.
|
||||||
* So we return meaningless statement and do nothing
|
*
|
||||||
|
* This function rewrites the function name to SQLite compatible function name.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function least() {
|
||||||
|
$arg_list = func_get_args();
|
||||||
|
return "min($arg_list)";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL GREATEST() function.
|
||||||
|
*
|
||||||
|
* This function rewrites the function name to SQLite compatible function name.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function greatest() {
|
||||||
|
$arg_list = func_get_args();
|
||||||
|
return "max($arg_list)";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to dummy out MySQL GET_LOCK() function.
|
||||||
|
*
|
||||||
|
* This function is meaningless in SQLite, so we do nothing.
|
||||||
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param integer $timeout
|
* @param integer $timeout
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -325,39 +566,75 @@ class PDOSQLiteUDFS {
|
||||||
public function get_lock($name, $timeout) {
|
public function get_lock($name, $timeout) {
|
||||||
return '1=1';
|
return '1=1';
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to dummy out MySQL RELEASE_LOCK() function.
|
||||||
|
*
|
||||||
|
* This function is meaningless in SQLite, so we do nothing.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function release_lock($name) {
|
public function release_lock($name) {
|
||||||
return '1=1';
|
return '1=1';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQL aliases for upper and lower functions
|
* Method to emulate MySQL UCASE() function.
|
||||||
* @param unknown $string
|
*
|
||||||
* @return string
|
* This is MySQL alias for upper() function. This function rewrites it
|
||||||
|
* to SQLite compatible name upper().
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string SQLite compatible function name.
|
||||||
*/
|
*/
|
||||||
public function ucase($string) {
|
public function ucase($string) {
|
||||||
return "upper($string)";
|
return "upper($string)";
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL LCASE() function.
|
||||||
|
*
|
||||||
|
* This is MySQL alias for lower() function. This function rewrites it
|
||||||
|
* to SQLite compatible name lower().
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string SQLite compatible function name.
|
||||||
|
*/
|
||||||
public function lcase($string) {
|
public function lcase($string) {
|
||||||
return "lower($string)";
|
return "lower($string)";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQL aliases for INET_NTOA and INET_ATON functions
|
* Method to emulate MySQL INET_NTOA() function.
|
||||||
* @param unsigned integer, string respectively
|
*
|
||||||
* @return string, unsigned integer respectively
|
* This function gets 4 or 8 bytes integer and turn it into the network address.
|
||||||
|
*
|
||||||
|
* @param unsigned long integer
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function inet_ntoa($num) {
|
public function inet_ntoa($num) {
|
||||||
return long2ip($num);
|
return long2ip($num);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL INET_ATON() function.
|
||||||
|
*
|
||||||
|
* This function gets the network address and turns it into integer.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return unsigned long integer
|
||||||
|
*/
|
||||||
public function inet_aton($addr) {
|
public function inet_aton($addr) {
|
||||||
$int_data = ip2long($addr);
|
$int_data = ip2long($addr);
|
||||||
$unsigned_int_data = sprintf('%u', $address);
|
$unsigned_int_data = sprintf('%u', $address);
|
||||||
return $unsigned_int_data;
|
return $unsigned_int_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQL aliase for DATEDIFF function
|
* Method to emulate MySQL DATEDIFF() function.
|
||||||
* @param string, string
|
*
|
||||||
|
* This function compares two dates value and returns the difference.
|
||||||
|
*
|
||||||
|
* PHP 5.3.2 has a serious bug in DateTime::diff(). So if users' PHP is that version,
|
||||||
|
* we don't use that function. See https://bugs.php.net/bug.php?id=51184.
|
||||||
|
*
|
||||||
|
* @param string start
|
||||||
|
* @param string end
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function datediff($start, $end) {
|
public function datediff($start, $end) {
|
||||||
|
@ -367,7 +644,16 @@ class PDOSQLiteUDFS {
|
||||||
return $interval;
|
return $interval;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* emulates MySQL LOCATE() function
|
* Method to emulate MySQL LOCATE() function.
|
||||||
|
*
|
||||||
|
* This function returns the position if $substr is found in $str. If not,
|
||||||
|
* it returns 0. If mbstring extension is loaded, mb_strpos() function is
|
||||||
|
* used.
|
||||||
|
*
|
||||||
|
* @param string needle
|
||||||
|
* @param string haystack
|
||||||
|
* @param integer position
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function locate($substr, $str, $pos = 0) {
|
public function locate($substr, $str, $pos = 0) {
|
||||||
if (!extension_loaded('mbstring')) {
|
if (!extension_loaded('mbstring')) {
|
||||||
|
@ -384,5 +670,46 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT date in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT date 'dddd-mm-dd'
|
||||||
|
*/
|
||||||
|
public function utc_date() {
|
||||||
|
return gmdate('Y-m-d', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT time in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT time '00:00:00'
|
||||||
|
*/
|
||||||
|
public function utc_time() {
|
||||||
|
return gmdate('H:i:s', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT time stamp in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT timestamp 'yyyy-mm-dd 00:00:00'
|
||||||
|
*/
|
||||||
|
public function utc_timestamp() {
|
||||||
|
return gmdate('Y-m-d H:i:s', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return MySQL version.
|
||||||
|
*
|
||||||
|
* This function only returns the current newest version number of MySQL,
|
||||||
|
* because it is meaningless for SQLite database.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string representing the version number: major_version.minor_version
|
||||||
|
*/
|
||||||
|
public function version() {
|
||||||
|
//global $required_mysql_version;
|
||||||
|
//return $required_mysql_version;
|
||||||
|
return '5.5';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
447
functions.php
447
functions.php
|
@ -1,23 +1,53 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file contains the class that defines user defined functions for PDO library.
|
||||||
|
*
|
||||||
|
* This file is for PHP 5.3.x or later. For PHP 5.2.x or lesser, functions-5-2.php is
|
||||||
|
* loaded. PHP version is checked in the db.php and that will load the apropriate
|
||||||
|
* one.
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu, Justin Adie
|
* @author Kojima Toshiyasu
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class defines user defined functions(UDFs) for PDO
|
* This class defines user defined functions(UDFs) for PDO library.
|
||||||
* This replaces the functions used in the SQL statement with the PHP functions.
|
*
|
||||||
* If you want another, add the name in the array and define the function with
|
* These functions replace those used in the SQL statement with the PHP functions.
|
||||||
* PHP script.
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* new PDOSQLiteUDFS(ref_to_pdo_obj);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* This automatically enables ref_to_pdo_obj to replace the function in the SQL statement
|
||||||
|
* to the ones defined here.
|
||||||
*/
|
*/
|
||||||
class PDOSQLiteUDFS {
|
class PDOSQLiteUDFS {
|
||||||
|
/**
|
||||||
|
* The class constructor
|
||||||
|
*
|
||||||
|
* Initializes the use defined functions to PDO object with PDO::sqliteCreateFunction().
|
||||||
|
*
|
||||||
|
* @param reference to PDO object $pdo
|
||||||
|
*/
|
||||||
public function __construct(&$pdo){
|
public function __construct(&$pdo){
|
||||||
|
if (!$pdo) {
|
||||||
|
wp_die('Database is not initialized.', 'Database Error');
|
||||||
|
}
|
||||||
foreach ($this->functions as $f=>$t) {
|
foreach ($this->functions as $f=>$t) {
|
||||||
$pdo->sqliteCreateFunction($f, array($this, $t));
|
$pdo->sqliteCreateFunction($f, array($this, $t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* array to define MySQL function => function defined with PHP.
|
||||||
|
*
|
||||||
|
* Replaced functions must be public.
|
||||||
|
*
|
||||||
|
* @var associative array
|
||||||
|
*/
|
||||||
private $functions = array(
|
private $functions = array(
|
||||||
'month' => 'month',
|
'month' => 'month',
|
||||||
'year' => 'year',
|
'year' => 'year',
|
||||||
|
@ -41,7 +71,6 @@ class PDOSQLiteUDFS {
|
||||||
'subdate' => 'date_sub',
|
'subdate' => 'date_sub',
|
||||||
'localtime' => 'now',
|
'localtime' => 'now',
|
||||||
'localtimestamp' => 'now',
|
'localtimestamp' => 'now',
|
||||||
//'date'=>'date',
|
|
||||||
'isnull' => 'isnull',
|
'isnull' => 'isnull',
|
||||||
'if' => '_if',
|
'if' => '_if',
|
||||||
'regexpp' => 'regexp',
|
'regexpp' => 'regexp',
|
||||||
|
@ -49,7 +78,7 @@ class PDOSQLiteUDFS {
|
||||||
'field' => 'field',
|
'field' => 'field',
|
||||||
'log' => 'log',
|
'log' => 'log',
|
||||||
'least' => 'least',
|
'least' => 'least',
|
||||||
'replace' => 'replace',
|
'greatest' => 'greatest',
|
||||||
'get_lock' => 'get_lock',
|
'get_lock' => 'get_lock',
|
||||||
'release_lock' => 'release_lock',
|
'release_lock' => 'release_lock',
|
||||||
'ucase' => 'ucase',
|
'ucase' => 'ucase',
|
||||||
|
@ -57,63 +86,169 @@ class PDOSQLiteUDFS {
|
||||||
'inet_ntoa' => 'inet_ntoa',
|
'inet_ntoa' => 'inet_ntoa',
|
||||||
'inet_aton' => 'inet_aton',
|
'inet_aton' => 'inet_aton',
|
||||||
'datediff' => 'datediff',
|
'datediff' => 'datediff',
|
||||||
'locate' => 'locate'
|
'locate' => 'locate',
|
||||||
|
'utc_date' => 'utc_date',
|
||||||
|
'utc_time' => 'utc_time',
|
||||||
|
'utc_timestamp' => 'utc_timestamp',
|
||||||
|
'version' => 'version'
|
||||||
);
|
);
|
||||||
|
/**
|
||||||
|
* Method to extract the month value from the date.
|
||||||
|
*
|
||||||
|
* @param string representing the date formated as 0000-00-00.
|
||||||
|
* @return string representing the number of the month between 1 and 12.
|
||||||
|
*/
|
||||||
public function month($field){
|
public function month($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return date('n', $t);
|
return date('n', $t);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to extract the year value from the date.
|
||||||
|
*
|
||||||
|
* @param string representing the date formated as 0000-00-00.
|
||||||
|
* @return string representing the number of the year.
|
||||||
|
*/
|
||||||
public function year($field){
|
public function year($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return date('Y', $t);
|
return date('Y', $t);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to extract the day value from the date.
|
||||||
|
*
|
||||||
|
* @param string representing the date formated as 0000-00-00.
|
||||||
|
* @return string representing the number of the day of the month from 1 and 31.
|
||||||
|
*/
|
||||||
public function day($field){
|
public function day($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return date('j', $t);
|
return date('j', $t);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to return the unix timestamp.
|
||||||
|
*
|
||||||
|
* Used without an argument, it returns PHP time() function (total seconds passed
|
||||||
|
* from '1970-01-01 00:00:00' GMT). Used with the argument, it changes the value
|
||||||
|
* to the timestamp.
|
||||||
|
*
|
||||||
|
* @param string representing the date formated as '0000-00-00 00:00:00'.
|
||||||
|
* @return number of unsigned integer
|
||||||
|
*/
|
||||||
public function unix_timestamp($field = null){
|
public function unix_timestamp($field = null){
|
||||||
return is_null($field) ? time() : strtotime($field);
|
return is_null($field) ? time() : strtotime($field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL SECOND() function.
|
||||||
|
*
|
||||||
|
* @param string representing the time formated as '00:00:00'.
|
||||||
|
* @return number of unsigned integer
|
||||||
|
*/
|
||||||
public function second($field){
|
public function second($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return intval( date("s", $t) );
|
return intval( date("s", $t) );
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL MINUTE() function.
|
||||||
|
*
|
||||||
|
* @param string representing the time formated as '00:00:00'.
|
||||||
|
* @return number of unsigned integer
|
||||||
|
*/
|
||||||
public function minute($field){
|
public function minute($field){
|
||||||
$t = strtotime($field);
|
$t = strtotime($field);
|
||||||
return intval(date("i", $t));
|
return intval(date("i", $t));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL HOUR() function.
|
||||||
|
*
|
||||||
|
* @param string representing the time formated as '00:00:00'.
|
||||||
|
* @return number
|
||||||
|
*/
|
||||||
public function hour($time){
|
public function hour($time){
|
||||||
list($hours, $minutes, $seconds) = explode(":", $time);
|
list($hours, $minutes, $seconds) = explode(":", $time);
|
||||||
return intval($hours);
|
return intval($hours);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL FROM_UNIXTIME() function.
|
||||||
|
*
|
||||||
|
* @param integer of unix timestamp
|
||||||
|
* @param string to indicate the way of formatting(optional)
|
||||||
|
* @return string formatted as '0000-00-00 00:00:00'.
|
||||||
|
*/
|
||||||
public function from_unixtime($field, $format=null){
|
public function from_unixtime($field, $format=null){
|
||||||
// $field is a timestamp
|
// $field is a timestamp
|
||||||
//convert to ISO time
|
//convert to ISO time
|
||||||
$date = date("Y-m-d H:i:s", $field);
|
$date = date("Y-m-d H:i:s", $field);
|
||||||
//now submit to dateformat
|
//now submit to dateformat
|
||||||
|
|
||||||
return is_null($format) ? $date : $self->dateformat($date, $format);
|
return is_null($format) ? $date : $self->dateformat($date, $format);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL NOW() function.
|
||||||
|
*
|
||||||
|
* @return string representing current time formatted as '0000-00-00 00:00:00'.
|
||||||
|
*/
|
||||||
public function now(){
|
public function now(){
|
||||||
return date("Y-m-d H:i:s");
|
return date("Y-m-d H:i:s");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL CURDATE() function.
|
||||||
|
*
|
||||||
|
* @return string representing current time formatted as '0000-00-00'.
|
||||||
|
*/
|
||||||
public function curdate() {
|
public function curdate() {
|
||||||
return date("Y-m-d");
|
return date("Y-m-d");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL CHAR_LENGTH() function.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return unsigned integer for the length of the argument.
|
||||||
|
*/
|
||||||
public function char_length($field){
|
public function char_length($field){
|
||||||
return strlen($field);
|
return strlen($field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL MD5() function.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string of the md5 hash value of the argument.
|
||||||
|
*/
|
||||||
public function md5($field){
|
public function md5($field){
|
||||||
return md5($field);
|
return md5($field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL RAND() function.
|
||||||
|
*
|
||||||
|
* SQLite does have a random generator, but it is called RANDOM() and returns random
|
||||||
|
* number between -9223372036854775808 and +9223372036854775807. So we substitute it
|
||||||
|
* with PHP random generator.
|
||||||
|
*
|
||||||
|
* This function uses mt_rand() which is four times faster than rand() and returns
|
||||||
|
* the random number between 0 and 1.
|
||||||
|
*
|
||||||
|
* @return unsigned integer
|
||||||
|
*/
|
||||||
public function rand(){
|
public function rand(){
|
||||||
return rand(0,1);
|
return mt_rand(0, 1);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL SUBSTRING() function.
|
||||||
|
*
|
||||||
|
* This function rewrites the function name to SQLite compatible substr(),
|
||||||
|
* which can manipulate UTF-8 characters.
|
||||||
|
*
|
||||||
|
* @param string $text
|
||||||
|
* @param integer $pos representing the start point.
|
||||||
|
* @param integer $len representing the length of the substring(optional).
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function substring($text, $pos, $len=null){
|
public function substring($text, $pos, $len=null){
|
||||||
if (is_null($len)) return substr($text, $pos-1);
|
return "substr($text, $pos, $len)";
|
||||||
else return substr($text, $pos-1, $len);
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL DATEFORMAT() function.
|
||||||
|
*
|
||||||
|
* @param string date formatted as '0000-00-00' or datetime as '0000-00-00 00:00:00'.
|
||||||
|
* @param string $format
|
||||||
|
* @return string formatted according to $format
|
||||||
|
*/
|
||||||
public function dateformat($date, $format){
|
public function dateformat($date, $format){
|
||||||
$mysql_php_dateformats = array ( '%a' => 'D', '%b' => 'M', '%c' => 'n', '%D' => 'jS', '%d' => 'd', '%e' => 'j', '%H' => 'H', '%h' => 'h', '%I' => 'h', '%i' => 'i', '%j' => 'z', '%k' => 'G', '%l' => 'g', '%M' => 'F', '%m' => 'm', '%p' => 'A', '%r' => 'h:i:s A', '%S' => 's', '%s' => 's', '%T' => 'H:i:s', '%U' => 'W', '%u' => 'W', '%V' => 'W', '%v' => 'W', '%W' => 'l', '%w' => 'w', '%X' => 'Y', '%x' => 'o', '%Y' => 'Y', '%y' => 'y', );
|
$mysql_php_dateformats = array ( '%a' => 'D', '%b' => 'M', '%c' => 'n', '%D' => 'jS', '%d' => 'd', '%e' => 'j', '%H' => 'H', '%h' => 'h', '%I' => 'h', '%i' => 'i', '%j' => 'z', '%k' => 'G', '%l' => 'g', '%M' => 'F', '%m' => 'm', '%p' => 'A', '%r' => 'h:i:s A', '%S' => 's', '%s' => 's', '%T' => 'H:i:s', '%U' => 'W', '%u' => 'W', '%V' => 'W', '%v' => 'W', '%W' => 'l', '%w' => 'w', '%X' => 'Y', '%x' => 'o', '%Y' => 'Y', '%y' => 'y', );
|
||||||
$t = strtotime($date);
|
$t = strtotime($date);
|
||||||
|
@ -121,6 +256,17 @@ class PDOSQLiteUDFS {
|
||||||
$output = date($format, $t);
|
$output = date($format, $t);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL DATE_ADD() function.
|
||||||
|
*
|
||||||
|
* This function adds the time value of $interval expression to $date.
|
||||||
|
* $interval is a single quoted strings rewritten by SQLiteQueryDriver::rewrite_query().
|
||||||
|
* It is calculated in the private function deriveInterval().
|
||||||
|
*
|
||||||
|
* @param string $date representing the start date.
|
||||||
|
* @param string $interval representing the expression of the time to add.
|
||||||
|
* @return string date formated as '0000-00-00 00:00:00'.
|
||||||
|
*/
|
||||||
public function date_add($date, $interval) {
|
public function date_add($date, $interval) {
|
||||||
$interval = $this->deriveInterval($interval);
|
$interval = $this->deriveInterval($interval);
|
||||||
switch (strtolower($date)) {
|
switch (strtolower($date)) {
|
||||||
|
@ -141,6 +287,17 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL DATE_SUB() function.
|
||||||
|
*
|
||||||
|
* This function substracts the time value of $interval expression from $date.
|
||||||
|
* $interval is a single quoted strings rewritten by SQLiteQueryDriver::rewrite_query().
|
||||||
|
* It is calculated in the private function deriveInterval().
|
||||||
|
*
|
||||||
|
* @param string $date representing the start date.
|
||||||
|
* @param string $interval representing the expression of the time to substract.
|
||||||
|
* @return string date formated as '0000-00-00 00:00:00'.
|
||||||
|
*/
|
||||||
public function date_sub($date, $interval) {
|
public function date_sub($date, $interval) {
|
||||||
$interval = $this->deriveInterval($interval);
|
$interval = $this->deriveInterval($interval);
|
||||||
switch (strtolower($date)) {
|
switch (strtolower($date)) {
|
||||||
|
@ -161,6 +318,13 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to calculate the interval time between two dates value.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param string $interval white space separated expression.
|
||||||
|
* @return string representing the time to add or substract.
|
||||||
|
*/
|
||||||
private function deriveInterval($interval) {
|
private function deriveInterval($interval) {
|
||||||
$interval = trim(substr(trim($interval), 8));
|
$interval = trim(substr(trim($interval), 8));
|
||||||
$parts = explode(' ', $interval);
|
$parts = explode(' ', $interval);
|
||||||
|
@ -181,55 +345,83 @@ class PDOSQLiteUDFS {
|
||||||
case "minute_second":
|
case "minute_second":
|
||||||
list($minutes, $seconds) = explode(':', $_parts[0]);
|
list($minutes, $seconds) = explode(':', $_parts[0]);
|
||||||
return 'PT' . $minutes . 'M' . $seconds . 'S';
|
return 'PT' . $minutes . 'M' . $seconds . 'S';
|
||||||
break;
|
|
||||||
case "hour_second":
|
case "hour_second":
|
||||||
list($hours, $minutes, $seconds) = explode (':', $_parts[0]);
|
list($hours, $minutes, $seconds) = explode (':', $_parts[0]);
|
||||||
return 'PT' . $hours . 'H' . $minutes . 'M' . $seconds . 'S';
|
return 'PT' . $hours . 'H' . $minutes . 'M' . $seconds . 'S';
|
||||||
break;
|
|
||||||
case "hour_minute":
|
case "hour_minute":
|
||||||
list($hours, $minutes) = explode (':', $_parts[0]);
|
list($hours, $minutes) = explode (':', $_parts[0]);
|
||||||
return 'PT' . $hours . 'H' . $minutes . 'M';
|
return 'PT' . $hours . 'H' . $minutes . 'M';
|
||||||
break;
|
|
||||||
case "day_second":
|
case "day_second":
|
||||||
$days = intval($_parts[0]);
|
$days = intval($_parts[0]);
|
||||||
list($hours, $minutes, $seconds) = explode (':', $_parts[1]);
|
list($hours, $minutes, $seconds) = explode (':', $_parts[1]);
|
||||||
return 'P' . $days . 'D' . 'T' . $hours . 'H' . $minutes . 'M' . $seconds . 'S';
|
return 'P' . $days . 'D' . 'T' . $hours . 'H' . $minutes . 'M' . $seconds . 'S';
|
||||||
break;
|
|
||||||
case "day_minute":
|
case "day_minute":
|
||||||
$days = intval($_parts[0]);
|
$days = intval($_parts[0]);
|
||||||
list($hours, $minutes) = explode(':', $parts[1]);
|
list($hours, $minutes) = explode(':', $parts[1]);
|
||||||
return 'P' . $days . 'D' . 'T' . $hours . 'H' . $minutes . 'M';
|
return 'P' . $days . 'D' . 'T' . $hours . 'H' . $minutes . 'M';
|
||||||
break;
|
|
||||||
case "day_hour":
|
case "day_hour":
|
||||||
$days = intval($_parts[0]);
|
$days = intval($_parts[0]);
|
||||||
$hours = intval($_parts[1]);
|
$hours = intval($_parts[1]);
|
||||||
return 'P' . $days . 'D' . 'T' . $hours . 'H';
|
return 'P' . $days . 'D' . 'T' . $hours . 'H';
|
||||||
break;
|
|
||||||
case "year_month":
|
case "year_month":
|
||||||
list($years, $months) = explode ('-', $_parts[0]);
|
list($years, $months) = explode ('-', $_parts[0]);
|
||||||
return 'P' . $years . 'Y' . $months . 'M';
|
return 'P' . $years . 'Y' . $months . 'M';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL DATE() function.
|
||||||
|
*
|
||||||
|
* @param string $date formatted as unix time.
|
||||||
|
* @return string formatted as '0000-00-00'.
|
||||||
|
*/
|
||||||
public function date($date){
|
public function date($date){
|
||||||
return date("Y-m-d", strtotime($date));
|
return date("Y-m-d", strtotime($date));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL ISNULL() function.
|
||||||
|
*
|
||||||
|
* This function returns true if the argument is null, and true if not.
|
||||||
|
*
|
||||||
|
* @param various types $field
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function isnull($field){
|
public function isnull($field){
|
||||||
return is_null($field);
|
return is_null($field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL IF() function.
|
||||||
|
*
|
||||||
|
* As 'IF' is a reserved word for PHP, function name must be changed.
|
||||||
|
*
|
||||||
|
* @param unknonw $expression the statement to be evaluated as true or false.
|
||||||
|
* @param unknown $true statement or value returned if $expression is true.
|
||||||
|
* @param unknown $false statement or value returned if $expression is false.
|
||||||
|
* @return unknown
|
||||||
|
*/
|
||||||
public function _if($expression, $true, $false){
|
public function _if($expression, $true, $false){
|
||||||
return ($expression == true) ? $true : $false;
|
return ($expression == true) ? $true : $false;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL REGEXP() function.
|
||||||
|
*
|
||||||
|
* @param string $field haystack
|
||||||
|
* @param string $pattern: regular expression to match.
|
||||||
|
* @return integer 1 if matched, 0 if not matched.
|
||||||
|
*/
|
||||||
public function regexp($field, $pattern){
|
public function regexp($field, $pattern){
|
||||||
$pattern = str_replace('/', '\/', $pattern);
|
$pattern = str_replace('/', '\/', $pattern);
|
||||||
$pattern = "/" . $pattern ."/i";
|
$pattern = "/" . $pattern ."/i";
|
||||||
return preg_match ($pattern, $field);
|
return preg_match ($pattern, $field);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL CONCAT() function.
|
||||||
|
*
|
||||||
|
* SQLite does have CONCAT() function, but it has a different syntax from MySQL.
|
||||||
|
* So this function must be manipulated here.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return NULL if the argument is null | string conatenated if the argument is given.
|
||||||
|
*/
|
||||||
public function concat() {
|
public function concat() {
|
||||||
$returnValue = "";
|
$returnValue = "";
|
||||||
$argsNum = func_num_args();
|
$argsNum = func_num_args();
|
||||||
|
@ -242,20 +434,55 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL FIELD() function.
|
||||||
|
*
|
||||||
|
* This function gets the list argument and compares the first item to all the others.
|
||||||
|
* If the same value is found, it returns the position of that value. If not, it
|
||||||
|
* returns 0.
|
||||||
|
*
|
||||||
|
* @param variable number of string, integer or double
|
||||||
|
* @return unsigned integer
|
||||||
|
*/
|
||||||
public function field() {
|
public function field() {
|
||||||
|
global $wpdb;
|
||||||
$numArgs = func_num_args();
|
$numArgs = func_num_args();
|
||||||
if ($numArgs < 2 or is_null(func_get_arg(0))) {
|
if ($numArgs < 2 or is_null(func_get_arg(0))) {
|
||||||
return null;
|
return 0;
|
||||||
|
} else {
|
||||||
|
$arg_list = func_get_args();
|
||||||
}
|
}
|
||||||
$arr = func_get_args();
|
$searchString = array_shift($arg_list);
|
||||||
$searchString = strtolower(array_shift($arr));
|
$str_to_check = substr($searchString, 0, strpos($searchString, '.'));
|
||||||
|
$str_to_check = str_replace($wpdb->prefix, '', $str_to_check);
|
||||||
|
if ($str_to_check && in_array(trim($str_to_check), $wpdb->tables)) return;
|
||||||
for ($i = 0; $i < $numArgs-1; $i++) {
|
for ($i = 0; $i < $numArgs-1; $i++) {
|
||||||
if ($searchString === strtolower($arr[$i])) return $i + 1;
|
if ($searchString === strtolower($arg_list[$i])) {
|
||||||
|
return $i + 1;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL LOG() function.
|
||||||
|
*
|
||||||
|
* Used with one argument, it returns the natural logarithm of X.
|
||||||
|
* <code>
|
||||||
|
* LOG(X)
|
||||||
|
* </code>
|
||||||
|
* Used with two arguments, it returns the natural logarithm of X base B.
|
||||||
|
* <code>
|
||||||
|
* LOG(B, X)
|
||||||
|
* </code>
|
||||||
|
* In this case, it returns the value of log(X) / log(B).
|
||||||
|
*
|
||||||
|
* Used without an argument, it returns false. This returned value will be
|
||||||
|
* rewritten to 0, because SQLite doesn't understand true/false value.
|
||||||
|
*
|
||||||
|
* @param integer representing the base of the logarithm, which is optional.
|
||||||
|
* @param double value to turn into logarithm.
|
||||||
|
* @return double | NULL
|
||||||
|
*/
|
||||||
public function log() {
|
public function log() {
|
||||||
$numArgs = func_num_args();
|
$numArgs = func_num_args();
|
||||||
if ($numArgs == 1) {
|
if ($numArgs == 1) {
|
||||||
|
@ -266,22 +493,36 @@ class PDOSQLiteUDFS {
|
||||||
$arg2 = func_get_arg(1);
|
$arg2 = func_get_arg(1);
|
||||||
return log($arg1)/log($arg2);
|
return log($arg1)/log($arg2);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function least() {
|
|
||||||
$arr = func_get_args();
|
|
||||||
return min($arr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function replace($haystack, $needle, $replace) {
|
|
||||||
return str_replace($needle, $replace, $haystack);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These two functions are meaningless in SQLite
|
* Method to emulate MySQL LEAST() function.
|
||||||
* So we return meaningless statement and do nothing
|
*
|
||||||
|
* This function rewrites the function name to SQLite compatible function name.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function least() {
|
||||||
|
$arg_list = func_get_args();
|
||||||
|
return "min($arg_list)";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL GREATEST() function.
|
||||||
|
*
|
||||||
|
* This function rewrites the function name to SQLite compatible function name.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function greatest() {
|
||||||
|
$arg_list = func_get_args();
|
||||||
|
return "max($arg_list)";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to dummy out MySQL GET_LOCK() function.
|
||||||
|
*
|
||||||
|
* This function is meaningless in SQLite, so we do nothing.
|
||||||
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param integer $timeout
|
* @param integer $timeout
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -289,45 +530,79 @@ class PDOSQLiteUDFS {
|
||||||
public function get_lock($name, $timeout) {
|
public function get_lock($name, $timeout) {
|
||||||
return '1=1';
|
return '1=1';
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to dummy out MySQL RELEASE_LOCK() function.
|
||||||
|
*
|
||||||
|
* This function is meaningless in SQLite, so we do nothing.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function release_lock($name) {
|
public function release_lock($name) {
|
||||||
return '1=1';
|
return '1=1';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQL aliases for upper and lower functions
|
* Method to emulate MySQL UCASE() function.
|
||||||
* @param $string
|
*
|
||||||
* @return string
|
* This is MySQL alias for upper() function. This function rewrites it
|
||||||
|
* to SQLite compatible name upper().
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string SQLite compatible function name.
|
||||||
*/
|
*/
|
||||||
public function ucase($string) {
|
public function ucase($string) {
|
||||||
return "upper($string)";
|
return "upper($string)";
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL LCASE() function.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This is MySQL alias for lower() function. This function rewrites it
|
||||||
|
* to SQLite compatible name lower().
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return string SQLite compatible function name.
|
||||||
|
*/
|
||||||
public function lcase($string) {
|
public function lcase($string) {
|
||||||
return "lower($string)";
|
return "lower($string)";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQL aliases for INET_NTOA and INET_ATON functions
|
* Method to emulate MySQL INET_NTOA() function.
|
||||||
* @param unsigned integer, string respectively
|
*
|
||||||
* @return string, unsigned integer respectively
|
* This function gets 4 or 8 bytes integer and turn it into the network address.
|
||||||
|
*
|
||||||
|
* @param unsigned long integer
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function inet_ntoa($num) {
|
public function inet_ntoa($num) {
|
||||||
return long2ip($num);
|
return long2ip($num);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate MySQL INET_ATON() function.
|
||||||
|
*
|
||||||
|
* This function gets the network address and turns it into integer.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* @return unsigned long integer
|
||||||
|
*/
|
||||||
public function inet_aton($addr) {
|
public function inet_aton($addr) {
|
||||||
$int_data = ip2long($addr);
|
$int_data = ip2long($addr);
|
||||||
$unsigned_int_data = sprintf('%u', $address);
|
$unsigned_int_data = sprintf('%u', $address);
|
||||||
return $unsigned_int_data;
|
return $unsigned_int_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQL aliase for DATEDIFF function
|
* Method to emulate MySQL DATEDIFF() function.
|
||||||
* @param string, string
|
*
|
||||||
|
* This function compares two dates value and returns the difference.
|
||||||
|
*
|
||||||
|
* PHP 5.3.2 has a serious bug in DateTime::diff(). So if users' PHP is that version,
|
||||||
|
* we don't use that function. See https://bugs.php.net/bug.php?id=51184.
|
||||||
|
*
|
||||||
|
* @param string start
|
||||||
|
* @param string end
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function datediff($start, $end) {
|
public function datediff($start, $end) {
|
||||||
/* PHP 5.3.2 has a serious bug in DateTime::diff()
|
|
||||||
* see https://bugs.php.net/bug.php?id=51184
|
|
||||||
*/
|
|
||||||
if (version_compare(PHP_VERSION, '5.3.2', '==')) {
|
if (version_compare(PHP_VERSION, '5.3.2', '==')) {
|
||||||
$start_date = strtotime($start);
|
$start_date = strtotime($start);
|
||||||
$end_date = strtotime($end);
|
$end_date = strtotime($end);
|
||||||
|
@ -341,7 +616,16 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* emulates MySQL LOCATE() function
|
* Method to emulate MySQL LOCATE() function.
|
||||||
|
*
|
||||||
|
* This function returns the position if $substr is found in $str. If not,
|
||||||
|
* it returns 0. If mbstring extension is loaded, mb_strpos() function is
|
||||||
|
* used.
|
||||||
|
*
|
||||||
|
* @param string needle
|
||||||
|
* @param string haystack
|
||||||
|
* @param integer position
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function locate($substr, $str, $pos = 0) {
|
public function locate($substr, $str, $pos = 0) {
|
||||||
if (!extension_loaded('mbstring')) {
|
if (!extension_loaded('mbstring')) {
|
||||||
|
@ -358,5 +642,46 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT date in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT date 'dddd-mm-dd'
|
||||||
|
*/
|
||||||
|
public function utc_date() {
|
||||||
|
return gmdate('Y-m-d', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT time in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT time '00:00:00'
|
||||||
|
*/
|
||||||
|
public function utc_time() {
|
||||||
|
return gmdate('H:i:s', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT time stamp in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT timestamp 'yyyy-mm-dd 00:00:00'
|
||||||
|
*/
|
||||||
|
public function utc_timestamp() {
|
||||||
|
return gmdate('Y-m-d H:i:s', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return MySQL version.
|
||||||
|
*
|
||||||
|
* This function only returns the current newest version number of MySQL,
|
||||||
|
* because it is meaningless for SQLite database.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string representing the version number: major_version.minor_version
|
||||||
|
*/
|
||||||
|
public function version() {
|
||||||
|
//global $required_mysql_version;
|
||||||
|
//return $required_mysql_version;
|
||||||
|
return '5.5';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
16
install.php
16
install.php
|
@ -1,10 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file contains the only one function wp_install().
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu, Justin Adie
|
* @author Kojima Toshiyasu, Justin Adie
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
echo 'Thank you, but you are not allowed to access this file.';
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function overrides wp_install() in wp-admin/includes/upgrade.php
|
* This function overrides wp_install() in wp-admin/includes/upgrade.php
|
||||||
*/
|
*/
|
||||||
|
@ -57,6 +64,15 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated =
|
||||||
|
|
||||||
wp_cache_flush();
|
wp_cache_flush();
|
||||||
|
|
||||||
|
if (isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false || isset($_SERVER['SERVER_SIGNATURE']) && stripos($_SERVER['SERVER_SIGNATURE'], 'apache') !== false) {
|
||||||
|
;// Your server is Apache. Nothing to do more.
|
||||||
|
} else {
|
||||||
|
$server_message = sprintf('Your webserver doesn\'t seem to be Apache. So the database directory access restriction by the .htaccess file may not function. We strongly recommend that you should restrict the access to the directory %s in some other way.', FQDBDIR);
|
||||||
|
echo '<div style="position: absolute; margin-top: 350px; width: 700px; border: .5px dashed rgb(0, 0, 0);"><p style="margin: 10px;">';
|
||||||
|
echo $server_message;
|
||||||
|
echo '</p></div>';
|
||||||
|
}
|
||||||
|
|
||||||
return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
|
return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
/* Silence is golden */
|
10
js/sqlite.js
10
js/sqlite.js
|
@ -1,6 +1,10 @@
|
||||||
/*
|
/**
|
||||||
* script for SQLite Integration
|
* This is a part of SQLite Integration.
|
||||||
* this file is only included on the documentation page and the utilities page
|
*
|
||||||
|
* This script is only included on the documentation and utility page.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
var $table = null;
|
var $table = null;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
jQuery(document).ready(function($){function stripe(arg){$(arg).find("tr.alt").removeClass("alt");var $args=arg+" tbody";$($args).each(function(){$(this).children(":visible").has("td").filter(function(index){return 1==index%2}).addClass("alt")})}var $table=null,$headers=null;null!=document.getElementById("sqlite-table")?($table=$("#sqlite-table"),$headers=$table.find("thead th").slice(0,2)):null!=document.getElementById("plugins-table")?($table=$("#plugins-table"),$headers=$table.find("thead th").slice(0)):null!=document.getElementById("patch-files")?($table=$("#patch-files"),$headers=$table.find("thead th").slice(1)):null!=document.getElementById("backup-files")&&($table=$("#backup-files"),$headers=$table.find("thead th").slice(1)),$headers.wrapInner('<a href="#"></a>').addClass("sort");var rows=$table.find("tbody > tr").get();$headers.bind("click",function(event){event.preventDefault();var $header=$(this),sortKey=$header.data("sort").key,sortDirection=1;$header.hasClass("sorted-asc")&&(sortDirection=-1),rows.sort(function(a,b){var keyA=$(a).data("table")[sortKey],keyB=$(b).data("table")[sortKey];return keyB>keyA?-sortDirection:keyA>keyB?sortDirection:0}),$headers.removeClass("sorted-asc sortd-desc"),$headers.addClass(1==sortDirection?"sorted-asc":"sorted-desc"),$.each(rows,function(index,row){$table.children("tbody").append(row)}),stripe("#plugins-table"),stripe("#sqlite-table"),stripe("#patch-files")}),stripe("#plugins-table"),stripe("#sys-info"),stripe("#sqlite-table"),stripe("#status"),stripe("#patch-files")}),jQuery(document).ready(function($){function stripe(arg){$(arg).find("tr.alt").removeClass("alt");var $args=arg+" tbody";$($args).each(function(){$(this).children(":visible").has("td").filter(function(index){return 1==index%2}).addClass("alt")})}var $table=$("#plugins-info"),$headers=$table.find("thead th").slice(0);$headers.wrapInner('<a href="#"></a>').addClass("sort");var rows=$table.find("tbody > tr").get();$headers.bind("click",function(event){event.preventDefault();var $header=$(this),sortKey=$header.data("sort").key,sortDirection=1;$header.hasClass("sorted-asc")&&(sortDirection=-1),rows.sort(function(a,b){var keyA=$(a).data("table")[sortKey],keyB=$(b).data("table")[sortKey];return keyB>keyA?-sortDirection:keyA>keyB?sortDirection:0}),$headers.removeClass("sorted-asc sortd-desc"),$headers.addClass(1==sortDirection?"sorted-asc":"sorted-desc"),$.each(rows,function(index,row){$table.children("tbody").append(row)}),stripe("#plugins-info")}),stripe("#plugins-info")});
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
/* Silence is golden */
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -129,12 +129,11 @@ msgstr "パッチ"
|
||||||
|
|
||||||
#: utilities/documentation.php:32
|
#: utilities/documentation.php:32
|
||||||
msgid ""
|
msgid ""
|
||||||
"This is a brief documentation about this plugin. For more details, see also "
|
"This is a brief documentation about this plugin. For more details, see also the "
|
||||||
"the <a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration\">Plugin "
|
"<a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration/\">SQLite Integration page</a>."
|
||||||
"Page</a>."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"このプラグインについての短いドキュメントです。詳しくは、<a href=\"http://dogwood.skr.jp/wordpress/"
|
"このプラグインについての短いドキュメントです。詳しくは、<a href=\"http://dogwood.skr.jp/wordpress/"
|
||||||
"sqlite-integration\">プラグインのページ</a>をご覧ください。"
|
"sqlite-integration/\">SQLite Integration</a> のページ</a>をご覧ください。"
|
||||||
|
|
||||||
#: utilities/documentation.php:35
|
#: utilities/documentation.php:35
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -156,12 +155,12 @@ msgid ""
|
||||||
"SQLite for its database. But PDO for WordPress doesn't seem to be maintained "
|
"SQLite for its database. But PDO for WordPress doesn't seem to be maintained "
|
||||||
"any more only to be outdated. SQLite Integration makes use of the basic "
|
"any more only to be outdated. SQLite Integration makes use of the basic "
|
||||||
"ideas and framework of PDO for WordPress, adds some new features and updates "
|
"ideas and framework of PDO for WordPress, adds some new features and updates "
|
||||||
"it to be able to work with the newest version of WordPress(3.6)."
|
"it to be able to work with the newest version of WordPress(3.8.1)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"このプラグインは<a href=\"http://wordpress.org/extend/plugins/pdo-for-wordpress/\">"
|
"このプラグインは<a href=\"http://wordpress.org/extend/plugins/pdo-for-wordpress/\">"
|
||||||
"PDO for WordPress</a>の後継です。PDO for WordPressはWordPressでSQLiteを使えるようにする"
|
"PDO for WordPress</a>の後継です。PDO for WordPressはWordPressでSQLiteを使えるようにする"
|
||||||
"ものでしたが、もうメンテナンスされていないようで、古くなってしまいました。SQLite Integrationは、その基本的な"
|
"ものでしたが、もうメンテナンスされていないようで、古くなってしまいました。SQLite Integrationは、その基本的な"
|
||||||
"考えと枠組みを使って、新たな機能を追加し、最新のWordPress(3.6)で動作するように"
|
"考えと枠組みを使って、新たな機能を追加し、最新のWordPress(3.8.1)で動作するように"
|
||||||
"したものです。"
|
"したものです。"
|
||||||
|
|
||||||
#: utilities/documentation.php:43
|
#: utilities/documentation.php:43
|
||||||
|
@ -243,7 +242,7 @@ msgstr ""
|
||||||
"が扱えないものもあります。だから..."
|
"が扱えないものもあります。だから..."
|
||||||
|
|
||||||
#: utilities/documentation.php:68
|
#: utilities/documentation.php:68
|
||||||
msgid "There are some plugins that you can't use in any way.<br />"
|
msgid "There are some plugins that you can't use. No way around.<br />"
|
||||||
msgstr "どうしても使えないプラグインがあります。"
|
msgstr "どうしても使えないプラグインがあります。"
|
||||||
|
|
||||||
#: utilities/documentation.php:69
|
#: utilities/documentation.php:69
|
||||||
|
@ -266,12 +265,12 @@ msgstr ""
|
||||||
msgid ""
|
msgid ""
|
||||||
"Some plugins do work fine if you rewrite MySQL functions. I made some patch "
|
"Some plugins do work fine if you rewrite MySQL functions. I made some patch "
|
||||||
"files and <a href=\"%s?page=patch\">Patch Utility</a>. See also the <a href="
|
"files and <a href=\"%s?page=patch\">Patch Utility</a>. See also the <a href="
|
||||||
"\"http://dogwood.skr.jp/wordpress/sqlite-integration\">Plugin Page</a> for "
|
"\"http://dogwood.skr.jp/wordpress/sqlite-integration/#plugin-compat\">SQLite Integration"
|
||||||
"more details."
|
" Page</a> for more details."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"MySQLの関数を書き換えると動作するプラグインがあります。いくつかはパッチファイルと、<a href=\"%s?page=patch\">"
|
"MySQLの関数を書き換えると動作するプラグインがあります。いくつかはパッチファイルと、<a href=\"%s?page=patch\">"
|
||||||
"パッチをあてる</a>ページを作りました。<a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration\">"
|
"パッチをあてる</a>ページを作りました。<a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration-ja/#plugin-compat\">"
|
||||||
"プラグインのページ</a>もご覧ください。"
|
"SQLite Integration のページ</a>もご覧ください。"
|
||||||
|
|
||||||
#: utilities/documentation.php:74
|
#: utilities/documentation.php:74
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -349,9 +348,7 @@ msgstr ""
|
||||||
#: utilities/documentation.php:104
|
#: utilities/documentation.php:104
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"Most of the plugins will work fine with this plugin. But there are some that "
|
"This is the list of the problematic plugins (far from "
|
||||||
"you need to rewrite some codes in them, and there are others that you can't "
|
|
||||||
"use with this plugin. This is the list of the problematic plugins (far from "
|
|
||||||
"complete). You can see informations about your installed plugins in the <a "
|
"complete). You can see informations about your installed plugins in the <a "
|
||||||
"href=\"%s?page=sys-info\">System Info</a> page. To see more details, please "
|
"href=\"%s?page=sys-info\">System Info</a> page. To see more details, please "
|
||||||
"visit the <a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration"
|
"visit the <a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration"
|
||||||
|
@ -388,126 +385,6 @@ msgstr "たぶん不可"
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr "不可"
|
msgstr "不可"
|
||||||
|
|
||||||
#: utilities/documentation.php:140
|
|
||||||
msgid "Caching Plugins"
|
|
||||||
msgstr "キャッシュ用プラグイン"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:142
|
|
||||||
msgid ""
|
|
||||||
"Some plugins that give you cache functinality might cause problems. It is "
|
|
||||||
"because they try to create the db.php file in wp-content directory, which "
|
|
||||||
"file SQLite Integration is using."
|
|
||||||
msgstr ""
|
|
||||||
"キャッシュの機能を提供するプラグインの中には問題になるものがあります。wp-contentディレクトリにdb.php"
|
|
||||||
"ファイルを作ろうとするのですが、SQLite Integrationがすでにそれを使ってしまっているからです。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:145
|
|
||||||
msgid ""
|
|
||||||
"If those plugins overwrite the db.php file, SQLite Integration doesn't work. "
|
|
||||||
"<span class=\"em\">My recommendation is not to use caching plugins</span>. "
|
|
||||||
"Even so, if you want a caching plugin, you could try <a href=\"http://"
|
|
||||||
"wordpress.org/extend/plugins/wp-super-cache/\">WP Super Cache</a>, which "
|
|
||||||
"doesn't use db.php file. But no warranty, try at your own risk."
|
|
||||||
msgstr ""
|
|
||||||
"これらのプラグインがdb.phpファイルを上書きすると、SQLite Integrationは動作しなくなります。"
|
|
||||||
"<span class=\"em\">私のお勧めは、キャッシュ・プラグインを使わないというものです</span>。"
|
|
||||||
"それでも、どうしても使いたいということであれば、<a href=\"http://wordpress.org/extend/plugins/"
|
|
||||||
"wp-super-cache/\">WP Super Cache</a>のようなものなら試せるかもしれません。db.phpを使わない"
|
|
||||||
"からです。でも、保証はありません。ご自分の責任でお試しください。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:148
|
|
||||||
msgid "I have not tested none of those caching plugins."
|
|
||||||
msgstr "私はこれらのキャッシュ・プラグインをテストしていません。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:150
|
|
||||||
msgid "MySQL specific functions"
|
|
||||||
msgstr "MySQL用の関数"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:152
|
|
||||||
msgid ""
|
|
||||||
"Some plugins don't use WordPress database functions such as dbDelta(), and "
|
|
||||||
"use PHP native MySQL functions when they create and manage tables in the "
|
|
||||||
"database. But PHP doesn't permit redefining of the native functions (at "
|
|
||||||
"least, under ordinary server setting). So SQLite Integration can't intercept "
|
|
||||||
"and rewrite those functions."
|
|
||||||
msgstr ""
|
|
||||||
"プラグインの中にはデータベースにアクセスするのに、WordPressが提供するdbDelta()のような関数を使わず、"
|
|
||||||
"PHPのmysqlドライバの提供する関数を使って、テーブルを作ったり、操作したりするものがあります。PHPは組み込み"
|
|
||||||
"の関数を再定義することを許しません(少なくとも通常のサーバ設定では)。だから、SQLite Integrationは"
|
|
||||||
"それらをインターセプトして、書き換えることができません。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:155
|
|
||||||
msgid "For example, you can see these codes in Google XML Sitemaps."
|
|
||||||
msgstr "たとえば、Google XML Sitemapsにはこのようなコードがあります。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:161
|
|
||||||
msgid "or in Camera Slideshow"
|
|
||||||
msgstr "あるいは、Camera Slideshowには、こんな部分があります。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:167
|
|
||||||
msgid ""
|
|
||||||
"Such functions as mysql_get_server_info() or mysql_query() are from the "
|
|
||||||
"MySQL driver of PHP. Not only some plugins but WordPress uses them, but "
|
|
||||||
"SQLite Integration has no way to rewrite or redefine them. If the plugin you "
|
|
||||||
"want to use has those functions in it, it won't work or give the error "
|
|
||||||
"messages."
|
|
||||||
msgstr ""
|
|
||||||
"mysql_get_server_info()やmysql_query()といった関数は、PHPのドライバが提供するものです。"
|
|
||||||
"でも、SQLite Integrationはこれらを書き換えたり、再定義したりすることができません。もし、あなたが"
|
|
||||||
"使いたいプラグインがこれらの関数を使っていたら、うまく動かないか、エラー・メッセージが出るでしょう。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:170
|
|
||||||
msgid ""
|
|
||||||
"So, you have to rewrite them for SQLite Integration can execute. The two "
|
|
||||||
"example above can be rewritten like this:"
|
|
||||||
msgstr ""
|
|
||||||
"だから、これらの関数は手動で書き換えなければ、SQLite Integrationで実行できません。上の2つの"
|
|
||||||
"例は、次のように書き換えればうまくいきます。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:179
|
|
||||||
msgid ""
|
|
||||||
"As for those functions in WordPress, I overrode the WordPress functions "
|
|
||||||
"themselves that contains such MySQL functions as mysql_query() or "
|
|
||||||
"mysql_real_escape_string()."
|
|
||||||
msgstr ""
|
|
||||||
"WordPressで使われているこれらの関数については、mysql_query()やmysql_real_escape_string()"
|
|
||||||
"といった関数を含むWordPress関数をオーバーライドしています。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:181
|
|
||||||
msgid "FULLTEXT index"
|
|
||||||
msgstr "FULLTEXTインデックス"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:183
|
|
||||||
msgid ""
|
|
||||||
"Some plugins use FULLTEXT index of MySQL. Of course SQLite does have the "
|
|
||||||
"functionality named "full-text search". But it is not correlated "
|
|
||||||
"with that of MySQL. In fact it is not an "index" and requires "
|
|
||||||
"another new table for that. And it has a different syntax. So you can't use "
|
|
||||||
"the plugins which uses FULLTEXT index"
|
|
||||||
msgstr ""
|
|
||||||
"プラグインの中には、MySQLのFULLTEXTインデックスを使うものがあります。もちろん、SQLiteにも、""
|
|
||||||
"full-text search"という機能があります。でも、これはMySQLのものとは違います。、実際は"
|
|
||||||
"インデックスではなく、新たなテーブルを作らなければならないものです。構文も異なります。だから、FULLTEXT"
|
|
||||||
"インデックスを使うプラグインは使うことができません。"
|
|
||||||
|
|
||||||
#: utilities/documentation.php:186
|
|
||||||
msgid ""
|
|
||||||
"If your language is not written by separating words with spaces, e.g. "
|
|
||||||
"Japanese, Chinese or Thai, neither FULLTEXT index nor full-text search work "
|
|
||||||
"effectively. Even if your language is space-separating-words one, you don't "
|
|
||||||
"have to be disappointed. Whatever languages you use, you can use <a href="
|
|
||||||
"\"http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/"
|
|
||||||
"\">WordPress Related Posts</a> or <a href=\"http://wordpress.org/extend/"
|
|
||||||
"plugins/related-posts/\">Related Posts</a> or others. They are working fine "
|
|
||||||
"with SQLite Integration!"
|
|
||||||
msgstr ""
|
|
||||||
"あなたの言語が、日本語や中国語やタイ語のように、スペースで単語を区切らない言語の場合、FULLTEXT"
|
|
||||||
"インデックスもfull-text searchも有効に働きません。あなたの言語が分かち書きをするものだとしても、"
|
|
||||||
"がっかりする必要はありません。<a href=\"http://wordpress.org/extend/plugins/"
|
|
||||||
"wordpress-23-related-posts-plugin/\">WordPress Related Posts</a>や<a href=\"http://"
|
|
||||||
"wordpress.org/extend/plugins/related-posts/\">Related Posts</a>のうようなプラグインを"
|
|
||||||
"使うことができます。これらは、SQLite Integrationでちゃんと動作します。"
|
|
||||||
|
|
||||||
#: utilities/patch.php:55
|
#: utilities/patch.php:55
|
||||||
msgid "Patch command is not found"
|
msgid "Patch command is not found"
|
||||||
msgstr "パッチコマンドがありません"
|
msgstr "パッチコマンドがありません"
|
||||||
|
@ -551,13 +428,40 @@ msgstr "エラー! ファイル%sは削除されていません。"
|
||||||
msgid "Error!: patches directory is not accessible."
|
msgid "Error!: patches directory is not accessible."
|
||||||
msgstr "エラー! パッチ・ディレクトリにアクセスできません。"
|
msgstr "エラー! パッチ・ディレクトリにアクセスできません。"
|
||||||
|
|
||||||
|
msgid "Unable to create a patch directory."
|
||||||
|
msgstr "パッチ・ディレクトリを作成できませんでした。"
|
||||||
|
|
||||||
|
msgid "Unable to create a .htaccess file."
|
||||||
|
msgstr ".htaccess ファイルを作成できませんでした。"
|
||||||
|
|
||||||
|
msgid "Invalid operation."
|
||||||
|
msgstr "不正な操作です。"
|
||||||
|
|
||||||
|
msgid "File is too large to upload."
|
||||||
|
msgstr "ファイルサイズが制限を越えています。"
|
||||||
|
|
||||||
|
msgid "File upload is not complete."
|
||||||
|
msgstr "ファイルアップロードは完了しませんでした。"
|
||||||
|
|
||||||
|
msgid "File is not uploaded."
|
||||||
|
msgstr "ファイルはアップロードされませんでした。"
|
||||||
|
|
||||||
|
msgid "Temporary directory is not writable."
|
||||||
|
msgstr "テンポラリ・ディレクトリに書込みできません。"
|
||||||
|
|
||||||
|
msgid "File cannot be written on the disk."
|
||||||
|
msgstr "ファイルをディスクに書き込めません。"
|
||||||
|
|
||||||
|
msgid "Unknown error."
|
||||||
|
msgstr "不明なエラーです。"
|
||||||
|
|
||||||
#: utilities/patch.php:142
|
#: utilities/patch.php:142
|
||||||
msgid "File is uploaded"
|
msgid "File is successfully uploaded."
|
||||||
msgstr "ファイルをアップロードしました"
|
msgstr "ファイルをアップロードしました"
|
||||||
|
|
||||||
#: utilities/patch.php:146
|
#: utilities/patch.php:146
|
||||||
msgid "File is not uploaded"
|
msgid "File upload failed. Possible file upload attack."
|
||||||
msgstr "ファイルはアップロードされていません"
|
msgstr "アップロードに失敗しました。不正なファイルです。"
|
||||||
|
|
||||||
#: utilities/patch.php:150
|
#: utilities/patch.php:150
|
||||||
msgid "File is not selected"
|
msgid "File is not selected"
|
||||||
|
@ -752,9 +656,11 @@ msgstr "ファイルを選択"
|
||||||
#: utilities/patch.php:286
|
#: utilities/patch.php:286
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select file from your computer. If the file name is the same as existent "
|
"Select file from your computer. If the file name is the same as existent "
|
||||||
"file, this operation will override it."
|
"file, this operation will override it. You can't upload the file whose "
|
||||||
|
"size is over 500kB."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"あなたのコンピュータにあるファイルを選択します。ファイル名がすでに存在する場合は、それを上書きします。"
|
"あなたのコンピュータにあるファイルを選択します。ファイル名がすでに存在する場合は、それを上書きします。"
|
||||||
|
"500kB を越えるサイズのファイルはアップロードできません。"
|
||||||
|
|
||||||
#: utilities/patch.php:288
|
#: utilities/patch.php:288
|
||||||
msgid "Upload"
|
msgid "Upload"
|
||||||
|
@ -827,6 +733,16 @@ msgstr "たぶん可"
|
||||||
msgid "Checked"
|
msgid "Checked"
|
||||||
msgstr "チェック済"
|
msgstr "チェック済"
|
||||||
|
|
||||||
|
msgid "Checked*"
|
||||||
|
msgstr "チェック済*"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"\"Checked*\" with an asterisk is from the users' information. "
|
||||||
|
"I didn't check myself yet. If you found any malfunctioning, please let me know."
|
||||||
|
msgstr ""
|
||||||
|
"「チェック済*」のようにアステリスクのついたものは、ユーザからの情報にもとづいたものです。"
|
||||||
|
"私自身はチェックしていません。もし、不具合があるようでしたら、お知らせください。"
|
||||||
|
|
||||||
#: utilities/utility.php:257 utilities/utility.php:263
|
#: utilities/utility.php:257 utilities/utility.php:263
|
||||||
msgid "Not Checked"
|
msgid "Not Checked"
|
||||||
msgstr "未確認"
|
msgstr "未確認"
|
||||||
|
@ -866,7 +782,7 @@ msgstr "SQLite Integrationにようこそ"
|
||||||
|
|
||||||
#: utilities/utility.php:406
|
#: utilities/utility.php:406
|
||||||
msgid "Thank you for using SQLite Integration plugin!"
|
msgid "Thank you for using SQLite Integration plugin!"
|
||||||
msgstr "SQLite Integrationをお使いいただき、ありがとうぐざいます。"
|
msgstr "SQLite Integrationをお使いいただき、ありがとうございます。"
|
||||||
|
|
||||||
#: utilities/utility.php:409
|
#: utilities/utility.php:409
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -1090,12 +1006,18 @@ msgstr "データベースの最適化、エラーログ、初期化ファイル
|
||||||
|
|
||||||
#: utilities/utility.php:695
|
#: utilities/utility.php:695
|
||||||
msgid "Please select backup file(s)."
|
msgid "Please select backup file(s)."
|
||||||
msgstr "データベースを最適化する"
|
msgstr "バックアップファイルを選択してください。"
|
||||||
|
|
||||||
#: utilities/utility.php:704
|
#: utilities/utility.php:704
|
||||||
msgid "Error! Please remove file(s) manyally."
|
msgid "Error! Please remove file(s) manyally."
|
||||||
msgstr "エラー! 手動でファイルを削除してください。"
|
msgstr "エラー! 手動でファイルを削除してください。"
|
||||||
|
|
||||||
|
msgid "Please select backup file."
|
||||||
|
msgstr "バックアップファイルを選択してください。"
|
||||||
|
|
||||||
|
msgid "Please select one file at a time."
|
||||||
|
msgstr "複数ファイルは選択できません。"
|
||||||
|
|
||||||
#: utilities/utility.php:718
|
#: utilities/utility.php:718
|
||||||
msgid "Database Optimization, Error Log, Init File"
|
msgid "Database Optimization, Error Log, Init File"
|
||||||
msgstr "データベース最適化、エラー・ログ、初期化ファイル"
|
msgstr "データベース最適化、エラー・ログ、初期化ファイル"
|
||||||
|
@ -1147,9 +1069,16 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"バックアップファイルを削除したい場合は、ファイルをチェックして削除ボタンをクリックしてください。複数ファイルを選択できます。"
|
"バックアップファイルを削除したい場合は、ファイルをチェックして削除ボタンをクリックしてください。複数ファイルを選択できます。"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"If you want to download a file, check the file name and click the Download button."
|
||||||
|
" Please check one file at a time."
|
||||||
|
msgstr ""
|
||||||
|
"バックアップファイルをダウンロードしたい場合は、ファイルをチェックしてダウンロードボタンをクリックしてください。"
|
||||||
|
"1ファイルのみ選択できます。"
|
||||||
|
|
||||||
#: utilities/utility.php:748
|
#: utilities/utility.php:748
|
||||||
msgid "Delete"
|
msgid "Delete/Download"
|
||||||
msgstr "削除"
|
msgstr "削除/ダウンロード"
|
||||||
|
|
||||||
#: utilities/utility.php:749
|
#: utilities/utility.php:749
|
||||||
msgid "Backup Files"
|
msgid "Backup Files"
|
||||||
|
@ -1173,6 +1102,11 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"バックアップファイルを削除します。\\n\\n中止する場合は[Cancel]を、続ける場合は[OK]をクリックしてください。"
|
"バックアップファイルを削除します。\\n\\n中止する場合は[Cancel]を、続ける場合は[OK]をクリックしてください。"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Are you sure to download backup file?\\n\\nClick [Cancel] to stop, [OK] to continue."
|
||||||
|
msgstr ""
|
||||||
|
"バックアップファイルをダウンロードします。\\n\\n中止する場合は[Cancel]を、続ける場合は[OK]をクリックしてください。"
|
||||||
|
|
||||||
#: utilities/utility.php:768
|
#: utilities/utility.php:768
|
||||||
msgid "SQLite Integration Error Log"
|
msgid "SQLite Integration Error Log"
|
||||||
msgstr "SQLite Integrationのエラーログ"
|
msgstr "SQLite Integrationのエラーログ"
|
||||||
|
@ -1337,3 +1271,73 @@ msgstr "あなたのデータベースは正常です。修復の必要はあり
|
||||||
|
|
||||||
msgid "You can check your database and fix it if needed."
|
msgid "You can check your database and fix it if needed."
|
||||||
msgstr "データベースのチェックと修復をすることができます。"
|
msgstr "データベースのチェックと修復をすることができます。"
|
||||||
|
|
||||||
|
msgid "Table name is not selected."
|
||||||
|
msgstr "テーブル名が選択されていません。"
|
||||||
|
|
||||||
|
msgid "There's no such table."
|
||||||
|
msgstr "テーブルが存在しません。"
|
||||||
|
|
||||||
|
msgid "Columns Information"
|
||||||
|
msgstr "カラム情報"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Select a table name and click \"Display Columns\" button, and you'll see "
|
||||||
|
"the column property of that table. This information is for debug use."
|
||||||
|
msgstr ""
|
||||||
|
"テーブル名を選択して「カラムを表示」ボタンをクリックしてください。そのテーブルのカラム属性を表示します。"
|
||||||
|
"この情報はデバッグのために利用されます。"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Display columns in the selected table.\\n\\nClick [Cancel] to stop, [OK] to continue."
|
||||||
|
msgstr ""
|
||||||
|
"選択したテーブルのカラムを表示します。\\n\\nやめるなら、[キャンセル]を、続けるんら、[OK]をクリックしてください。"
|
||||||
|
|
||||||
|
msgid "Columns In %s"
|
||||||
|
msgstr "%sのカラム"
|
||||||
|
|
||||||
|
msgid "Columns Info"
|
||||||
|
msgstr "カラム情報"
|
||||||
|
|
||||||
|
msgid "Table Name: "
|
||||||
|
msgstr "テーブル名"
|
||||||
|
|
||||||
|
msgid "Column"
|
||||||
|
msgstr "カラム"
|
||||||
|
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "タイプ"
|
||||||
|
|
||||||
|
msgid "Null"
|
||||||
|
msgstr "ヌル"
|
||||||
|
|
||||||
|
msgid "Default"
|
||||||
|
msgstr "デフォルト"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Upgrading Notice: To finish upgrading, please activate SQLite Integration "
|
||||||
|
"and go Setting >> SQLite Integration >> Miscellaneous, and click the button "update" at"
|
||||||
|
" the bottom of the page. Or else replace wp-content/db.php with the one in sqlite-integration "
|
||||||
|
"directory manually."
|
||||||
|
msgstr ""
|
||||||
|
"注意: アップグレードを完了するには、SQLite Integration を有効化して、設定 >> SQLite Integration >> いろいろ "
|
||||||
|
"ページに移り、ページの最下段にある「更新」ボタンをクリックしてください。あるいは、wp-content/db.php を sqlite-integration "
|
||||||
|
"ディレクトリにある db.php で上書きしてください。"
|
||||||
|
|
||||||
|
msgid "Update db.php"
|
||||||
|
msgstr "db.php のアップデート"
|
||||||
|
|
||||||
|
msgid "Replace the old db.php with the new one."
|
||||||
|
msgstr "古い db.php を新しいファイルと入れ替えます。"
|
||||||
|
|
||||||
|
msgid "Update"
|
||||||
|
msgstr "更新"
|
||||||
|
|
||||||
|
msgid "Are you sure to update this file?\n\nClick [Cancel] to stop, [OK] to continue."
|
||||||
|
msgstr "このファイルを更新してもいいですか。\n\nやめるなら [Cancel] を、続けるなら [OK] をクリックしてください。"
|
||||||
|
|
||||||
|
msgid "Your db.php is updated."
|
||||||
|
msgstr "db.php がアップデートされました。"
|
||||||
|
|
||||||
|
msgid "Couldn"t update db.php file. Please replace it manually."
|
||||||
|
msgstr "db.php ファイルをアップデートできませんでした。手動で置き換えてください。"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
197
pdodb.class.php
197
pdodb.class.php
|
@ -1,12 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file defines PDODB class, which inherits wpdb class and replaces it
|
||||||
|
* global $wpdb variable.
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu, Justin Adie
|
* @author Kojima Toshiyasu
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
echo 'Thank you, but you are not allowed to accesss this file.';
|
||||||
|
die();
|
||||||
|
}
|
||||||
require_once PDODIR . 'pdoengine.class.php';
|
require_once PDODIR . 'pdoengine.class.php';
|
||||||
require_once PDODIR . 'install.php';
|
//require_once PDODIR . 'install.php';
|
||||||
|
|
||||||
if (!defined('SAVEQUERIES')){
|
if (!defined('SAVEQUERIES')){
|
||||||
define ('SAVEQUERIES', false);
|
define ('SAVEQUERIES', false);
|
||||||
|
@ -17,20 +23,27 @@ if(!defined('PDO_DEBUG')){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class extends wpdb and replaces it.
|
* This class extends wpdb and replaces it.
|
||||||
* It also rewrites some functions that use mysql specific functions.
|
*
|
||||||
|
* It also rewrites some methods that use mysql specific functions.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class PDODB extends wpdb {
|
class PDODB extends wpdb {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var reference to the object of PDOEngine class.
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
protected $dbh = null;
|
protected $dbh = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: emulates wpdb but this gets another parameter $db_type,
|
* Constructor
|
||||||
* which is given by the constant 'DB_TYPE' defined in wp-config.php.
|
|
||||||
* SQLite uses only $db_type and all the others are simply ignored.
|
|
||||||
*
|
*
|
||||||
|
* This overrides wpdb::__construct() which has database server, username and
|
||||||
|
* password as arguments. This class doesn't use them.
|
||||||
|
*
|
||||||
|
* @see wpdb::__construct()
|
||||||
*/
|
*/
|
||||||
function __construct() {
|
public function __construct() {
|
||||||
register_shutdown_function(array($this, '__destruct'));
|
register_shutdown_function(array($this, '__destruct'));
|
||||||
|
|
||||||
if (WP_DEBUG)
|
if (WP_DEBUG)
|
||||||
|
@ -40,45 +53,89 @@ class PDODB extends wpdb {
|
||||||
|
|
||||||
$this->db_connect();
|
$this->db_connect();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
function __destruct() {
|
* Desctructor
|
||||||
|
*
|
||||||
|
* This overrides wpdb::__destruct(), but does nothing but return true.
|
||||||
|
*
|
||||||
|
* @see wpdb::__destruct()
|
||||||
|
*/
|
||||||
|
public function __destruct() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dummy out the MySQL function
|
* Method to set character set for the database.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::set_charset(), only to dummy out the MySQL function.
|
||||||
|
*
|
||||||
* @see wpdb::set_charset()
|
* @see wpdb::set_charset()
|
||||||
*/
|
*/
|
||||||
function set_charset($dbh, $charset = null, $collate = null) {
|
public function set_charset($dbh, $charset = null, $collate = null) {
|
||||||
if ( ! isset( $charset ) )
|
if ( ! isset( $charset ) )
|
||||||
$charset = $this->charset;
|
$charset = $this->charset;
|
||||||
if ( ! isset( $collate ) )
|
if ( ! isset( $collate ) )
|
||||||
$collate = $this->collate;
|
$collate = $this->collate;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* dummy out the MySQL function
|
* Method to dummy out wpdb::set_sql_mode()
|
||||||
|
*
|
||||||
|
* @see wpdb::set_sql_mode()
|
||||||
|
*/
|
||||||
|
public function set_sql_mode($modes = array()) {
|
||||||
|
unset($modes);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to select the database connection.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::select(), only to dummy out the MySQL function.
|
||||||
|
*
|
||||||
* @see wpdb::select()
|
* @see wpdb::select()
|
||||||
*/
|
*/
|
||||||
function select($db, $dbh = null) {
|
public function select($db, $dbh = null) {
|
||||||
if (is_null($dbh))
|
if (is_null($dbh))
|
||||||
$dbh = $this->dbh;
|
$dbh = $this->dbh;
|
||||||
$this->ready = true;
|
$this->ready = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* overrides wpdb::_real_escape(), which uses mysql_real_escape_string().
|
* Method to dummy out wpdb::_weak_escape()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function _weak_escape($string) {
|
||||||
|
return addslashes($string);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to escape characters.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::_real_escape() to avoid using mysql_real_escape_string().
|
||||||
|
*
|
||||||
* @see wpdb::_real_escape()
|
* @see wpdb::_real_escape()
|
||||||
*/
|
*/
|
||||||
function _real_escape($string) {
|
function _real_escape($string) {
|
||||||
return addslashes($string);
|
return addslashes($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* overrides wpdb::print_error()
|
* Method to dummy out wpdb::esc_like() function.
|
||||||
|
*
|
||||||
|
* WordPress 4.0.0 introduced esc_like() function that adds backslashes to %,
|
||||||
|
* underscore and backslash, which is not interpreted as escape character
|
||||||
|
* by SQLite. So we override it and dummy out this function.
|
||||||
|
*
|
||||||
|
* @see wpdb::esc_like()
|
||||||
|
*/
|
||||||
|
public function esc_like($text) {
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to put out the error message.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::print_error(), for we can't use the parent class method.
|
||||||
|
*
|
||||||
* @see wpdb::print_error()
|
* @see wpdb::print_error()
|
||||||
*/
|
*/
|
||||||
function print_error($str = '') {
|
public function print_error($str = '') {
|
||||||
global $EZSQL_ERROR;
|
global $EZSQL_ERROR;
|
||||||
|
|
||||||
if (!$str) {
|
if (!$str) {
|
||||||
|
@ -118,12 +175,30 @@ class PDODB extends wpdb {
|
||||||
</div>";
|
</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* overrides wpdb::db_connect()
|
* Method to flush cached data.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::flush(). This is not necessarily overridden, because
|
||||||
|
* $result will never be resource.
|
||||||
|
*
|
||||||
|
* @see wpdb::flush
|
||||||
|
*/
|
||||||
|
public function flush() {
|
||||||
|
$this->last_result = array();
|
||||||
|
$this->col_info = null;
|
||||||
|
$this->last_query = null;
|
||||||
|
$this->rows_affected = $this->num_rows = 0;
|
||||||
|
$this->last_error = '';
|
||||||
|
$this->result = null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to do the database connection.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::db_connect() to avoid using MySQL function.
|
||||||
|
*
|
||||||
* @see wpdb::db_connect()
|
* @see wpdb::db_connect()
|
||||||
*/
|
*/
|
||||||
function db_connect() {
|
public function db_connect($allow_bail=true) {
|
||||||
if (WP_DEBUG) {
|
if (WP_DEBUG) {
|
||||||
$this->dbh = new PDOEngine();
|
$this->dbh = new PDOEngine();
|
||||||
} else {
|
} else {
|
||||||
|
@ -136,14 +211,25 @@ class PDODB extends wpdb {
|
||||||
$this->bail(sprintf(__("<h1>Error establlishing a database connection</h1><p>We have been unable to connect to the specified database. <br />The error message received was %s"), $this->dbh->errorInfo()));
|
$this->bail(sprintf(__("<h1>Error establlishing a database connection</h1><p>We have been unable to connect to the specified database. <br />The error message received was %s"), $this->dbh->errorInfo()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$this->has_connected = true;
|
||||||
$this->ready = true;
|
$this->ready = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* overrides wpdb::query()
|
* Method to dummy out wpdb::check_connection()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function check_connection($allow_bail=true) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to execute the query.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::query(). In fact, this method does all the database
|
||||||
|
* access jobs.
|
||||||
|
*
|
||||||
* @see wpdb::query()
|
* @see wpdb::query()
|
||||||
*/
|
*/
|
||||||
function query($query) {
|
public function query($query) {
|
||||||
if (!$this->ready)
|
if (!$this->ready)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -175,7 +261,7 @@ class PDODB extends wpdb {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^\\s*(create|alter|truncate|drop|optimize)\\s*/i', $query)) {
|
if (preg_match('/^\\s*(create|alter|truncate|drop|optimize)\\s*/i', $query)) {
|
||||||
// $return_val = $this->result;
|
//$return_val = $this->result;
|
||||||
$return_val = $this->dbh->get_return_value();
|
$return_val = $this->dbh->get_return_value();
|
||||||
} elseif (preg_match('/^\\s*(insert|delete|update|replace)\s/i', $query)) {
|
} elseif (preg_match('/^\\s*(insert|delete|update|replace)\s/i', $query)) {
|
||||||
$this->rows_affected = $this->dbh->get_affected_rows();
|
$this->rows_affected = $this->dbh->get_affected_rows();
|
||||||
|
@ -190,23 +276,49 @@ class PDODB extends wpdb {
|
||||||
}
|
}
|
||||||
return $return_val;
|
return $return_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* overrides wpdb::load_col_info(), which uses a mysql function.
|
* Method for future use?
|
||||||
* @see wpdb::load_col_info()
|
*
|
||||||
|
* WordPress 3.9 separated the method to execute real query from query() function.
|
||||||
|
* This is for the restoration from the case that nothing returns from database.
|
||||||
|
* But this is necessary because we aleady did error manipulations in
|
||||||
|
* pdoengine.class.php. So we don't use this function.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
function load_col_info() {
|
private function _do_query($query) {
|
||||||
|
if (defined('SAVEQUERIES') && SAVEQUERIES) {
|
||||||
|
$this->timer_start();
|
||||||
|
}
|
||||||
|
$this->result = $this->dbh->query($query);
|
||||||
|
$this->num_queries++;
|
||||||
|
if (defined('SAVEQUERIES') && SAVEQUERIES) {
|
||||||
|
$this->queries[] = array($query, $this->timer_stop(), $this->get_caller());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to set the class variable $col_info.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::load_col_info(), which uses a mysql function.
|
||||||
|
*
|
||||||
|
* @see wpdb::load_col_info()
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
|
protected function load_col_info() {
|
||||||
if ($this->col_info)
|
if ($this->col_info)
|
||||||
return;
|
return;
|
||||||
$this->col_info = $this->dbh->get_columns();
|
$this->col_info = $this->dbh->get_columns();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* overrides wpdb::has_cap()
|
* Method to return what the database can do.
|
||||||
* We don't support collation, group_concat, set_charset
|
*
|
||||||
|
* This overrides wpdb::has_cap() to avoid using MySQL functions.
|
||||||
|
* SQLite supports subqueries, but not support collation, group_concat and set_charset.
|
||||||
|
*
|
||||||
* @see wpdb::has_cap()
|
* @see wpdb::has_cap()
|
||||||
*/
|
*/
|
||||||
function has_cap($db_cap) {
|
public function has_cap($db_cap) {
|
||||||
switch(strtolower($db_cap)) {
|
switch(strtolower($db_cap)) {
|
||||||
case 'collation':
|
case 'collation':
|
||||||
case 'group_concat':
|
case 'group_concat':
|
||||||
|
@ -219,17 +331,22 @@ class PDODB extends wpdb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* overrides wpdb::db_version()
|
* Method to return database version number.
|
||||||
* Returns mysql version number but it means nothing for SQLite.
|
*
|
||||||
|
* This overrides wpdb::db_version() to avoid using MySQL function.
|
||||||
|
* It returns mysql version number, but it means nothing for SQLite.
|
||||||
|
* So it return the newest mysql version.
|
||||||
|
*
|
||||||
* @see wpdb::db_version()
|
* @see wpdb::db_version()
|
||||||
*/
|
*/
|
||||||
function db_version() {
|
public function db_version() {
|
||||||
global $required_mysql_version;
|
//global $required_mysql_version;
|
||||||
return $required_mysql_version;
|
//return $required_mysql_version;
|
||||||
|
return '5.5';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Initialize $wpdb with PDODB class
|
* Initialize $wpdb with PDODB class
|
||||||
*/
|
*/
|
||||||
if (!isset($wpdb)) {
|
if (!isset($wpdb)) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
626
query.class.php
626
query.class.php
|
@ -1,21 +1,68 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file defines PDOSQLiteDriver class.
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu, Justin Adie
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* base class for sql rewriting except CREATE, ALTER TABLE
|
* This class is for rewriting various query string except CREATE and ALTER.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class PDOSQLiteDriver {
|
class PDOSQLiteDriver {
|
||||||
|
|
||||||
//required variables
|
|
||||||
public $query_type = '';
|
|
||||||
public $_query = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to determin which functions to use
|
* Variable to indicate the query types.
|
||||||
|
*
|
||||||
|
* @var string $query_type
|
||||||
|
*/
|
||||||
|
public $query_type = '';
|
||||||
|
/**
|
||||||
|
* Variable to store query string.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $_query = '';
|
||||||
|
/**
|
||||||
|
* Variable to check if rewriting CALC_FOUND_ROWS is needed.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $rewrite_calc_found = false;
|
||||||
|
/**
|
||||||
|
* Variable to check if rewriting ON DUPLICATE KEY UPDATE is needed.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $rewrite_duplicate_key = false;
|
||||||
|
/**
|
||||||
|
* Variable to check if rewriting index hints is needed.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $rewrite_index_hint = false;
|
||||||
|
/**
|
||||||
|
* Variable to check if rewriting BETWEEN is needed.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $rewrite_between = false;
|
||||||
|
/**
|
||||||
|
* Variable to check how many times rewriting BETWEEN is needed.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $num_of_rewrite_between = 0;
|
||||||
|
/**
|
||||||
|
* Variable to check order by field() with column data.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $orderby_field = false;
|
||||||
|
/**
|
||||||
|
* Method to rewrite a query string for SQLite to execute.
|
||||||
|
*
|
||||||
* @param strin $query
|
* @param strin $query
|
||||||
* @param string $query_type
|
* @param string $query_type
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -23,80 +70,151 @@ class PDOSQLiteDriver {
|
||||||
public function rewrite_query($query, $query_type){
|
public function rewrite_query($query, $query_type){
|
||||||
$this->query_type = $query_type;
|
$this->query_type = $query_type;
|
||||||
$this->_query = $query;
|
$this->_query = $query;
|
||||||
|
$this->parse_query();
|
||||||
switch ($this->query_type) {
|
switch ($this->query_type) {
|
||||||
case 'truncate':
|
case 'truncate':
|
||||||
$this->_handle_truncate_query();
|
$this->handle_truncate_query();
|
||||||
break;
|
break;
|
||||||
case 'alter':
|
case 'alter':
|
||||||
$this->_handle_alter_query();
|
$this->handle_alter_query();
|
||||||
break;
|
break;
|
||||||
case 'create':
|
case 'create':
|
||||||
$this->_handle_create_query();
|
$this->handle_create_query();
|
||||||
break;
|
break;
|
||||||
case 'describe':
|
case 'describe':
|
||||||
case 'desc':
|
case 'desc':
|
||||||
$this->_handle_describe_query();
|
$this->handle_describe_query();
|
||||||
break;
|
break;
|
||||||
case 'show':
|
case 'show':
|
||||||
$this->_handle_show_query();
|
$this->handle_show_query();
|
||||||
break;
|
break;
|
||||||
case 'showcolumns':
|
case 'showcolumns':
|
||||||
$this->_handle_show_columns_query();
|
$this->handle_show_columns_query();
|
||||||
break;
|
break;
|
||||||
case 'showindex':
|
case 'showindex':
|
||||||
$this->_handle_show_index();
|
$this->handle_show_index();
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
$this->_strip_backticks();
|
//$this->strip_backticks();
|
||||||
$this->_handle_sql_count();
|
$this->handle_sql_count();
|
||||||
$this->_rewrite_date_sub();
|
$this->rewrite_date_sub();
|
||||||
$this->_delete_index_hints();
|
$this->delete_index_hints();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
$this->_rewrite_boolean();
|
//$this->rewrite_boolean();
|
||||||
$this->_fix_date_quoting();
|
$this->fix_date_quoting();
|
||||||
$this->_rewrite_between();
|
$this->rewrite_between();
|
||||||
|
$this->handle_orderby_field();
|
||||||
break;
|
break;
|
||||||
case 'insert':
|
case 'insert':
|
||||||
$this->_strip_backticks();
|
//$this->safe_strip_backticks();
|
||||||
$this->_execute_duplicate_key_update();
|
$this->execute_duplicate_key_update();
|
||||||
$this->_rewrite_insert_ignore();
|
$this->rewrite_insert_ignore();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
$this->_fix_date_quoting();
|
$this->fix_date_quoting();
|
||||||
break;
|
break;
|
||||||
case 'update':
|
case 'update':
|
||||||
$this->_strip_backticks();
|
//$this->safe_strip_backticks();
|
||||||
$this->_rewrite_update_ignore();
|
$this->rewrite_update_ignore();
|
||||||
// $this->_rewrite_date_sub();
|
//$this->_rewrite_date_sub();
|
||||||
$this->_rewrite_limit_usage();
|
$this->rewrite_limit_usage();
|
||||||
$this->_rewrite_order_by_usage();
|
$this->rewrite_order_by_usage();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
$this->_rewrite_between();
|
$this->rewrite_between();
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$this->_strip_backticks();
|
//$this->strip_backticks();
|
||||||
$this->_rewrite_limit_usage();
|
$this->rewrite_limit_usage();
|
||||||
$this->_rewrite_order_by_usage();
|
$this->rewrite_order_by_usage();
|
||||||
$this->_rewrite_date_sub();
|
$this->rewrite_date_sub();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
$this->_delete_workaround();
|
$this->delete_workaround();
|
||||||
break;
|
break;
|
||||||
case 'replace':
|
case 'replace':
|
||||||
$this->_strip_backticks();
|
//$this->safe_strip_backticks();
|
||||||
$this->_rewrite_date_sub();
|
$this->rewrite_date_sub();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
break;
|
break;
|
||||||
case 'optimize':
|
case 'optimize':
|
||||||
$this->_rewrite_optimize();
|
$this->rewrite_optimize();
|
||||||
|
break;
|
||||||
|
case 'pragma':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (defined(WP_DEBUG) && WP_DEBUG) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
$this->return_true();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $this->_query;
|
return $this->_query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to dummy the SHOW TABLES query
|
* Method to parse query string and determine which operation is needed.
|
||||||
|
*
|
||||||
|
* Remove backticks and change true/false values into 1/0. And determines
|
||||||
|
* if rewriting CALC_FOUND_ROWS or ON DUPLICATE KEY UPDATE etc is needed.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_show_query(){
|
private function parse_query() {
|
||||||
|
$tokens = preg_split("/(\\\'|''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
|
$literal = false;
|
||||||
|
$query_string = '';
|
||||||
|
foreach ($tokens as $token) {
|
||||||
|
if ($token == "'") {
|
||||||
|
if ($literal) {
|
||||||
|
$literal = false;
|
||||||
|
} else {
|
||||||
|
$literal = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($literal === false) {
|
||||||
|
if (strpos($token, '`') !== false) {
|
||||||
|
$token = str_replace('`', '', $token);
|
||||||
|
}
|
||||||
|
if (preg_match('/\\bTRUE\\b/i', $token)) {
|
||||||
|
$token = str_ireplace('TRUE', '1', $token);
|
||||||
|
}
|
||||||
|
if (preg_match('/\\bFALSE\\b/i', $token)) {
|
||||||
|
$token = str_ireplace('FALSE', '0', $token);
|
||||||
|
}
|
||||||
|
if (stripos($token, 'SQL_CALC_FOUND_ROWS') !== false) {
|
||||||
|
$this->rewrite_calc_found = true;
|
||||||
|
}
|
||||||
|
if (stripos($token, 'ON DUPLICATE KEY UPDATE') !== false) {
|
||||||
|
$this->rewrite_duplicate_key = true;
|
||||||
|
}
|
||||||
|
if (stripos($token, 'USE INDEX') !== false) {
|
||||||
|
$this->rewrite_index_hint = true;
|
||||||
|
}
|
||||||
|
if (stripos($token, 'IGNORE INDEX') !== false) {
|
||||||
|
$this->rewrite_index_hint = true;
|
||||||
|
}
|
||||||
|
if (stripos($token, 'FORCE INDEX') !== false) {
|
||||||
|
$this->rewrite_index_hint = true;
|
||||||
|
}
|
||||||
|
if (stripos($token, 'BETWEEN') !== false) {
|
||||||
|
$this->rewrite_between = true;
|
||||||
|
$this->num_of_rewrite_between++;
|
||||||
|
}
|
||||||
|
if (stripos($token, 'ORDER BY FIELD') !== false) {
|
||||||
|
$this->orderby_field = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$query_string .= $token;
|
||||||
|
}
|
||||||
|
$this->_query = $query_string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* method to handle SHOW TABLES query.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function handle_show_query(){
|
||||||
|
$this->_query = str_ireplace(' FULL', '', $this->_query);
|
||||||
$table_name = '';
|
$table_name = '';
|
||||||
$pattern = '/^\\s*SHOW\\s*TABLES\\s*.*?(LIKE\\s*(.*))$/im';
|
$pattern = '/^\\s*SHOW\\s*TABLES\\s*.*?(LIKE\\s*(.*))$/im';
|
||||||
if (preg_match($pattern, $this->_query, $matches)) {
|
if (preg_match($pattern, $this->_query, $matches)) {
|
||||||
|
@ -109,76 +227,119 @@ class PDOSQLiteDriver {
|
||||||
}
|
}
|
||||||
$this->_query = "SELECT name FROM sqlite_master WHERE type='table'" . $suffix . ' ORDER BY name DESC';
|
$this->_query = "SELECT name FROM sqlite_master WHERE type='table'" . $suffix . ' ORDER BY name DESC';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to strip all column qualifiers (backticks) from a query
|
* Method to strip all column qualifiers (backticks) from a query.
|
||||||
|
*
|
||||||
|
* All the back quotes in the query string are removed automatically.
|
||||||
|
* So it must not be used when INSERT, UPDATE or REPLACE query is executed.
|
||||||
|
*
|
||||||
|
* Obsolite since 1.5.1
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _strip_backticks(){
|
private function strip_backticks(){
|
||||||
$this->_query = str_replace('`', '', $this->_query);
|
$this->_query = str_replace('`', '', $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to emulate the SQL_CALC_FOUND_ROWS placeholder for mysql
|
* Method to strip all column qualifiers (backticks) from a query except post data.
|
||||||
*
|
*
|
||||||
* this is a kind of tricky play.
|
* All the back quotes execpt user data to be inserted are revomved automatically.
|
||||||
* 1. remove SQL_CALC_FOUND_ROWS option, and give it to the pdo engine
|
* This method must be used when INSERT, UPDATE or REPLACE query is executed.
|
||||||
* 2. make another $wpdb instance, and execute SELECT COUNT(*) query
|
|
||||||
* 3. give the returned value to the original instance variable
|
|
||||||
*
|
*
|
||||||
* when SQL statement contains GROUP BY option, SELECT COUNT query doesn't
|
* Obsolite since 1.5.1
|
||||||
* go well. So we remove the GROUP BY, which means the returned value may
|
|
||||||
* be a approximate one.
|
|
||||||
*
|
*
|
||||||
* this kind of statement is required for WordPress to calculate the paging.
|
* @access private
|
||||||
* see also WP_Query class in wp-includes/query.php
|
|
||||||
*/
|
*/
|
||||||
private function _handle_sql_count(){
|
private function safe_strip_backticks() {
|
||||||
if (stripos($this->_query, 'SELECT SQL_CALC_FOUND_ROWS') !== false){
|
$query_string = '';
|
||||||
|
$tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
|
$literal = false;
|
||||||
|
$query_string = '';
|
||||||
|
foreach ($tokens as $token) {
|
||||||
|
if ($token == "'") {
|
||||||
|
if ($literal) {
|
||||||
|
$literal = false;
|
||||||
|
} else {
|
||||||
|
$literal = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($literal === false && strpos($token, '`') !== false) {
|
||||||
|
$token = str_replace('`', '', $token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$query_string .= $token;
|
||||||
|
}
|
||||||
|
$this->_query = $query_string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to emulate the SQL_CALC_FOUND_ROWS placeholder for MySQL.
|
||||||
|
*
|
||||||
|
* This is a kind of tricky play.
|
||||||
|
* 1. remove SQL_CALC_FOUND_ROWS option, and give it to the pdo engine
|
||||||
|
* 2. make another $wpdb instance, and execute the rewritten query
|
||||||
|
* 3. give the returned value (integer: number of the rows) to the original instance variable without LIMIT
|
||||||
|
*
|
||||||
|
* We no longer use SELECT COUNT query, because it returns the inexact values when used with WP_Meta_Query().
|
||||||
|
*
|
||||||
|
* This kind of statement is required for WordPress to calculate the paging information.
|
||||||
|
* see also WP_Query class in wp-includes/query.php
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function handle_sql_count(){
|
||||||
|
if (!$this->rewrite_calc_found) return;
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
// first strip the code. this is the end of rewriting process
|
// first strip the code. this is the end of rewriting process
|
||||||
$this->_query = str_ireplace('SQL_CALC_FOUND_ROWS', '', $this->_query);
|
$this->_query = str_ireplace('SQL_CALC_FOUND_ROWS', '', $this->_query);
|
||||||
// we make the data for next SELECE FOUND_ROWS() statement
|
// we make the data for next SELECE FOUND_ROWS() statement
|
||||||
$unlimited_query = preg_replace('/\\bLIMIT\\s*.*/imsx', '', $this->_query);
|
$unlimited_query = preg_replace('/\\bLIMIT\\s*.*/imsx', '', $this->_query);
|
||||||
// $unlimited_query = preg_replace('/\\bFALSE\\s*.*/imsx', '0', $unlimited_query);
|
//$unlimited_query = preg_replace('/\\bGROUP\\s*BY\\s*.*/imsx', '', $unlimited_query);
|
||||||
$unlimited_query = preg_replace('/\\bGROUP\\s*BY\\s*.*/imsx', '', $unlimited_query);
|
// we no longer use SELECT COUNT query
|
||||||
$unlimited_query = $this->__transform_to_count($unlimited_query);
|
//$unlimited_query = $this->_transform_to_count($unlimited_query);
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$result = $_wpdb->query($unlimited_query);
|
$result = $_wpdb->query($unlimited_query);
|
||||||
$wpdb->dbh->found_rows_result = $_wpdb->last_result;
|
$wpdb->dbh->found_rows_result = $result;
|
||||||
|
$_wpdb = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* transforms a select query to a select count(*)
|
* Call back method to change SELECT query to SELECT COUNT().
|
||||||
|
*
|
||||||
|
* obsolite since version 1.5.1
|
||||||
*
|
*
|
||||||
* @param string $query the query to be transformed
|
* @param string $query the query to be transformed
|
||||||
* @return string the transformed query
|
* @return string the transformed query
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function __transform_to_count($query){
|
private function _transform_to_count($query){
|
||||||
$pattern = '/^\\s*SELECT\\s*(DISTINCT|)?.*?FROM\b/imsx';
|
$pattern = '/^\\s*SELECT\\s*(DISTINCT|)?.*?FROM\b/isx';
|
||||||
$_query = preg_replace($pattern, 'SELECT \\1 COUNT(*) FROM ', $query);
|
$_query = preg_replace($pattern, 'SELECT \\1 COUNT(*) FROM ', $query);
|
||||||
return $_query;
|
return $_query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rewrites the insert ignore phrase for sqlite
|
* Method to rewrite INSERT IGNORE to INSERT OR IGNORE.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_insert_ignore(){
|
private function rewrite_insert_ignore(){
|
||||||
$this->_query = str_ireplace('INSERT IGNORE', 'INSERT OR IGNORE ', $this->_query);
|
$this->_query = str_ireplace('INSERT IGNORE', 'INSERT OR IGNORE ', $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rewrites the update ignore phrase for sqlite
|
* Method to rewrite UPDATE IGNORE to UPDATE OR IGNORE.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_update_ignore(){
|
private function rewrite_update_ignore(){
|
||||||
$this->_query = str_ireplace('UPDATE IGNORE', 'UPDATE OR IGNORE ', $this->_query);
|
$this->_query = str_ireplace('UPDATE IGNORE', 'UPDATE OR IGNORE ', $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rewrites the date_add function for udf to manipulate
|
* Method to rewrite DATE_ADD() function.
|
||||||
|
*
|
||||||
|
* DATE_ADD has a parameter PHP function can't parse, so we quote the list and
|
||||||
|
* pass it to the user defined function.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_date_add(){
|
private function rewrite_date_add(){
|
||||||
//(date,interval expression unit)
|
//(date,interval expression unit)
|
||||||
$pattern = '/\\s*date_add\\s*\(([^,]*),([^\)]*)\)/imsx';
|
$pattern = '/\\s*date_add\\s*\(([^,]*),([^\)]*)\)/imsx';
|
||||||
if (preg_match($pattern, $this->_query, $matches)) {
|
if (preg_match($pattern, $this->_query, $matches)) {
|
||||||
|
@ -186,11 +347,15 @@ class PDOSQLiteDriver {
|
||||||
$this->_query = preg_replace($pattern, " date_add($matches[1], $expression) ", $this->_query);
|
$this->_query = preg_replace($pattern, " date_add($matches[1], $expression) ", $this->_query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rewrite the data_sub function for udf to manipulate
|
* Method to rewrite DATE_SUB() function.
|
||||||
|
*
|
||||||
|
* DATE_SUB has a parameter PHP function can't parse, so we quote the list and
|
||||||
|
* pass it to the user defined function.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_date_sub(){
|
private function rewrite_date_sub(){
|
||||||
//(date,interval expression unit)
|
//(date,interval expression unit)
|
||||||
$pattern = '/\\s*date_sub\\s*\(([^,]*),([^\)]*)\)/imsx';
|
$pattern = '/\\s*date_sub\\s*\(([^,]*),([^\)]*)\)/imsx';
|
||||||
if (preg_match($pattern, $this->_query, $matches)) {
|
if (preg_match($pattern, $this->_query, $matches)) {
|
||||||
|
@ -198,23 +363,30 @@ class PDOSQLiteDriver {
|
||||||
$this->_query = preg_replace($pattern, " date_sub($matches[1], $expression) ", $this->_query);
|
$this->_query = preg_replace($pattern, " date_sub($matches[1], $expression) ", $this->_query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handles the create query
|
* Method to handle CREATE query.
|
||||||
* this function won't be used... See PDOEngine class
|
*
|
||||||
|
* If the query is CREATE query, it will be passed to the query_create.class.php.
|
||||||
|
* So this method can't be used. It's here for safety.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_create_query(){
|
private function handle_create_query(){
|
||||||
require_once PDODIR.'query_create.class.php';
|
require_once PDODIR . 'query_create.class.php';
|
||||||
$engine = new CreateQuery();
|
$engine = new CreateQuery();
|
||||||
$this->_query = $engine->rewrite_query($this->_query);
|
$this->_query = $engine->rewrite_query($this->_query);
|
||||||
$engine = null;
|
$engine = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handles the ALTER query
|
* Method to handle ALTER query.
|
||||||
* this function won't be used... See PDOEngine class
|
*
|
||||||
|
* If the query is ALTER query, it will be passed ot the query_alter.class.php.
|
||||||
|
* So this method can't be used. It is here for safety.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_alter_query(){
|
private function handle_alter_query(){
|
||||||
require_once PDODIR . 'query_alter.class.php';
|
require_once PDODIR . 'query_alter.class.php';
|
||||||
$engine = new AlterQuery();
|
$engine = new AlterQuery();
|
||||||
$this->_query = $engine->rewrite_query($this->_query, 'alter');
|
$this->_query = $engine->rewrite_query($this->_query, 'alter');
|
||||||
|
@ -222,53 +394,83 @@ class PDOSQLiteDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handles DESCRIBE or DESC query
|
* Method to handle DESCRIBE or DESC query.
|
||||||
* this is required in the WordPress install process
|
*
|
||||||
|
* DESCRIBE is required for WordPress installation process. DESC is
|
||||||
|
* an alias for DESCRIBE, but it is not used in core WordPress.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_describe_query(){
|
private function handle_describe_query(){
|
||||||
// $this->_query = "select 1=1";
|
|
||||||
$pattern = '/^\\s*(DESCRIBE|DESC)\\s*(.*)/i';
|
$pattern = '/^\\s*(DESCRIBE|DESC)\\s*(.*)/i';
|
||||||
if (preg_match($pattern, $this->_query, $match)) {
|
if (preg_match($pattern, $this->_query, $match)) {
|
||||||
$tablename = preg_replace('/[\';]/', '', $match[2]);
|
$tablename = preg_replace('/[\';]/', '', $match[2]);
|
||||||
$this->_query = "PRAGMA table_info($tablename)";
|
$this->_query = "PRAGMA table_info($tablename)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Method to remove LIMIT clause from DELETE or UPDATE query.
|
||||||
|
*
|
||||||
* The author of the original 'PDO for WordPress' says update method of wpdb
|
* The author of the original 'PDO for WordPress' says update method of wpdb
|
||||||
* insists on adding LIMIT. But the newest version of WordPress doesn't do that.
|
* insists on adding LIMIT. But the newest version of WordPress doesn't do that.
|
||||||
* Nevertheless some plugins use DELETE with LIMIT, UPDATE with LIMIT.
|
* Nevertheless some plugins use DELETE with LIMIT, UPDATE with LIMIT.
|
||||||
* We need to exclude sub query's LIMIT.
|
* We need to exclude sub query's LIMIT. And if SQLite is compiled with
|
||||||
|
* ENABLE_UPDATE_DELETE_LIMIT option, we don't remove it.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_limit_usage(){
|
private function rewrite_limit_usage(){
|
||||||
|
$_wpdb = new PDODB();
|
||||||
|
$options = $_wpdb->get_results('PRAGMA compile_options');
|
||||||
|
foreach ($options as $opt) {
|
||||||
|
if (stripos($opt->compile_option, 'ENABLE_UPDATE_DELETE_LIMIT') !== false) return;
|
||||||
|
}
|
||||||
if (stripos($this->_query, '(select') === false) {
|
if (stripos($this->_query, '(select') === false) {
|
||||||
$this->_query = preg_replace('/\\s*LIMIT\\s*[0-9]$/i', '', $this->_query);
|
$this->_query = preg_replace('/\\s*LIMIT\\s*[0-9]$/i', '', $this->_query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* Method to remove ORDER BY clause from DELETE or UPDATE query.
|
||||||
|
*
|
||||||
* SQLite compiled without SQLITE_ENABLE_UPDATE_DELETE_LIMIT option can't
|
* SQLite compiled without SQLITE_ENABLE_UPDATE_DELETE_LIMIT option can't
|
||||||
* execute UPDATE with ORDER BY, DELETE with GROUP BY.
|
* execute UPDATE with ORDER BY, DELETE with GROUP BY.
|
||||||
* We need to exclude sub query's GROUP BY.
|
* We need to exclude sub query's GROUP BY.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_order_by_usage() {
|
private function rewrite_order_by_usage() {
|
||||||
|
$_wpdb = new PDODB();
|
||||||
|
$options = $_wpdb->get_results('PRAGMA compile_options');
|
||||||
|
foreach ($options as $opt) {
|
||||||
|
if (stripos($opt->compile_option, 'ENABLE_UPDATE_DELETE_LIMIT') !== false) return;
|
||||||
|
}
|
||||||
if (stripos($this->_query, '(select') === false) {
|
if (stripos($this->_query, '(select') === false) {
|
||||||
$this->_query = preg_replace('/\\s*ORDER\\s*BY\\s*.*$/i', '', $this->_query);
|
$this->_query = preg_replace('/\\s+ORDER\\s+BY\\s*.*$/i', '', $this->_query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
private function _handle_truncate_query(){
|
* Method to handle TRUNCATE query.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function handle_truncate_query(){
|
||||||
$pattern = '/TRUNCATE TABLE (.*)/im';
|
$pattern = '/TRUNCATE TABLE (.*)/im';
|
||||||
$this->_query = preg_replace($pattern, 'DELETE FROM $1', $this->_query);
|
$this->_query = preg_replace($pattern, 'DELETE FROM $1', $this->_query);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* rewrites use of Optimize queries in mysql for sqlite.
|
* Method to handle OPTIMIZE query.
|
||||||
* table name is ignored.
|
*
|
||||||
|
* Original query has the table names, but they are simply ignored.
|
||||||
|
* Table names are meaningless in SQLite.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_optimize(){
|
private function rewrite_optimize(){
|
||||||
$this->_query ="VACUUM";
|
$this->_query ="VACUUM";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Method to rewrite day.
|
||||||
|
*
|
||||||
* Jusitn Adie says: some wp UI interfaces (notably the post interface)
|
* Jusitn Adie says: some wp UI interfaces (notably the post interface)
|
||||||
* badly composes the day part of the date leading to problems in sqlite
|
* badly composes the day part of the date leading to problems in sqlite
|
||||||
* sort ordering etc.
|
* sort ordering etc.
|
||||||
|
@ -276,61 +478,84 @@ class PDOSQLiteDriver {
|
||||||
* I don't understand that...
|
* I don't understand that...
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_badly_formed_dates(){
|
private function rewrite_badly_formed_dates(){
|
||||||
$pattern = '/([12]\d{3,}-\d{2}-)(\d )/ims';
|
$pattern = '/([12]\d{3,}-\d{2}-)(\d )/ims';
|
||||||
$this->_query = preg_replace($pattern, '${1}0$2', $this->_query);
|
$this->_query = preg_replace($pattern, '${1}0$2', $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to remove unsupported index hinting from mysql queries
|
* Method to remove INDEX HINT.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _delete_index_hints(){
|
private function delete_index_hints(){
|
||||||
$pattern = '/\\s*(use|ignore|force)\\s+index\\s*\(.*?\)/i';
|
$pattern = '/\\s*(use|ignore|force)\\s+index\\s*\(.*?\)/i';
|
||||||
$this->_query = preg_replace($pattern, '', $this->_query);
|
$this->_query = preg_replace($pattern, '', $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix the date string and quote. This is required for the calendar widget.
|
* Method to fix the date string and quoting.
|
||||||
*
|
*
|
||||||
* where month(fieldname)=08 becomes month(fieldname)='8'
|
* This is required for the calendar widget.
|
||||||
* where month(fieldname)='08' becomes month(fieldname)='8'
|
*
|
||||||
|
* WHERE month(fieldname)=08 is converted to month(fieldname)='8'
|
||||||
|
* WHERE month(fieldname)='08' is converted to month(fieldname)='8'
|
||||||
*
|
*
|
||||||
* I use preg_replace_callback instead of 'e' option because of security reason.
|
* I use preg_replace_callback instead of 'e' option because of security reason.
|
||||||
* cf. PHP manual (regular expression)
|
* cf. PHP manual (regular expression)
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _fix_date_quoting() {
|
private function fix_date_quoting() {
|
||||||
$pattern = '/(month|year|second|day|minute|hour|dayofmonth)\\s*\((.*?)\)\\s*=\\s*["\']?(\d{1,4})[\'"]?\\s*/im';
|
$pattern = '/(month|year|second|day|minute|hour|dayofmonth)\\s*\((.*?)\)\\s*=\\s*["\']?(\d{1,4})[\'"]?\\s*/im';
|
||||||
$this->_query = preg_replace_callback($pattern, array($this, '__fix_date_quoting'), $this->_query);
|
$this->_query = preg_replace_callback($pattern, array($this, '_fix_date_quoting'), $this->_query);
|
||||||
}
|
}
|
||||||
private function __fix_date_quoting($match) {
|
/**
|
||||||
|
* Call back method to rewrite date string.
|
||||||
|
*
|
||||||
|
* @param string $match
|
||||||
|
* @return string
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function _fix_date_quoting($match) {
|
||||||
$fixed_val = "{$match[1]}({$match[2]})='" . intval($match[3]) . "' ";
|
$fixed_val = "{$match[1]}({$match[2]})='" . intval($match[3]) . "' ";
|
||||||
return $fixed_val;
|
return $fixed_val;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
private function _rewrite_regexp(){
|
* Method to rewrite REGEXP() function.
|
||||||
|
*
|
||||||
|
* This method changes function name to regexpp() and pass it to the user defined
|
||||||
|
* function.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function rewrite_regexp(){
|
||||||
$pattern = '/\s([^\s]*)\s*regexp\s*(\'.*?\')/im';
|
$pattern = '/\s([^\s]*)\s*regexp\s*(\'.*?\')/im';
|
||||||
$this->_query = preg_replace($pattern, ' regexpp(\1, \2)', $this->_query);
|
$this->_query = preg_replace($pattern, ' regexpp(\1, \2)', $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rewrites boolean to numeral
|
* Method to rewrite boolean to number.
|
||||||
* SQLite doesn't support true/false type
|
*
|
||||||
|
* SQLite doesn't support true/false type, so we need to convert them to 1/0.
|
||||||
|
*
|
||||||
|
* Obsolite since 1.5.1
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_boolean() {
|
private function rewrite_boolean() {
|
||||||
$query = str_ireplace('TRUE', "1", $this->_query);
|
$query = str_ireplace('TRUE', "1", $this->_query);
|
||||||
$query = str_ireplace('FALSE', "0", $query);
|
$query = str_ireplace('FALSE', "0", $query);
|
||||||
$this->_query = $query;
|
$this->_query = $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to execute SHOW COLUMNS query
|
* Method to handl SHOW COLUMN query.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_show_columns_query() {
|
private function handle_show_columns_query() {
|
||||||
|
$this->_query = str_ireplace(' FULL', '', $this->_query);
|
||||||
$pattern_like = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?\\s*LIKE\\s*(.*)?/i';
|
$pattern_like = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?\\s*LIKE\\s*(.*)?/i';
|
||||||
$pattern = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?/i';
|
$pattern = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?/i';
|
||||||
if (preg_match($pattern_like, $this->_query, $matches)) {
|
if (preg_match($pattern_like, $this->_query, $matches)) {
|
||||||
|
@ -344,12 +569,14 @@ class PDOSQLiteDriver {
|
||||||
$this->_query = $query_string;
|
$this->_query = $query_string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to execute SHOW INDEX query
|
* Method to handle SHOW INDEX query.
|
||||||
|
*
|
||||||
* Moved the WHERE clause manipulation to pdoengin.class.php (ver 1.3.1)
|
* Moved the WHERE clause manipulation to pdoengin.class.php (ver 1.3.1)
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_show_index() {
|
private function handle_show_index() {
|
||||||
$pattern = '/^\\s*SHOW\\s*(?:INDEX|INDEXES|KEYS)\\s*FROM\\s*(\\w+)?/im';
|
$pattern = '/^\\s*SHOW\\s*(?:INDEX|INDEXES|KEYS)\\s*FROM\\s*(\\w+)?/im';
|
||||||
if (preg_match($pattern, $this->_query, $match)) {
|
if (preg_match($pattern, $this->_query, $match)) {
|
||||||
$table_name = preg_replace("/[\';]/", '', $match[1]);
|
$table_name = preg_replace("/[\';]/", '', $match[1]);
|
||||||
|
@ -357,16 +584,19 @@ class PDOSQLiteDriver {
|
||||||
$this->_query = "SELECT * FROM sqlite_master WHERE tbl_name='$table_name'";
|
$this->_query = "SELECT * FROM sqlite_master WHERE tbl_name='$table_name'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to rewrite ON DUPLICATE KEY UPDATE statement
|
* Method to handle ON DUPLICATE KEY UPDATE statement.
|
||||||
* I use SELECT query and check if INSERT is allowed or not
|
*
|
||||||
* Rewriting procedure looks like a detour, but I've got another way.
|
* First we use SELECT query and check if INSERT is allowed or not.
|
||||||
|
* Rewriting procedure looks like a detour, but I've got no other ways.
|
||||||
|
*
|
||||||
|
* Added the literal check since the version 1.5.1.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _execute_duplicate_key_update() {
|
private function execute_duplicate_key_update() {
|
||||||
$update = false;
|
if (!$this->rewrite_duplicate_key) return;
|
||||||
$unique_keys_for_cond = array();
|
$unique_keys_for_cond = array();
|
||||||
$unique_keys_for_check = array();
|
$unique_keys_for_check = array();
|
||||||
$pattern = '/^\\s*INSERT\\s*INTO\\s*(\\w+)?\\s*(.*)\\s*ON\\s*DUPLICATE\\s*KEY\\s*UPDATE\\s*(.*)$/ims';
|
$pattern = '/^\\s*INSERT\\s*INTO\\s*(\\w+)?\\s*(.*)\\s*ON\\s*DUPLICATE\\s*KEY\\s*UPDATE\\s*(.*)$/ims';
|
||||||
|
@ -405,7 +635,6 @@ class PDOSQLiteDriver {
|
||||||
$val = trim(array_shift($ins_data_array));
|
$val = trim(array_shift($ins_data_array));
|
||||||
$ins_data_assoc[trim($col)] = $val;
|
$ins_data_assoc[trim($col)] = $val;
|
||||||
}
|
}
|
||||||
// $ins_data_assoc = array_combine($col_array, $ins_array);
|
|
||||||
$condition = '';
|
$condition = '';
|
||||||
foreach ($unique_keys_for_cond as $unique_key) {
|
foreach ($unique_keys_for_cond as $unique_key) {
|
||||||
if (strpos($unique_key, ',') !== false) {
|
if (strpos($unique_key, ',') !== false) {
|
||||||
|
@ -421,7 +650,6 @@ class PDOSQLiteDriver {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// $condition = rtrim($condition, ' AND ');
|
|
||||||
} else {
|
} else {
|
||||||
$col = trim($unique_key);
|
$col = trim($unique_key);
|
||||||
if (isset($ins_data_assoc[$col])) {
|
if (isset($ins_data_assoc[$col])) {
|
||||||
|
@ -439,7 +667,6 @@ class PDOSQLiteDriver {
|
||||||
$this->_query = 'INSERT INTO '.$table_name.' '.$insert_data;
|
$this->_query = 'INSERT INTO '.$table_name.' '.$insert_data;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// change (col, col...) values (data, data...) to array(col=>data, col=>data...)
|
|
||||||
if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/im', $insert_data, $match_2)) {
|
if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/im', $insert_data, $match_2)) {
|
||||||
$col_array = explode(',', $match_2[1]);
|
$col_array = explode(',', $match_2[1]);
|
||||||
$ins_array = explode(',', $match_2[2]);
|
$ins_array = explode(',', $match_2[2]);
|
||||||
|
@ -450,8 +677,6 @@ class PDOSQLiteDriver {
|
||||||
$ins_array_assoc[$col] = $val;
|
$ins_array_assoc[$col] = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// change col = data, col = data to array(col=>data, col=>data)
|
|
||||||
// some plugins have semi-colon at the end of the query
|
|
||||||
$update_data = rtrim($update_data, ';');
|
$update_data = rtrim($update_data, ';');
|
||||||
$tmp_array = explode(',', $update_data);
|
$tmp_array = explode(',', $update_data);
|
||||||
foreach ($tmp_array as $pair) {
|
foreach ($tmp_array as $pair) {
|
||||||
|
@ -460,7 +685,6 @@ class PDOSQLiteDriver {
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
$update_array_assoc[$col] = $value;
|
$update_array_assoc[$col] = $value;
|
||||||
}
|
}
|
||||||
// change array(col=>values(col)) to array(col=>data)
|
|
||||||
foreach ($update_array_assoc as $key => &$value) {
|
foreach ($update_array_assoc as $key => &$value) {
|
||||||
if (preg_match('/^VALUES\\s*\((.*)\)$/im', $value, $match_3)) {
|
if (preg_match('/^VALUES\\s*\((.*)\)$/im', $value, $match_3)) {
|
||||||
$col = trim($match_3[1]);
|
$col = trim($match_3[1]);
|
||||||
|
@ -483,44 +707,130 @@ class PDOSQLiteDriver {
|
||||||
$update_strings = rtrim($update_strings, ',');
|
$update_strings = rtrim($update_strings, ',');
|
||||||
$unique_where = array_unique($where_array, SORT_REGULAR);
|
$unique_where = array_unique($where_array, SORT_REGULAR);
|
||||||
$where_string = ' WHERE ' . implode(' AND ', $unique_where);
|
$where_string = ' WHERE ' . implode(' AND ', $unique_where);
|
||||||
// $where_string = ' WHERE ' . rtrim($where_string, ',');
|
|
||||||
$update_query = 'UPDATE ' . $table_name . ' SET ' . $update_strings . $where_string;
|
$update_query = 'UPDATE ' . $table_name . ' SET ' . $update_strings . $where_string;
|
||||||
$this->_query = $update_query;
|
$this->_query = $update_query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// wordaround...
|
|
||||||
$pattern = '/ ON DUPLICATE KEY UPDATE.*$/im';
|
|
||||||
$replace_query = preg_replace($pattern, '', $this->_query);
|
|
||||||
$replace_query = str_ireplace('INSERT ', 'INSERT OR REPLACE ', $replace_query);
|
|
||||||
$this->_query = $replace_query;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
private function _rewrite_between() {
|
* Method to rewrite BETWEEN A AND B clause.
|
||||||
$pattern = '/\\s*(\\w+)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s]*)?\\s*/ims';
|
*
|
||||||
|
* This clause is the same form as natural language, so we have to check if it is
|
||||||
|
* in the data or SQL statement.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function rewrite_between() {
|
||||||
|
if (!$this->rewrite_between) return;
|
||||||
|
$pattern = '/\\s*(CAST\([^\)]+?\)|[^\\s\(]*)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s\)]*)?\\s*/ims';
|
||||||
|
do {
|
||||||
if (preg_match($pattern, $this->_query, $match)) {
|
if (preg_match($pattern, $this->_query, $match)) {
|
||||||
$column_name = trim($match[1]);
|
$column_name = trim($match[1]);
|
||||||
$min_value = trim($match[2]);
|
$min_value = trim($match[2]);
|
||||||
$max_value = trim($match[3]);
|
$max_value = trim($match[3]);
|
||||||
$replacement = " $column_name >= '$min_value' AND $column_name <= '$max_value'";
|
$max_value = rtrim($max_value);
|
||||||
|
$replacement = " ($column_name >= $min_value AND $column_name <= $max_value)";
|
||||||
$this->_query = str_ireplace($match[0], $replacement, $this->_query);
|
$this->_query = str_ireplace($match[0], $replacement, $this->_query);
|
||||||
}
|
}
|
||||||
|
$this->num_of_rewrite_between--;
|
||||||
|
} while ($this->num_of_rewrite_between > 0);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to handle ORDER BY FIELD() clause.
|
||||||
|
*
|
||||||
|
* When FIELD() function has column name to compare, we can't rewrite it with
|
||||||
|
* use defined functions. When this function detect column name in the argument,
|
||||||
|
* it creates another instance, does the query withuot ORDER BY clause and gives
|
||||||
|
* the result array sorted to the main instance.
|
||||||
|
*
|
||||||
|
* If FIELD() function doesn't have column name, it will use the user defined
|
||||||
|
* function. usort() function closure function to compare the items.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function handle_orderby_field() {
|
||||||
|
if (!$this->orderby_field) return;
|
||||||
|
global $wpdb;
|
||||||
|
$pattern = '/\\s+ORDER\\s+BY\\s+FIELD\\s*\(\\s*([^\)]+?)\\s*\)/i';
|
||||||
|
if (preg_match($pattern, $this->_query, $match)) {
|
||||||
|
global $flipped;
|
||||||
|
$params = explode(',', $match[1]);
|
||||||
|
$params = array_map('trim', $params);
|
||||||
|
$tbl_col = array_shift($params);
|
||||||
|
$flipped = array_flip($params);
|
||||||
|
$tbl_name = substr($tbl_col, 0, strpos($tbl_col, '.'));
|
||||||
|
$tbl_name = str_replace($wpdb->prefix, '', $tbl_name);
|
||||||
|
if ($tbl_name && in_array($tbl_name, $wpdb->tables)) {
|
||||||
|
$query = str_replace($match[0], '', $this->_query);
|
||||||
|
$_wpdb = new PDODB();
|
||||||
|
$results = $_wpdb->get_results($query);
|
||||||
|
$_wpdb = null;
|
||||||
|
/* $compare = function($a, $b) { */
|
||||||
|
/* global $flipped; */
|
||||||
|
/* return $flipped[$a->ID] - $flipped[$b->ID]; */
|
||||||
|
/* }; */
|
||||||
|
/* usort($results, $compare); */
|
||||||
|
usort($results, array($this, 'orderby_callback'));
|
||||||
|
}
|
||||||
|
$wpdb->dbh->pre_ordered_results = $results;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* workaround function to avoid DELETE with JOIN
|
* Callback method for sorting
|
||||||
|
*
|
||||||
|
* As PHP 5.2 doesn't allow closure function, this callback procedure
|
||||||
|
* is necessary.
|
||||||
|
*
|
||||||
|
* @param queried object
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function orderby_callback($a, $b) {
|
||||||
|
global $flipped;
|
||||||
|
return $flipped[$a->ID] - $flipped[$b->ID];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to avoid DELETE with JOIN statement.
|
||||||
|
*
|
||||||
* wp-admin/includes/upgrade.php contains 'DELETE ... JOIN' statement.
|
* wp-admin/includes/upgrade.php contains 'DELETE ... JOIN' statement.
|
||||||
* This query can't be replaced with regular expression or udf, so we
|
* This query can't be replaced with regular expression or udf, so we
|
||||||
* replace all the statement with another.
|
* replace all the statement with another. But this query was used in
|
||||||
|
* the very old version of WordPress when it was upgraded. So we won't
|
||||||
|
* have no chance that this method should be used.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _delete_workaround() {
|
private function delete_workaround() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
// $pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (option_name) WHERE o2.option_id > o1.option_id";
|
|
||||||
$pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2";
|
$pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2";
|
||||||
|
$pattern2 = "DELETE a, b FROM $wpdb->sitemeta AS a, $wpdb->sitemeta AS b";
|
||||||
$rewritten = "DELETE FROM $wpdb->options WHERE option_id IN (SELECT MIN(option_id) FROM $wpdb->options GROUP BY option_name HAVING COUNT(*) > 1)";
|
$rewritten = "DELETE FROM $wpdb->options WHERE option_id IN (SELECT MIN(option_id) FROM $wpdb->options GROUP BY option_name HAVING COUNT(*) > 1)";
|
||||||
if (stripos($this->_query, $pattern) !== false) {
|
if (stripos($this->_query, $pattern) !== false) {
|
||||||
$this->_query = $rewritten;
|
$this->_query = $rewritten;
|
||||||
|
} else if (stripos($this->_query, $pattern2) !== false) {
|
||||||
|
$time = time();
|
||||||
|
$prep_query = "SELECT a.meta_id AS aid, b.meta_id AS bid FROM $wpdb->sitemeta AS a INNER JOIN $wpdb->sitemeta AS b ON a.meta_key='_site_transient_timeout_'||substr(b.meta_key, 17) WHERE b.meta_key='_site_transient_'||substr(a.meta_key, 25) AND a.meta_value < $time";
|
||||||
|
$_wpdb = new PDODB();
|
||||||
|
$ids = $_wpdb->get_results($prep_query);
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$ids_to_delete[] = $id->aid;
|
||||||
|
$ids_to_delete[] = $id->bid;
|
||||||
}
|
}
|
||||||
|
$rewritten = "DELETE FROM $wpdb->sitemeta WHERE meta_id IN (".implode(',', $ids_to_delete).")";
|
||||||
|
$this->_query = $rewritten;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to suppress errors.
|
||||||
|
*
|
||||||
|
* When the query string is the one that this class can't manipulate,
|
||||||
|
* the query string is replaced with the one that always returns true
|
||||||
|
* and does nothing.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function return_true() {
|
||||||
|
$this->_query = 'SELECT 1=1';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -1,13 +1,26 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* The class for manipulating ALTER query
|
* The class for manipulating ALTER query.
|
||||||
|
*
|
||||||
* newly supports multiple variants
|
* newly supports multiple variants
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
class AlterQuery {
|
class AlterQuery {
|
||||||
|
/**
|
||||||
|
* Variable to store the rewritten query string.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $_query = null;
|
public $_query = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to split the query string to the tokens and call apropreate functions.
|
||||||
|
*
|
||||||
|
* @param string @query
|
||||||
|
* @parm string $query_type
|
||||||
|
* @return boolean | stirng
|
||||||
|
*/
|
||||||
public function rewrite_query($query, $query_type) {
|
public function rewrite_query($query, $query_type) {
|
||||||
if (stripos($query, $query_type) === false) {
|
if (stripos($query, $query_type) === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,7 +33,7 @@ class AlterQuery {
|
||||||
$command = str_ireplace($match[0], '', $query);
|
$command = str_ireplace($match[0], '', $query);
|
||||||
$tmp_tokens['query_type'] = trim($match[1]);
|
$tmp_tokens['query_type'] = trim($match[1]);
|
||||||
$tmp_tokens['table_name'] = trim($match[2]);
|
$tmp_tokens['table_name'] = trim($match[2]);
|
||||||
// $command_array = $this->split_multiple($command);
|
//$command_array = $this->split_multiple($command);
|
||||||
$command_array = explode(',', $command);
|
$command_array = explode(',', $command);
|
||||||
|
|
||||||
$single_command = array_shift($command_array);
|
$single_command = array_shift($command_array);
|
||||||
|
@ -35,7 +48,6 @@ class AlterQuery {
|
||||||
$this->_query = 'SELECT 1=1';
|
$this->_query = 'SELECT 1=1';
|
||||||
return $this->_query;
|
return $this->_query;
|
||||||
}
|
}
|
||||||
// foreach ($tokens as $token) {
|
|
||||||
$command_name = strtolower($tokens['command']);
|
$command_name = strtolower($tokens['command']);
|
||||||
switch ($command_name) {
|
switch ($command_name) {
|
||||||
case 'add column': case 'rename to': case 'add index': case 'drop index':
|
case 'add column': case 'rename to': case 'add index': case 'drop index':
|
||||||
|
@ -59,7 +71,6 @@ class AlterQuery {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
if (!is_array($tmp_query)) {
|
if (!is_array($tmp_query)) {
|
||||||
$this->_query[] = $tmp_query;
|
$this->_query[] = $tmp_query;
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,7 +84,13 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
return $this->_query;
|
return $this->_query;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to analyze ALTER TABLE command and sets the data to an array.
|
||||||
|
*
|
||||||
|
* @param string $command
|
||||||
|
* @return boolean|array
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private function command_tokenizer($command) {
|
private function command_tokenizer($command) {
|
||||||
$tokens = array();
|
$tokens = array();
|
||||||
if (preg_match('/^(ADD|DROP|RENAME|MODIFY|CHANGE|ALTER)\\s*(\\w+)?\\s*(\\w+(\(.+\)|))?\\s*/ims', $command, $match)) {
|
if (preg_match('/^(ADD|DROP|RENAME|MODIFY|CHANGE|ALTER)\\s*(\\w+)?\\s*(\\w+(\(.+\)|))?\\s*/ims', $command, $match)) {
|
||||||
|
@ -204,7 +221,15 @@ class AlterQuery {
|
||||||
return $tokens;
|
return $tokens;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to split multiple commands into an array and return it.
|
||||||
|
*
|
||||||
|
* This function is deprecated.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param unknown $command
|
||||||
|
* @return multitype:string unknown Ambigous <string, unknown>
|
||||||
|
*/
|
||||||
private function split_multiple($command) {
|
private function split_multiple($command) {
|
||||||
$out = true;
|
$out = true;
|
||||||
$command_array = array();
|
$command_array = array();
|
||||||
|
@ -245,7 +270,13 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
return $command_array;
|
return $command_array;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to handle single command.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param array of string $queries
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function handle_single_command($queries) {
|
private function handle_single_command($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
if (stripos($tokenized_query['command'], 'add column') !== false) {
|
if (stripos($tokenized_query['command'], 'add column') !== false) {
|
||||||
|
@ -263,7 +294,13 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to handle ADD PRIMARY KEY.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param array of string $queries
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
private function handle_add_primary_key($queries) {
|
private function handle_add_primary_key($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$tbl_name = $tokenized_query['table_name'];
|
$tbl_name = $tokenized_query['table_name'];
|
||||||
|
@ -287,7 +324,13 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to handle DROP PRIMARY KEY.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param array of string $queries
|
||||||
|
* @return array of string
|
||||||
|
*/
|
||||||
private function handle_drop_primary_key($queries) {
|
private function handle_drop_primary_key($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
||||||
|
@ -315,7 +358,13 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to handle MODIFY COLUMN.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param array of string $queries
|
||||||
|
* @return string|array of string
|
||||||
|
*/
|
||||||
private function handle_modify_command($queries) {
|
private function handle_modify_command($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
||||||
|
@ -347,7 +396,13 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to handle CHANGE COLUMN.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param array of string $queries
|
||||||
|
* @return string|array of string
|
||||||
|
*/
|
||||||
private function handle_change_command($queries) {
|
private function handle_change_command($queries) {
|
||||||
$col_check = false;
|
$col_check = false;
|
||||||
$old_fields = '';
|
$old_fields = '';
|
||||||
|
@ -401,7 +456,13 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to handle ALTER COLUMN.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param array of string $queries
|
||||||
|
* @return string|array of string
|
||||||
|
*/
|
||||||
private function handle_alter_command($queries) {
|
private function handle_alter_command($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
||||||
|
@ -461,7 +522,9 @@ class AlterQuery {
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Change the field definition to SQLite compatible data type.
|
* Function to change the field definition to SQLite compatible data type.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
* @param string $col_name
|
* @param string $col_name
|
||||||
* @param string $col_def
|
* @param string $col_def
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -488,7 +551,12 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
return $def_string;
|
return $def_string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Variable to store the data definition table.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var associative array
|
||||||
|
*/
|
||||||
private $array_types = array(
|
private $array_types = array(
|
||||||
'bit' => 'INTEGER', 'bool' => 'INTEGER',
|
'bit' => 'INTEGER', 'bool' => 'INTEGER',
|
||||||
'boolean' => 'INTEGER', 'tinyint' => 'INTEGER',
|
'boolean' => 'INTEGER', 'tinyint' => 'INTEGER',
|
||||||
|
|
|
@ -1,23 +1,56 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file defines CreateQuery class.
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu, Justin Adie
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a class for rewriting create queries
|
* This class provides a function to rewrite CREATE query.
|
||||||
* this class borrows its inspiration from the work done on tikiwiki.
|
*
|
||||||
*/
|
*/
|
||||||
class CreateQuery{
|
class CreateQuery{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The query string to be rewritten in this class.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private $_query = '';
|
private $_query = '';
|
||||||
|
/**
|
||||||
|
* The array to contain CREATE INDEX queries.
|
||||||
|
*
|
||||||
|
* @var array of strings
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private $index_queries = array();
|
private $index_queries = array();
|
||||||
|
/**
|
||||||
|
* The array to contain error messages.
|
||||||
|
*
|
||||||
|
* @var array of string
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private $_errors = array();
|
private $_errors = array();
|
||||||
|
/**
|
||||||
|
* Variable to have the table name to be executed.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private $table_name = '';
|
private $table_name = '';
|
||||||
|
/**
|
||||||
|
* Variable to check if the query has the primary key.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private $has_primary_key = false;
|
private $has_primary_key = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialises the object properties
|
* Function to rewrite query.
|
||||||
|
*
|
||||||
* @param string $query the query being processed
|
* @param string $query the query being processed
|
||||||
* @return string|array the processed (rewritten) query
|
* @return string|array the processed (rewritten) query
|
||||||
*/
|
*/
|
||||||
|
@ -25,14 +58,20 @@ class CreateQuery{
|
||||||
$this->_query = $query;
|
$this->_query = $query;
|
||||||
$this->_errors [] = '';
|
$this->_errors [] = '';
|
||||||
if (preg_match('/^CREATE\\s*(UNIQUE|FULLTEXT|)\\s*INDEX/ims', $this->_query, $match)) {
|
if (preg_match('/^CREATE\\s*(UNIQUE|FULLTEXT|)\\s*INDEX/ims', $this->_query, $match)) {
|
||||||
|
// we manipulate CREATE INDEX query in PDOEngine.class.php
|
||||||
|
// FULLTEXT index creation is simply ignored.
|
||||||
if (isset($match[1]) && stripos($match[1], 'fulltext') !== false) {
|
if (isset($match[1]) && stripos($match[1], 'fulltext') !== false) {
|
||||||
return 'SELECT 1=1';
|
return 'SELECT 1=1';
|
||||||
} else {
|
} else {
|
||||||
return $this->_query;
|
return $this->_query;
|
||||||
}
|
}
|
||||||
} elseif (preg_match('/^CREATE\\s*(TEMP|TEMPORARY|)\\s*TRIGGER\\s*/im', $this->_query)) {
|
} elseif (preg_match('/^CREATE\\s*(TEMP|TEMPORARY|)\\s*TRIGGER\\s*/im', $this->_query)) {
|
||||||
|
// if WordPress comes to use foreign key constraint, trigger will be needed.
|
||||||
|
// we don't use it for now.
|
||||||
return $this->_query;
|
return $this->_query;
|
||||||
}
|
}
|
||||||
|
$this->strip_backticks();
|
||||||
|
$this->quote_illegal_field();
|
||||||
$this->get_table_name();
|
$this->get_table_name();
|
||||||
$this->rewrite_comments();
|
$this->rewrite_comments();
|
||||||
$this->rewrite_field_types();
|
$this->rewrite_field_types();
|
||||||
|
@ -41,20 +80,22 @@ class CreateQuery{
|
||||||
$this->rewrite_unsigned();
|
$this->rewrite_unsigned();
|
||||||
$this->rewrite_autoincrement();
|
$this->rewrite_autoincrement();
|
||||||
$this->rewrite_primary_key();
|
$this->rewrite_primary_key();
|
||||||
|
$this->rewrite_foreign_key();
|
||||||
$this->rewrite_unique_key();
|
$this->rewrite_unique_key();
|
||||||
$this->rewrite_enum();
|
$this->rewrite_enum();
|
||||||
$this->rewrite_set();
|
$this->rewrite_set();
|
||||||
$this->rewrite_key();
|
$this->rewrite_key();
|
||||||
$this->add_if_not_exists();
|
$this->add_if_not_exists();
|
||||||
$this->strip_backticks();
|
|
||||||
|
|
||||||
return $this->post_process();
|
return $this->post_process();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for getting the table name from the create query.
|
* Method to get table name from the query string.
|
||||||
* taken from PDO for WordPress
|
*
|
||||||
* we don't need 'IF NOT EXISTS', so we changed the pattern.
|
* 'IF NOT EXISTS' clause is removed for the easy regular expression usage.
|
||||||
|
* It will be added at the end of the process.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_table_name(){
|
private function get_table_name(){
|
||||||
// $pattern = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*([^\(]*)/imsx';
|
// $pattern = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*([^\(]*)/imsx';
|
||||||
|
@ -63,9 +104,16 @@ class CreateQuery{
|
||||||
$this->table_name = trim($matches[1]);
|
$this->table_name = trim($matches[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for changing the field type to SQLite compatible type.
|
* Method to change the MySQL field types to SQLite compatible types.
|
||||||
|
*
|
||||||
|
* If column name is the same as the key value, e.g. "date" or "timestamp",
|
||||||
|
* and the column is on the top of the line, we add a single quote and avoid
|
||||||
|
* to be replaced. But this doesn't work if that column name is in the middle
|
||||||
|
* of the line.
|
||||||
|
* Order of the key value is important. Don't change it.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_field_types(){
|
private function rewrite_field_types(){
|
||||||
$array_types = array (
|
$array_types = array (
|
||||||
|
@ -86,8 +134,14 @@ class CreateQuery{
|
||||||
'mediumblob' => 'blob', 'mediumtext' => 'text',
|
'mediumblob' => 'blob', 'mediumtext' => 'text',
|
||||||
'longblob' => 'blob', 'longtext' => 'text'
|
'longblob' => 'blob', 'longtext' => 'text'
|
||||||
);
|
);
|
||||||
foreach ($array_types as $o=>$r){
|
foreach ($array_types as $o => $r){
|
||||||
$pattern = "/\\b(?<!`)$o\\b\\s*(\([^\)]*\)*)?\\s*/ims";
|
if (preg_match("/^\\s*(?<!')$o\\s+(.+$)/im", $this->_query, $match)) {
|
||||||
|
$ptrn = "/$match[1]/im";
|
||||||
|
$replaced = str_ireplace($ptrn, '#placeholder#', $this->_query);
|
||||||
|
$replaced = str_ireplace($o, "'{$o}'", $replaced);
|
||||||
|
$this->_query = str_replace('#placeholder#', $ptrn, $replaced);
|
||||||
|
}
|
||||||
|
$pattern = "/\\b(?<!')$o\\b\\s*(\([^\)]*\)*)?\\s*/ims";
|
||||||
if (preg_match("/^\\s*.*?\\s*\(.*?$o.*?\)/im", $this->_query)) {
|
if (preg_match("/^\\s*.*?\\s*\(.*?$o.*?\)/im", $this->_query)) {
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,33 +149,44 @@ class CreateQuery{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for stripping the comments from the SQL statement
|
* Method for stripping the comments from the SQL statement.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_comments(){
|
private function rewrite_comments(){
|
||||||
$this->_query = preg_replace("/# --------------------------------------------------------/","-- ******************************************************",$this->_query);
|
$this->_query = preg_replace("/# --------------------------------------------------------/","-- ******************************************************",$this->_query);
|
||||||
$this->_query = preg_replace("/#/","--",$this->_query);
|
$this->_query = preg_replace("/#/","--",$this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for stripping the engine and other stuffs
|
* Method for stripping the engine and other stuffs.
|
||||||
|
*
|
||||||
|
* TYPE, ENGINE and AUTO_INCREMENT are removed here.
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_engine_info(){
|
private function rewrite_engine_info(){
|
||||||
$this->_query = preg_replace("/\\s*(TYPE|ENGINE)\\s*=\\s*.*(?<!;)/ims",'',$this->_query);
|
$this->_query = preg_replace("/\\s*(TYPE|ENGINE)\\s*=\\s*.*(?<!;)/ims",'',$this->_query);
|
||||||
$this->_query = preg_replace("/ AUTO_INCREMENT\\s*=\\s*[0-9]*/ims",'',$this->_query);
|
$this->_query = preg_replace("/ AUTO_INCREMENT\\s*=\\s*[0-9]*/ims",'',$this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for stripping unsigned
|
* Method for stripping unsigned.
|
||||||
|
*
|
||||||
|
* SQLite doesn't have unsigned int data type. So UNSIGNED INT(EGER) is converted
|
||||||
|
* to INTEGER here.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_unsigned(){
|
private function rewrite_unsigned(){
|
||||||
$this->_query = preg_replace('/\\bunsigned\\b/ims', ' ', $this->_query);
|
$this->_query = preg_replace('/\\bunsigned\\b/ims', ' ', $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for rewriting auto_increment
|
* Method for rewriting primary key auto_increment.
|
||||||
* if the field type is 'integer primary key', it is automatically autoincremented
|
*
|
||||||
|
* If the field type is 'INTEGER PRIMARY KEY', it is automatically autoincremented
|
||||||
|
* by SQLite. There's a little difference between PRIMARY KEY and AUTOINCREMENT, so
|
||||||
|
* we may well convert to PRIMARY KEY only.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_autoincrement(){
|
private function rewrite_autoincrement(){
|
||||||
$this->_query = preg_replace('/\\bauto_increment\\s*primary\\s*key\\s*(,)?/ims', ' PRIMARY KEY AUTOINCREMENT \\1', $this->_query, -1, $count);
|
$this->_query = preg_replace('/\\bauto_increment\\s*primary\\s*key\\s*(,)?/ims', ' PRIMARY KEY AUTOINCREMENT \\1', $this->_query, -1, $count);
|
||||||
|
@ -130,34 +195,53 @@ class CreateQuery{
|
||||||
$this->has_primary_key = true;
|
$this->has_primary_key = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for rewriting primary key
|
* Method for rewriting primary key.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_primary_key(){
|
private function rewrite_primary_key(){
|
||||||
if ($this->has_primary_key) {
|
if ($this->has_primary_key) {
|
||||||
$this->_query = preg_replace('/\\bprimary key\\s*\([^\)]*\)/ims', ' ', $this->_query);
|
$this->_query = preg_replace('/\\s*primary key\\s*.*?\([^\)]*\)\\s*(,|)/i', ' ', $this->_query);
|
||||||
} else {
|
} else {
|
||||||
// If primary key has an index name, we remove that name.
|
// If primary key has an index name, we remove that name.
|
||||||
$this->_query = preg_replace('/\\bprimary\\s*key\\s*.*?\\s*(\(.*?\))/im', 'PRIMARY KEY \\1', $this->_query);
|
$this->_query = preg_replace('/\\bprimary\\s*key\\s*.*?\\s*(\(.*?\))/im', 'PRIMARY KEY \\1', $this->_query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for rewriting unique key
|
* Method for rewriting foreign key.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function rewrite_foreign_key() {
|
||||||
|
$pattern = '/\\s*foreign\\s*key\\s*(|.*?)\([^\)]+?\)\\s*references\\s*.*/i';
|
||||||
|
if (preg_match_all($pattern, $this->_query, $match)) {
|
||||||
|
if (isset($match[1])) {
|
||||||
|
$this->_query = str_ireplace($match[1], '', $this->_query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method for rewriting unique key.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_unique_key(){
|
private function rewrite_unique_key(){
|
||||||
$this->_query = preg_replace_callback('/\\bunique key\\b([^\(]*)(\([^\)]*\))/ims', array($this, '_rewrite_unique_key'), $this->_query);
|
$this->_query = preg_replace_callback('/\\bunique key\\b([^\(]*)(\(.*\))/im', array($this, '_rewrite_unique_key'), $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback method for rewrite_unique_key
|
* Callback method for rewrite_unique_key.
|
||||||
|
*
|
||||||
* @param array $matches an array of matches from the Regex
|
* @param array $matches an array of matches from the Regex
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_unique_key($matches){
|
private function _rewrite_unique_key($matches){
|
||||||
$index_name = trim($matches[1]);
|
$index_name = trim($matches[1]);
|
||||||
$col_name = trim($matches[2]);
|
$col_name = trim($matches[2]);
|
||||||
$tbl_name = $this->table_name;
|
$tbl_name = $this->table_name;
|
||||||
|
if (preg_match('/\(\\d+?\)/', $col_name)) {
|
||||||
|
$col_name = preg_replace('/\(\\d+?\)/', '', $col_name);
|
||||||
|
}
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
|
$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
|
||||||
$_wpdb = null;
|
$_wpdb = null;
|
||||||
|
@ -174,46 +258,53 @@ class CreateQuery{
|
||||||
$this->index_queries[] = "CREATE UNIQUE INDEX $index_name ON " . $tbl_name .$col_name;
|
$this->index_queries[] = "CREATE UNIQUE INDEX $index_name ON " . $tbl_name .$col_name;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for handling ENUM fields
|
* Method for handling ENUM fields.
|
||||||
* SQLite doesn't support enum, so we change it to check constraint
|
*
|
||||||
|
* SQLite doesn't support enum, so we change it to check constraint.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_enum(){
|
private function rewrite_enum(){
|
||||||
$pattern = '/(,|\))([^,]*)enum\((.*?)\)([^,\)]*)/ims';
|
$pattern = '/(,|\))([^,]*)enum\((.*?)\)([^,\)]*)/ims';
|
||||||
$this->_query = preg_replace_callback($pattern, array($this, '_rewrite_enum'), $this->_query);
|
$this->_query = preg_replace_callback($pattern, array($this, '_rewrite_enum'), $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for the callback function rewrite_enum and rewrite_set
|
* Call back method for rewrite_enum() and rewrite_set().
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_enum($matches){
|
private function _rewrite_enum($matches){
|
||||||
$output = $matches[1] . ' ' . $matches[2]. ' TEXT '. $matches[4].' CHECK ('.$matches[2].' IN ('.$matches[3].')) ';
|
$output = $matches[1] . ' ' . $matches[2]. ' TEXT '. $matches[4].' CHECK ('.$matches[2].' IN ('.$matches[3].')) ';
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for rewriting usage of set
|
* Method for rewriting usage of set.
|
||||||
* whilst not identical to enum, they are similar and sqlite does not
|
*
|
||||||
* support either.
|
* It is similar but not identical to enum. SQLite does not support either.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_set(){
|
private function rewrite_set(){
|
||||||
$pattern = '/\b(\w)*\bset\\s*\((.*?)\)\\s*(.*?)(,)*/ims';
|
$pattern = '/\b(\w)*\bset\\s*\((.*?)\)\\s*(.*?)(,)*/ims';
|
||||||
$this->_query = preg_replace_callback($pattern, array($this, '_rewrite_enum'), $this->_query);
|
$this->_query = preg_replace_callback($pattern, array($this, '_rewrite_enum'), $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for rewriting usage of key to create an index
|
* Method for rewriting usage of key to create an index.
|
||||||
* sqlite cannot create non-unique indices as part of the create query
|
*
|
||||||
* so we need to create an index by hand and append it to the create query
|
* SQLite cannot create non-unique indices as part of the create query,
|
||||||
|
* so we need to create an index by hand and append it to the create query.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_key(){
|
private function rewrite_key(){
|
||||||
$this->_query = preg_replace_callback('/,\\s*(KEY|INDEX)\\s*(\\w+)?\\s*(\(.*(?<!\\d)\))/im', array($this, '_rewrite_key'), $this->_query);
|
$this->_query = preg_replace_callback('/,\\s*(KEY|INDEX)\\s*(\\w+)?\\s*(\(.+\))/im', array($this, '_rewrite_key'), $this->_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback method for rewrite_key
|
* Callback method for rewrite_key.
|
||||||
|
*
|
||||||
* @param array $matches an array of matches from the Regex
|
* @param array $matches an array of matches from the Regex
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_key($matches){
|
private function _rewrite_key($matches){
|
||||||
$index_name = trim($matches[2]);
|
$index_name = trim($matches[2]);
|
||||||
|
@ -237,15 +328,27 @@ class CreateQuery{
|
||||||
$this->index_queries[] = 'CREATE INDEX '. $index_name . ' ON ' . $tbl_name . $col_name ;
|
$this->index_queries[] = 'CREATE INDEX '. $index_name . ' ON ' . $tbl_name . $col_name ;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Call back method to remove unnecessary string.
|
||||||
|
*
|
||||||
|
* This method is deprecated.
|
||||||
|
*
|
||||||
|
* @param string $match
|
||||||
|
* @return string whose length is zero
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private function _remove_length($match) {
|
private function _remove_length($match) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Method to assemble the main query and index queries into an array
|
* Method to assemble the main query and index queries into an array.
|
||||||
* to be returned to the base class
|
*
|
||||||
|
* It return the array of the queries to be executed separately.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function post_process(){
|
private function post_process() {
|
||||||
$mainquery = $this->_query;
|
$mainquery = $this->_query;
|
||||||
do{
|
do{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
@ -260,10 +363,12 @@ class CreateQuery{
|
||||||
return $return_val;
|
return $return_val;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Method to add IF NOT EXISTS to query defs
|
* Method to add IF NOT EXISTS to query string.
|
||||||
* sometimes, if upgrade.php is being called, wordpress seems to want to run
|
*
|
||||||
* new create queries. this stops the query from throwing an error and halting
|
* This adds IF NOT EXISTS to every query string, which prevent the exception
|
||||||
* output
|
* from being thrown.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function add_if_not_exists(){
|
private function add_if_not_exists(){
|
||||||
$pattern_table = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*/ims';
|
$pattern_table = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*/ims';
|
||||||
|
@ -273,9 +378,10 @@ class CreateQuery{
|
||||||
$this->index_queries[$i] = preg_replace($pattern_index, 'CREATE $1 INDEX IF NOT EXISTS ', $this->index_queries[$i]);
|
$this->index_queries[$i] = preg_replace($pattern_index, 'CREATE $1 INDEX IF NOT EXISTS ', $this->index_queries[$i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to strip back ticks
|
* Method to strip back quotes.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function strip_backticks(){
|
private function strip_backticks(){
|
||||||
$this->_query = str_replace('`', '', $this->_query);
|
$this->_query = str_replace('`', '', $this->_query);
|
||||||
|
@ -283,9 +389,13 @@ class CreateQuery{
|
||||||
$query = str_replace('`', '', $query);
|
$query = str_replace('`', '', $query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to remove the character set information from within mysql queries
|
* Method to remove the character set information from within mysql queries.
|
||||||
|
*
|
||||||
|
* This removes DEFAULT CHAR(ACTER) SET and COLLATE, which is meaningless for
|
||||||
|
* SQLite.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_character_set(){
|
private function rewrite_character_set(){
|
||||||
$pattern_charset = '/\\b(default\\s*character\\s*set|default\\s*charset|character\\s*set)\\s*(?<!\()[^ ]*/im';
|
$pattern_charset = '/\\b(default\\s*character\\s*set|default\\s*charset|character\\s*set)\\s*(?<!\()[^ ]*/im';
|
||||||
|
@ -294,4 +404,13 @@ class CreateQuery{
|
||||||
$patterns = array($pattern_charset, $pattern_collate1, $pattern_collate2);
|
$patterns = array($pattern_charset, $pattern_collate1, $pattern_collate2);
|
||||||
$this->_query = preg_replace($patterns, '', $this->_query);
|
$this->_query = preg_replace($patterns, '', $this->_query);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to quote illegal field name for SQLite
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function quote_illegal_field() {
|
||||||
|
$this->_query = preg_replace("/^\\s*(?<!')(default|values)/im", "'\\1'", $this->_query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
?>
|
210
readme-ja.txt
210
readme-ja.txt
|
@ -6,8 +6,8 @@ Tags: database, SQLite, PDO
|
||||||
Author: Kojima Toshiyasu
|
Author: Kojima Toshiyasu
|
||||||
Author URI: http://dogwood.skr.jp/
|
Author URI: http://dogwood.skr.jp/
|
||||||
Requires at least: 3.3
|
Requires at least: 3.3
|
||||||
Tested up to: 3.6
|
Tested up to: 4.1.1
|
||||||
Stable tag: 1.4
|
Stable tag: 1.8.1
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
@ -15,116 +15,109 @@ SQLite IntegrationはSQLiteでWordPressを使えるようにするプラグイ
|
||||||
|
|
||||||
== Description ==
|
== Description ==
|
||||||
|
|
||||||
このプラグインは[SQLite](http://www.sqlite.org/)を使ってWordPressを運用するためのものです。MySQLデータベース・サーバを用意する必要はありません。SQLiteは自己完結的で、サーバを必要とせず、トランザクションをサポートしたデータベース・エンジンです。MySQLのようにたくさんの拡張機能を持たないかわりに、小規模から中規模のトラフィックがあるウェブサイトに適しています。
|
このプラグインを使うと、MySQL データベースサーバがなくても WordPress のサイトを作ることができます。必要なものは、Apache か、同等のウェブサーバと、PDO エクステンションが使える PHP だけです。WordPress のアーカイブとこのプラグインがあれば、それだけで WordPress サイトを試すことができます。
|
||||||
|
|
||||||
SQLite Integrationはラッパ・プログラムです。WordPressとSQLiteの間に入って、やり取りを中継し、次のように動作します。
|
SQLite Integration は [PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress) プラグインの後継です。後者は残念なことに、もうメンテナンスされていないようです。SQLite IntegrationはPDO for WordPressの基本的なアイディアと構造を借りて、より多くの機能とユーティリティを追加しました。
|
||||||
|
|
||||||
1. WordPressからMySQLに発行されるSQLステートメントをインターセプトします
|
= 特徴 =
|
||||||
2. それをSQLiteが実行できる形に書き換えます
|
|
||||||
3. SQLiteに渡します
|
|
||||||
4. SQLiteから結果を受け取ります
|
|
||||||
5. 必要なら、WordPressが望む形式にフォーマットしなおします
|
|
||||||
6. WordPressに結果を返します
|
|
||||||
|
|
||||||
WordPressはMySQLと話していると思っていて、背後で何が起こっているかは知りません。実際にはSQLiteと話しているのですが、WordPressはいつもの通り仕事をします。
|
SQLite Integration はデータベースアクセスを制御するためのプログラムです。だから、他のプラグインとは違います。WordPress をインストールするときに使わなければなりません。インストールのセクションを参照してください。[SQLite Integration(ja)](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)をご覧になると、もっと詳しい説明を読むことができます。
|
||||||
|
|
||||||
SQLite Integrationは[PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress)プラグインの後継です。後者は残念なことに、もうメンテナンスされていないようです。SQLite IntegrationはPDO for WordPressの基本的なアイディアと構造を借りて、より多くの機能とユーティリティを追加しました。
|
インストールに成功したら、MySQL を使う他の WordPress と同じように使うことができます。オプションとして、一時的に MySQL を使い、また SQLite に戻るというような使い方ができます。開発のときに、MySQL のないローカルマシンでサイトのテストをすることもできるでしょう。
|
||||||
|
|
||||||
= 重要なお知らせ =
|
インストールが終わったら、このプラグインを有効化することができます(必須ではありませんが、お勧めします)。そうすると、サーバやインストールされたプラグインについての情報を見ることができるようになります。
|
||||||
|
|
||||||
このプラグインを使ってWordPress 3.5.x をインストールし、3.6にアップグレードした場合、データベースが意図したとおりに動作していないかもしれません。これに該当する場合は、プラグインを最新版にアップグレードして、管理画面のメンテナンスページに移動し、修復が必要かどうかをチェックしてください。必要なら、そのページで提供しているユーティリティを使って修復をすることができます。
|
= システム要件 =
|
||||||
|
|
||||||
WordPress 3.6 をインストールした場合や、3.5.x を使っている場合は、これに該当しませんので、修復は必要ありません。
|
* PHP 5.2 以上で PDO extension が必要です(PHP 5.3 以上をお勧めします)。
|
||||||
|
* PDO SQLite ドライバがロードされている必要があります。
|
||||||
|
|
||||||
= Features =
|
= 後方互換性 =
|
||||||
|
|
||||||
SQLite Integrationは普通の「プラグイン」ではありません。WordPressをインストールするときに使います。そのため、少し準備が必要です。インストールのセクションを参照してください。[SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/)をご覧になると、もっと詳しい説明を読むことができます。
|
|
||||||
|
|
||||||
インストールに成功したら、MySQLを使う他のWordPressと同じように使うことができます。オプションとして、管理パネルでこのプラグインを有効化することができます。有効化すると有益な情報と説明を見ることができます。これは必須ではありませんが、お勧めします。
|
|
||||||
|
|
||||||
= Backward Compatibility =
|
|
||||||
|
|
||||||
現在[PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress)をお使いの場合は、データベースを移行することができます。インストールのセクションをご覧ください。
|
現在[PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress)をお使いの場合は、データベースを移行することができます。インストールのセクションをご覧ください。
|
||||||
|
|
||||||
= Support =
|
= サポート =
|
||||||
|
|
||||||
下の方法でコンタクトを取ってください。
|
下の方法でコンタクトを取ってください。
|
||||||
|
|
||||||
[Support Forum](http://wordpress.org/support/plugin/sqlite-integration)にポストする。
|
1. [Support Forum](http://wordpress.org/support/plugin/sqlite-integration)にポストする。
|
||||||
|
2. [SQLite Integration(ja)のページ](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)でメッセージを残す。
|
||||||
|
|
||||||
注意: WordPress.orgはMySQL以外のデータベースを正式にサポートしていません。だから、WordPress.orgからのサポートは得られません。フォーラムに投稿しても、回答を得ることはまずないでしょう。また、パッチをあてたプラグインを使う場合は、そのプラグインの作者からのサポートはないものと思ってください。自分でリスクを負う必要があります。
|
= サポートについての注意 =
|
||||||
|
|
||||||
= Translation =
|
WordPress.org は MySQL 以外のデータベースを正式にサポートしていません。だから、WordPress.org からのサポートは得られません。フォーラムに投稿しても、回答を得ることはまずないでしょう。また、パッチをあてたプラグインを使う場合は、そのプラグインの作者からのサポートはないものと思ってください。できるだけご協力はしますが、自分でリスクを負う必要があります。
|
||||||
|
|
||||||
ドキュメントは英語で書かれています。日本語のカタログファイルと、.potファイルがアーカイブに含まれています。もしあなたの言語に翻訳をしたら、知らせてください。
|
= 翻訳 =
|
||||||
|
|
||||||
== Installation ==
|
ドキュメントは英語で書かれています。もしあなたの言語に翻訳をしたら、知らせてください。
|
||||||
|
|
||||||
このプラグインは他のプラグインとはちがいます。管理パネルのプラグイン・ページでインストールすることはできません。
|
* 日本語(kjmtsh)
|
||||||
|
* スペイン語(Pablo Laguna)
|
||||||
|
|
||||||
まず、WordPressのインストールを準備しなければなりません。Codexの[Installing Wordpress ](http://codex.wordpress.org/Installing_WordPress)をご覧ください。
|
== インストール ==
|
||||||
|
|
||||||
必要要件をチェックし、WordPressのアーカイブを展開したら、wp-config-sample.phpをwp-config.phpにリネームして、[Codex page](http://codex.wordpress.org/Editing_wp-config.php)に書いてあるように、少し編集する必要があります。データベースの設定*以外*の部分を設定してください。
|
より詳細な情報は、[SQLite Integration(ja)](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)をご覧ください。
|
||||||
|
|
||||||
終わったら、オプションの設定を書き加えることができます。次の説明に従ってください。
|
= 準備 =
|
||||||
|
|
||||||
* デフォルト(wp-content/database)とは違うディレクトリにSQLiteデータベース・ファイルを置きたい場合は、次の行を追加してください(最後のスラッシュを忘れずに)。
|
1. 最新の WordPress アーカイブとこのプラグインをダウンロードして、ローカルマシンに展開します。
|
||||||
|
2. sqlite-integration フォルダを wordpress/wp-content/plugins フォルダに移動します。
|
||||||
|
3. sqlite-integration フォルダの中にある db.php ファイルを wordpress/wp-content フォルダにコピーします。
|
||||||
|
4. wordpress/wp-config-sample.php ファイルを wordpress/wp-config.php とリネームします。
|
||||||
|
|
||||||
`define('DB_DIR', '/home/youraccount/database_directory/');`
|
= 基本的な設定 =
|
||||||
|
|
||||||
注意: PHPスクリプトがこのディレクトリを作ったり、中にファイルを書き込んだりする権限を持っていることが必要です。
|
wp-config.php ファイルを開き、下のセクションを編集します。
|
||||||
|
|
||||||
* デフォルト(.ht.sqlite)とは違うデータベース・ファイル名を使いたい場合は、次の行を追加してください。
|
* 認証用ユニークキー
|
||||||
|
* WordPressデータベーステーブルの接頭辞
|
||||||
|
* ローカル言語(日本語版では、jaがすでに設定されています)
|
||||||
|
|
||||||
`define('DB_FILE', 'database_file_name');`
|
Codex の[wp-config.php の編集](http://wpdocs.sourceforge.jp/wp-config.php_%E3%81%AE%E7%B7%A8%E9%9B%86)を参照してください。
|
||||||
|
|
||||||
注意: PDO for WordPressをお使いの方は、「データベースを移行する」のセクションをご覧ください。
|
= 5 分もかからないインストール =
|
||||||
|
|
||||||
よくわからない場合は、何も追加する必要はありません。
|
wordpress フォルダをサーバにアップロードして、ブラウザでアクセスすると、インストールが始まります。ブログ名などを入力してインストールすれば終了です。ブログをお楽しみください。
|
||||||
|
|
||||||
wp-config.phpの準備が終わったら、次のステップに進みます。
|
= オプション設定 =
|
||||||
|
|
||||||
1. プラグインのアーカイブを展開します。
|
wp-config.php に設定を書き込むと、デフォルトの設定を変更することができます。SQLite データベースファイル名を変更したい場合は(デフォルトは .ht.sqlite です)、下の 1 行を加えてください。
|
||||||
|
|
||||||
2. アーカイブに含まれるdb.phpファイルをwp-contentディレクトリに移動(またはコピー)してください。
|
`define('DB_FILE', 'your_database_name');`
|
||||||
|
|
||||||
3. sqlite-wordpressディレクトリをwp-content/plugin/ディレクトリの下に移動してください。
|
SQLite データベースファイルが置かれるディレクトリを変更したい場合は、次の行を追加してください。
|
||||||
|
|
||||||
`wordpress/wp-contents/db.php`
|
`define('DB_DIR', '/home/youraccount/database_directory/');`
|
||||||
|
|
||||||
と、
|
どちらか片方だけでも、両方でも変更できます。
|
||||||
|
|
||||||
`wordpress/wp-contents/sqlite-integration`
|
= このプラグインを削除せずに MySQL を使う =
|
||||||
|
|
||||||
のようになります。
|
MySQL を使いたいときは、次の行を wp-config.php に追加してください。
|
||||||
|
|
||||||
さあ、これでお終いです。ディレクトリの構造をそのままに、あなたのサーバにアップロードして、お好きなブラウザでwp-admin/install.phpにアクセスしてください。WordPressのインストールが始まります。Enjoy blogging!
|
`define('USE_MYSQL', true);`
|
||||||
|
|
||||||
= Migrate your database to SQLite Integration =
|
もちろん、これだけでは足りません。データベースサーバやユーザ名、パスワードなども設定してください。この行を追加して、最初にサイトにアクセスすると、WordPress のインストールが始まります。MySQL でのインストールを終えてください。おわかりのように、SQLite のデータは自動的に MySQL に引き継がれることはありません。
|
||||||
|
|
||||||
一番よい方法は、次のようにすることです。
|
SQLite に戻りたいときには、この行を次のように変更するか、この行を削除してください。
|
||||||
|
|
||||||
1. データをエクスポートする。
|
`define('USE_MYSQL', false);`
|
||||||
|
|
||||||
|
= PDO for WordPress から SQLite Integration にデータベースを移行する =
|
||||||
|
|
||||||
|
現在、PDO for WordPress をお使いなら、データベースを SQLite Integration に移行することができます。お勧めは下のようにすることです。より詳細な情報については、[SQLite Integration(ja)](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)を参照してください。
|
||||||
|
|
||||||
|
1. 現在のデータをエクスポートする。
|
||||||
2. 最新のWordPressを、SQLite Integrationを使って新規インストールする。
|
2. 最新のWordPressを、SQLite Integrationを使って新規インストールする。
|
||||||
|
|
||||||
3. WordPress Importerを使って以前のデータをインポートする。
|
3. WordPress Importerを使って以前のデータをインポートする。
|
||||||
|
|
||||||
何らかの理由で、データがエクスポートできない場合は、次の方法を試すことができます。
|
何らかの理由で、データがエクスポートできない場合は、上のサイトをご覧ください。別の方法を読むことができます。
|
||||||
|
|
||||||
1. あなたのMyBlog.sqliteがWordPressの必要とするテーブルを全て含んでいるかどうかチェックしてください。[SQLite Manager Mozilla Addon](https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/)のようなユーティリティが必要かもしれません。また、Codexの[Database Description](http://codex.wordpress.org/Database_Description)を参照してください。
|
== よくある質問 ==
|
||||||
|
|
||||||
2. MyBlog.sqliteとdb.phpファイルをバックアップしてください。
|
= 「データベース接続エラー」でインストールが止まります =
|
||||||
|
|
||||||
3. あなたのMyBlog.sqliteを.ht.sqliteにリネームするか、または、wp-config.phpに次の行を追加してください。
|
wp-config.php を手動で作成することが必要です。WordPress に作らせようとすると、途中でインストールが止まります。
|
||||||
|
|
||||||
`define('FQDB', 'MyBlog.sqlite');`
|
|
||||||
|
|
||||||
4. wp-content/db.phpをSQLite Integrationに含まれている同名のファイルと入れ替えてください。
|
|
||||||
|
|
||||||
これでおしまいです。忘れずに必要要件とWordPressのバージョンをチェックしてください。*SQLite IntegrationはWordPress 3.2.x以前のものでは動作しません。*
|
|
||||||
|
|
||||||
== Frequently Asked Questions ==
|
|
||||||
|
|
||||||
= データベース・ファイルが作られません =
|
= データベース・ファイルが作られません =
|
||||||
|
|
||||||
|
@ -142,37 +135,100 @@ wp-config.phpの準備が終わったら、次のステップに進みます。
|
||||||
|
|
||||||
1. システム情報の画面ではデータベースの状態やプラグインの対応状況を見ることができます。
|
1. システム情報の画面ではデータベースの状態やプラグインの対応状況を見ることができます。
|
||||||
|
|
||||||
== Requirements ==
|
|
||||||
|
|
||||||
* PHP 5.2 以上で PDO extension が必要です(PHP 5.3 以上をお勧めします)。
|
|
||||||
* PDO SQLite ドライバがロードされている必要があります。
|
|
||||||
|
|
||||||
== Known Limitations ==
|
== Known Limitations ==
|
||||||
|
|
||||||
多くのプラグインはちゃんと動作するはずです。が、中にはそうでないものもあります。一般的には、WordPressの関数を通さず、PHPのMysqlあるいはMysqliライブラリの関数を使ってデータベースを操作しようとするプラグインは問題を起こすでしょう。
|
多くのプラグインはちゃんと動作するはずです。が、中にはそうでないものもあります。一般的には、WordPressの関数を通さず、PHPのMysqlあるいはMysqliライブラリの関数を使ってデータベースを操作しようとするプラグインは問題を起こすでしょう。
|
||||||
|
|
||||||
他には下のようなものがあります。
|
他には下のようなものがあります。
|
||||||
|
|
||||||
= これらのプラグインを使うことはできません。SQLite Integrationと同じファイルを使おうとするからです。 =
|
これらのプラグインを使うことはできません。SQLite Integrationと同じファイルを使おうとするからです。
|
||||||
|
|
||||||
* [W3 Total Cache](http://wordpress.org/extend/plugins/w3-total-cache/)
|
* W3 Total Cache
|
||||||
* [DB Cache Reloaded Fix](http://wordpress.org/extend/plugins/db-cache-reloaded-fix/)
|
* DB Cache Reloaded Fix
|
||||||
* [HyperDB](http://wordpress.org/extend/plugins/hyperdb/)
|
* HyperDB
|
||||||
|
|
||||||
= これらのプラグインも使えません。SQLiteがエミュレートできないMySQL独自の拡張機能を使っているからです。 =
|
'WP Super Cache'や'Quick Cache'のようなプラグインなら使えるかもしれません。お勧めはしませんし、何も保証しませんが。
|
||||||
|
|
||||||
* [Yet Another Related Posts](http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/)
|
これらのプラグインも使えません。SQLite Integration がエミュレートできない MySQL 独自の拡張機能を使っているからです。
|
||||||
* [Better Related Posts](http://wordpress.org/extend/plugins/better-related/)
|
|
||||||
|
* Yet Another Related Posts
|
||||||
|
* Better Related Posts
|
||||||
|
|
||||||
|
'WordPress Related Posts'や'Related Posts'のようなプラグインなら使うことができるかもしれません。
|
||||||
|
|
||||||
たぶん、もっとあるでしょう。動作しないプラグインを見つけたら、お知らせいただけると助かります。
|
たぶん、もっとあるでしょう。動作しないプラグインを見つけたら、お知らせいただけると助かります。
|
||||||
|
|
||||||
|
非互換のプラグインの中には、少し修正をすると、使えるようになるものがあります。[Plugins(ja)](http://dogwood.skr.jp/wordpress/plugins-ja/)で情報を公開していますので、参照してください。
|
||||||
|
|
||||||
|
このプラグインは、'WP_PLUGIN_URL' 定数をサポートしません。
|
||||||
|
|
||||||
== Upgrade Notice ==
|
== Upgrade Notice ==
|
||||||
|
|
||||||
SQLite Integrationのアップグレードに失敗するようなら、FTPを使っての手動アップグレードを試してみてください。
|
WordPress 4.1.1 での動作チェックをして、いくつかのバグを修正しました。アップグレードをお勧めします。自動アップグレードで失敗するようなら、FTPを使っての手動アップグレードを試してみてください。
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.8 (2014-03-06) =
|
||||||
|
* インストール・プロセスのバグを修正しました。
|
||||||
|
* index query の正規表現を修正しました。いくつかのプラグインが影響を受けるかもしれません。
|
||||||
|
* PHP 5.2.x で動作しない部分を修正しました。
|
||||||
|
|
||||||
|
= 1.7 (2014-09-05) =
|
||||||
|
* エディタ画面で、添付ファイルの並べ替えができなかったのを修正しました。
|
||||||
|
* CREATE クエリのバグを修正しました。
|
||||||
|
* 128x128 アイコンと 256x256 アイコンを追加しました。
|
||||||
|
* pcre.backtrack_limit が大きな値に設定されている場合、それを使うようにしました。
|
||||||
|
* メタクエリの BETWEEN の扱いを変更しました。
|
||||||
|
* WordPress 4.0 での動作チェックをしました。
|
||||||
|
|
||||||
|
= 1.6.3 (2014-05-10) =
|
||||||
|
* BETWEEN 比較をするメタクエリのバグを修正しました。
|
||||||
|
* スペイン語カタログを追加しました。
|
||||||
|
* WordPress 3.9.1 での動作チェックをしました。
|
||||||
|
|
||||||
|
= 1.6.2 (2014-05-05) =
|
||||||
|
* 正規表現に関するバグを修正しました。
|
||||||
|
* 管理画面のドキュメント(表示されていなかった)を修正しました。
|
||||||
|
|
||||||
|
= 1.6.1 (2014-04-22) =
|
||||||
|
* WP Slimstat を使うために、いくつかのバグを修正しました。
|
||||||
|
* 古い db.php を使い続けている場合は、ダッシュボードに注意を表示するようにしました(必要な場合のみ)。
|
||||||
|
* 古い db.php を新しいものを置き換えるユーティリティを追加しました。
|
||||||
|
* 日本語カタログファイルをアップデートしました。
|
||||||
|
|
||||||
|
= 1.6 (2014-04-17) =
|
||||||
|
* 未対応のクエリに対するエラーメッセージのコントロールができていないのを修正しました。
|
||||||
|
* SQL_CALC_FOUND_ROW ステートメントのバグを修正しました。メインクエリと WP_Query、WP_Meta_Query などのページング情報に関連したものです。
|
||||||
|
* コメント本文からバッククォートが削除されるバグを修正しました。
|
||||||
|
* バックアップファイルをローカルにダウンロードできるようにしました。
|
||||||
|
* PHP documentor で使えるように、ソースコードのドキュメントを書き直しました。
|
||||||
|
* このドキュメントを変えました。
|
||||||
|
* マイナーな変更、修正がいくつかありました。
|
||||||
|
* WordPress 3.8.2 と 3.9 alpha でインストールテストをしました。
|
||||||
|
* プラグイン互換リストを増補しました。
|
||||||
|
* これまで使えなくしていた wp-db.php の関数を使えるようにしました。
|
||||||
|
* いくつかのユーザ定義関数を追加しました。
|
||||||
|
|
||||||
|
= 1.5 (2013-12-17) =
|
||||||
|
* WordPress 3.8 でのインストールと動作テストをしました。
|
||||||
|
* SQLite と MySQL を交互に使えるようにしました。
|
||||||
|
* readme-ja.txt のインストールの説明をかえました。
|
||||||
|
* SQLite のコンパイルオプション'ENABLE_UPDATE_DELETE_LIMIT'をチェックするようにしました。
|
||||||
|
* WordPress 3.8 の管理画面に合わせて sytle を変更しました。
|
||||||
|
* グローバルで動くファイルへのダイレクトアクセスを制限するようにしました。
|
||||||
|
|
||||||
|
= 1.4.2 (2013-11-06) =
|
||||||
|
* ダッシュボードに表示される情報についてのバグを修正しました。
|
||||||
|
* スクリーンショットを変更しました。
|
||||||
|
* WordPress 3.7.1 でのインストールテストを行いました。
|
||||||
|
|
||||||
|
= 1.4.1 (2013-09-27) =
|
||||||
|
* BETWEEN関数の書き換え方を修正しました。致命的なバグです。新規投稿に'between A and B'というフレーズが含まれていると、公開されず、投稿自体も消えます。
|
||||||
|
* MP6を使っているときに、管理画面のレイアウトが崩れるのを修正しました。
|
||||||
|
* 日本語が一部表示されないのを直しました。
|
||||||
|
* SELECT version()がダミーデータを返すようにしました。
|
||||||
|
* WP_DEBUGが有効の時に、WordPressのテーブルからカラム情報を読んで表示できるようにしました。
|
||||||
|
|
||||||
= 1.4 (2013-09-12) =
|
= 1.4 (2013-09-12) =
|
||||||
* アップグレードしたWordPressで期待通り動作しないのを修正するために、データベース管理ユーティリティを追加しました。
|
* アップグレードしたWordPressで期待通り動作しないのを修正するために、データベース管理ユーティリティを追加しました。
|
||||||
* SHOW INDEXクエリにWHERE句がある場合の処理を変更しました。
|
* SHOW INDEXクエリにWHERE句がある場合の処理を変更しました。
|
||||||
|
|
|
@ -0,0 +1,262 @@
|
||||||
|
# SQLite Integration
|
||||||
|
Contributors: kjmtsh
|
||||||
|
Plugin Name: SQLite Integration
|
||||||
|
Plugin URI: http://dogwood.skr.jp/wordpress/sqlite-integration/
|
||||||
|
Tags: database, SQLite, PDO
|
||||||
|
Author: Kojima Toshiyasu
|
||||||
|
Author URI: http://dogwood.skr.jp/
|
||||||
|
Requires at least: 3.3
|
||||||
|
Tested up to: 4.1.1
|
||||||
|
Stable tag: 1.8.1
|
||||||
|
License: GPLv2
|
||||||
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
|
SQLite Integration is the plugin that enables WordPress to use SQLite. If you want to build a WordPress website with it, this plugin is for you.
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
This plugin enables you to create WordPress based web sites without MySQL database server. All you've got to prepare is the Apache web server or the like and PHP with PDO extension. WordPress archive and this plugin in hand, you can build a WordPress web site out of the box.
|
||||||
|
|
||||||
|
SQLite Integration is a successor to [PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress) plugin, which unfortunately enough, doesn't seem to be maintained any more. SQLite Integration uses the basic idea and structures of that plugin and adds some utilities with more features.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
SQLite Integration is a database access engine program, which means it's not like the other plugins. It must be used to install WordPress. Please read the install section. And see more detailed instruction in the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/).
|
||||||
|
|
||||||
|
Once you succeed in installing WordPress, you can use it just like the other systems using MySQL. Optionally, this plugin provides the feature to temporarily change the database to MySQL and come back to SQLite, which may help developers test their sites on the local machines without MySQL.
|
||||||
|
|
||||||
|
After you finish installing, you can activate this plugin (this is optional but I recommend you to). And you can see some instructions and useful information on your server or your installed plugins.
|
||||||
|
|
||||||
|
### System Requirements
|
||||||
|
|
||||||
|
* PHP 5.2 or newer with PDO extension (PHP 5.3 or newer is better).
|
||||||
|
* PDO SQLite driver must be loaded.
|
||||||
|
|
||||||
|
### Backward Compatibility
|
||||||
|
|
||||||
|
If you are using 'PDO for WordPress', you can migrate your database to this plugin. Please check the install section.
|
||||||
|
|
||||||
|
### Support (outdated)
|
||||||
|
|
||||||
|
Please contact us with the methods below:
|
||||||
|
|
||||||
|
1. Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/).
|
||||||
|
2. Visit the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/)(in English) or [SQLite Integration(ja) Page](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)(in Japanese) and leave a message there.
|
||||||
|
|
||||||
|
### Notes about Support
|
||||||
|
|
||||||
|
WordPress.org doesn't officially support using any other database than MySQL. So you will have no supports from WordPress.org. Even if you post to the general Forum, you'll have few chances to get the answer. And if you use patched plugins, you will have no support from the plugin author(s), eithter. I will help you as much as I can, but take your own risk, please.
|
||||||
|
|
||||||
|
### Translation
|
||||||
|
|
||||||
|
Documentation is written in English. If you translate it into your language, please let me know.
|
||||||
|
|
||||||
|
* Japanese (kjmtsh)
|
||||||
|
* Spanish (Pablo Laguna)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
For more detailed instruction, please visit [SQLite Integration](http://dogwood.skr.jp/wordpress/sqlite-integration/).
|
||||||
|
|
||||||
|
### Preparation
|
||||||
|
|
||||||
|
1. Download the latest WordPress archive and this plugin. And expand them on your machine.
|
||||||
|
2. Move sqlite-integration folder to wordpress/wp-content/plugins folder.
|
||||||
|
3. Copy db.php file in sqlite-integratin folder to wordpress/wp-content folder.
|
||||||
|
4. Rename wordpress/wp-config-sample.php to wordpress/wp-config.php.
|
||||||
|
|
||||||
|
### Basic settings
|
||||||
|
|
||||||
|
Open wp-config.php and edit the section below:
|
||||||
|
|
||||||
|
* Authentication Unique keys and Salts
|
||||||
|
* WordPress Database Table prefix
|
||||||
|
* WordPress Localized Language
|
||||||
|
|
||||||
|
See also [Editing wp-config.php](http://codex.wordpress.org/Editing_wp-config.php) in the Codex. Note that you don't have to write your database server, user name, user password or etc...
|
||||||
|
|
||||||
|
### Less than 5 minutes installation
|
||||||
|
|
||||||
|
Upload everything (keeping the directory structure) to your server and access the wp-admin/install.php with your favorite browser, and WordPress installation process will begin. Enjoy your blogging!
|
||||||
|
|
||||||
|
### Optional settings
|
||||||
|
|
||||||
|
You can change some default settings with the directives in wp-config.php.If you change the SQLite database file name (default is .ht.sqlite) to others, add the next line in your wp-config.php.
|
||||||
|
|
||||||
|
`define('DB_FILE', 'your_database_name');`
|
||||||
|
|
||||||
|
If you change the directory where the SQLite database is put, add the next line in your wp-config.php.
|
||||||
|
|
||||||
|
`define('DB_DIR', '/home/youraccount/database_directory/');`
|
||||||
|
|
||||||
|
You can change either of them or both of them.
|
||||||
|
|
||||||
|
### Use MySQL without uninstalling this plugins
|
||||||
|
|
||||||
|
If you want to use MySQL, add the next line in your wp-config.php.
|
||||||
|
|
||||||
|
`define('USE_MYSQL', true);`
|
||||||
|
|
||||||
|
Of course, this is not enough. You must give your database server address, user name, passowrd or etc... in the same file. After you add that line and access your web site for the first time, WordPress installer will begin. Then you must finish setting MySQL database. As you know, data in the SQLite database is not automatically migrated to MySQL.
|
||||||
|
|
||||||
|
If you want to use SQLite again, change the line in wp-config.php as below or just remove this line.
|
||||||
|
|
||||||
|
`define('USE_MYSQL', false);`
|
||||||
|
|
||||||
|
### For PDO for WordPress users
|
||||||
|
|
||||||
|
If you are using PDO for WordPress now, you can migrate your database to SQLite Integration. I recommend the way below. See more detailed instruction [SQLite Integration](http://dogwood.skr.jp/wordpress/sqlite-integration/).
|
||||||
|
|
||||||
|
1. Export your data from current database.
|
||||||
|
2. Install latest WordPress with SQLite Integration.
|
||||||
|
3. Import the old data.
|
||||||
|
|
||||||
|
If export or import fails for some reason, please visit our site and try another way described there.
|
||||||
|
|
||||||
|
## Frequently Asked Questions
|
||||||
|
|
||||||
|
### Install stops with 'Error establishing a database connection'
|
||||||
|
|
||||||
|
It is required that you should prepare wp-config.php manually. If you try to make WordPress create wp-config.php, you'll get that message and can't continue install process.
|
||||||
|
|
||||||
|
### Database file is not created
|
||||||
|
|
||||||
|
The reason of failure in creating directory or files is often that PHP is not allowed to craete them. Please check your server setting or ask the administrator.
|
||||||
|
|
||||||
|
### Such and such plugins can't be activated or doesn't seem to work properly
|
||||||
|
|
||||||
|
Some of the plugins, especially cache plugins or database maintenace plugins, are not compatible with this plugin. Please activate SQLite Integration and see the known limitations section in this document or visit the [SQLite Integration](http://dogwood.skr.jp/wordpress/sqlite-integration/) for more detailed information.
|
||||||
|
|
||||||
|
### I don't want the admin menu and documentation
|
||||||
|
|
||||||
|
Just deactivate the plugin, and you can remove them. Activation and deactivation affect only admin menu. If you want to remove all the plugin files, just delete it.
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
1. System Information tells you your database status and installed plugins compatibility.
|
||||||
|
|
||||||
|
## Known Limitations
|
||||||
|
|
||||||
|
Many of the other plugins will work fine with this plugin. But there are some you can't use. Generally speaking, the plugins that manipulate database not with WordPress' APIs but with MySQL or MySQLi native drivers from PHP might cause the problem.
|
||||||
|
|
||||||
|
These are some examples:
|
||||||
|
|
||||||
|
You can't use these plugins because they create the same file that this plugin uses.
|
||||||
|
|
||||||
|
* W3 Total Cache
|
||||||
|
* DB Cache Reloaded Fix
|
||||||
|
* HyperDB
|
||||||
|
|
||||||
|
You may be able to use 'WP Super Cache' or 'Quick Cache' instead of them. I don't mean to recommend them and give no warranty at all.
|
||||||
|
|
||||||
|
You can't use these plugins, because they are using MySQL specific features that SQLite Integration can't emulate.
|
||||||
|
|
||||||
|
* Yet Another Related Posts
|
||||||
|
* Better Related Posts
|
||||||
|
|
||||||
|
You may be able to use 'WordPress Related Posts' or 'Related Posts' instead of them. Probably there are more, I'm afraid. If you find one, please let me know.
|
||||||
|
|
||||||
|
There are some among the incompatible plugins, which work fine by rewriting some codes. I give information about them and provide the patch files on [Plugins](http://dogwood.skr.jp/wordpress/plugins/).
|
||||||
|
|
||||||
|
This plugin doesn't support 'WP_PLUGIN_URL' constant.
|
||||||
|
|
||||||
|
## Upgrade Notice
|
||||||
|
|
||||||
|
WordPress 4.1.1 compatibility is checked and some bugs are fixed. Upgrade is recommended. When auto upgrading fails, please try manual upgrade via FTP.
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
See also ChangeLog file contained in the archive.
|
||||||
|
|
||||||
|
= 1.8 (2015-03-06) =
|
||||||
|
* Fixed the bug about install process algorithm.
|
||||||
|
* Fixed the index query regexp, which may cause a problem to some plugins.
|
||||||
|
* Solved PHP 5.2.x compatibility issue.
|
||||||
|
|
||||||
|
= 1.7 (2014-09-05) =
|
||||||
|
* Fixed the bug about changing the order of the attachment file in the editor screen.
|
||||||
|
* Fixed the bug about the manipulation of CREATE query.
|
||||||
|
* Added an 128x128 icon and 256x256 icon.
|
||||||
|
* Change for checking the user defined value of pcre.backtrack_limit and using it.
|
||||||
|
* WordPress 4.0 compatibilitiy checked.
|
||||||
|
|
||||||
|
= 1.6.3 (2014-05-10) =
|
||||||
|
* Fixed the bug about manipulating meta query with BETWEEN comparison.
|
||||||
|
* Added the Spanish langugae support.
|
||||||
|
* WordPress 3.9.1 compatibility checked.
|
||||||
|
|
||||||
|
= 1.6.2 (2014-05-05) =
|
||||||
|
* Fixed some bugs for the regular expression.
|
||||||
|
* Fixed the documents on the admin dashboard.
|
||||||
|
|
||||||
|
= 1.6.1 (2014-04-22) =
|
||||||
|
* Fixed some bugs for using with WP Slimstat plugin.
|
||||||
|
* Display admin notice when not replacing the old db.php with the new one (when necessary).
|
||||||
|
* Add the feature for replacing the old db.php file with the button click.
|
||||||
|
* Fixed the Japanese translation catalog file.
|
||||||
|
|
||||||
|
= 1.6 (2014-04-17) =
|
||||||
|
* Fixed the bug of error messaging control for the unknown query.
|
||||||
|
* Fixed the bug for 'SQL_CALC_FOUND_ROW' statement. This is for the main query, WP_Query class and WP_Meta_Query concerning paging information.
|
||||||
|
* Fixed the bug that the back quote in the comments was removed.
|
||||||
|
* Added the feature to download a backup file to a local machine.
|
||||||
|
* Revised all the doc strings in the sourcse code for PHP documentor.
|
||||||
|
* Changed the documentation.
|
||||||
|
* Fixed minor bugs and typos.
|
||||||
|
* Tested to install WordPress 3.8.2 and 3.9 beta.
|
||||||
|
* Augumented the plugin compatibility list.
|
||||||
|
* Some functions in wp-db.php, which was disabled by the plugin, is enabled and can be used.
|
||||||
|
* Some more user defined functions are added.
|
||||||
|
|
||||||
|
= 1.5 (2013-12-17) =
|
||||||
|
* Tested WordPress 3.8 installation and compatibility.
|
||||||
|
* Add the optional feature to change the database from SQLite to MySQL.
|
||||||
|
* Changed the install instruction in the readme.txt.
|
||||||
|
* Add the code to check if the SQLite library was compiled with the option 'ENABLE_UPDATE_DELETE_LIMIT'.
|
||||||
|
* Changed the admin panel style to fit for WordPress 3.8.
|
||||||
|
* Restricted the direct access to the files that works in the global namespace.
|
||||||
|
|
||||||
|
= 1.4.2 (2013-11-06) =
|
||||||
|
* Fixed some minor bugs about the information in the dashboard.
|
||||||
|
* Changed the screenshot.
|
||||||
|
* Tested WordPress 3.7.1 installation.
|
||||||
|
|
||||||
|
= 1.4.1 (2013-09-27) =
|
||||||
|
* Fixed the rewriting process of BETWEEN function. This is a critical bug. When your newly created post contains 'between A and B' phrase, it is not published and disappears.
|
||||||
|
* Fixed the admin dashboard display when using MP6.
|
||||||
|
* Fixed the Japanese catalog.
|
||||||
|
* Added the procedure for returning the dummy data when using SELECT version().
|
||||||
|
* Added the procedure for displaying column informatin of WordPress tables when WP_DEBUG enabled.
|
||||||
|
|
||||||
|
= 1.4 (2013-09-12) =
|
||||||
|
* Added the database maintenance utility for fixing the database malfunction of the upgraded WordPress installation.
|
||||||
|
* Changed the manipulation of SHOW INDEX query with WHERE clause.
|
||||||
|
* Fixed the bug of the manipulation of ALTER TABLE query.
|
||||||
|
|
||||||
|
= 1.3 (2013-09-04) =
|
||||||
|
* Added the backup utility that creates the zipped archive of the current snapshot of the database file.
|
||||||
|
* Changed the dashboard style to match MP6 plugin.
|
||||||
|
* Changed the way of putting out the error messages when language catalogs are not loaded.
|
||||||
|
* Modified the _rewrite_field_types() in query_create.class.php for the dbDelta() function to work properly.
|
||||||
|
* Added the support for BETWEEN statement.
|
||||||
|
* Changed the regular expression to remove all the index hints from the query string.
|
||||||
|
* Fixed the manipulation of ALTER TABLE CHANGE COLUMN query for NewStatPress plugin to work.
|
||||||
|
* Fixed minor bugs.
|
||||||
|
|
||||||
|
= 1.2.1 (2013-08-04) =
|
||||||
|
* Removed wpdb::real_escape property following the change of the wpdb.php file which makes the plugin compatible with Wordpress 3.6.
|
||||||
|
|
||||||
|
= 1.2 (2013-08-03) =
|
||||||
|
* Fixed the date string format and its quotation for calendar widget.
|
||||||
|
* Fixed the patch utility program for using on the Windows machine.
|
||||||
|
* Fixed the textdomain error in utilities/patch.php file when uploading the patch file.
|
||||||
|
* Changed the manipulation of the query with ON DUPLICATE KEY UPDATE.
|
||||||
|
* Fixed the typos in readme.txt and readme-ja.txt.
|
||||||
|
|
||||||
|
= 1.1 (2013-07-24) =
|
||||||
|
* Fixed the manipulation of DROP INDEX query.
|
||||||
|
* Removed destruct() from shutdown_hook.
|
||||||
|
* Enabled LOCATE() function in the query string.
|
||||||
|
|
||||||
|
= 1.0 (2013-07-07) =
|
||||||
|
* First release version of the plugin.
|
198
readme.txt
198
readme.txt
|
@ -1,198 +0,0 @@
|
||||||
=== SQLite Integration ===
|
|
||||||
Contributors: kjmtsh
|
|
||||||
Plugin Name: SQLite Integration
|
|
||||||
Plugin URI: http://dogwood.skr.jp/wordpress/sqlite-integration/
|
|
||||||
Tags: database, SQLite, PDO
|
|
||||||
Author: Kojima Toshiyasu
|
|
||||||
Author URI: http://dogwood.skr.jp/
|
|
||||||
Requires at least: 3.3
|
|
||||||
Tested up to: 3.6
|
|
||||||
Stable tag: 1.4
|
|
||||||
License: GPLv2
|
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
|
|
||||||
SQLite Integration is the plugin that enables WordPress to use SQLite. If you want to build a WordPress website with it, this plugin is for you.
|
|
||||||
|
|
||||||
== Description ==
|
|
||||||
|
|
||||||
This plugin enables WordPress to work with [SQLite](http://www.sqlite.org/). You don't have to prepare MySQL database server and its configuration. SQLite is a self-contained, serverless, transactional SQL database engine. It is not a full-featured database system like MySQL or PostgreSQL, but it best fits for low to medium traffic websites.
|
|
||||||
|
|
||||||
SQLite Integration is a kind of wrapper program, which is placed between WordPress and SQLite database and works as a mediator. It works as follows:
|
|
||||||
|
|
||||||
1. Intercepts the SQL statement for MySQL from WordPress
|
|
||||||
2. Rewrites it for SQLite to execute
|
|
||||||
3. Give it to SQLite
|
|
||||||
4. Gets the results from SQLite
|
|
||||||
5. Formats the results as WordPress wants, if necessary
|
|
||||||
6. Give the results back to WordPress
|
|
||||||
|
|
||||||
WordPress thinks she talks with MySQL and doesn't know what has happened in the background. She really talks with SQLite and will be happy with it.
|
|
||||||
|
|
||||||
SQLite Integration is a successor to [PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress) plugin, which unfortunately enough, doesn't seem to be maintained any more. SQLite Integration uses the basic idea and structures of that plugin and adds some more features or some utilities.
|
|
||||||
|
|
||||||
= Important Notice =
|
|
||||||
|
|
||||||
When your installed WordPress 3.5.x with this plugin and upgraded to 3.6, your database might not work as expected. If this is your case, please upgrade this plugin to the newest version (1.4) and visit the maintenance page in the admin dashboard, where you can check if you need to fix your database, and you can do fixing job with the utility.
|
|
||||||
|
|
||||||
When you installed WordPress 3.6 with this plugin or your WordPress is 3.5.x, you don't have to fix your database.
|
|
||||||
|
|
||||||
= Features =
|
|
||||||
|
|
||||||
SQLite Integration is not an ordinary 'plugin'. It is used to install WordPress itself. You need to do some preparations. Please read the install section. And see more detailed instruction in the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration).
|
|
||||||
|
|
||||||
Once you succeeded in installing WordPress, you can use it just like the others using MySQL. Optionally, you can activate this plugin in the installed plugins panel of the adimn dashboard, and you can see the useful information and instructions. It is not required but I recommend it.
|
|
||||||
|
|
||||||
= Backward Compatibility =
|
|
||||||
|
|
||||||
If you are using [PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress), you can migrate your database. See install section.
|
|
||||||
|
|
||||||
= Support =
|
|
||||||
|
|
||||||
Please contact us with the methods below:
|
|
||||||
|
|
||||||
Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/).
|
|
||||||
|
|
||||||
Notes: WordPress.org doesn't officially support using any other database than MySQL. So there will be no supports from WordPress.org. Even if you post to the general Forum, you have few chances to get the answer. And if you use patched plugins, you will have no support from the plugin authors, eithter.
|
|
||||||
|
|
||||||
= Translation =
|
|
||||||
|
|
||||||
Documentation is written in English. Japanese catalog file and .pot file are included in the archive. If you translate it into your language, please let me know.
|
|
||||||
|
|
||||||
== Installation ==
|
|
||||||
|
|
||||||
This plugin is *not* like the other plugins. You can't install and activate it on the plugin administration panel.
|
|
||||||
|
|
||||||
First of all, you've got to prepare WordPress installation. See [Installing Wordpress ](http://codex.wordpress.org/Installing_WordPress) section in the Codex.
|
|
||||||
|
|
||||||
After checking the prerequisites and unzipping the WordPress archive file, you must rename wp-contig-sample.php file to wp-config.php and do some editting as the [Codex page](http://codex.wordpress.org/Editing_wp-config.php) says. Please follow the instructions *except* the database settings.
|
|
||||||
|
|
||||||
When you finish, you can add optional settings. Follow the steps below:
|
|
||||||
|
|
||||||
* If you want to put the SQLite database file to the directory different from the default setting (wp-content/database), you can add the line below (don't forget to add a trailing slash):
|
|
||||||
|
|
||||||
`define('DB_DIR', '/home/youraccount/database_directory/');`
|
|
||||||
|
|
||||||
Note: Your PHP scripts must be able to create that directory and files in it.
|
|
||||||
|
|
||||||
* If you want to change the database file name to the one different from the default (.ht.sqlite), you can add the line below:
|
|
||||||
|
|
||||||
`define('DB_FILE', 'database_file_name');`
|
|
||||||
|
|
||||||
Note: If you are using 'PDO for WordPress' plugin, see also 'Migrating your database' section.
|
|
||||||
|
|
||||||
If you don't understand well, you don't have to add any of the lines above.
|
|
||||||
|
|
||||||
After you finish preparing wp-config.php, follow the next steps:
|
|
||||||
|
|
||||||
1. Unzip the plugin archive file.
|
|
||||||
|
|
||||||
2. Move db.php file contained in the archive to wp-content directory.
|
|
||||||
|
|
||||||
3. Move the sqlite-integration directory to wp-content/plugin/ directory.
|
|
||||||
|
|
||||||
`wordpress/wp-contents/db.php`
|
|
||||||
|
|
||||||
and
|
|
||||||
|
|
||||||
`wordpress/wp-contents/sqlite-integration`
|
|
||||||
|
|
||||||
respectively.
|
|
||||||
|
|
||||||
OK. This is all. Upload everything (keeping the directory structure) to your server and access the wp-admin/install.php with your favorite browser, and WordPress installation process will begin. Enjoy your blogging!
|
|
||||||
|
|
||||||
= Migrate your database to SQLite Integration =
|
|
||||||
|
|
||||||
If you are using PDO for WordPress now, you can migrate your database to SQLite Integration. You don't have to reinstall WordPress. Please follow the next steps:
|
|
||||||
|
|
||||||
1. Check if your MyBlog.sqlite file contains all the tables required by WordPress. You have to use a utility software like [SQLite Manager Mozilla Addon](https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/). See also [Database Description](http://codex.wordpress.org/Database_Description) in Codex.
|
|
||||||
|
|
||||||
2. Backup your MyBlog.sqlite and db.php files.
|
|
||||||
|
|
||||||
3. EITHER rename your MyBlog.sqlite to .ht.sqlite OR add the next line in wp-config.php file.
|
|
||||||
|
|
||||||
`define('FQDB', 'MyBlog.sqlite');`
|
|
||||||
|
|
||||||
4. Overwrite your wp-content/db.php with the db.php file contained in SQLite Integration archive.
|
|
||||||
|
|
||||||
That's all. Don't forget to check the requirement and your WordPress version. *SQLite Integration doesn't work with WordPress version 3.2.x or lesser*.
|
|
||||||
|
|
||||||
== Frequently Asked Questions ==
|
|
||||||
|
|
||||||
= Database file is not created =
|
|
||||||
|
|
||||||
The reason of failure in creating directory or files is often that PHP is not allowed to craete them. Please check your server setting or ask the administrator.
|
|
||||||
|
|
||||||
= Such and such plugins can't be activated or doesn't seem to work properly =
|
|
||||||
|
|
||||||
Some of the plugins, especially cache plugins or database maintenace plugins, are not compatible with this plugin. Please activate SQLite Integration and see the plugin comatibility section in the documentation or visit the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/).
|
|
||||||
|
|
||||||
= I don't want the admin menu and documentation =
|
|
||||||
|
|
||||||
Just deactivate the plugin, and you can remove them. Activation and deactivation affect only admin menu. If you want to remove all the plugin files, just delete it.
|
|
||||||
|
|
||||||
== Screenshots ==
|
|
||||||
|
|
||||||
1. System Information tells you your database status and installed plugins compatibility.
|
|
||||||
|
|
||||||
== Requirements ==
|
|
||||||
|
|
||||||
* PHP 5.2 or newer with PDO extension (PHP 5.3 or newer is better).
|
|
||||||
* PDO SQLite driver must be loaded.
|
|
||||||
|
|
||||||
== Known Limitations ==
|
|
||||||
|
|
||||||
Many of the other plugins will work fine with this plugin. But there are some you can't use. Generally speaking, the plugins that manipulate database not with WordPress functions but with Mysql or Mysqli native drivers from PHP might cause the problem.
|
|
||||||
|
|
||||||
These are other examples:
|
|
||||||
|
|
||||||
= You can't use these plugins because they create the same file that this plugin uses: =
|
|
||||||
|
|
||||||
* [W3 Total Cache](http://wordpress.org/extend/plugins/w3-total-cache/)
|
|
||||||
* [DB Cache Reloaded Fix](http://wordpress.org/extend/plugins/db-cache-reloaded-fix/)
|
|
||||||
* [HyperDB](http://wordpress.org/extend/plugins/hyperdb/)
|
|
||||||
|
|
||||||
= You can't use some of the plugins, because they are using MySQL specific features that SQLite can't emulate. For example: =
|
|
||||||
|
|
||||||
* [Yet Another Related Posts](http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/)
|
|
||||||
* [Better Related Posts](http://wordpress.org/extend/plugins/better-related/)
|
|
||||||
|
|
||||||
Probably there are more, I'm afraid. If you find one, please let me know.
|
|
||||||
|
|
||||||
== Upgrade Notice ==
|
|
||||||
|
|
||||||
When auto upgrading of SQLite Integration fails, please try manual upgrade via FTP.
|
|
||||||
|
|
||||||
== Changelog ==
|
|
||||||
|
|
||||||
= 1.4 (2013-09-12) =
|
|
||||||
* Added the database maintenance utility for fixing the database mulfunction of the upgraded WordPress installation.
|
|
||||||
* Changed the manipulation of SHOW INDEX query with WHERE clause.
|
|
||||||
* Fixed the bug of the manipulation of ALTER TABLE query.
|
|
||||||
|
|
||||||
= 1.3 (2013-09-04) =
|
|
||||||
* Added the backup utility that creates the zipped archive of the current snapshot of the database file.
|
|
||||||
* Changed the dashboard style to match MP6 plugin.
|
|
||||||
* Changed the way of putting out the error messages when language catalogs are not loaded.
|
|
||||||
* Modified the _rewrite_field_types() in query_create.class.php for the dbDelta() function to work properly.
|
|
||||||
* Added the support for BETWEEN statement.
|
|
||||||
* Changed the regular expression to remove all the index hints from the query string.
|
|
||||||
* Fixed the manipulation of ALTER TABLE CHANGE COLUMN query for NewStatPress plugin to work.
|
|
||||||
* Fixed minor bugs.
|
|
||||||
|
|
||||||
= 1.2.1 (2013-08-04) =
|
|
||||||
* Removed wpdb::real_escape property following the change of the wpdb.php file which makes the plugin compatible with Wordpress 3.6.
|
|
||||||
|
|
||||||
= 1.2 (2013-08-03) =
|
|
||||||
* Fixed the date string format and its quotation for calendar widget.
|
|
||||||
* Fixed the patch utility program for using on the Windows machine.
|
|
||||||
* Fixed the textdomain error in utilities/patch.php file when uploading the patch file.
|
|
||||||
* Changed the manipulation of the query with ON DUPLICATE KEY UPDATE.
|
|
||||||
* Fixed the typos in readme.txt and readme-ja.txt.
|
|
||||||
|
|
||||||
= 1.1 (2013-07-24) =
|
|
||||||
* Fixed the manipulation of DROP INDEX query.
|
|
||||||
* Removed destruct() from shutdown_hook.
|
|
||||||
* Enabled LOCATE() function in the query string.
|
|
||||||
|
|
||||||
= 1.0 (2013-07-07) =
|
|
||||||
* First release version of the plugin.
|
|
30
schema.php
30
schema.php
|
@ -1,12 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file defines the make_db_sqlite() function.
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu, Justin Adie
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
echo 'Thank you, but you are not allowed to access this file.';
|
||||||
|
die();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Function to create tables according to the schemas of WordPress
|
* Function to create tables according to the schemas of WordPress.
|
||||||
* This is run only once while installation.
|
*
|
||||||
|
* This is executed only once while installation.
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function make_db_sqlite() {
|
function make_db_sqlite() {
|
||||||
|
@ -14,7 +22,7 @@ function make_db_sqlite() {
|
||||||
include_once ABSPATH . 'wp-admin/includes/schema.php';
|
include_once ABSPATH . 'wp-admin/includes/schema.php';
|
||||||
$index_array = array();
|
$index_array = array();
|
||||||
|
|
||||||
ob_end_clean();
|
//ob_end_clean();
|
||||||
$table_schemas = wp_get_db_schema();
|
$table_schemas = wp_get_db_schema();
|
||||||
$queries = explode (";", $table_schemas);
|
$queries = explode (";", $table_schemas);
|
||||||
$query_parser = new CreateQuery();
|
$query_parser = new CreateQuery();
|
||||||
|
@ -24,8 +32,7 @@ function make_db_sqlite() {
|
||||||
$err_data = $err->errorInfo;
|
$err_data = $err->errorInfo;
|
||||||
$message = 'Database connection error!<br />';
|
$message = 'Database connection error!<br />';
|
||||||
$message .= sprintf("Error message is: %s", $err_data[2]);
|
$message .= sprintf("Error message is: %s", $err_data[2]);
|
||||||
echo $message;
|
wp_die($message, 'Database Error!');
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -40,10 +47,10 @@ function make_db_sqlite() {
|
||||||
$index_queries = $rewritten_query;
|
$index_queries = $rewritten_query;
|
||||||
$table_query = trim($table_query);
|
$table_query = trim($table_query);
|
||||||
$pdo->exec($table_query);
|
$pdo->exec($table_query);
|
||||||
// foreach($rewritten_query as $single_query) {
|
//foreach($rewritten_query as $single_query) {
|
||||||
// $single_query = trim($single_query);
|
// $single_query = trim($single_query);
|
||||||
// $pdo->exec($single_query);
|
// $pdo->exec($single_query);
|
||||||
// }
|
//}
|
||||||
} else {
|
} else {
|
||||||
$rewritten_query = trim($rewritten_query);
|
$rewritten_query = trim($rewritten_query);
|
||||||
$pdo->exec($rewritten_query);
|
$pdo->exec($rewritten_query);
|
||||||
|
@ -78,8 +85,7 @@ function make_db_sqlite() {
|
||||||
$pdo->rollBack();
|
$pdo->rollBack();
|
||||||
$message = sprintf("Error occured while creating tables or indexes...<br />Query was: %s<br />", var_export($rewritten_query, true));
|
$message = sprintf("Error occured while creating tables or indexes...<br />Query was: %s<br />", var_export($rewritten_query, true));
|
||||||
$message .= sprintf("Error message is: %s", $err_data[2]);
|
$message .= sprintf("Error message is: %s", $err_data[2]);
|
||||||
echo $message;
|
wp_die($message, 'Database Error!');
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,14 @@ Plugin Name: SQLite Integration
|
||||||
Plugin URI: http://dogwood.skr.jp/wordpress/sqlite-integration/
|
Plugin URI: http://dogwood.skr.jp/wordpress/sqlite-integration/
|
||||||
Description: SQLite Integration is the plugin that enables WordPress to use SQLite. If you don't have MySQL and want to build a WordPress website, it's for you.
|
Description: SQLite Integration is the plugin that enables WordPress to use SQLite. If you don't have MySQL and want to build a WordPress website, it's for you.
|
||||||
Author: Kojima Toshiyasu
|
Author: Kojima Toshiyasu
|
||||||
Version: 1.4
|
Version: 1.8.1
|
||||||
Author URI: http://dogwood.skr.jp
|
Author URI: http://dogwood.skr.jp
|
||||||
Text Domain: sqlite-integration
|
Text Domain: sqlite-integration
|
||||||
Domain Path: /languages
|
Domain Path: /languages
|
||||||
License: GPL2 or later
|
License: GPL2 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Copyright 2013 Kojima Toshiyasu (email: kjm@dogwood.skr.jp)
|
/* Copyright 2013-2014 Kojima Toshiyasu (email: kjm@dogwood.skr.jp)
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License, version 2, as
|
it under the terms of the GNU General Public License, version 2, as
|
||||||
published by the Free Software Foundation.
|
published by the Free Software Foundation.
|
||||||
|
@ -27,14 +27,35 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Globals
|
* This file defines global constants and defines SQLiteIntegration class.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
echo 'Thank you, but you are not allowed to access this file.';
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* This will be activated after the installation is finished.
|
||||||
|
* So you can use all the functionality of WordPress.
|
||||||
*/
|
*/
|
||||||
$siteurl = get_option('siteurl');
|
$siteurl = get_option('siteurl');
|
||||||
|
/*
|
||||||
|
* Defines basic constants.
|
||||||
|
*/
|
||||||
|
define('SQLITE_INTEGRATION_VERSION', '1.8.1');
|
||||||
define('SQLiteDir', dirname(plugin_basename(__FILE__)));
|
define('SQLiteDir', dirname(plugin_basename(__FILE__)));
|
||||||
define('SQLiteFilePath', dirname(__FILE__));
|
define('SQLiteFilePath', dirname(__FILE__));
|
||||||
define('SQLiteDirName', basename(SQLiteFilePath));
|
define('SQLiteDirName', basename(SQLiteFilePath));
|
||||||
define('SQLiteUrl', $siteurl . '/wp-content/plugins/' . SQLiteDir);
|
if (defined('WP_PLUGIN_URL')) {
|
||||||
|
define('SQLiteUrl', WP_PLUGIN_URL . '/' . SQLiteDir);
|
||||||
|
} else {
|
||||||
|
define('SQLiteUrl', $siteurl . '/wp-content/plugins/' . SQLiteDir);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Defines patch file upload directory.
|
||||||
|
*/
|
||||||
if (defined('UPLOADS')) {
|
if (defined('UPLOADS')) {
|
||||||
define('SQLitePatchDir', UPLOADS . '/patches');
|
define('SQLitePatchDir', UPLOADS . '/patches');
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,9 +65,13 @@ if (defined('UPLOADS')) {
|
||||||
define('SQLitePatchDir', ABSPATH . 'wp-content/uploads/patches');
|
define('SQLitePatchDir', ABSPATH . 'wp-content/uploads/patches');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Plugin compatibility file in json format.
|
||||||
|
*/
|
||||||
define('SQLiteListFile', SQLiteFilePath . '/utilities/plugin_lists.json');
|
define('SQLiteListFile', SQLiteFilePath . '/utilities/plugin_lists.json');
|
||||||
|
/*
|
||||||
|
* Instantiates utility classes.
|
||||||
|
*/
|
||||||
if (!class_exists('SQLiteIntegrationUtils')) {
|
if (!class_exists('SQLiteIntegrationUtils')) {
|
||||||
require_once SQLiteFilePath . '/utilities/utility.php';
|
require_once SQLiteFilePath . '/utilities/utility.php';
|
||||||
$utils = new SQLiteIntegrationUtils();
|
$utils = new SQLiteIntegrationUtils();
|
||||||
|
@ -65,38 +90,50 @@ if (!class_exists('DatabaseMaintenance')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is for WordPress Administration Panel
|
* This class is for WordPress Administration Panel.
|
||||||
|
*
|
||||||
* This class and other utility classes don't affect the base functionality
|
* This class and other utility classes don't affect the base functionality
|
||||||
* of the plugin.
|
* of the plugin.
|
||||||
*
|
*
|
||||||
* @package SQLite Integration
|
|
||||||
* @author Kojima Toshiyasu
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class SQLiteIntegration {
|
class SQLiteIntegration {
|
||||||
/**
|
/**
|
||||||
* This constructor does everything needed
|
* Constructor.
|
||||||
|
*
|
||||||
|
* This constructor does everything needed for the administration panel.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
*/
|
*/
|
||||||
function __construct() {
|
function __construct() {
|
||||||
if (function_exists('register_activation_hook')) {
|
if (function_exists('register_activation_hook')) {
|
||||||
register_activation_hook(__FILE__, array($this, 'install'));
|
register_activation_hook(__FILE__, array($this, 'install'));
|
||||||
}
|
}
|
||||||
if (function_exists('register_deactivation_hook')) {
|
if (function_exists('register_deactivation_hook')) {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
if (function_exists('register_uninstall_hook')) {
|
if (function_exists('register_uninstall_hook')) {
|
||||||
register_uninstall_hook(__FILE__, array('SQLiteIntegration', 'uninstall'));
|
register_uninstall_hook(__FILE__, array('SQLiteIntegration', 'uninstall'));
|
||||||
}
|
}
|
||||||
if (function_exists('is_multisite') && is_multisite()) {
|
if (function_exists('is_multisite') && is_multisite()) {
|
||||||
add_action('network_admin_menu', array($this, 'add_network_pages'));
|
add_action('network_admin_menu', array($this, 'add_network_pages'));
|
||||||
|
add_action('network_admin_notices', array('SQLiteIntegrationUtils', 'show_admin_notice'));
|
||||||
} else {
|
} else {
|
||||||
add_action('admin_menu', array($this, 'add_pages'));
|
add_action('admin_menu', array($this, 'add_pages'));
|
||||||
|
add_action('admin_notices', array('SQLiteIntegrationUtils', 'show_admin_notice'));
|
||||||
}
|
}
|
||||||
|
// See the docstring for download_backup_db() in utilities/utility.php
|
||||||
|
// We need this registration process.
|
||||||
|
add_action('admin_init', array('SQLiteIntegrationUtils', 'download_backup_db'));
|
||||||
add_action('plugins_loaded', array($this, 'textdomain_init'));
|
add_action('plugins_loaded', array($this, 'textdomain_init'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nothing to install
|
* Method to install on multisite or single site.
|
||||||
* for future use...
|
*
|
||||||
|
* There really is nothing to install for now. It is for future use...
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return returns null.
|
||||||
*/
|
*/
|
||||||
function install() {
|
function install() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
@ -116,17 +153,26 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nothing to do...
|
* Method to install something.
|
||||||
* We show menu and documents only to the network administrator
|
*
|
||||||
|
* We have nothing to do for now.
|
||||||
|
* We show menu and documents only to the network administrator.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function _install() {
|
function _install() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is it better that we remove wp-content/db.php and wp-content/patches
|
* Method to uninstall plugin.
|
||||||
* directory?...
|
*
|
||||||
|
* This will remove wp-content/db.php and wp-content/patches direcotry.
|
||||||
* If you migrate the site to the sever with MySQL, you have only to
|
* If you migrate the site to the sever with MySQL, you have only to
|
||||||
* migrate the data in the database.
|
* migrate the data in the database.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function uninstall() {
|
function uninstall() {
|
||||||
// remove patch files and patch directory
|
// remove patch files and patch directory
|
||||||
|
@ -151,10 +197,15 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Method to manipulate the admin panel, stylesheet and JavaScript.
|
||||||
|
*
|
||||||
* We use class method to show pages and want to load style files and script
|
* We use class method to show pages and want to load style files and script
|
||||||
* files only in our plugin documents, so we need add_submenu_page with parent
|
* files only in our plugin documents, so we need add_submenu_page with parent
|
||||||
* slug set to null. This means that menu items are added but hidden from the
|
* slug set to null. This means that menu items are added but hidden from the
|
||||||
* users.
|
* users.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function add_pages() {
|
function add_pages() {
|
||||||
global $utils, $doc, $patch_utils, $maintenance;
|
global $utils, $doc, $patch_utils, $maintenance;
|
||||||
|
@ -168,7 +219,7 @@ class SQLiteIntegration {
|
||||||
add_action('admin_print_styles-'.$welcome_page, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$welcome_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$edit_db, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$edit_db, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$doc_page, array($this, 'add_doc_style_sheet'));
|
add_action('admin_print_styles-'.$doc_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$patch_page, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$patch_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_scripts-'.$util_page, array($this, 'add_sqlite_script'));
|
add_action('admin_print_scripts-'.$util_page, array($this, 'add_sqlite_script'));
|
||||||
add_action('admin_print_scripts-'.$doc_page, array($this, 'add_sqlite_script'));
|
add_action('admin_print_scripts-'.$doc_page, array($this, 'add_sqlite_script'));
|
||||||
|
@ -179,8 +230,12 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network admin can only see documents and manipulate patch files.
|
* Method to manipulate network admin panel.
|
||||||
* So, capability is set to manage_network_options.
|
*
|
||||||
|
* Capability is set to manage_network_options.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function add_network_pages() {
|
function add_network_pages() {
|
||||||
global $utils, $doc, $patch_utils, $maintenance;
|
global $utils, $doc, $patch_utils, $maintenance;
|
||||||
|
@ -194,7 +249,7 @@ class SQLiteIntegration {
|
||||||
add_action('admin_print_styles-'.$welcome_page, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$welcome_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$edit_db, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$edit_db, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$doc_page, array($this, 'add_doc_style_sheet'));
|
add_action('admin_print_styles-'.$doc_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$patch_page, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$patch_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_scripts-'.$util_page, array($this, 'add_sqlite_script'));
|
add_action('admin_print_scripts-'.$util_page, array($this, 'add_sqlite_script'));
|
||||||
add_action('admin_print_scripts-'.$doc_page, array($this, 'add_sqlite_script'));
|
add_action('admin_print_scripts-'.$doc_page, array($this, 'add_sqlite_script'));
|
||||||
|
@ -205,38 +260,60 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Japanese catalog is only available
|
* Method to initialize textdomain.
|
||||||
|
*
|
||||||
|
* Japanese catalog is only available.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function textdomain_init() {
|
function textdomain_init() {
|
||||||
global $utils;
|
global $utils;
|
||||||
// $current_locale = get_locale();
|
//$current_locale = get_locale();
|
||||||
// if (!empty($current_locale)) {
|
//if (!empty($current_locale)) {
|
||||||
// $moFile = dirname(__FILE__) . "/languages/sqlite-wordpress-" . $current_locale . ".mo";
|
// $moFile = dirname(__FILE__) . "/languages/sqlite-wordpress-" . $current_locale . ".mo";
|
||||||
// if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('sqlite-wordpress', $moFile);
|
// if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('sqlite-wordpress', $moFile);
|
||||||
// }
|
//}
|
||||||
load_plugin_textdomain($utils->text_domain, false, SQLiteDir.'/languages/');
|
load_plugin_textdomain($utils->text_domain, false, SQLiteDir.'/languages/');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Styles and JavaScripts
|
* Method to initialize stylesheet on the admin panel.
|
||||||
|
*
|
||||||
|
* This determines which stylesheet to use depending on the users' choice
|
||||||
|
* of admin_color. Each stylesheet imports style.css and change the color
|
||||||
|
* of the admin dashboard.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function add_style_sheet() {
|
function add_style_sheet() {
|
||||||
$style_url = SQLiteUrl . '/styles/style.css';
|
global $current_user;
|
||||||
$style_file = SQLiteFilePath . '/styles/style.css';
|
get_currentuserinfo();
|
||||||
|
$admin_color = get_user_meta($current_user->ID, 'admin_color', true);
|
||||||
|
if ($admin_color == 'fresh') {
|
||||||
|
$stylesheet_file = 'style.min.css';
|
||||||
|
} else {
|
||||||
|
$stylesheet_file = $admin_color . '.min.css';
|
||||||
|
}
|
||||||
|
$style_url = SQLiteUrl . '/styles/' . $stylesheet_file;
|
||||||
|
$style_file = SQLiteFilePath . '/styles/' . $stylesheet_file;
|
||||||
if (file_exists($style_file)) {
|
if (file_exists($style_file)) {
|
||||||
wp_enqueue_style('sqlite_integration_stylesheet', $style_url);
|
wp_enqueue_style('sqlite_integration_stylesheet', $style_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function add_doc_style_sheet() {
|
/**
|
||||||
$style_url = SQLiteUrl . '/styles/doc.css';
|
* Method to register the JavaScript file.
|
||||||
$style_file = SQLiteFilePath . '/styles/doc.css';
|
*
|
||||||
if (file_exists($style_file)) {
|
* To register the JavaScript file. It's only for the admin dashboard.
|
||||||
wp_enqueue_style('sqlite_integration_doc_style', $style_url);
|
* It won't included in web pages.
|
||||||
}
|
*
|
||||||
}
|
* @param no parameter is provided.
|
||||||
|
* @return no return value.
|
||||||
|
*/
|
||||||
function add_sqlite_script() {
|
function add_sqlite_script() {
|
||||||
$script_url = SQLiteUrl . '/js/sqlite.js';
|
$script_url = SQLiteUrl . '/js/sqlite.min.js';
|
||||||
$script_file = SQLiteFilePath . '/js/sqlite.js';
|
$script_file = SQLiteFilePath . '/js/sqlite.min.js';
|
||||||
if (file_exists($script_file)) {
|
if (file_exists($script_file)) {
|
||||||
wp_enqueue_script('sqlite-integration', $script_url, 'jquery');
|
wp_enqueue_script('sqlite-integration', $script_url, 'jquery');
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of SQLite Integration.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
@import url('./style.min.css');
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
#sqlite-admin-wrap h2,
|
||||||
|
#sqlite-admin-side-wrap h2 {
|
||||||
|
background: #4796b3;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
.menu-item {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border: .5px solit #000;
|
||||||
|
background: #4796b3;
|
||||||
|
color: (255, 255, 255);
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.menu-selected {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border: .5px solit #000;
|
||||||
|
background: #096484;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
.menu-item a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#4796b3;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#4796b3;color:(255,255,255);line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#096484;color:#fff}.menu-item a{text-decoration:none;color:#fff}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of SQLite Integration.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
@import url('./style.min.css');
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
#sqlite-admin-wrap h2,
|
||||||
|
#sqlite-admin-side-wrap h2 {
|
||||||
|
background: #59524c;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
.menu-item {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border: .5px solit #000;
|
||||||
|
background: #59524c;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.menu-selected {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
background: #c7a589;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
.menu-item a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#59524c;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#59524c;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#c7a589;color:#fff}.menu-item a{text-decoration:none;color:#fff}
|
124
styles/doc.css
124
styles/doc.css
|
@ -1,124 +0,0 @@
|
||||||
@CHARSET "UTF-8";
|
|
||||||
#sqlite-admin-wrap h2,
|
|
||||||
#sqlite-admin-side-wrap h2 {
|
|
||||||
background: rgb(34, 34, 34);
|
|
||||||
color: rgb(256, 256, 256);
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
.navigation {
|
|
||||||
display: block;
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
min-height: 20px;
|
|
||||||
/* border: 1px solid #000; */
|
|
||||||
}
|
|
||||||
.navi-menu {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
.menu-item {
|
|
||||||
font-size: 20px;
|
|
||||||
display: inline;
|
|
||||||
min-width: 150px;
|
|
||||||
height: 50px;
|
|
||||||
margin-left: 0;
|
|
||||||
margin-right: 10px;
|
|
||||||
padding: 5px;
|
|
||||||
border: .5px solit #000;
|
|
||||||
background: rgb(51, 51, 51);
|
|
||||||
color: (256, 256, 256);
|
|
||||||
}
|
|
||||||
.menu-selected {
|
|
||||||
font-size: 20px;
|
|
||||||
display: inline;
|
|
||||||
min-width: 150px;
|
|
||||||
height: 50px;
|
|
||||||
margin-left: 0;
|
|
||||||
margin-right: 10px;
|
|
||||||
padding: 5px;
|
|
||||||
border: .5px solit #000;
|
|
||||||
background: rgb(0, 116, 162);
|
|
||||||
color: rgb(256, 256, 256);
|
|
||||||
}
|
|
||||||
.menu-item a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: rgb(256, 256, 256);
|
|
||||||
}
|
|
||||||
#sqlite-admin-wrap {
|
|
||||||
color: #1d1d1d;
|
|
||||||
font-size: 10pt;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
background: rgb(256, 256, 256);
|
|
||||||
/* border-top: 0; */
|
|
||||||
-webkit-border-bottom-right-radius: 6px;
|
|
||||||
-webkit-border-bottom-left-radius: 6px;
|
|
||||||
-moz-border-radius-bottomright: 6px;
|
|
||||||
-moz-border-radius-bottomleft: 6px;
|
|
||||||
border-bottom-right-radius: 6px;
|
|
||||||
border-bottom-left-radius: 6px;
|
|
||||||
-webkit-border-top-right-radius: 6px;
|
|
||||||
-webkit-border-top-left-radius: 6px;
|
|
||||||
-moz-border-radius-topright: 6px;
|
|
||||||
-moz-border-radius-topleft: 6px;
|
|
||||||
border-top-right-radius: 6px;
|
|
||||||
border-top-left-radius: 6px;
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
min-height: 100px;
|
|
||||||
position: relative;
|
|
||||||
width: 47%;
|
|
||||||
margin-top: 10px;
|
|
||||||
padding: 5px;
|
|
||||||
box-shadow: 5px 5px 5px #eee;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
#sqlite-admin-side-wrap {
|
|
||||||
color: #1d1d1d;
|
|
||||||
font-size: 10pt;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
background: rgb(256, 256, 256);
|
|
||||||
/* border-top: 0; */
|
|
||||||
-webkit-border-bottom-right-radius: 6px;
|
|
||||||
-webkit-border-bottom-left-radius: 6px;
|
|
||||||
-moz-border-radius-bottomright: 6px;
|
|
||||||
-moz-border-radius-bottomleft: 6px;
|
|
||||||
border-bottom-right-radius: 6px;
|
|
||||||
border-bottom-left-radius: 6px;
|
|
||||||
-webkit-border-top-right-radius: 6px;
|
|
||||||
-webkit-border-top-left-radius: 6px;
|
|
||||||
-moz-border-radius-topright: 6px;
|
|
||||||
-moz-border-radius-topleft: 6px;
|
|
||||||
border-top-right-radius: 6px;
|
|
||||||
border-top-left-radius: 6px;
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
min-height: 100px;
|
|
||||||
position: relative;
|
|
||||||
width: 47%;
|
|
||||||
margin-top: 10px;
|
|
||||||
padding: 5px;
|
|
||||||
box-shadow: 5px 5px 5px #eee;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
text-indent: 15px;
|
|
||||||
line-height: 150%;
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
ul {
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
ol {
|
|
||||||
margin-left: 40px;
|
|
||||||
}
|
|
||||||
pre.code {
|
|
||||||
margin-left: 10px;
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
.alt {
|
|
||||||
background: rgb(247, 254, 236);
|
|
||||||
}
|
|
||||||
.em {
|
|
||||||
font-weight: bold;
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of SQLite Integration.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
@import url('./style.min.css');
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
#sqlite-admin-wrap h2,
|
||||||
|
#sqlite-admin-side-wrap h2 {
|
||||||
|
background: #523f6d;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
.menu-item {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border: .5px solit #000;
|
||||||
|
background: #523f6d;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.menu-selected {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
background: #a3b745;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
.menu-item a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#523f6d;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#523f6d;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#a3b745;color:#fff}.menu-item a{text-decoration:none;color:#fff}
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
/* Silence is golden */
|
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of SQLite Integration.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
@import url('./style.min.css');
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
#sqlite-admin-wrap h2,
|
||||||
|
#sqlite-admin-side-wrap h2 {
|
||||||
|
background: #e5e5e5;
|
||||||
|
color: rgb(55, 55, 55);
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
.menu-item {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border: .5px solit #000;
|
||||||
|
background: #e5e5e5;
|
||||||
|
color: rgb(55, 55, 55);
|
||||||
|
border-bottom-color: whitesmoke;
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.menu-selected {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
background: #888888;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
border-bottom-color: whitesmoke;
|
||||||
|
}
|
||||||
|
.menu-item a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(55, 55, 55);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#e5e5e5;color:#373737;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#e5e5e5;color:#373737;border-bottom-color:whitesmoke;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#888;color:#fff;border-bottom-color:whitesmoke}.menu-item a{text-decoration:none;color:#373737}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of SQLite Integration.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
@import url('./style.min.css');
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
#sqlite-admin-wrap h2,
|
||||||
|
#sqlite-admin-side-wrap h2 {
|
||||||
|
background: #363b3f;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
.menu-item {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border: .5px solit #000;
|
||||||
|
background: #363b3f;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.menu-selected {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
background: #e14d43;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
.menu-item a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
.menu-item {
|
||||||
|
background: #363b3f;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#363b3f;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#363b3f;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#e14d43;color:#fff}.menu-item a{text-decoration:none;color:#fff}.menu-item{background:#363b3f;color:#fff}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of SQLite Integration.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
@import url('./style.min.css');
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
#sqlite-admin-wrap h2,
|
||||||
|
#sqlite-admin-side-wrap h2 {
|
||||||
|
background: #738e96;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
.menu-item {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border: .5px solit #000;
|
||||||
|
background: #738e96;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.menu-selected {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
background: #9ebaa0;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
.menu-item a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#738e96;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#738e96;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#9ebaa0;color:#fff}.menu-item a{text-decoration:none;color:#fff}
|
214
styles/style.css
214
styles/style.css
|
@ -1,8 +1,14 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of SQLite Integration.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
#sqlite-admin-wrap h2,
|
#sqlite-admin-wrap h2,
|
||||||
#sqlite-admin-side-wrap h2 {
|
#sqlite-admin-side-wrap h2 {
|
||||||
background: rgb(34, 34, 34);
|
background: rgb(34, 34, 34);
|
||||||
color: rgb(256, 256, 256);
|
color: rgb(255, 255, 255);
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
h3 {
|
h3 {
|
||||||
|
@ -13,7 +19,6 @@ h3 {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
min-height: 20px;
|
min-height: 20px;
|
||||||
/* border: 1px solid #000; */
|
|
||||||
}
|
}
|
||||||
.navi-menu {
|
.navi-menu {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
|
@ -28,7 +33,8 @@ h3 {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: .5px solit #000;
|
border: .5px solit #000;
|
||||||
background: rgb(51, 51, 51);
|
background: rgb(51, 51, 51);
|
||||||
color: (256, 256, 256);
|
color: (255, 255, 255);
|
||||||
|
line-height: 40px;
|
||||||
}
|
}
|
||||||
.menu-selected {
|
.menu-selected {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
@ -39,19 +45,18 @@ h3 {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: .5px solit #000;
|
border: .5px solit #000;
|
||||||
background: rgb(0, 116, 162);
|
background: rgb(46, 162, 204);
|
||||||
color: rgb(256, 256, 256);
|
color: rgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
.menu-item a {
|
.menu-item a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: rgb(256, 256, 256);
|
color: rgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
#sqlite-admin-wrap {
|
#sqlite-admin-wrap {
|
||||||
color: #1d1d1d;
|
color: #1d1d1d;
|
||||||
font-size: 10pt;
|
font-size: 11pt;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
background: rgb(256, 256, 256);
|
background: rgb(255, 255, 255);
|
||||||
/* border-top: 0; */
|
|
||||||
-webkit-border-bottom-right-radius: 6px;
|
-webkit-border-bottom-right-radius: 6px;
|
||||||
-webkit-border-bottom-left-radius: 6px;
|
-webkit-border-bottom-left-radius: 6px;
|
||||||
-moz-border-radius-bottomright: 6px;
|
-moz-border-radius-bottomright: 6px;
|
||||||
|
@ -74,11 +79,14 @@ h3 {
|
||||||
box-shadow: 5px 5px 5px #eee;
|
box-shadow: 5px 5px 5px #eee;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
#wpbody-content > .single {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
#sqlite-admin-side-wrap {
|
#sqlite-admin-side-wrap {
|
||||||
color: #1d1d1d;
|
color: #1d1d1d;
|
||||||
font-size: 10pt;
|
font-size: 11pt;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
background: rgb(256, 256, 256);
|
background: rgb(255, 255, 255);
|
||||||
/* border-top: 0; */
|
/* border-top: 0; */
|
||||||
-webkit-border-bottom-right-radius: 6px;
|
-webkit-border-bottom-right-radius: 6px;
|
||||||
-webkit-border-bottom-left-radius: 6px;
|
-webkit-border-bottom-left-radius: 6px;
|
||||||
|
@ -104,27 +112,33 @@ h3 {
|
||||||
}
|
}
|
||||||
p {
|
p {
|
||||||
text-indent: 15px;
|
text-indent: 15px;
|
||||||
line-height: 150%;
|
line-height: 160%;
|
||||||
|
font-size: 11pt;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
line-height: 130%;
|
||||||
}
|
}
|
||||||
table#sys-info{
|
table#sys-info{
|
||||||
/* width: 600px; */
|
/* width: 600px; */
|
||||||
width: 480px;
|
width: 80%;
|
||||||
}
|
}
|
||||||
table#status {
|
table#status {
|
||||||
width: 480px;
|
width: 100%;
|
||||||
}
|
}
|
||||||
table#sqlite-table {
|
table#sqlite-table {
|
||||||
/* width: 700px; */
|
/* width: 700px; */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
th.tbl-name {
|
th.tbl-name {
|
||||||
width: 200px;
|
width: 25%;
|
||||||
}
|
}
|
||||||
th.tbl_owner {
|
th.tbl_owner {
|
||||||
width: 105px;
|
width: 25%;
|
||||||
}
|
}
|
||||||
th.tbl_index {
|
th.tbl_index {
|
||||||
width: 300px;
|
width: 50%;
|
||||||
}
|
}
|
||||||
td.system {
|
td.system {
|
||||||
color: rgb(153, 0, 0);
|
color: rgb(153, 0, 0);
|
||||||
|
@ -138,7 +152,7 @@ td.menu-title {
|
||||||
table.statement {
|
table.statement {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
}
|
}
|
||||||
ul {
|
ul.in-body-list {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
ol {
|
ol {
|
||||||
|
@ -149,6 +163,9 @@ pre.code {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
background: #eee;
|
background: #eee;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
tr.incompatible {
|
tr.incompatible {
|
||||||
background: rgb(251, 229, 221);
|
background: rgb(251, 229, 221);
|
||||||
|
@ -159,10 +176,10 @@ tr.workaround {
|
||||||
tr.compatible {
|
tr.compatible {
|
||||||
}
|
}
|
||||||
th.active-plugins {
|
th.active-plugins {
|
||||||
width: 120px;
|
width: 20%;
|
||||||
}
|
}
|
||||||
th.compatible {
|
th.compatible {
|
||||||
width: 80px;
|
width: 30%;
|
||||||
}
|
}
|
||||||
input.button-primary {
|
input.button-primary {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -172,19 +189,23 @@ input.button-primary {
|
||||||
.alt {
|
.alt {
|
||||||
background: rgb(247, 254, 236);
|
background: rgb(247, 254, 236);
|
||||||
}
|
}
|
||||||
|
.em {
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
table#patch-files .item,
|
table#patch-files .item,
|
||||||
table#backup-files .item {
|
table#backup-files .item {
|
||||||
width: 40px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
.alert {
|
.alert {
|
||||||
color: rgb(256, 0, 0);
|
color: rgb(255, 0, 0);
|
||||||
}
|
}
|
||||||
div.alert {
|
div.alert {
|
||||||
display: block;
|
display: block;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
color: rgb(256, 0, 0);
|
color: rgb(255, 0, 0);
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
blockquote.caution {
|
blockquote.caution {
|
||||||
|
@ -198,3 +219,150 @@ blockquote.caution > p {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
#errorlog,
|
||||||
|
#dbfile {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Media Query
|
||||||
|
*/
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
#sqlite-admin-wrap {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-wrap > table#sys-info{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
table#sys-info th.item {
|
||||||
|
width: 50%
|
||||||
|
}
|
||||||
|
#sqlite-admin-wrap > table#status {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
table#status th {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
table#sqlite-table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
th.tbl-name {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
th.tbl_owner {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
th.tbl_index {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap table#plugins-info {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
th.installed-plugins {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
th.active-plugins {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
th.compatible {
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap > table#plugins-table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap > table#plugins-table th.item {
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap > table#plugins-table th.compat {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap > table#plugins-table th.reason {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 782px) {
|
||||||
|
#sqlite-admin-wrap {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
table#plugins-info {
|
||||||
|
width: 480px;
|
||||||
|
}
|
||||||
|
table#sqlite-table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
th.tbl-name {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
th.tbl_owner {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
th.tbl_index {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
#plugins-table {
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 900px) {
|
||||||
|
#sqlite-admin-wrap {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
table#plugins-info {
|
||||||
|
width: 480px;
|
||||||
|
}
|
||||||
|
table#sqlite-table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
th.tbl-name {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
th.tbl_owner {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
th.tbl_index {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
#plugins-table {
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 1169px) {
|
||||||
|
#sqlite-admin-wrap {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
#sqlite-admin-side-wrap {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
table#plugins-info {
|
||||||
|
width: 480px;
|
||||||
|
}
|
||||||
|
table#sys-info {
|
||||||
|
width: 460px;
|
||||||
|
}
|
||||||
|
table#status {
|
||||||
|
width: 460px;
|
||||||
|
}
|
||||||
|
table#sqlite-table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
th.tbl-name {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
th.tbl_owner {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
th.tbl_index {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
#plugins-table {
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#222;color:#fff;padding-left:5px}h3{clear:both}.navigation{display:block;margin-top:0;margin-bottom:0;min-height:20px}.navi-menu{margin-left:0}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#333;color:(255,255,255);line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#2ea2cc;color:#fff}.menu-item a{text-decoration:none;color:#fff}#sqlite-admin-wrap{color:#1d1d1d;font-size:11pt;border:1px solid #ddd;background:#fff;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;border-top-right-radius:6px;border-top-left-radius:6px;display:block;float:left;min-height:100%;position:relative;width:58%;margin-top:10px;padding:5px;box-shadow:5px 5px 5px #eee;z-index:1}#wpbody-content>.single{width:95%}#sqlite-admin-side-wrap{color:#1d1d1d;font-size:11pt;border:1px solid #ddd;background:#fff;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;border-top-right-radius:6px;border-top-left-radius:6px;display:block;float:left;min-height:100%;position:relative;width:35%;margin-top:10px;padding:5px 5px 5px 5px;box-shadow:5px 5px 5px #eee;z-index:1}p{text-indent:15px;line-height:160%;font-size:11pt;margin-left:10px;margin-right:10px}li{line-height:130%}table#sys-info{width:80%}table#status{width:100%}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}td.system{color:#900}td.user{color:#00f}td.menu-title{width:95px}table.statement{width:500px}ul.in-body-list{margin-left:20px}ol{margin-left:40px}pre.code{padding:5px 5px 5px 5px;margin-left:15px;margin-right:10px;background:#eee;white-space:pre-wrap;word-wrap:break-word;overflow:auto}tr.incompatible{background:#fbe5dd}tr.workaround{background:#d9e8ed}th.active-plugins{width:20%}th.compatible{width:30%}input.button-primary{display:block;clear:both;width:100px}.alt{background:#f7feec}.em{font-weight:bold;text-transform:capitalize}table#patch-files .item,table#backup-files .item{width:150px}.alert{color:#f00}div.alert{display:block;width:95%;text-align:center;margin:0 auto;color:#f00;text-transform:capitalize}blockquote.caution{display:block;width:95%;border:3px double #000;margin:0 auto;padding:5px}blockquote.caution>p{margin:5px;padding:0}#errorlog,#dbfile{width:100%}@media screen and (max-width:600px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}#sqlite-admin-wrap>table#sys-info{width:100%}table#sys-info th.item{width:50%}#sqlite-admin-wrap>table#status{width:100%}table#status th{width:50%}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#sqlite-admin-side-wrap table#plugins-info{width:100%}th.installed-plugins{width:50%}th.active-plugins{width:20%}th.compatible{width:30%}#sqlite-admin-side-wrap>table#plugins-table{width:100%}#sqlite-admin-side-wrap>table#plugins-table th.item{width:30%}#sqlite-admin-side-wrap>table#plugins-table th.compat{width:20%}#sqlite-admin-side-wrap>table#plugins-table th.reason{width:50%}}@media screen and (max-width:782px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}@media screen and (max-width:900px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}@media screen and (max-width:1169px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sys-info{width:460px}table#status{width:460px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of SQLite Integration.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
@import url('./style.min.css');
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
#sqlite-admin-wrap h2,
|
||||||
|
#sqlite-admin-side-wrap h2 {
|
||||||
|
background: #cf4944;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
.menu-item {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border: .5px solit #000;
|
||||||
|
background: #cf4944;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
line-height: 40px;
|
||||||
|
}
|
||||||
|
.menu-selected {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline;
|
||||||
|
min-width: 150px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
background: #dd823b;
|
||||||
|
color: rgb(256, 256, 256);
|
||||||
|
}
|
||||||
|
.menu-item a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@import url('./style.min.css');@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#cf4944;color:#fff;padding-left:5px}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#cf4944;color:#fff;line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;background:#dd823b;color:#100100100}.menu-item a{text-decoration:none;color:#fff}
|
|
@ -1,9 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* database check and restoration
|
* This file defines DatabaseMaintenance class.
|
||||||
|
*
|
||||||
|
* When WordPress was upgraded from 3.5.x to 3.6, SQLite Integration couldn't manipulate
|
||||||
|
* dbDelta() function of WordPress as expected. As a result, there are some tables whose
|
||||||
|
* default values are missing.
|
||||||
|
*
|
||||||
* This file is for temporary use and will be removed or changed in the future release.
|
* This file is for temporary use and will be removed or changed in the future release.
|
||||||
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* This class provide the methods to check the table schemas and restore if necessary.
|
||||||
|
*
|
||||||
|
* Each method is a private function except the one to show admin page.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class DatabaseMaintenance {
|
class DatabaseMaintenance {
|
||||||
|
/**
|
||||||
|
* Method to check the table schemas.
|
||||||
|
*
|
||||||
|
* If there are any broken tables, it returns the array of the table names to be fixed.
|
||||||
|
* If not, it returns true.
|
||||||
|
*
|
||||||
|
* @return boolean|multitype:string
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private function sanity_check() {
|
private function sanity_check() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$results_table = array();
|
$results_table = array();
|
||||||
|
@ -17,13 +40,12 @@ class DatabaseMaintenance {
|
||||||
'comment_author_email' => '\'\'',
|
'comment_author_email' => '\'\'',
|
||||||
'comment_author_url' => '\'\'',
|
'comment_author_url' => '\'\'',
|
||||||
'comment_author_IP' => '\'\'',
|
'comment_author_IP' => '\'\'',
|
||||||
'comment_date' => '\'0000-00-00 00:00:00\'',
|
|
||||||
'comment_date_gmt' => '\'0000-00-00 00:00:00\'',
|
'comment_date_gmt' => '\'0000-00-00 00:00:00\'',
|
||||||
|
'comment_date' => '\'0000-00-00 00:00:00\'',
|
||||||
'comment_karma' => '\'0\'',
|
'comment_karma' => '\'0\'',
|
||||||
'comment_approved' => '\'1\'',
|
'comment_approved' => '\'1\'',
|
||||||
'comment_agent' => '\'\'',
|
'comment_agent' => '\'\'',
|
||||||
'comment_type' => '\'\'',
|
'comment_type' => '\'\'',
|
||||||
'comment_type' => '\'\'',
|
|
||||||
'comment_parent' => '\'0\'',
|
'comment_parent' => '\'0\'',
|
||||||
'user_id' => '\'0\''
|
'user_id' => '\'0\''
|
||||||
),
|
),
|
||||||
|
@ -50,15 +72,15 @@ class DatabaseMaintenance {
|
||||||
),
|
),
|
||||||
$wpdb->prefix.'posts' => array(
|
$wpdb->prefix.'posts' => array(
|
||||||
'post_author' => '\'0\'',
|
'post_author' => '\'0\'',
|
||||||
'post_date' => '\'0000-00-00 00:00:00\'',
|
|
||||||
'post_date_gmt' => '\'0000-00-00 00:00:00\'',
|
'post_date_gmt' => '\'0000-00-00 00:00:00\'',
|
||||||
|
'post_date' => '\'0000-00-00 00:00:00\'',
|
||||||
'post_status' => '\'publish\'',
|
'post_status' => '\'publish\'',
|
||||||
'comment_status' => '\'open\'',
|
'comment_status' => '\'open\'',
|
||||||
'ping_status' => '\'open\'',
|
'ping_status' => '\'open\'',
|
||||||
'post_password' => '\'\'',
|
'post_password' => '\'\'',
|
||||||
'post_name' => '\'\'',
|
'post_name' => '\'\'',
|
||||||
'post_modified' => '\'0000-00-00 00:00:00\'',
|
|
||||||
'post_modified_gmt' => '\'0000-00-00 00:00:00\'',
|
'post_modified_gmt' => '\'0000-00-00 00:00:00\'',
|
||||||
|
'post_modified' => '\'0000-00-00 00:00:00\'',
|
||||||
'post_parent' => '\'0\'',
|
'post_parent' => '\'0\'',
|
||||||
'guid' => '\'\'',
|
'guid' => '\'\'',
|
||||||
'menu_order' => '\'0\'',
|
'menu_order' => '\'0\'',
|
||||||
|
@ -90,7 +112,6 @@ class DatabaseMaintenance {
|
||||||
'user_status' => '\'0\'',
|
'user_status' => '\'0\'',
|
||||||
'display_name' => '\'\'',
|
'display_name' => '\'\'',
|
||||||
// for network install
|
// for network install
|
||||||
'user_login' => '\'\'',
|
|
||||||
'spam' => '\'0\'',
|
'spam' => '\'0\'',
|
||||||
'deleted' => '\'0\''
|
'deleted' => '\'0\''
|
||||||
),
|
),
|
||||||
|
@ -157,6 +178,15 @@ class DatabaseMaintenance {
|
||||||
return $results_table;
|
return $results_table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to do the fixing job to the broken tables.
|
||||||
|
*
|
||||||
|
* If the job succeeded, it returns string of success message.
|
||||||
|
* If failed, it returns the array of the failed query for debugging.
|
||||||
|
*
|
||||||
|
* @return string|array of string
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private function do_fix_database() {
|
private function do_fix_database() {
|
||||||
global $wpdb, $wp_version, $utils;
|
global $wpdb, $wp_version, $utils;
|
||||||
$global_schema_to_change = array(
|
$global_schema_to_change = array(
|
||||||
|
@ -306,14 +336,13 @@ class DatabaseMaintenance {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (version_compare($wp_version, '3.6', '<')) return false;
|
if (version_compare($wp_version, '3.6', '<')) return false;
|
||||||
$results = $this->sanity_check();
|
|
||||||
$return_val = array();
|
$return_val = array();
|
||||||
$queries = array();
|
$queries = array();
|
||||||
|
$results = $this->sanity_check();
|
||||||
if ($results !== true) {
|
if ($results !== true) {
|
||||||
if (!$this->maintenance_backup()) {
|
if (!$this->maintenance_backup()) {
|
||||||
$message = __('Can\'t create backup file.', $domain);
|
$message = __('Can\'t create backup file.', $domain);
|
||||||
echo $message;
|
return $message;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
$tables = array_keys($results);
|
$tables = array_keys($results);
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
|
@ -336,15 +365,47 @@ class DatabaseMaintenance {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return true;
|
$message = __('Your database is OK. You don\'t have to restore it.', $domain);
|
||||||
|
return $message;
|
||||||
}
|
}
|
||||||
if (empty($return_val)) {
|
if (empty($return_val)) {
|
||||||
return true;
|
$message = __('Your database restoration is successfully finished!', $domain);
|
||||||
|
return $message;
|
||||||
} else {
|
} else {
|
||||||
return $return_val;
|
return $return_val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to return the result of SHOW COLUMNS query.
|
||||||
|
*
|
||||||
|
* It returns the result of SHOW COLUMNS query as an object if the table exists.
|
||||||
|
* It returns the error message if the table doesn't exist.
|
||||||
|
*
|
||||||
|
* @return string|object
|
||||||
|
*/
|
||||||
|
private function show_columns() {
|
||||||
|
global $wpdb, $utils;
|
||||||
|
$domain = $utils->text_domain;
|
||||||
|
$tables = $wpdb->tables('all');
|
||||||
|
if (!isset($_POST['table'])) {
|
||||||
|
$message = __('Table name is not selected.', $domain);
|
||||||
|
return $message;
|
||||||
|
} elseif (!in_array($_POST['table'], $tables)) {
|
||||||
|
$message = __('There\'s no such table.', $domain);
|
||||||
|
return $message;
|
||||||
|
} else {
|
||||||
|
$table_name = $_POST['table'];
|
||||||
|
$results = $wpdb->get_results("SHOW COLUMNS FROM $table_name");
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to create a back up file of the database.
|
||||||
|
*
|
||||||
|
* It returns true if success, false if failure.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
private function maintenance_backup() {
|
private function maintenance_backup() {
|
||||||
$result = array();
|
$result = array();
|
||||||
$database_file = FQDB;
|
$database_file = FQDB;
|
||||||
|
@ -374,17 +435,18 @@ class DatabaseMaintenance {
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to display the maintenance page on the admin panel.
|
||||||
|
*
|
||||||
|
*/
|
||||||
function show_maintenance_page() {
|
function show_maintenance_page() {
|
||||||
global $utils;
|
global $utils, $wpdb;
|
||||||
$domain = $utils->text_domain;
|
$domain = $utils->text_domain;
|
||||||
if (is_multisite() && !current_user_can('manage_network_options')) {
|
if (is_multisite() && !current_user_can('manage_network_options')) {
|
||||||
die(__('You are not allowed to access this page!', $domain));
|
die(__('You are not allowed to access this page!', $domain));
|
||||||
} elseif (!current_user_can('manage_options')) {
|
} elseif (!current_user_can('manage_options')) {
|
||||||
die(__('You are not allowed to access this page!', $domain));
|
die(__('You are not allowed to access this page!', $domain));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($_GET['page']) && $_GET['page'] == 'maintenance') : ?>
|
if (isset($_GET['page']) && $_GET['page'] == 'maintenance') : ?>
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
<ul class="navi-menu">
|
<ul class="navi-menu">
|
||||||
|
@ -403,10 +465,10 @@ class DatabaseMaintenance {
|
||||||
<?php _e('This page provide you the database sanity check utility and the restore utility.', $domain);?>
|
<?php _e('This page provide you the database sanity check utility and the restore utility.', $domain);?>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('Click "Sanity Check" button first, and see if you need to fix database or not. If needed, click "Fix Database" button. Afterward you may go to Miscellaneous page and optimize database (this is not required).')?>
|
<?php _e('Click "Sanity Check" button first, and see if you need to fix database or not. If needed, click "Fix Database" button. Afterward you may go to Miscellaneous page and optimize database (this is not required).', $domain);?>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('Fix Database procedure will create a database backup file each time the button clicked. The backup file is named with "maintenance-backup", so you can remove it if you don\'t need it. Please go to Miscellaneous page and check if there is one.')?>
|
<?php _e('Fix Database procedure will create a database backup file each time the button clicked. The backup file is named with "maintenance-backup", so you can remove it if you don\'t need it. Please go to Miscellaneous page and check if there is one.', $domain);?>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('If you installed WordPress 3.6 (not upgraded), you don\'t have to restore the database.', $domain);?>
|
<?php _e('If you installed WordPress 3.6 (not upgraded), you don\'t have to restore the database.', $domain);?>
|
||||||
|
@ -421,6 +483,31 @@ class DatabaseMaintenance {
|
||||||
<input type="submit" name="sanity-check" class="button-primary" value="<?php _e('Sanity Check', $domain);?>" onclick="return confirm('<?php _e('Are you sure to check the database? This will take some time.\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
<input type="submit" name="sanity-check" class="button-primary" value="<?php _e('Sanity Check', $domain);?>" onclick="return confirm('<?php _e('Are you sure to check the database? This will take some time.\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||||
<input type="submit" name="do-fix-database" class="button-primary" value="<?php _e('Fix database', $domain);?>" onclick="return confirm('<?php _e('Are you sure to do fix the database? This will take some time.\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
<input type="submit" name="do-fix-database" class="button-primary" value="<?php _e('Fix database', $domain);?>" onclick="return confirm('<?php _e('Are you sure to do fix the database? This will take some time.\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php if (defined('WP_DEBUG') && WP_DEBUG == true) : ?>
|
||||||
|
<h3><?php _e('Columns Information', $domain);?></h3>
|
||||||
|
<p>
|
||||||
|
<?php _e('Select a table name and click "Display Columns" button, and you\'ll see the column property of that table. This information is for debug use.', $domain);?>
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
$wp_tables = $wpdb->tables('all');
|
||||||
|
?>
|
||||||
|
<form action="" method="post">
|
||||||
|
<?php
|
||||||
|
if (function_exists('wp_nonce_field')) {
|
||||||
|
wp_nonce_field('sqliteintegration-database-manip-stats');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<label for="table"/><?php _e('Table Name: ', $domain);?></label>
|
||||||
|
<select name="table" id="table">
|
||||||
|
<?php foreach ($wp_tables as $table) :?>
|
||||||
|
<option value="<?php echo $table;?>"><?php echo $table;?></option>
|
||||||
|
<?php endforeach;?>
|
||||||
|
</select>
|
||||||
|
<input type="submit" name="show-columns" class="button-secondary" value="<?php _e('Display Columns', $domain);?>" onclick="return confirm('<?php _e('Display columns in the selected table.\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
|
|
||||||
|
@ -432,7 +519,7 @@ class DatabaseMaintenance {
|
||||||
die(__('You are not allowed to do this operation!', $domain));
|
die(__('You are not allowed to do this operation!', $domain));
|
||||||
}
|
}
|
||||||
$fix_results = $this->do_fix_database();
|
$fix_results = $this->do_fix_database();
|
||||||
if ($fix_results !== true) {
|
if (is_array($fix_results)) {
|
||||||
$title = '<h3>'. __('Results', $domain) . '</h3>';
|
$title = '<h3>'. __('Results', $domain) . '</h3>';
|
||||||
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||||
echo $title;
|
echo $title;
|
||||||
|
@ -444,10 +531,9 @@ class DatabaseMaintenance {
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
} else {
|
} else {
|
||||||
$title = '<h3>'. __('Results', $domain) . '</h3>';
|
$title = '<h3>'. __('Results', $domain) . '</h3>';
|
||||||
$message = __('Your database restoration is successfully finished!', $domain);
|
|
||||||
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||||
echo $title;
|
echo $title;
|
||||||
echo '<p>'.$message.'</p>';
|
echo '<p>'.$fix_results.'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -479,6 +565,43 @@ class DatabaseMaintenance {
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($_POST['show-columns'])) {
|
||||||
|
check_admin_referer('sqliteintegration-database-manip-stats');
|
||||||
|
if (is_multisite() && !current_user_can('manage_network_options')) {
|
||||||
|
die(__('You are not allowed to do this operation!', $domain));
|
||||||
|
} elseif (!current_user_can('manage_options')) {
|
||||||
|
die(__('You are not allowed to do this operation!', $domain));
|
||||||
|
}
|
||||||
|
$results = $this->show_columns();
|
||||||
|
if (is_array($results)) {
|
||||||
|
$title = '<h3>'. sprintf(__('Columns In %s', $domain), $_POST['table']) . '</h3>';
|
||||||
|
$column_header = __('Column', $domain);
|
||||||
|
$type_header = __('Type', $domain);
|
||||||
|
$null_header = __('Null', $domain);
|
||||||
|
$default_header = __('Default', $domain);
|
||||||
|
echo '<div class="wrap" id="sqlite-admin-side-wrap" style="clear: both;">';
|
||||||
|
echo $title;
|
||||||
|
echo '<table class="widefat page fixed"><thead><tr><th>'. $column_header . '</th><th>'. $type_header . '</th><th>' . $null_header . '</th><th>' . $default_header . '</th></tr></thead>';
|
||||||
|
echo '<tbody>';
|
||||||
|
$counter = 0;
|
||||||
|
foreach ($results as $column) {
|
||||||
|
echo (($counter % 2) == 1) ? '<tr class="alt">' : '<tr>';
|
||||||
|
echo '<td>' . $column->Field . '</td>';
|
||||||
|
echo '<td>' . $column->Type . '</td>';
|
||||||
|
echo '<td>' . $column->Null . '</td>';
|
||||||
|
echo '<td>' . $column->Default . '</td>';
|
||||||
|
echo '</tr>';
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
echo '</tbody></table></div>';
|
||||||
|
} else {
|
||||||
|
$title = '<h3>'. __('Columns Info', $domain) . '</h3>';
|
||||||
|
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||||
|
echo $title;
|
||||||
|
echo '<p>' . $results;
|
||||||
|
echo '</p></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -1,15 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file defines SQLiteIntegrationDocument class.
|
||||||
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu
|
* @author Kojima Toshiyasu
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* dispaly documentation page
|
* This class defines the methods to display the documentation page on the admin panel.
|
||||||
|
*
|
||||||
* TODO: separate database access methods and display methods for maintenance
|
* TODO: separate database access methods and display methods for maintenance
|
||||||
*/
|
*/
|
||||||
class SQLiteIntegrationDocument {
|
class SQLiteIntegrationDocument {
|
||||||
|
/**
|
||||||
|
* Method to display the document page.
|
||||||
|
*
|
||||||
|
*/
|
||||||
function show_doc() {
|
function show_doc() {
|
||||||
|
// textdomain is defined in the utils class
|
||||||
global $utils;
|
global $utils;
|
||||||
$domain = $utils->text_domain;
|
$domain = $utils->text_domain;
|
||||||
if (is_multisite() && !current_user_can('manage_network_options')) {
|
if (is_multisite() && !current_user_can('manage_network_options')) {
|
||||||
|
@ -30,7 +37,7 @@ class SQLiteIntegrationDocument {
|
||||||
<div class="wrap" id="sqlite-admin-wrap">
|
<div class="wrap" id="sqlite-admin-wrap">
|
||||||
<h2><?php _e('Documentation', $domain); ?></h2>
|
<h2><?php _e('Documentation', $domain); ?></h2>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('This is a brief documentation about this plugin. For more details, see also the <a href="http://dogwood.skr.jp/wordpress/sqlite-integration">Plugin Page</a>.', $domain);?>
|
<?php _e('This is a brief documentation about this plugin. For more details, see also the <a href="http://dogwood.skr.jp/wordpress/sqlite-integration/">SQLite Integration page</a>.', $domain);?>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('Please don\'t forget: WordPress DOES NOT OFFICIALLY SUPPORT any database other than MySQL. So if you ask about this plugin in the Forum, it\'s not unlikely that you won\'t get no answers at all.', $domain);?>
|
<?php _e('Please don\'t forget: WordPress DOES NOT OFFICIALLY SUPPORT any database other than MySQL. So if you ask about this plugin in the Forum, it\'s not unlikely that you won\'t get no answers at all.', $domain);?>
|
||||||
|
@ -38,7 +45,7 @@ class SQLiteIntegrationDocument {
|
||||||
|
|
||||||
<h3><?php _e('Features', $domain);?></h3>
|
<h3><?php _e('Features', $domain);?></h3>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('This plugin is a successor to <a href="http://wordpress.org/extend/plugins/pdo-for-wordpress/">PDO for WordPress</a>, which enabled WordPress to use SQLite for its database. But PDO for WordPress doesn\'t seem to be maintained any more only to be outdated. SQLite Integration makes use of the basic ideas and framework of PDO for WordPress, adds some new features and updates it to be able to work with the newest version of WordPress(3.6).', $domain); ?>
|
<?php _e('This plugin is a successor to <a href="http://wordpress.org/extend/plugins/pdo-for-wordpress/">PDO for WordPress</a>, which enabled WordPress to use SQLite for its database. But PDO for WordPress doesn\'t seem to be maintained any more only to be outdated. SQLite Integration makes use of the basic ideas and framework of PDO for WordPress, adds some new features and updates it to be able to work with the newest version of WordPress(3.8.1).', $domain); ?>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('<a href="http://www.sqlite.org/">SQLite Web Page</a> says — SQLite is a "software library that implements selfcontained, serverless, zero-configuration, transactional SQL database engine". It is "a good choice for small to medium size websites". It\'s small and portable, and you don\'t need any database server system.', $domain); ?>
|
<?php _e('<a href="http://www.sqlite.org/">SQLite Web Page</a> says — SQLite is a "software library that implements selfcontained, serverless, zero-configuration, transactional SQL database engine". It is "a good choice for small to medium size websites". It\'s small and portable, and you don\'t need any database server system.', $domain); ?>
|
||||||
|
@ -66,10 +73,10 @@ class SQLiteIntegrationDocument {
|
||||||
<?php _e('SQLite Integration uses SQLite, so the limitations of SQLite is, as it is, those of SQLite Integration. MySQL is far from a simple SQL engine and has many extended features and functionalities. WordPress uses some of them. Among those are some SQLite doesn\'t implement. For those features that WordPress uses, I made them work with SQLite Integration. But for others that some plugins are using, SQLite Integration can\'t manipulate. So...', $domain); ?>
|
<?php _e('SQLite Integration uses SQLite, so the limitations of SQLite is, as it is, those of SQLite Integration. MySQL is far from a simple SQL engine and has many extended features and functionalities. WordPress uses some of them. Among those are some SQLite doesn\'t implement. For those features that WordPress uses, I made them work with SQLite Integration. But for others that some plugins are using, SQLite Integration can\'t manipulate. So...', $domain); ?>
|
||||||
</p>
|
</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li><strong><?php _e('There are some plugins that you can\'t use in any way.<br />', $domain);?></strong>
|
<li><strong><?php _e('There are some plugins that you can\'t use. No way around.<br />', $domain);?></strong>
|
||||||
<?php _e('Some plugins can\'t be activated or work properly. See the "Plugin Compatibility/Incompatibility" section.', $domain);?></li>
|
<?php _e('Some plugins can\'t be activated or work properly. See the "Plugin Compatibility/Incompatibility" section.', $domain);?></li>
|
||||||
<li><strong><?php _e('There are some plugins that you can\'t use without rewriting some codes in them.<br />', $domain);?></strong>
|
<li><strong><?php _e('There are some plugins that you can\'t use without rewriting some codes in them.<br />', $domain);?></strong>
|
||||||
<?php echo sprintf(__('Some plugins do work fine if you rewrite MySQL functions. I made some patch files and <a href="%s?page=patch">Patch Utility</a>. See also the <a href="http://dogwood.skr.jp/wordpress/sqlite-integration">Plugin Page</a> for more details.', $domain), $utils->show_parent());?></li>
|
<?php echo sprintf(__('Some plugins do work fine if you rewrite MySQL functions. I made some patch files and <a href="%s?page=patch">Patch Utility</a>. See also the <a href="http://dogwood.skr.jp/wordpress/sqlite-integration/#plugin-compat">SQLite Integration Page</a> for more details.', $domain), $utils->show_parent());?></li>
|
||||||
</ol>
|
</ol>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('And there may be other problems I overlooked. If you find malfunctionality, please let me know at the <a href="http://wordpress.org/support/plugin/sqlite-integration">Support Forum</a>.', $domain);?>
|
<?php _e('And there may be other problems I overlooked. If you find malfunctionality, please let me know at the <a href="http://wordpress.org/support/plugin/sqlite-integration">Support Forum</a>.', $domain);?>
|
||||||
|
@ -86,7 +93,7 @@ class SQLiteIntegrationDocument {
|
||||||
<p>
|
<p>
|
||||||
<?php _e('SQLite Integration doesn\'t contain database maintenace functionality, because there are some other free or proprietary softwares that give you such functionalities. For example, these are among free softwares:', $domain);?>
|
<?php _e('SQLite Integration doesn\'t contain database maintenace functionality, because there are some other free or proprietary softwares that give you such functionalities. For example, these are among free softwares:', $domain);?>
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul class="in-body-list">
|
||||||
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/">SQLite Manager Mozilla Addon</a>(<?php _e('my recommendation', $domain);?>)</li>
|
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/">SQLite Manager Mozilla Addon</a>(<?php _e('my recommendation', $domain);?>)</li>
|
||||||
<li><a href="http://www.sqlitemanager.org/">SQLiteManager</a>(<?php _e('unfortunately seems not to maintained...', $domain); ?>)</li>
|
<li><a href="http://www.sqlitemanager.org/">SQLiteManager</a>(<?php _e('unfortunately seems not to maintained...', $domain); ?>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -102,15 +109,15 @@ class SQLiteIntegrationDocument {
|
||||||
<?php _e('WordPress without its plugins is a king without people. Of course, you need plugins, I know.', $domain);?>
|
<?php _e('WordPress without its plugins is a king without people. Of course, you need plugins, I know.', $domain);?>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<?php echo sprintf(__('Most of the plugins will work fine with this plugin. But there are some that you need to rewrite some codes in them, and there are others that you can\'t use with this plugin. This is the list of the problematic plugins (far from complete). You can see informations about your installed plugins in the <a href="%s?page=sys-info">System Info</a> page. To see more details, please visit the <a href="http://dogwood.skr.jp/wordpress/sqlite-integration">Plugin Page</a>.', $domain), $utils->show_parent());?>
|
<?php echo sprintf(__('This is the list of the problematic plugins (far from complete). You can see informations about your installed plugins in the <a href="%s?page=sys-info">System Info</a> page. To see more details, please visit the <a href="http://dogwood.skr.jp/wordpress/sqlite-integration">Plugin Page</a>.', $domain), $utils->show_parent());?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table class="widefat page fixed" id="plugins-table">
|
<table class="widefat page fixed" id="plugins-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th data-sort='{"key":"name"}' class="item"><?php _e('Plugins Name', $domain); ?></th>
|
<th data-sort='{"key":"name"}' class="item"><?php _e('Plugins Name', $domain); ?></th>
|
||||||
<th data-sort='{"key":"compat"}'><?php _e('Compatibility', $domain); ?></th>
|
<th data-sort='{"key":"compat"}' class="compat"><?php _e('Compatibility', $domain); ?></th>
|
||||||
<th data-sort='{"key":"reason"}'><?php _e('Reasons', $domain);?></th>
|
<th data-sort='{"key":"reason"}' class="reason"><?php _e('Reasons', $domain);?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -131,61 +138,12 @@ class SQLiteIntegrationDocument {
|
||||||
<td><?php _e('No', $domain);?></td>
|
<td><?php _e('No', $domain);?></td>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
<td><?php echo $plugin_info->reason;?></td>
|
<td><?php echo $plugin_info->reason;?></td>
|
||||||
<?php endif;?>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php endif;?>
|
||||||
<?php endforeach;?>
|
<?php endforeach;?>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><?php _e('Caching Plugins', $domain); ?></h3>
|
|
||||||
<p>
|
|
||||||
<?php _e('Some plugins that give you cache functinality might cause problems. It is because they try to create the db.php file in wp-content directory, which file SQLite Integration is using.', $domain);?>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<?php _e('If those plugins overwrite the db.php file, SQLite Integration doesn\'t work. <span class="em">My recommendation is not to use caching plugins</span>. Even so, if you want a caching plugin, you could try <a href="http://wordpress.org/extend/plugins/wp-super-cache/">WP Super Cache</a>, which doesn\'t use db.php file. But no warranty, try at your own risk.', $domain);?>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<?php _e('I have not tested none of those caching plugins.', $domain);?>
|
|
||||||
</p>
|
|
||||||
<h3><?php _e('MySQL specific functions', $domain);?></h3>
|
|
||||||
<p>
|
|
||||||
<?php _e('Some plugins don\'t use WordPress database functions such as dbDelta(), and use PHP native MySQL functions when they create and manage tables in the database. But PHP doesn\'t permit redefining of the native functions (at least, under ordinary server setting). So SQLite Integration can\'t intercept and rewrite those functions.', $domain);?>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<?php _e('For example, you can see these codes in Google XML Sitemaps.', $domain);?>
|
|
||||||
</p>
|
|
||||||
<pre class="code">
|
|
||||||
$postRes = mysql_query($sql,$wpdb->dbh);
|
|
||||||
</pre>
|
|
||||||
<p>
|
|
||||||
<?php _e('or in Camera Slideshow', $domain); ?>
|
|
||||||
</p>
|
|
||||||
<pre class="code">
|
|
||||||
if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
|
|
||||||
</pre>
|
|
||||||
<p>
|
|
||||||
<?php _e('Such functions as mysql_get_server_info() or mysql_query() are from the MySQL driver of PHP. Not only some plugins but WordPress uses them, but SQLite Integration has no way to rewrite or redefine them. If the plugin you want to use has those functions in it, it won\'t work or give the error messages.', $domain); ?>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<?php _e('So, you have to rewrite them for SQLite Integration can execute. The two example above can be rewritten like this:', $domain);?>
|
|
||||||
</p>
|
|
||||||
<pre class="code">
|
|
||||||
$postRes = $wpdb->query($sql);
|
|
||||||
</pre>
|
|
||||||
<pre class="code">
|
|
||||||
if ( version_compare($wpdb->db_version(), '4.1.0', '>=') ) {
|
|
||||||
</pre>
|
|
||||||
<p>
|
|
||||||
<?php _e('As for those functions in WordPress, I overrode the WordPress functions themselves that contains such MySQL functions as mysql_query() or mysql_real_escape_string().', $domain); ?>
|
|
||||||
</p>
|
|
||||||
<h3><?php _e('FULLTEXT index');?></h3>
|
|
||||||
<p>
|
|
||||||
<?php _e('Some plugins use FULLTEXT index of MySQL. Of course SQLite does have the functionality named "full-text search". But it is not correlated with that of MySQL. In fact it is not an "index" and requires another new table for that. And it has a different syntax. So you can\'t use the plugins which uses FULLTEXT index', $domain);?>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<?php _e('If your language is not written by separating words with spaces, e.g. Japanese, Chinese or Thai, neither FULLTEXT index nor full-text search work effectively. Even if your language is space-separating-words one, you don\'t have to be disappointed. Whatever languages you use, you can use <a href="http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/">WordPress Related Posts</a> or <a href="http://wordpress.org/extend/plugins/related-posts/">Related Posts</a> or others. They are working fine with SQLite Integration!', $domain);?>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
/* Silence is golden */
|
|
@ -1,16 +1,23 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* This file contains PatchUtils class
|
* This file defines PatchUtils class.
|
||||||
*
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* This class provides the methods for patching utilities.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class PatchUtils {
|
class PatchUtils {
|
||||||
/**
|
/**
|
||||||
* Reads wp-content/uploads/patches directory and returns file names in it.
|
* Method to read the patch directory and returns the list of the files in it.
|
||||||
|
*
|
||||||
|
* It reads wp-content/uploads/patches directory and returns file names in it.
|
||||||
* If directory contains none, returns empty array.
|
* If directory contains none, returns empty array.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_patch_files() {
|
private function get_patch_files() {
|
||||||
$patch_files = array();
|
$patch_files = array();
|
||||||
|
@ -19,7 +26,7 @@ class PatchUtils {
|
||||||
} else {
|
} else {
|
||||||
if ($dir_handle = opendir(SQLitePatchDir)) {
|
if ($dir_handle = opendir(SQLitePatchDir)) {
|
||||||
while (($file_name = readdir($dir_handle)) !== false) {
|
while (($file_name = readdir($dir_handle)) !== false) {
|
||||||
if ($file_name == '.' || $file_name == '..')
|
if ($file_name == '.' || $file_name == '..' || $file_name == '.htaccess')
|
||||||
continue;
|
continue;
|
||||||
$patch_files[] = $file_name;
|
$patch_files[] = $file_name;
|
||||||
}
|
}
|
||||||
|
@ -28,10 +35,14 @@ class PatchUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Execute patch command and apply it to the target plugins.
|
* Method to apply patch to the plugins.
|
||||||
|
*
|
||||||
|
* It executes patch command and apply it to the target plugins.
|
||||||
* If patch file(s) is not selected, returns false.
|
* If patch file(s) is not selected, returns false.
|
||||||
* Or else returns array contains messages.
|
* Or else returns array contains messages.
|
||||||
|
*
|
||||||
* @return boolean|array
|
* @return boolean|array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function apply_patches() {
|
private function apply_patches() {
|
||||||
global $utils;
|
global $utils;
|
||||||
|
@ -41,6 +52,7 @@ class PatchUtils {
|
||||||
$output = array();
|
$output = array();
|
||||||
$retval = 0;
|
$retval = 0;
|
||||||
$patch_results = array();
|
$patch_results = array();
|
||||||
|
$message = '';
|
||||||
if (isset($_POST['plugin_checked'])) {
|
if (isset($_POST['plugin_checked'])) {
|
||||||
$file_names = $_POST['plugin_checked'];
|
$file_names = $_POST['plugin_checked'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -99,10 +111,14 @@ class PatchUtils {
|
||||||
return $patch_results;
|
return $patch_results;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Delete uploaded patch file(s).
|
* Method to remove patch file(s) from the server.
|
||||||
|
*
|
||||||
|
* It deletes uploaded patch file(s).
|
||||||
* If patch file(s) is not selected, returns false.
|
* If patch file(s) is not selected, returns false.
|
||||||
* Or else returns array contains messages.
|
* Or else returns array contains messages.
|
||||||
|
*
|
||||||
* @return boolean|array
|
* @return boolean|array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function delete_patch_files() {
|
private function delete_patch_files() {
|
||||||
global $utils;
|
global $utils;
|
||||||
|
@ -128,31 +144,90 @@ class PatchUtils {
|
||||||
return $rm_results;
|
return $rm_results;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Uploads a patch file.
|
* Method to upload patch file(s) to the server.
|
||||||
|
*
|
||||||
|
* It uploads a patch file to the server. You must have the permission to write to the
|
||||||
|
* temporary directory. If there isn't SQLitePatchDir, this method will create it and
|
||||||
|
* set the permission to 0707.
|
||||||
|
*
|
||||||
* No return values.
|
* No return values.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function upload_file() {
|
private function upload_file() {
|
||||||
global $utils;
|
global $utils;
|
||||||
$domain = $utils->text_domain;
|
$domain = $utils->text_domain;
|
||||||
if (!file_exists(SQLitePatchDir) || !is_dir(SQLitePatchDir)) {
|
if (!file_exists(SQLitePatchDir) || !is_dir(SQLitePatchDir)) {
|
||||||
mkdir(SQLitePatchDir, 0705, true);
|
if (!mkdir(SQLitePatchDir, 0707, true)) {
|
||||||
|
$message = __('Unable to create a patch directory.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!is_file(SQLitePatchDir . '/.htaccess')) {
|
||||||
|
$fp = fopen(SQLitePatchDir . '/.htaccess', 'w');
|
||||||
|
if (!$fp) {
|
||||||
|
$message = __('Unable to create a .htaccess file.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
fwrite($fp, 'DENY FROM ALL');
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
if (!isset($_FILES['upfile']['error']) || !is_int($_FILES['upfile']['error'])) {
|
||||||
|
$message = __('Invalid operation.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
return false;
|
||||||
|
} elseif ($_FILES['upfile']['error'] != UPLOAD_ERR_OK) {
|
||||||
|
switch ($_FILES['upfile']['error']) {
|
||||||
|
case UPLOAD_ERR_FORM_SIZE:
|
||||||
|
$message = __('File is too large to upload.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
break;
|
||||||
|
case UPLOAD_ERR_PARTIAL:
|
||||||
|
$message = __('File upload is not complete.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
break;
|
||||||
|
case UPLOAD_ERR_NO_FILE:
|
||||||
|
$message = __('File is not uploaded.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
break;
|
||||||
|
case UPLOAD_ERR_NO_TMP_DIR:
|
||||||
|
$message = __('Temporary directory is not writable.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
break;
|
||||||
|
case UPLOAD_ERR_CANT_WRITE:
|
||||||
|
$message = __('File cannot be written on the disk.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$message = __('Unknown error.', $domain);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (is_uploaded_file($_FILES['upfile']['tmp_name'])) {
|
if (is_uploaded_file($_FILES['upfile']['tmp_name'])) {
|
||||||
if (move_uploaded_file($_FILES['upfile']['tmp_name'], SQLitePatchDir.'/'.$_FILES['upfile']['name'])) {
|
$file_full_path = SQLitePatchDir . '/' . $_FILES['upfile']['name'];
|
||||||
$message = __('File is uploaded', $domain);
|
if (move_uploaded_file($_FILES['upfile']['tmp_name'], $file_full_path)) {
|
||||||
|
$message = __('File is successfully uploaded.', $domain);
|
||||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0644);
|
chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0606);
|
||||||
} else {
|
} else {
|
||||||
$message = __('File is not uploaded', $domain);
|
$message = __('File upload failed. Possible file upload attack.', $domain);
|
||||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$message = __('File is not selected', $domain);
|
$message = __('File is not selected', $domain);
|
||||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Displays patch util page
|
* Method to display the patch utility page on the admin panel.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
function show_patch_page() {
|
function show_patch_page() {
|
||||||
global $utils;
|
global $utils;
|
||||||
|
@ -284,7 +359,8 @@ class PatchUtils {
|
||||||
wp_nonce_field('sqlitewordpress-plugin-patch-file-stats');
|
wp_nonce_field('sqlitewordpress-plugin-patch-file-stats');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<label for="upload"><?php _e('Select file from your computer. If the file name is the same as existent file, this operation will override it.', $domain);?></label><br />
|
<input type="hidden" name="MAX_FILE_SIZE" value="500000" />
|
||||||
|
<label for="upload"><?php _e('Select file from your computer. If the file name is the same as existent file, this operation will override it. You can\'t upload the file whose size is over 500kB.', $domain);?></label><br />
|
||||||
<input type="file" id="upload" name="upfile" size="60"/>
|
<input type="file" id="upload" name="upfile" size="60"/>
|
||||||
<input type="submit" name="upload" id="submit-upload" class="button" value="<?php _e('Upload', $domain)?>" />
|
<input type="submit" name="upload" id="submit-upload" class="button" value="<?php _e('Upload', $domain)?>" />
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,4 +1,18 @@
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"name":"Add Meta Tags",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Advanced Sitemap Generator",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Akismet",
|
"name":"Akismet",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -11,18 +25,46 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"All In One WP Security & Firewall",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Anti-spam",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Any Mobile Theme Switcher",
|
"name":"Any Mobile Theme Switcher",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Batcache",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"BAW Manual Related Posts",
|
"name":"BAW Manual Related Posts",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"bbPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Better Delete Revision",
|
"name":"Better Delete Revision",
|
||||||
"compat":"No",
|
"compat":"No",
|
||||||
|
@ -37,6 +79,20 @@
|
||||||
"class":"incompatible"
|
"class":"incompatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Better WP Security",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Bit.ly",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Breadcrumb NavXT",
|
"name":"Breadcrumb NavXT",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -45,8 +101,10 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Broken Link Checker",
|
"name":"Broken Link Checker",
|
||||||
"compat":"Checked",
|
"compat":"Needs Patch",
|
||||||
"class":"compatible"
|
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||||
|
"reason":"MySQL function",
|
||||||
|
"class":"workaround"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -55,6 +113,20 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"BuddyPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"BuddyPress Courseware",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Camera slideshow",
|
"name":"Camera slideshow",
|
||||||
"compat":"Needs Patch",
|
"compat":"Needs Patch",
|
||||||
|
@ -63,12 +135,40 @@
|
||||||
"class":"workaround"
|
"class":"workaround"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Cart66 Cloud :: Ecommerce with security",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Cart66 Lite :: WordPress Ecommerce",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Category Order and Taxonomy Terms Order",
|
"name":"Category Order and Taxonomy Terms Order",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"CKEditor For WordPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"configure-login-timeout",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Contact Form 7",
|
"name":"Contact Form 7",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -81,12 +181,61 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Control XML-RPC publishing",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Count per Day",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Crayon Syntax Highlighter",
|
"name":"Crayon Syntax Highlighter",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Custom Post type and short code",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Custom Content Shortcode",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Custom Field List Widget",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Custom Meta Widget",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Custom sidebars",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"DB Cache Reloaded Fix",
|
"name":"DB Cache Reloaded Fix",
|
||||||
"compat":"Probably No",
|
"compat":"Probably No",
|
||||||
|
@ -112,6 +261,27 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Disable XML-RPC",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Download Button Shortcode",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress Download Manager",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Dynamic To Top",
|
"name":"Dynamic To Top",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -119,9 +289,53 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"FeedWordPress",
|
"name":"Easy Digital Downloads",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Easy WP SMTP",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"EDD Hide Download",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"eShop",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Facebook",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"FeedWordPress",
|
||||||
|
"compat":"Needs patch",
|
||||||
|
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||||
|
"reason":"MySQL specific function",
|
||||||
|
"class":"workaround"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"FlexiCache",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -130,6 +344,13 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Google Analytics for WordPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Google Analytics Popular Posts",
|
"name":"Google Analytics Popular Posts",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -150,6 +371,13 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"HTTP Digest Authentication",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"HyperDB",
|
"name":"HyperDB",
|
||||||
"compat":"Probably No",
|
"compat":"Probably No",
|
||||||
|
@ -163,6 +391,13 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Jigoshop",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Ktai Style",
|
"name":"Ktai Style",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -175,6 +410,81 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Login Only 1 Session",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Mass Email To users",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Mathjax Latex",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Members",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Members Category",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"MP6",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Multisite Global Search",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Multisite User Management",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"MW WP Form",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"My Content Management",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Networks for WordPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"NewStatPress",
|
"name":"NewStatPress",
|
||||||
"compat":"Needs Patch",
|
"compat":"Needs Patch",
|
||||||
|
@ -183,6 +493,21 @@
|
||||||
"class":"workaround"
|
"class":"workaround"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"NextGEN Gallery",
|
||||||
|
"compat":"Needs Patch",
|
||||||
|
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||||
|
"reason":"MySQL specific function",
|
||||||
|
"class":"workaround"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"StatCounter - Free Real Time Visitor Stats",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Optimize Database after Deleting Revisions",
|
"name":"Optimize Database after Deleting Revisions",
|
||||||
"compat":"Probably No",
|
"compat":"Probably No",
|
||||||
|
@ -190,12 +515,61 @@
|
||||||
"class":"workaround"
|
"class":"workaround"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Options Framework",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"OSE Firewall™ Security",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Page Builder by SiteOrigin",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"PDF.js Viewer Shortcode",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"PHP Code Widget",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Polylang",
|
"name":"Polylang",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Prevent XMLRPC",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Qikmo Mobile Website Redirection",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Redirection",
|
"name":"Redirection",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -214,6 +588,13 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Safer Cookies",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Search Everything",
|
"name":"Search Everything",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -226,36 +607,169 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Sell Downloads",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Session Manager",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Simple Session Support",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Simple Tags",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Smart Donations",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Socializer!",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"SQLite Integration",
|
"name":"SQLite Integration",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"StatPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Synchi",
|
"name":"Synchi",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"SysInfo",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"System information",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Theme-Check",
|
"name":"Theme-Check",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Theme My Login",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Welcart e-Commerce",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Wikiful Mediawiki Bridge",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WooCommerce - excelling eCommerce",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Wordfence Security",
|
"name":"Wordfence Security",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress Advanced Ticket System",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Attachments",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WordPress Beta Tester",
|
"name":"WordPress Beta Tester",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Campaign Manager",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress.com Custom CSS",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress.com Stats",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress Hit Counter",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WordPress Importer",
|
"name":"WordPress Importer",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -263,9 +777,39 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Wordpress Popular Posts",
|
"name":"WordPress Login Redirect",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress Mobile Pack",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress MU Domain Mapping",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress MU Sitewide Tags Pages",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Wordpress Popular Posts",
|
||||||
|
"compat":"Needs Patch",
|
||||||
|
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||||
|
"reason":"MySQL specific query",
|
||||||
|
"class":"workaround"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -274,18 +818,123 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress SEO by Yoast",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Document Revisions",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP e-Commerce",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Email Login",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP Emmet",
|
"name":"WP Emmet",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Custom Login",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Frontpage News",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP iSell Photo",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Mail SMTP",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP-Members",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP-Piwik",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WPtap Mobile Detector",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Mobile Edition",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Mobile Theme Switcher",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP-Mobilizer",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP Multibyte Patch",
|
"name":"WP Multibyte Patch",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Online Store",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP-PageNavi",
|
"name":"WP-PageNavi",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -310,24 +959,94 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Session Manager",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP Social Bookmarking Light",
|
"name":"WP Social Bookmarking Light",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP-Statistics",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP Super Cache",
|
"name":"WP Super Cache",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP System Health",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP Video Lightbox",
|
"name":"WP Video Lightbox",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"wp-webservices",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Document Revisions Simple Downloads",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Marketplace - Complete Shopping Cart / eCommerce Solution",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WordPress Multi Site Mobile Edition",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WPQuery Shortcode",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Social Stats",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WPtouch Mobile Plugin",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Wysija Newsletters",
|
"name":"Wysija Newsletters",
|
||||||
"compat":"Needs Patch",
|
"compat":"Needs Patch",
|
||||||
|
|
|
@ -1,21 +1,72 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* This file defines SQLiteIntegrationUtils class.
|
||||||
*
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu
|
* @author Kojima Toshiyasu
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* This class provides global $text_domain variable and defines some utility methods.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class SQLiteIntegrationUtils {
|
class SQLiteIntegrationUtils {
|
||||||
|
/**
|
||||||
|
* Varible to store textdomain string for all the plugin files.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $text_domain = 'sqlite-integration';
|
public $text_domain = 'sqlite-integration';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* It does nothing.
|
||||||
|
*/
|
||||||
function __construct() {
|
function __construct() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to return contents of 'FQDBDIR/debug.txt'.
|
* Method to display update notice on the admin dashboard.
|
||||||
* if the file is not existent, returns false.
|
*
|
||||||
|
* Check if db.php file is replaced with the apropriate version,
|
||||||
|
* and if not, display notice.
|
||||||
|
*
|
||||||
|
* This is not required for now. So this method only returns and
|
||||||
|
* do nothing.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function show_admin_notice() {
|
||||||
|
return;
|
||||||
|
$notice_string = __('Upgrading Notice: To finish upgrading, please activate SQLite Integration and go Setting >> SQLite Integration >> Miscellaneous, and click the button "update" at the bottom of the page. Or else replace wp-content/db.php with the one in sqlite-integration directory manually.', 'sqlite-integration');
|
||||||
|
$current_version = defined('SQLITE_INTEGRATION_VERSION') ? SQLITE_INTEGRATION_VERSION : '';
|
||||||
|
if (version_compare($current_version, '1.8.1', '=')) return;
|
||||||
|
$version = '';
|
||||||
|
if (defined('WP_CONTENT_DIR')) {
|
||||||
|
$path = WP_CONTENT_DIR . '/db.php';
|
||||||
|
} else {
|
||||||
|
$path = ABSPATH . 'wp-content/db.php';
|
||||||
|
}
|
||||||
|
if (!$file_handle = @fopen($path, 'r')) return;
|
||||||
|
while (($buffer = fgets($file_handle)) !== false) {
|
||||||
|
if (stripos($buffer, '@version') !== false) {
|
||||||
|
$version = str_ireplace('*@version ', '', $buffer);
|
||||||
|
$version = trim($version);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose($file_handle);
|
||||||
|
if (empty($version) || version_compare($version, $current_version, '<')) {
|
||||||
|
echo '<div class="updated sqlite-notice" style="padding:10px;line-height:150%;font-size:12px"><span>'.$notice_string.'</span></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to read a error log file and returns its contents.
|
||||||
|
*
|
||||||
|
* 'FQDBDIR/debug.txt' is the log file name.
|
||||||
|
* If this file is not existent, returns false.
|
||||||
|
*
|
||||||
* @return string|boolean
|
* @return string|boolean
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function show_error_log() {
|
private function show_error_log() {
|
||||||
$file = FQDBDIR . 'debug.txt';
|
$file = FQDBDIR . 'debug.txt';
|
||||||
|
@ -27,8 +78,10 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to clear the contents of 'FQDBIR/debug.txt'
|
* Method to clear the contents of the error log file.
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function clear_log_file() {
|
private function clear_log_file() {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
@ -49,10 +102,16 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to return associative array of system informations
|
* Method to get system information from the server and returns its data.
|
||||||
|
*
|
||||||
|
* Returned value is an associative array of system informations.
|
||||||
|
* <code>
|
||||||
* sys_info['WordPress'] => WordPress Version
|
* sys_info['WordPress'] => WordPress Version
|
||||||
* sys_info['PHP'] => PHP Version
|
* sys_info['PHP'] => PHP Version
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_system_info() {
|
private function get_system_info() {
|
||||||
global $wp_version;
|
global $wp_version;
|
||||||
|
@ -62,8 +121,12 @@ class SQLiteIntegrationUtils {
|
||||||
return $sys_info;
|
return $sys_info;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to return various database information
|
* Method to get database information from the database and returns its data.
|
||||||
* @return assoc array
|
*
|
||||||
|
* Returned value is an associative array.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_database_status() {
|
private function get_database_status() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
@ -93,10 +156,16 @@ class SQLiteIntegrationUtils {
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to return associative array
|
* Method to get table information and returns its data.
|
||||||
|
*
|
||||||
|
* Returned value is an associative array like:
|
||||||
|
* <code>
|
||||||
* array( table name => array( index name ( column name )))
|
* array( table name => array( index name ( column name )))
|
||||||
|
* </code>
|
||||||
* for each table in the database
|
* for each table in the database
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_tables_info() {
|
private function get_tables_info() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
@ -116,8 +185,12 @@ class SQLiteIntegrationUtils {
|
||||||
return $table_info;
|
return $table_info;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to return the autoincremented values of each table
|
* Method to get the autoincremented values of each table and returns it.
|
||||||
|
*
|
||||||
|
* The data is from sqlite_sequence table.
|
||||||
|
*
|
||||||
* @return assoc array name => sequence, or false
|
* @return assoc array name => sequence, or false
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_sequence() {
|
private function get_sequence() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
@ -133,9 +206,12 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to return contents of 'wp-content/db.php' file
|
* Method to show the contents of 'wp-content/db.php' file.
|
||||||
* if the file is not existent, returns false.
|
*
|
||||||
* @return string|boolean
|
* If this file is not existent, shows message and returns false.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function show_db_php() {
|
private function show_db_php() {
|
||||||
if (defined('WP_CONTENT_DIR')) {
|
if (defined('WP_CONTENT_DIR')) {
|
||||||
|
@ -146,19 +222,21 @@ class SQLiteIntegrationUtils {
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
if (is_readable($file)) {
|
if (is_readable($file)) {
|
||||||
$contents = file_get_contents($file);
|
$contents = file_get_contents($file);
|
||||||
echo $contents;
|
return $contents;
|
||||||
} else {
|
} else {
|
||||||
echo 'file is not readable';
|
$contents = 'file is not readable';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo 'file doesn\'t exist';
|
$contents = 'file doesn\'t exist';
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return $contents;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to get the textarea contents and write into db.php file
|
* Method to get the textarea content and write it to db.php file.
|
||||||
|
*
|
||||||
* @param string $contents
|
* @param string $contents
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function save_db_php($contents) {
|
private function save_db_php($contents) {
|
||||||
if (defined('WP_CONTENT_DIR')) {
|
if (defined('WP_CONTENT_DIR')) {
|
||||||
|
@ -181,9 +259,44 @@ class SQLiteIntegrationUtils {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to optimize database file
|
* Method to replace the old db.php with the new one.
|
||||||
* only to give vacuum command to SQLite
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private function update_db_file() {
|
||||||
|
$new_file = PDODIR . 'db.php';
|
||||||
|
if (file_exists($new_file) && is_readable($new_file)) {
|
||||||
|
$contents = file_get_contents($new_file);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (defined('WP_CONTENT_DIR')) {
|
||||||
|
$path = WP_CONTENT_DIR . '/db.php';
|
||||||
|
} else {
|
||||||
|
$path = ABSPATH . 'wp-content/db.php';
|
||||||
|
}
|
||||||
|
if (($handle = @fopen($path, 'w+')) && flock($handle, LOCK_EX)) {
|
||||||
|
if (fwrite($handle, $contents) == false) {
|
||||||
|
flock($handle, LOCK_UN);
|
||||||
|
fclose($handle);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
flock($handle, LOCK_UN);
|
||||||
|
fclose($handle);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to optimize SQLite database.
|
||||||
|
*
|
||||||
|
* This only gives VACUUM command to SQLite database. This query is rewritten in
|
||||||
|
* the query.class.php file.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function optimize_db() {
|
private function optimize_db() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
@ -191,8 +304,10 @@ class SQLiteIntegrationUtils {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to get SQLite database file size
|
* Method to get SQLite database file size.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_database_size() {
|
private function get_database_size() {
|
||||||
$db_file = FQDB;
|
$db_file = FQDB;
|
||||||
|
@ -203,9 +318,11 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to format file size to unit byte
|
* Method to format the file size number to the unit byte.
|
||||||
|
*
|
||||||
* @param integer $size
|
* @param integer $size
|
||||||
* @return string
|
* @return string
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function convert_to_formatted_number($size) {
|
private function convert_to_formatted_number($size) {
|
||||||
$unim = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB');
|
$unim = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB');
|
||||||
|
@ -218,7 +335,10 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to echo plugins info table component
|
* Method to echo plugins info table component.
|
||||||
|
*
|
||||||
|
* @return nothing returned.
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function show_plugins_info() {
|
private function show_plugins_info() {
|
||||||
$domain = $this->text_domain;
|
$domain = $this->text_domain;
|
||||||
|
@ -251,7 +371,11 @@ class SQLiteIntegrationUtils {
|
||||||
$compat = __('No', $domain);
|
$compat = __('No', $domain);
|
||||||
break;
|
break;
|
||||||
case 'Checked':
|
case 'Checked':
|
||||||
|
if (!empty($plugin_info->informed) && stripos($plugin_info->informed, 'Users\' Information') !== false) {
|
||||||
|
$compat = __('Checked*', $domain);
|
||||||
|
} else {
|
||||||
$compat = __('Checked', $domain);
|
$compat = __('Checked', $domain);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$compat = __('Not Checked', $domain);
|
$compat = __('Not Checked', $domain);
|
||||||
|
@ -279,9 +403,11 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to return output of phpinfo() as an array
|
* Method to return output of phpinfo() as an array.
|
||||||
* See PHP Manual
|
*
|
||||||
|
* @See PHP Manual
|
||||||
* @return array
|
* @return array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function parse_php_modules() {
|
private function parse_php_modules() {
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -313,9 +439,11 @@ class SQLiteIntegrationUtils {
|
||||||
return $modules;
|
return $modules;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* function to echo PHP module info
|
* Method to echo PHP module info.
|
||||||
|
*
|
||||||
* @param string $module_name
|
* @param string $module_name
|
||||||
* @param string $setting_name
|
* @param string $setting_name
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_module_setting($module_name, $setting_name) {
|
private function get_module_setting($module_name, $setting_name) {
|
||||||
$module_info = $this->parse_php_modules();
|
$module_info = $this->parse_php_modules();
|
||||||
|
@ -330,11 +458,14 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to parse FQDBDIR and return backup database files
|
* Method to parse FQDBDIR and return backup database files.
|
||||||
|
*
|
||||||
|
* @return nothing returned.
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_backup_files() {
|
private function get_backup_files() {
|
||||||
$db_name = basename(FQDB);
|
$db_name = basename(FQDB);
|
||||||
$names_to_exclude = array('.', '..', '.htaccess', 'debug.txt', '.ht.sqlite', $db_name);
|
$names_to_exclude = array('.', '..', '.htaccess', 'debug.txt', '.ht.sqlite', 'index.php', $db_name);
|
||||||
$backup_files = array();
|
$backup_files = array();
|
||||||
if (is_dir(FQDBDIR)) {
|
if (is_dir(FQDBDIR)) {
|
||||||
if ($dir_handle = opendir(FQDBDIR)) {
|
if ($dir_handle = opendir(FQDBDIR)) {
|
||||||
|
@ -348,9 +479,13 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to create backup file
|
* Method to create backup database file.
|
||||||
|
*
|
||||||
|
* @return string array
|
||||||
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function backup_db() {
|
private function backup_db() {
|
||||||
|
$domain = $this->text_domain;
|
||||||
$result = array();
|
$result = array();
|
||||||
$database_file = FQDB;
|
$database_file = FQDB;
|
||||||
$db_name = basename(FQDB);
|
$db_name = basename(FQDB);
|
||||||
|
@ -379,10 +514,16 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to delete backup database file(s).
|
||||||
|
*
|
||||||
|
* Users can delete multiple files at a time.
|
||||||
|
*
|
||||||
|
* @return false if file names aren't checked, empty array if failed, array of messages if succeeded.
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
private function delete_backup_db() {
|
private function delete_backup_db() {
|
||||||
global $utils;
|
$domain = $this->text_domain;
|
||||||
$domain = $utils->text_domain;
|
|
||||||
$file_names = array();
|
$file_names = array();
|
||||||
$results = array();
|
$results = array();
|
||||||
if (isset($_POST['backup_checked'])) {
|
if (isset($_POST['backup_checked'])) {
|
||||||
|
@ -401,11 +542,62 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to download a backup file.
|
||||||
|
*
|
||||||
|
* This method uses header() function, so we have to register this function using
|
||||||
|
* admin_init action hook. It must also be declared as public. We check HTTP_REFERER
|
||||||
|
* and input button name, and ,after that, wp_nonce. When the admin_init is executed
|
||||||
|
* it only returns true.
|
||||||
|
*
|
||||||
|
* The database file might be several hundred mega bytes, so we don't use readfile()
|
||||||
|
* but use fread() instead.
|
||||||
|
*
|
||||||
|
* Users can download one file at a time.
|
||||||
|
*
|
||||||
|
* @return 1 if the file name isn't checked, 2 if multiple files are checked, true if succeeded.
|
||||||
|
*/
|
||||||
|
static function download_backup_db() {
|
||||||
|
if (is_multisite()) {
|
||||||
|
$script_url = network_admin_url('settings.php?page=setting-file');
|
||||||
|
} else {
|
||||||
|
$script_url = admin_url('options-general.php?page=setting-file');
|
||||||
|
}
|
||||||
|
if (isset($_POST['download_backup_file']) && stripos($_SERVER['HTTP_REFERER'], $script_url) !== false) {
|
||||||
|
check_admin_referer('sqliteintegration-backup-manip-stats');
|
||||||
|
if (!isset($_POST['backup_checked'])) return 1;
|
||||||
|
$file_names = array();
|
||||||
|
$file_names = $_POST['backup_checked'];
|
||||||
|
if (count($file_names) != 1) return 2;
|
||||||
|
$file_name = $file_names[0];
|
||||||
|
$file_path = FQDBDIR . $file_name;
|
||||||
|
$blog_name = str_replace(array(' ', ' ', ';'), array('_', '_', '_'), get_bloginfo('name'));
|
||||||
|
$download_file_name = $blog_name . '_' . $file_name;
|
||||||
|
header('Pragma: public');
|
||||||
|
header('Cache-Control: must-revalidate,post-check=0,pre-check=0');
|
||||||
|
header('Content-Type: application/force-download');
|
||||||
|
header('Content-Type: application/octet-stream');
|
||||||
|
header('Content-Type: application/download');
|
||||||
|
header('Content-Disposition: attachment; filename='.$download_file_name.';');
|
||||||
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
header('Content-Length: '.filesize($file_path));
|
||||||
|
$fp = fopen($file_path, 'r');
|
||||||
|
while (!feof($fp)) {
|
||||||
|
echo fread($fp, 65536);
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to show Welcome page.
|
||||||
|
*
|
||||||
|
*/
|
||||||
function welcome() {
|
function welcome() {
|
||||||
$domain = $this->text_domain;
|
$domain = $this->text_domain;
|
||||||
if (isset($_GET['page']) && $_GET['page'] == 'sqlite-integration') :?>
|
if (isset($_GET['page']) && $_GET['page'] == 'sqlite-integration') :?>
|
||||||
<div class="wrap" id="sqlite-admin-wrap">
|
<div class="wrap single" id="sqlite-admin-wrap">
|
||||||
<h2><?php _e('Welcome to SQLite Integration', $domain) ?></h2>
|
<h2><?php _e('Welcome to SQLite Integration', $domain) ?></h2>
|
||||||
<p>
|
<p>
|
||||||
<?php _e('Thank you for using SQLite Integration plugin!', $domain) ?>
|
<?php _e('Thank you for using SQLite Integration plugin!', $domain) ?>
|
||||||
|
@ -446,12 +638,11 @@ class SQLiteIntegrationUtils {
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php endif;
|
<?php endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to show Utiliy page contents
|
* Method to show Untility page.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
function show_utils() {
|
function show_utils() {
|
||||||
$domain = $this->text_domain;
|
$domain = $this->text_domain;
|
||||||
|
@ -633,12 +824,16 @@ class SQLiteIntegrationUtils {
|
||||||
<?php $this->show_plugins_info();?>
|
<?php $this->show_plugins_info();?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<p>
|
||||||
|
<?php _e('"Checked*" with an asterisk is from the users\' information. I didn\'t check myself yet. If you found any malfunctioning, please let me know.', $domain);?>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to show Setting File page
|
* Method to show Setting File page.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
function edit_db_file() {
|
function edit_db_file() {
|
||||||
$domain = $this->text_domain;
|
$domain = $this->text_domain;
|
||||||
|
@ -715,6 +910,42 @@ class SQLiteIntegrationUtils {
|
||||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($_POST['download_backup_file'])) {
|
||||||
|
check_admin_referer('sqliteintegration-backup-manip-stats');
|
||||||
|
$message = '';
|
||||||
|
$result = self::download_backup_db();
|
||||||
|
if ($result !== true) {
|
||||||
|
switch($result) {
|
||||||
|
case 1:
|
||||||
|
$message = __('Please select backup file.', $domain);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$message = __('Please select one file at a time.', $domain);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
echo '<div id="message" class="updated fade">' . $message . '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($_POST['sqliteintegration_update_db_file'])) {
|
||||||
|
check_admin_referer('sqliteintegration-db-update-stats');
|
||||||
|
$result = $this->update_db_file();
|
||||||
|
if ($result === false) {
|
||||||
|
$message = __('Couldn"t update db.php file. Please replace it manually.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
} else {
|
||||||
|
echo <<<JS
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
(function() {jQuery(".sqlite-notice").addClass("hidden");})(jQuery);
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
JS;
|
||||||
|
$message = __('Your db.php is updated.', $domain);
|
||||||
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isset($_GET['page']) && $_GET['page'] == 'setting-file') :?>
|
if (isset($_GET['page']) && $_GET['page'] == 'setting-file') :?>
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
<ul class="navi-menu">
|
<ul class="navi-menu">
|
||||||
|
@ -725,7 +956,7 @@ class SQLiteIntegrationUtils {
|
||||||
<li class="menu-item"><a href="<?php echo $this->show_parent();?>?page=maintenance"><?php _e('Maintenance', $domain);?></a></li>
|
<li class="menu-item"><a href="<?php echo $this->show_parent();?>?page=maintenance"><?php _e('Maintenance', $domain);?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="wrap" id="sqlite-admin-wrap">
|
<div class="wrap single" id="sqlite-admin-wrap">
|
||||||
<h2><?php _e('Database Optimization, Error Log, Init File', $domain)?></h2>
|
<h2><?php _e('Database Optimization, Error Log, Init File', $domain)?></h2>
|
||||||
<h3><?php _e('Optimize You Database', $domain)?></h3>
|
<h3><?php _e('Optimize You Database', $domain)?></h3>
|
||||||
<p>
|
<p>
|
||||||
|
@ -747,6 +978,9 @@ class SQLiteIntegrationUtils {
|
||||||
<p>
|
<p>
|
||||||
<?php _e('If you want to delete the file(s), check the file name and click the Delete button. You can check multiple files.', $domain);?>
|
<?php _e('If you want to delete the file(s), check the file name and click the Delete button. You can check multiple files.', $domain);?>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<?php _e('If you want to download a file, check the file name and click the Download button. Please check one file at a time.', $domain);?>
|
||||||
|
</p>
|
||||||
<?php $backup_files = $this->get_backup_files();?>
|
<?php $backup_files = $this->get_backup_files();?>
|
||||||
<form action="" method="post" id="delete-backup-form">
|
<form action="" method="post" id="delete-backup-form">
|
||||||
<?php if (function_exists('wp_nonce_field')) {
|
<?php if (function_exists('wp_nonce_field')) {
|
||||||
|
@ -756,7 +990,7 @@ class SQLiteIntegrationUtils {
|
||||||
<table class="widefat page fixed" id="backup-files">
|
<table class="widefat page fixed" id="backup-files">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="item"><?php _e('Delete', $domain);?></th>
|
<th class="item"><?php _e('Delete/Download', $domain);?></th>
|
||||||
<th data-sort='{"key":"name"}'><?php _e('Backup Files', $domain);?></th>
|
<th data-sort='{"key":"name"}'><?php _e('Backup Files', $domain);?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -774,6 +1008,7 @@ class SQLiteIntegrationUtils {
|
||||||
<p>
|
<p>
|
||||||
<input type="submit" name="backup_db" class="button-primary" value="<?php _e('Backup', $domain);?>" onclick="return confirm('<?php _e('Are you sure to make a backup file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
<input type="submit" name="backup_db" class="button-primary" value="<?php _e('Backup', $domain);?>" onclick="return confirm('<?php _e('Are you sure to make a backup file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||||
<input type="submit" name="delete_backup_files" class="button-primary" value="<?php _e('Delete file', $domain);?>" onclick="return confirm('<?php _e('Are you sure to delete backup file(s)?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
<input type="submit" name="delete_backup_files" class="button-primary" value="<?php _e('Delete file', $domain);?>" onclick="return confirm('<?php _e('Are you sure to delete backup file(s)?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||||
|
<input type="submit" name="download_backup_file" class="button-primary" value="<?php _e('Download', $domain);?>" onclick="return confirm('<?php _e('Are you sure to download backup file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')"/>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
<h3><?php _e('SQLite Integration Error Log', $domain);?></h3>
|
<h3><?php _e('SQLite Integration Error Log', $domain);?></h3>
|
||||||
|
@ -785,37 +1020,41 @@ class SQLiteIntegrationUtils {
|
||||||
wp_nonce_field('sqlitewordpress-log-reset-stats');
|
wp_nonce_field('sqlitewordpress-log-reset-stats');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<textarea name="errorlog" id="errorlog" cols="70" rows="10">
|
<?php $ret_val = $this->show_error_log();
|
||||||
<?php $ret_val = $this->show_error_log();
|
|
||||||
if ($ret_val === false || empty($ret_val)) {
|
if ($ret_val === false || empty($ret_val)) {
|
||||||
$message = __('No error messages are found', $domain);
|
$ret_val = __('No error messages are found', $domain);
|
||||||
echo $message;
|
|
||||||
} else {
|
|
||||||
echo $ret_val;
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</textarea>
|
<textarea name="errorlog" id="errorlog" cols="70" rows="10"><?php echo $ret_val;?></textarea>
|
||||||
<p>
|
<p>
|
||||||
<input type="submit" name="sqlitewordpress_log_reset" value="<?php _e('Clear Log', $domain)?>" onclick="return confirm('<?php _e('Are you sure to clear Log?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" class="button-primary">
|
<input type="submit" name="sqlitewordpress_log_reset" value="<?php _e('Clear Log', $domain)?>" onclick="return confirm('<?php _e('Are you sure to clear Log?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" class="button-primary">
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3><?php _e('Edit Initial File (wp-content/db.php)', $domain)?></h3>
|
<?php if (!(defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT) || !(defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS)) : ?>
|
||||||
<p>
|
<?php echo '<h3>';?>
|
||||||
|
<?php _e('Edit Initial File (wp-content/db.php)', $domain)?>
|
||||||
|
<?php echo '</h3><p>'; ?>
|
||||||
<?php _e('When you go "Plugins » Edit Plugin" page, you can edit plugin source file. But you can\'t see this file there because it is not in the plugin directory. If you need to edit this file, you can edit here. This settings may cause problems. <span class="alert">If you don\'t understand well, please don\'t edit this file</span>.', $domain)?>
|
<?php _e('When you go "Plugins » Edit Plugin" page, you can edit plugin source file. But you can\'t see this file there because it is not in the plugin directory. If you need to edit this file, you can edit here. This settings may cause problems. <span class="alert">If you don\'t understand well, please don\'t edit this file</span>.', $domain)?>
|
||||||
</p>
|
<?php echo '</p>'; ?>
|
||||||
<form action="" method="post">
|
<?php echo '<form action="" method="post">'; ?>
|
||||||
<?php if (function_exists('wp_nonce_field')) {
|
<?php if (function_exists('wp_nonce_field')) {
|
||||||
wp_nonce_field('sqlitewordpress-db-save-stats');
|
wp_nonce_field('sqlitewordpress-db-save-stats');
|
||||||
|
}?>
|
||||||
|
<?php $db_contents = $this->show_db_php();?>
|
||||||
|
<?php echo '<textarea name="dbfile" id="dbfile" cols="70" rows="10">'.$db_contents.'</textarea><p>'; ?>
|
||||||
|
<?php printf('<input type="submit" name="sqlitewordpress_db_save" value="%s" onclick="return confirm(\'%s\')" class="button-primary">', __('Save', $domain), __('Are you sure to save this file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain)); ?>
|
||||||
|
<?php echo '</p></form>'; ?>
|
||||||
|
<?php endif;?>
|
||||||
|
<h3><?php _e('Update db.php', $domain);?></h3>
|
||||||
|
<p><?php _e('Replace the old db.php with the new one.', $domain);?></p>
|
||||||
|
<form action="" method="post">
|
||||||
|
<?php if (function_exists('wp_nonce_field')) {
|
||||||
|
wp_nonce_field('sqliteintegration-db-update-stats');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<textarea name="dbfile" id="dbfile" cols="70" rows="10">
|
<p><?php printf('<input type="submit" name="sqliteintegration_update_db_file" value="%s" onclick="return confirm(\'%s\')" class="button-primary">', __('Update', $domain), __('Are you sure to update this file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain));?></p>
|
||||||
<?php $this->show_db_php();?></textarea>
|
|
||||||
<p>
|
|
||||||
<input type="submit" name="sqlitewordpress_db_save" value="<?php _e('Save')?>" onclick="return confirm('<?php _e('Are you sure to save this file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" class="button-primary">
|
|
||||||
</p>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue