Compare commits

...

49 Commits

Author SHA1 Message Date
Eric van der Vlist 990297f6ac Markdown 2020-04-27 16:07:25 +00:00
kjmtsh 1f2e8fc987 bugfix release
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@1116219 b8457f37-d9ea-0310-8a92-e5e31aec5664
2015-03-19 18:05:37 +00:00
kjmtsh 54d9e1b02a tagged 1.8 and released
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@1106368 b8457f37-d9ea-0310-8a92-e5e31aec5664
2015-03-05 21:01:35 +00:00
kjmtsh 8235d4c4d8 fixed the typo
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@1002204 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-10-06 00:19:56 +00:00
kjmtsh 25cb914d6e changed for Mac environment and some others
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@1000379 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-10-02 07:18:40 +00:00
kjmtsh b0c959ba4f version 1.7 release
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@980581 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-09-04 21:18:00 +00:00
kjmtsh 5e95bc00c4 Added memory usage check code and changed for the usage of user defined pcre.backtrack_limit value
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@957733 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-07-30 23:44:12 +00:00
kjmtsh d4b86db22e fixed the manipulation for the FIELD() function with column name
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@949333 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-07-16 04:35:27 +00:00
kjmtsh 907be4a3e4 fixed the typo
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@948629 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-07-15 07:58:19 +00:00
kjmtsh 61e6960b40 change the algorithm for manipulating multiple meta query
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@948014 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-07-14 08:46:32 +00:00
kjmtsh e5f495a745 Yet another fix for manipulating multiple meta query
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@934021 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-06-17 22:52:14 +00:00
kjmtsh 9fd9fd7bbd Another fix for manipulating BETWEEN statement
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@933223 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-06-16 18:56:00 +00:00
kjmtsh ccf36c0dd9 fixed the procedure for manipulating multiple between statement
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@933053 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-06-16 14:41:07 +00:00
kjmtsh 8286b0ac20 fixed meta query problem and added Spanish language support.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@911415 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-05-10 00:34:30 +00:00
kjmtsh 7d94787d40 some bug fixes
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@908000 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-05-05 03:38:15 +00:00
kjmtsh 4c4d7022a9 bug fixes and make compatible with WP Slimstat
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@899667 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-04-21 19:39:09 +00:00
kjmtsh f6859effd2 fixed the bug for BETWEEN statement
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@895814 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-04-17 07:34:54 +00:00
kjmtsh 862acb1899 made compatible with WP 3.9 and fixed bugs
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@895495 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-04-17 02:45:32 +00:00
kjmtsh f0a5b97f3c bug fixes
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@877068 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-03-18 10:06:36 +00:00
kjmtsh 71a1df03db Fixed some bugs and added more features.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@852178 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-02-05 19:29:23 +00:00
kjmtsh 22a658ac3a Fixed some bugs and revised the documentations
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@847560 b8457f37-d9ea-0310-8a92-e5e31aec5664
2014-01-29 09:35:06 +00:00
kjmtsh 8c2258e7ee remove the misleading description from readme.txt
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@823590 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-12-17 02:55:27 +00:00
kjmtsh f41368010a WordPress3.8 compatible. Add some new features.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@823587 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-12-17 02:46:42 +00:00
kjmtsh 3f06610a5a Changed the version number.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@799987 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-11-06 19:29:24 +00:00
kjmtsh 0f7f96848d Fixed some minor bugs and tested WordPress 3.7.1 installation.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@799983 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-11-06 19:23:32 +00:00
kjmtsh a5897b4369 Changed stable tag.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@779069 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-27 03:50:37 +00:00
kjmtsh 295ea862d2 Changed _rewrite_between() function. Added some plugins to the plugin compatiblity list. Fixed the server check message.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@779068 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-27 03:45:59 +00:00
kjmtsh cfc1d0b2ef Removed the rewriting code of the BETWEEN function. Changed some documentation.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@778174 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-25 07:40:16 +00:00
kjmtsh d7f68d81a6 Changed Japanese catalog and fixed some bugs.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@773009 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-16 01:46:22 +00:00
kjmtsh c906f23f46 Added a new user defined function version() and a utility for displaying column information. Fixed for the plugin that uses SHOW VARIABLES query. Added the message for other server than Apache.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@772930 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-15 21:04:53 +00:00
kjmtsh faff964bcd Fixed styles to match MP6 plugin and text_domain to display Japanese catalog file.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@771394 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-13 06:17:53 +00:00
kjmtsh a6345fd8b3 Added the database maintenance utility. Fixed and Changed the procedure for ALTER TABLE and SHOW INDEX query. Fixed some bugs.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@770386 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-11 19:39:01 +00:00
kjmtsh a246ffa700 Fixed the bug of ALTER TABLE ALTER COLUMN query.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@768830 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-09 06:02:18 +00:00
kjmtsh 72bc68b45b Fixed the manipulation of SHOW INDEX query.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@768773 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-09 01:39:25 +00:00
kjmtsh 3ea3b0974d Changed the stable version to 1.3.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@766770 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-04 07:52:01 +00:00
kjmtsh bae9e47e0e Added a backup utility and updated the language catalog. Fixed the minor bugs.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@766763 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-09-04 07:45:37 +00:00
kjmtsh 953f18e719 Fix the database optimization bug. Add a new screenshot.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@765246 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-31 23:07:21 +00:00
kjmtsh be737aa08e Added NewsStatPress to compatible plugin list. BETWEEN statement is newly supported. Changed the style of Admin dashboard to match MP6 styles.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@760976 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-23 01:31:59 +00:00
kjmtsh 6401a9b0ec changed the handling of the error messages. Fixed the manipulation of ALTER TABLE CHANGE COLUMN query. Added the support for BETWEEN function.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@755392 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-13 00:34:40 +00:00
kjmtsh ce9c138473 added some plugin information to the compatiblity list
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@752674 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-07 03:13:38 +00:00
kjmtsh aa897ce408 change the method of rewriting ALTER query to support ADD INDEX without index name, and the method of removing index hinting to support IGNORE and FORCE
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@752352 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-06 14:59:31 +00:00
kjmtsh 4147af7334 changed the regular expression in _handle_show_query() to manipulate FROM or IN db_name
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@751138 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-04 15:08:47 +00:00
kjmtsh d48bb8ab28 changes of PDODB class to make it comapatible with WordPress 3.6
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@750261 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-02 20:24:47 +00:00
kjmtsh 8b14aafcd2 fixed typo in plugin_lists.json
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@750228 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-02 19:24:15 +00:00
kjmtsh 6e31b4e3ca update the plugin version to 1.2 and WordPress version 3.6
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@750182 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-02 18:12:49 +00:00
kjmtsh b1398156dc fixed the date format and quote style in query.class.php
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@750153 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-08-02 17:40:12 +00:00
kjmtsh 0124a71687 updated compatible plugin list
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@748973 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-07-31 23:49:15 +00:00
kjmtsh 6b66c23718 fixed the patch utility for Windows and the manipulation of 'ON DUPLICATE KEY UPDATE' query.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@748127 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-07-30 03:18:31 +00:00
kjmtsh d8314baf48 bug fix: _execute_duplicate_key_update() in query.class.php
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@746595 b8457f37-d9ea-0310-8a92-e5e31aec5664
2013-07-26 05:14:04 +00:00
50 changed files with 11878 additions and 5886 deletions

8
BUGS Normal file
View File

@ -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.

56
ChangeLog Normal file
View File

@ -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.

118
db.php
View File

@ -1,30 +1,52 @@
<?php
/**
* This file must be placed in the directory
*
* wordpress/wp-content/db.php
*
* This file defines some constant required for SQLite Integration.
*
* 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
* @version 1.1
* @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();
}
function pdo_log_erro($message, $data = null) {
if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin') !== false) {
$admin_dir = '';
} else {
$admin_dir = 'wp-admin/';
}
die(<<<HTML
/*
* 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) {
if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin') !== false) {
$admin_dir = '';
} else {
$admin_dir = 'wp-admin/';
}
die(<<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress &rsaquo; Error</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{$admin_dir}install.css" type="text/css" />
<link rel="stylesheet" href="{$admin_dir}css/install.css" type="text/css" />
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="{$admin_dir}images/wordpress-logo.png" /></h1>
@ -38,58 +60,70 @@ HTML
}
if (version_compare( PHP_VERSION, '5.2.4', '<')) {
pdo_log_erro(__('PHP version on this server is too old.'), sprinf(__("Your server is running PHP version %d but this version of WordPress requires at least 5.2.4"), phpversion()));
pdo_log_error('PHP version on this server is too old.', sprinf("Your server is running PHP version %d but this version of WordPress requires at least 5.2.4", phpversion()));
}
if (!extension_loaded('pdo')) {
pdo_log_erro(__('PHP PDO Extension is not loaded.'), __('Your PHP installation appears to be missing the PDO extension which is required for this version of WordPress.'));
pdo_log_error('PHP PDO Extension is not loaded.', 'Your PHP installation appears to be missing the PDO extension which is required for this version of WordPress.');
}
if (!extension_loaded('pdo_sqlite')) {
pdo_log_erro(__('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:
* Your scripts have the permission to create directories or files on your server.
* If you write in your wp-config.php like below, we take these definitions.
* define('DB_DIR', '/full_path_to_the_database_directory/');
* define('DB_FILE', 'database_file_name');
*/
/*
* PDODIR is SQLite Integration installed directory.
*/
if (defined('WP_PLUGIN_DIR')) {
define('PDODIR', WP_PLUGIN_DIR . '/sqlite-integration/');
define('PDODIR', WP_PLUGIN_DIR . '/sqlite-integration/');
} else {
if (defined('WP_CONTENT_DIR')) {
define('PDODIR', WP_CONTENT_DIR . '/plugins/sqlite-integration/');
} else {
define('PDODIR', ABSPATH . 'wp-content/plugins/sqlite-integration/');
}
if (defined('WP_CONTENT_DIR')) {
define('PDODIR', WP_CONTENT_DIR . '/plugins/sqlite-integration/');
} else {
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 (substr(DB_DIR, -1, 1) != '/') {
define('FQDBDIR', DB_DIR . '/');
} else {
define('FQDBDIR', DB_DIR);
}
if (substr(DB_DIR, -1, 1) != '/') {
define('FQDBDIR', DB_DIR . '/');
} else {
define('FQDBDIR', DB_DIR);
}
} else {
if (defined('WP_CONTENT_DIR')) {
define('FQDBDIR', WP_CONTENT_DIR . '/database/');
} else {
define('FQDBDIR', ABSPATH . 'wp-content/database/');
}
if (defined('WP_CONTENT_DIR')) {
define('FQDBDIR', WP_CONTENT_DIR . '/database/');
} else {
define('FQDBDIR', ABSPATH . 'wp-content/database/');
}
}
/*
* FQDB is a database file name. If DB_FILE is defined, it is used
* as FQDB.
*/
if ( defined('DB_FILE' )) {
define('FQDB', FQDBDIR . DB_FILE);
define('FQDB', FQDBDIR . DB_FILE);
} 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', '<')) {
define('UDF_FILE', PDODIR . 'functions-5-2.php');
define('UDF_FILE', PDODIR . 'functions-5-2.php');
} elseif (version_compare(PHP_VERSION, '5.3', '>=')) {
define('UDF_FILE', PDODIR . 'functions.php');
define('UDF_FILE', PDODIR . 'functions.php');
}
require_once PDODIR . 'pdodb.class.php';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2
index.php Normal file
View File

@ -0,0 +1,2 @@
<?php
/* Silence is golden */

View File

@ -1,63 +1,78 @@
<?php
/**
* This file contains the only one function wp_install().
*
* @package SQLite Integration
* @version 1.1
* @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/upgrade.php
* This function overrides wp_install() in wp-admin/includes/upgrade.php
*/
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '') {
if (!empty($deprecated))
_deprecated_argument(__FUNCTION__, '2.6');
if (!empty($deprecated))
_deprecated_argument(__FUNCTION__, '2.6');
wp_check_mysql_version();
wp_cache_flush();
/* changes */
require_once PDODIR . 'schema.php';
make_db_sqlite();
/* changes */
populate_options();
populate_roles();
update_option('blogname', $blog_title);
update_option('admin_email', $user_email);
update_option('blog_public', $public);
$guessurl = wp_guess_url();
update_option('siteurl', $guessurl);
wp_check_mysql_version();
wp_cache_flush();
/* changes */
require_once PDODIR . 'schema.php';
make_db_sqlite();
/* changes */
populate_options();
populate_roles();
if (!$public)
update_option('default_pingback_flag', 0);
$user_id = username_exists($user_name);
$user_password = trim($user_password);
$email_password = false;
if (!$user_id && empty($user_password)) {
$user_password = wp_generate_password(12, false);
$message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
$user_id = wp_create_user($user_name, $user_password, $user_email);
update_user_option($user_id, 'default_password_nag', true, true);
$email_password = true;
} else if (!$user_id) {
$message = '<em>'.__('Your chosen password.').'</em>';
$user_id = wp_create_user($user_name, $user_password, $user_email);
}
$user = new WP_User($user_id);
$user->set_role('administrator');
wp_install_defaults($user_id);
flush_rewrite_rules();
wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.')));
wp_cache_flush();
return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
update_option('blogname', $blog_title);
update_option('admin_email', $user_email);
update_option('blog_public', $public);
$guessurl = wp_guess_url();
update_option('siteurl', $guessurl);
if (!$public)
update_option('default_pingback_flag', 0);
$user_id = username_exists($user_name);
$user_password = trim($user_password);
$email_password = false;
if (!$user_id && empty($user_password)) {
$user_password = wp_generate_password(12, false);
$message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
$user_id = wp_create_user($user_name, $user_password, $user_email);
update_user_option($user_id, 'default_password_nag', true, true);
$email_password = true;
} else if (!$user_id) {
$message = '<em>'.__('Your chosen password.').'</em>';
$user_id = wp_create_user($user_name, $user_password, $user_email);
}
$user = new WP_User($user_id);
$user->set_role('administrator');
wp_install_defaults($user_id);
flush_rewrite_rules();
wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.')));
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);
}
?>

2
js/index.php Normal file
View File

@ -0,0 +1,2 @@
<?php
/* Silence is golden */

View File

@ -1,6 +1,10 @@
/*
* script for SQLite Integration
* this file is only included on the documentation page and the utilities page
/**
* This is a part of SQLite Integration.
*
* This script is only included on the documentation and utility page.
*
* @package SQLite Integration
* @author Kojima Toshiyasu
*/
jQuery(document).ready(function($) {
var $table = null;
@ -14,16 +18,19 @@ jQuery(document).ready(function($) {
} else if (document.getElementById("patch-files") != null) {
$table = $('#patch-files');
$headers = $table.find('thead th').slice(1);
} else if (document.getElementById("backup-files") != null) {
$table = $('#backup-files');
$headers = $table.find('thead th').slice(1);
}
$headers
.wrapInner('<a href="#"></a>')
.addClass('sort');
.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;
sortKey = $header.data('sort').key,
sortDirection = 1;
if ($header.hasClass('sorted-asc')) {
sortDirection = -1;
}
@ -63,14 +70,14 @@ jQuery(document).ready(function($) {
var $table = $('#plugins-info');
var $headers = $table.find('thead th').slice(0);
$headers
.wrapInner('<a href="#"></a>')
.addClass('sort');
.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;
sortKey = $header.data('sort').key,
sortDirection = 1;
if ($header.hasClass('sorted-asc')) {
sortDirection = -1;
}

1
js/sqlite.min.js vendored Normal file
View File

@ -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")});

2
languages/index.php Normal file
View File

@ -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.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,229 +1,352 @@
<?php
/**
* This file defines PDODB class, which inherits wpdb class and replaces it
* global $wpdb variable.
*
* @package SQLite Integration
* @version 1.1
* @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 . 'install.php';
//require_once PDODIR . 'install.php';
if (!defined('SAVEQUERIES')){
define ('SAVEQUERIES', false);
}
if(!defined('PDO_DEBUG')){
define('PDO_DEBUG', false);
define('PDO_DEBUG', false);
}
/**
* 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 {
/**
*
* @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,
* 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.
*
*/
function __construct() {
register_shutdown_function(array($this, '__destruct'));
/**
* Constructor
*
* This overrides wpdb::__construct() which has database server, username and
* password as arguments. This class doesn't use them.
*
* @see wpdb::__construct()
*/
public function __construct() {
register_shutdown_function(array($this, '__destruct'));
if (WP_DEBUG)
$this->show_errors();
$this->init_charset();
if (WP_DEBUG)
$this->show_errors();
$this->db_connect();
}
function __destruct() {
return true;
}
/**
* dummy out the MySQL function
* @see wpdb::select()
*/
function select($db, $dbh = null) {
if (is_null($dbh))
$dbh = $this->dbh;
$this->ready = true;
return;
}
$this->init_charset();
$this->db_connect();
}
/**
* Desctructor
*
* This overrides wpdb::__destruct(), but does nothing but return true.
*
* @see wpdb::__destruct()
*/
public function __destruct() {
return true;
}
/**
* Method to set character set for the database.
*
* This overrides wpdb::set_charset(), only to dummy out the MySQL function.
*
* @see wpdb::set_charset()
*/
public function set_charset($dbh, $charset = null, $collate = null) {
if ( ! isset( $charset ) )
$charset = $this->charset;
if ( ! isset( $collate ) )
$collate = $this->collate;
}
/**
* 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()
*/
public function select($db, $dbh = null) {
if (is_null($dbh))
$dbh = $this->dbh;
$this->ready = true;
return;
}
/**
* 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()
*/
function _real_escape($string) {
return addslashes($string);
}
/**
* 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()
*/
public function print_error($str = '') {
global $EZSQL_ERROR;
if (!$str) {
$err = $this->dbh->get_error_message() ? $this->dbh->get_error_message() : '';
if (!empty($err)) $str = $err[2]; else $str = '';
}
$EZSQL_ERROR[] = array('query' => $this->last_query, 'error_str' => $str);
if ($this->suppress_errors)
return false;
wp_load_translations_early();
if ($caller = $this->get_caller())
$error_str = sprintf(__('WordPress database error %1$s for query %2$s made by %3$s'), $str, $this->last_query, $caller);
else
$error_str = sprintf(__('WordPress database error %1$s for query %2$s'), $str, $this->last_query);
error_log($error_str);
if (!$this->show_errors)
return false;
if (is_multisite()) {
$msg = "WordPress database error: [$str]\n{$this->last_query}\n";
if (defined('ERRORLOGFILE'))
error_log($msg, 3, ERRORLOGFILE);
if (defined('DIEONDBERROR'))
wp_die($msg);
} else {
$str = htmlspecialchars($str, ENT_QUOTES);
$query = htmlspecialchars($this->last_query, ENT_QUOTES);
/**
* overrides wpdb::_real_escape(), which uses mysql_real_escape_string().
* @see wpdb::_real_escape()
*/
function _real_escape($string) {
if ($this->dbh && $this->real_escape)
return $this->dbh->quote($string);
else
return addslashes($string);
}
/**
* overrides wpdb::print_error()
* @see wpdb::print_error()
*/
function print_error($str = '') {
global $EZSQL_ERROR;
if (!$str) {
$err = $this->dbh->get_error_message() ? $this->dbh->get_error_message() : '';
$str = $err[2];
}
$EZSQL_ERROR[] = array('query' => $this->last_query, 'error_str' => $str);
if ($this->suppress_errors)
return false;
wp_load_translations_early();
if ($caller = $this->get_caller())
$error_str = sprintf(__('WordPress database error %1$s for query %2$s made by %3$s'), $str, $this->last_query, $caller);
else
$error_str = sprintf(__('WordPress database error %1$s for query %2$s'), $str, $this->last_query);
error_log($error_str);
if (!$this->show_errors)
return false;
if (is_multisite()) {
$msg = "WordPress database error: [$str]\n{$this->last_query}\n";
if (defined('ERRORLOGFILE'))
error_log($msg, 3, ERRORLOGFILE);
if (defined('DIEONDBERROR'))
wp_die($msg);
} else {
$str = htmlspecialchars($str, ENT_QUOTES);
$query = htmlspecialchars($this->last_query, ENT_QUOTES);
print "<div id='error'>
<p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
<code>$query</code></p>
</div>";
}
}
}
}
/**
* 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()
*/
public function db_connect($allow_bail=true) {
if (WP_DEBUG) {
$this->dbh = new PDOEngine();
} else {
// WP_DEBUG or not, we don't use @ which causes the slow execution
// PDOEngine class will take the Exception handling.
$this->dbh = new PDOEngine();
}
if (!$this->dbh) {
wp_load_translations_early();//probably there's no translations
$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;
}
$this->has_connected = true;
$this->ready = true;
}
/**
* 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()
*/
public function query($query) {
if (!$this->ready)
return false;
/**
* overrides wpdb::db_connect()
* @see wpdb::db_connect()
*/
function db_connect() {
if (WP_DEBUG) {
$this->dbh = new PDOEngine();
} else {
// WP_DEBUG or not, we don't use @ which causes the slow execution
// PDOEngine class will take the Exception handling.
$this->dbh = new PDOEngine();
}
if (!$this->dbh) {
wp_load_translations_early();//probably there's no translations
$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;
}
$this->ready = true;
}
/**
* overrides wpdb::query()
* @see wpdb::query()
*/
function query($query) {
if (!$this->ready)
return false;
$query = apply_filters('query', $query);
$return_val = 0;
$this->flush();
$this->func_call = "\$db->query(\"$query\")";
$this->last_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());
if ($this->last_error = $this->dbh->get_error_message()) {
if (defined('WP_INSTALLING') && WP_INSTALLING) {
//$this->suppress_errors();
} else {
$this->print_error($this->last_error);
return false;
}
}
if (preg_match('/^\\s*(create|alter|truncate|drop|optimize)\\s*/i', $query)) {
// $return_val = $this->result;
$return_val = $this->dbh->get_return_value();
} elseif (preg_match('/^\\s*(insert|delete|update|replace)\s/i', $query)) {
$this->rows_affected = $this->dbh->get_affected_rows();
if (preg_match('/^\s*(insert|replace)\s/i', $query)) {
$this->insert_id = $this->dbh->get_insert_id();
}
$return_val = $this->rows_affected;
} else {
$this->last_result = $this->dbh->get_query_results();
$this->num_rows = $this->dbh->get_num_rows();
$return_val = $this->num_rows;
}
return $return_val;
}
/**
* overrides wpdb::load_col_info(), which uses a mysql function.
* @see wpdb::load_col_info()
*/
function load_col_info() {
if ($this->col_info)
return;
$this->col_info = $this->dbh->get_columns();
}
/**
* overrides wpdb::has_cap()
* We don't support collation, group_concat, set_charset
* @see wpdb::has_cap()
*/
function has_cap($db_cap) {
switch(strtolower($db_cap)) {
case 'collation':
case 'group_concat':
case 'set_charset':
return false;
case 'subqueries':
return true;
default:
return false;
}
}
/**
* overrides wpdb::db_version()
* Returns mysql version number but it means nothing for SQLite.
* @see wpdb::db_version()
*/
function db_version() {
global $required_mysql_version;
return $required_mysql_version;
}
$query = apply_filters('query', $query);
$return_val = 0;
$this->flush();
$this->func_call = "\$db->query(\"$query\")";
$this->last_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());
if ($this->last_error = $this->dbh->get_error_message()) {
if (defined('WP_INSTALLING') && WP_INSTALLING) {
//$this->suppress_errors();
} else {
$this->print_error($this->last_error);
return false;
}
}
if (preg_match('/^\\s*(create|alter|truncate|drop|optimize)\\s*/i', $query)) {
//$return_val = $this->result;
$return_val = $this->dbh->get_return_value();
} elseif (preg_match('/^\\s*(insert|delete|update|replace)\s/i', $query)) {
$this->rows_affected = $this->dbh->get_affected_rows();
if (preg_match('/^\s*(insert|replace)\s/i', $query)) {
$this->insert_id = $this->dbh->get_insert_id();
}
$return_val = $this->rows_affected;
} else {
$this->last_result = $this->dbh->get_query_results();
$this->num_rows = $this->dbh->get_num_rows();
$return_val = $this->num_rows;
}
return $return_val;
}
/**
* Method for future use?
*
* 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
*/
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)
return;
$this->col_info = $this->dbh->get_columns();
}
/**
* Method to return what the database can do.
*
* 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()
*/
public function has_cap($db_cap) {
switch(strtolower($db_cap)) {
case 'collation':
case 'group_concat':
case 'set_charset':
return false;
case 'subqueries':
return true;
default:
return false;
}
}
/**
* Method to return database version number.
*
* 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()
*/
public function db_version() {
//global $required_mysql_version;
//return $required_mysql_version;
return '5.5';
}
}
/**
/*
* Initialize $wpdb with PDODB class
*/
if (!isset($wpdb)) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +1,77 @@
<?php
/**
* This file defines CreateQuery class.
*
* @package SQLite Integration
* @version 1.1
* @author Kojima Toshiyasu, Justin Adie
* @author Kojima Toshiyasu
*/
/**
* Provides a class for rewriting create queries
* this class borrows its inspiration from the work done on tikiwiki.
* This class provides a function to rewrite CREATE query.
*
*/
class CreateQuery{
private $_query = '';
private $index_queries = array();
private $_errors = array();
private $table_name = '';
private $has_primary_key = false;
/**
* initialises the object properties
* @param string $query the query being processed
* @return string|array the processed (rewritten) query
* The query string to be rewritten in this class.
*
* @var string
* @access private
*/
private $_query = '';
/**
* The array to contain CREATE INDEX queries.
*
* @var array of strings
* @access private
*/
private $index_queries = array();
/**
* The array to contain error messages.
*
* @var array of string
* @access private
*/
private $_errors = array();
/**
* Variable to have the table name to be executed.
*
* @var string
* @access private
*/
private $table_name = '';
/**
* Variable to check if the query has the primary key.
*
* @var boolean
* @access private
*/
private $has_primary_key = false;
/**
* Function to rewrite query.
*
* @param string $query the query being processed
* @return string|array the processed (rewritten) query
*/
public function rewrite_query($query){
$this->_query = $query;
$this->_query = $query;
$this->_errors [] = '';
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) {
return 'SELECT 1=1';
} else {
return $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;
}
$this->strip_backticks();
$this->quote_illegal_field();
$this->get_table_name();
$this->rewrite_comments();
$this->rewrite_field_types();
@ -41,83 +80,114 @@ class CreateQuery{
$this->rewrite_unsigned();
$this->rewrite_autoincrement();
$this->rewrite_primary_key();
$this->rewrite_foreign_key();
$this->rewrite_unique_key();
$this->rewrite_enum();
$this->rewrite_set();
$this->rewrite_key();
$this->add_if_not_exists();
return $this->post_process();
}
/**
* Method for getting the table name from the create query.
* taken from PDO for WordPress
* we don't need 'IF NOT EXISTS', so we changed the pattern.
* Method to get table name from the query string.
*
* '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(){
// $pattern = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*([^\(]*)/imsx';
$pattern = '/^\\s*CREATE\\s*(?:TEMP|TEMPORARY)?\\s*TABLE\\s*(?:IF\\s*NOT\\s*EXISTS)?\\s*([^\(]*)/imsx';
$pattern = '/^\\s*CREATE\\s*(?:TEMP|TEMPORARY)?\\s*TABLE\\s*(?:IF\\s*NOT\\s*EXISTS)?\\s*([^\(]*)/imsx';
if (preg_match($pattern, $this->_query, $matches)) {
$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(){
$array_types = array (
'bit' => 'integer', 'bool' => 'integer',
'boolean' => 'integer', 'tinyint' => 'integer',
'smallint' => 'integer', 'mediumint' => 'integer',
'int' => 'integer', 'integer' => 'integer',
'bigint' => 'integer', 'float' => 'real',
'double' => 'real', 'decimal' => 'real',
'dec' => 'real', 'numeric' => 'real',
'fixed' => 'real', 'date' => 'text',
'datetime' => 'text', 'timestamp' => 'text',
'time' => 'text', 'year' => 'text',
'char' => 'text', 'varchar' => 'text',
'binary' => 'integer', 'varbinary' => 'blob',
'tinyblob' => 'blob', 'tinytext' => 'text',
'blob' => 'blob', 'text' => 'text',
'mediumblob' => 'blob', 'mediumtext' => 'text',
'longblob' => 'blob', 'longtext' => 'text'
);
foreach ($array_types as $o=>$r){
$pattern = '/\\b(?<!`)'.$o.'\\b\\s*(\([^\)]*\)*)?\\s*/imsx';
$this->_query = preg_replace($pattern, " $r ", $this->_query);
'bit' => 'integer', 'bool' => 'integer',
'boolean' => 'integer', 'tinyint' => 'integer',
'smallint' => 'integer', 'mediumint' => 'integer',
'int' => 'integer', 'integer' => 'integer',
'bigint' => 'integer', 'float' => 'real',
'double' => 'real', 'decimal' => 'real',
'dec' => 'real', 'numeric' => 'real',
'fixed' => 'real', 'date' => 'text',
'datetime' => 'text', 'timestamp' => 'text',
'time' => 'text', 'year' => 'text',
'char' => 'text', 'varchar' => 'text',
'binary' => 'integer', 'varbinary' => 'blob',
'tinyblob' => 'blob', 'tinytext' => 'text',
'blob' => 'blob', 'text' => 'text',
'mediumblob' => 'blob', 'mediumtext' => 'text',
'longblob' => 'blob', 'longtext' => 'text'
);
foreach ($array_types as $o => $r){
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)) {
;
} else {
$this->_query = preg_replace($pattern, " $r ", $this->_query);
}
}
}
/**
* Method for stripping the comments from the SQL statement
*/
* Method for stripping the comments from the SQL statement.
*
* @access private
*/
private function rewrite_comments(){
$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(){
$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);
}
/**
* 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(){
$this->_query = preg_replace('/\\bunsigned\\b/ims', ' ', $this->_query);
}
/**
* Method for rewriting auto_increment
* if the field type is 'integer primary key', it is automatically autoincremented
*/
* Method for rewriting primary key auto_increment.
*
* 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(){
$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\\b\\s*(,)?/ims', ' PRIMARY KEY AUTOINCREMENT $1', $this->_query, -1, $count);
@ -125,168 +195,222 @@ class CreateQuery{
$this->has_primary_key = true;
}
}
/**
* Method for rewriting primary key
*/
* Method for rewriting primary key.
*
* @access private
*/
private function rewrite_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 {
// 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);
// 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);
}
}
/**
* Method for rewriting unique key
*/
private function rewrite_unique_key(){
$this->_query = preg_replace_callback('/\\bunique key\\b([^\(]*)(\([^\)]*\))/ims', array($this, '_rewrite_unique_key'), $this->_query);
* 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);
}
}
}
/**
* Callback method for rewrite_unique_key
* Method for rewriting unique key.
*
* @access private
*/
private function rewrite_unique_key(){
$this->_query = preg_replace_callback('/\\bunique key\\b([^\(]*)(\(.*\))/im', array($this, '_rewrite_unique_key'), $this->_query);
}
/**
* Callback method for rewrite_unique_key.
*
* @param array $matches an array of matches from the Regex
* @access private
*/
private function _rewrite_unique_key($matches){
$index_name = trim($matches[1]);
$col_name = trim($matches[2]);
$tbl_name = $this->table_name;
$_wpdb = new PDODB();
$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
$_wpdb = null;
if ($results) {
foreach ($results as $result) {
if ($result->name == $index_name) {
$r = rand(0, 50);
$index_name = $index_name . "_$r";
break;
}
}
}
$index_name = trim($matches[1]);
$col_name = trim($matches[2]);
$tbl_name = $this->table_name;
if (preg_match('/\(\\d+?\)/', $col_name)) {
$col_name = preg_replace('/\(\\d+?\)/', '', $col_name);
}
$_wpdb = new PDODB();
$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
$_wpdb = null;
if ($results) {
foreach ($results as $result) {
if ($result->name == $index_name) {
$r = rand(0, 50);
$index_name = $index_name . "_$r";
break;
}
}
}
$index_name = str_replace(' ', '', $index_name);
$this->index_queries[] = "CREATE UNIQUE INDEX $index_name ON " . $tbl_name .$col_name;
return '';
}
/**
* Method for handling ENUM fields
* SQLite doesn't support enum, so we change it to check constraint
* Method for handling ENUM fields.
*
* SQLite doesn't support enum, so we change it to check constraint.
*
* @access private
*/
private function rewrite_enum(){
$pattern = '/(,|\))([^,]*)enum\((.*?)\)([^,\)]*)/ims';
$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){
$output = $matches[1] . ' ' . $matches[2]. ' TEXT '. $matches[4].' CHECK ('.$matches[2].' IN ('.$matches[3].')) ';
return $output;
}
/**
* Method for rewriting usage of set
* whilst not identical to enum, they are similar and sqlite does not
* support either.
* Method for rewriting usage of set.
*
* It is similar but not identical to enum. SQLite does not support either.
*
* @access private
*/
private function rewrite_set(){
$pattern = '/\b(\w)*\bset\\s*\((.*?)\)\\s*(.*?)(,)*/ims';
$this->_query = preg_replace_callback($pattern, array($this, '_rewrite_enum'), $this->_query);
}
/**
* 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
* 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.
*
* @access private
*/
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
*/
* @access private
*/
private function _rewrite_key($matches){
$index_name = trim($matches[2]);
$col_name = trim($matches[3]);
if (preg_match('/\([0-9]+?\)/', $col_name, $match)) {
$col_name = preg_replace_callback('/\([0-9]+?\)/', array($this, '_remove_length'), $col_name);
}
$tbl_name = $this->table_name;
$_wpdb = new PDODB();
$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
$_wpdb = null;
if ($results) {
foreach ($results as $result) {
if ($result->name == $index_name) {
$r = rand(0, 50);
$index_name = $index_name . "_$r";
break;
}
}
}
$index_name = trim($matches[2]);
$col_name = trim($matches[3]);
if (preg_match('/\([0-9]+?\)/', $col_name, $match)) {
$col_name = preg_replace_callback('/\([0-9]+?\)/', array($this, '_remove_length'), $col_name);
}
$tbl_name = $this->table_name;
$_wpdb = new PDODB();
$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
$_wpdb = null;
if ($results) {
foreach ($results as $result) {
if ($result->name == $index_name) {
$r = rand(0, 50);
$index_name = $index_name . "_$r";
break;
}
}
}
$this->index_queries[] = 'CREATE INDEX '. $index_name . ' ON ' . $tbl_name . $col_name ;
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) {
return '';
return '';
}
/**
* Method to assemble the main query and index queries into an array
* to be returned to the base class
* @return array
* Method to assemble the main query and index queries into an array.
*
* It return the array of the queries to be executed separately.
*
* @return array
* @access private
*/
private function post_process(){
private function post_process() {
$mainquery = $this->_query;
do{
$count = 0;
$count = 0;
$mainquery = preg_replace('/,\\s*\)/imsx',')', $mainquery, -1, $count);
} while ($count > 0);
do {
$count = 0;
$mainquery = preg_replace('/\(\\s*?,/imsx', '(', $mainquery, -1, $count);
$count = 0;
$mainquery = preg_replace('/\(\\s*?,/imsx', '(', $mainquery, -1, $count);
} while ($count > 0);
$return_val[] = $mainquery;
$return_val = array_merge($return_val, $this->index_queries);
return $return_val;
$return_val = array_merge($return_val, $this->index_queries);
return $return_val;
}
/**
* Method to add IF NOT EXISTS to query defs
* 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
* output
* Method to add IF NOT EXISTS to query string.
*
* This adds IF NOT EXISTS to every query string, which prevent the exception
* from being thrown.
*
* @access private
*/
private function add_if_not_exists(){
$pattern_table = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*/ims';
$this->_query = preg_replace($pattern_table, 'CREATE $1 TABLE IF NOT EXISTS ', $this->_query);
$this->_query = preg_replace($pattern_table, 'CREATE $1 TABLE IF NOT EXISTS ', $this->_query);
$pattern_index = '/^\\s*CREATE\\s*(UNIQUE)?\\s*INDEX\\s*(IF NOT EXISTS)?\\s*/ims';
for ($i = 0; $i < count($this->index_queries); $i++) {
$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(){
$this->_query = str_replace('`', '', $this->_query);
foreach ($this->index_queries as &$query) {
$query = str_replace('`', '', $query);
}
foreach ($this->index_queries as &$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(){
$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';
$pattern_collate1 = '/\\s*collate\\s*[^ ]*(?=,)/im';
$pattern_collate2 = '/\\s*collate\\s*[^ ]*(?<!;)/im';
$patterns = array($pattern_charset, $pattern_collate1, $pattern_collate2);
$this->_query = preg_replace($patterns, '', $this->_query);
$pattern_collate2 = '/\\s*collate\\s*[^ ]*(?<!;)/im';
$patterns = array($pattern_charset, $pattern_collate1, $pattern_collate2);
$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);
}
}
?>

View File

@ -6,8 +6,8 @@ Tags: database, SQLite, PDO
Author: Kojima Toshiyasu
Author URI: http://dogwood.skr.jp/
Requires at least: 3.3
Tested up to: 3.5.2
Stable tag: 1.1
Tested up to: 4.1.1
Stable tag: 1.8.1
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -15,110 +15,109 @@ SQLite IntegrationはSQLiteでWordPressを使えるようにするプラグイ
== 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 のないローカルマシンでサイトのテストをすることもできるでしょう。
= Features =
インストールが終わったら、このプラグインを有効化することができます(必須ではありませんが、お勧めします)。そうすると、サーバやインストールされたプラグインについての情報を見ることができるようになります。
SQLite Integrationは普通の「プラグイン」ではありません。WordPressをインストールするときに使います。そのため、少し準備が必要です。インストールのセクションを参照してください。[SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/)をご覧になると、もっと詳しい説明を読むことができます。
= システム要件 =
インストールに成功したら、MySQLを使う他のWordPressと同じように使うことができます。オプションとして、管理パネルでこのプラグインを有効化することができます。有効化すると有益な情報と説明を見ることができます。これは必須ではありませんが、お勧めします。
* PHP 5.2 以上で PDO extension が必要です(PHP 5.3 以上をお勧めします)。
* PDO SQLite ドライバがロードされている必要があります。
= Backward Compatibility =
= 後方互換性 =
現在[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データベース・ファイルを置きたい場合は、次の行を追加してください(最後のスラッシュを忘れずに)。
`define('DB_DIR', '/home/youraccount/database_directory/');`
注意: PHPスクリプトがこのディレクトリを作ったり、中にファイルを書き込んだりする権限を持っていることが必要です。
* デフォルト(.ht.sqlite)とは違うデータベース・ファイル名を使いたい場合は、次の行を追加してください。
`define('DB_FILE', 'database_file_name');`
注意: PDO for WordPressをお使いの方は、「データベースを移行する」のセクションをご覧ください。
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 とリネームします。
よくわからない場合は、何も追加する必要はありません。
= 基本的な設定 =
wp-config.phpの準備が終わったら、次のステップに進みます。
wp-config.php ファイルを開き、下のセクションを編集します。
1. プラグインのアーカイブを展開します。
* 認証用ユニークキー
* WordPressデータベーステーブルの接頭辞
* ローカル言語(日本語版では、jaがすでに設定されています)
2. アーカイブに含まれるdb.phpファイルをwp-contentディレクトリに移動(またはコピー)してください。
Codex の[wp-config.php の編集](http://wpdocs.sourceforge.jp/wp-config.php_%E3%81%AE%E7%B7%A8%E9%9B%86)を参照してください。
3. sqlite-wordpressディレクトリをwp-content/plugin/ディレクトリの下に移動してください。
= 5 分もかからないインストール =
`wordpress/wp-contents/db.php`
と、
`wordpress/wp-contents/sqlite-integration`
のようになります。
wordpress フォルダをサーバにアップロードして、ブラウザでアクセスすると、インストールが始まります。ブログ名などを入力してインストールすれば終了です。ブログをお楽しみください。
さあ、これでお終いです。ディレクトリの構造をそのままに、あなたのサーバにアップロードして、お好きなブラウザでwp-admin/install.phpにアクセスしてください。WordPressのインストールが始まります。Enjoy blogging!
= オプション設定 =
= Migrate your database to SQLite Integration =
wp-config.php に設定を書き込むと、デフォルトの設定を変更することができます。SQLite データベースファイル名を変更したい場合は(デフォルトは .ht.sqlite です)、下の 1 行を加えてください。
一番よい方法は、次のようにすることです。
`define('DB_FILE', 'your_database_name');`
1. データをエクスポートする
SQLite データベースファイルが置かれるディレクトリを変更したい場合は、次の行を追加してください
`define('DB_DIR', '/home/youraccount/database_directory/');`
どちらか片方だけでも、両方でも変更できます。
= このプラグインを削除せずに MySQL を使う =
MySQL を使いたいときは、次の行を wp-config.php に追加してください。
`define('USE_MYSQL', true);`
もちろん、これだけでは足りません。データベースサーバやユーザ名、パスワードなども設定してください。この行を追加して、最初にサイトにアクセスすると、WordPress のインストールが始まります。MySQL でのインストールを終えてください。おわかりのように、SQLite のデータは自動的に MySQL に引き継がれることはありません。
SQLite に戻りたいときには、この行を次のように変更するか、この行を削除してください。
`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を使って新規インストールする。
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に次の行を追加してください。
`define('FQDB', 'MyBlog.sqlite');`
4. wp-content/db.phpをSQLite Integrationに含まれている同名のファイルと入れ替えてください。
これでおしまいです。忘れずに必要要件とWordPressのバージョンをチェックしてください。*SQLite IntegrationはWordPress 3.2.x以前のものでは動作しません。*
== Frequently Asked Questions ==
wp-config.php を手動で作成することが必要です。WordPress に作らせようとすると、途中でインストールが止まります。
= データベース・ファイルが作られません =
@ -136,40 +135,129 @@ wp-config.phpの準備が終わったら、次のステップに進みます。
1. システム情報の画面ではデータベースの状態やプラグインの対応状況を見ることができます。
== Requirements ==
* PHP 5.2 以上で PDO extension が必要です(PHP 5.3 以上をお勧めします)。
* PDO SQLite ドライバがロードされている必要があります。
== Known Limitations ==
多くのプラグインはちゃんと動作するはずです。が、中にはそうでないものもあります。一般的には、WordPressの関数を通さず、PHPのMysqlあるいはMysqliライブラリの関数を使ってデータベースを操作しようとするプラグインは問題を起こすでしょう。
他には下のようなものがあります。
= これらのプラグインを使うことはできません。SQLite Integrationと同じファイルを使おうとするからです。 =
これらのプラグインを使うことはできません。SQLite Integrationと同じファイルを使おうとするからです。
* [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/)
* W3 Total Cache
* DB Cache Reloaded Fix
* HyperDB
= これらのプラグインも使えません。SQLiteがエミュレートできないMySQL独自の拡張機能を使っているからです。 =
'WP Super Cache'や'Quick Cache'のようなプラグインなら使えるかもしれません。お勧めはしませんし、何も保証しませんが。
* [Yet Another Related Posts](http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/)
* [Better Related Posts](http://wordpress.org/extend/plugins/better-related/)
これらのプラグインも使えません。SQLite Integration がエミュレートできない MySQL 独自の拡張機能を使っているからです。
たぶん、もっとあるでしょう。
* Yet Another Related Posts
* Better Related Posts
== Changelog ==
'WordPress Related Posts'や'Related Posts'のようなプラグインなら使うことができるかもしれません。
= 1.1 (2013-07-24) =
* DROP INDEX 単独のクエリが動作していなかったのを修正しました。
* shutdown_hook で descructor を実行していたのをやめました。
* LOCATE() 関数を使えるようにしました。
たぶん、もっとあるでしょう。動作しないプラグインを見つけたら、お知らせいただけると助かります。
= 1.0 (2013-07-07) =
最初のリリース。
非互換のプラグインの中には、少し修正をすると、使えるようになるものがあります。[Plugins(ja)](http://dogwood.skr.jp/wordpress/plugins-ja/)で情報を公開していますので、参照してください。
このプラグインは、'WP_PLUGIN_URL' 定数をサポートしません。
== Upgrade Notice ==
SQLite Integrationのアップグレードに失敗するようなら、FTPを使っての手動アップグレードを試してみてください。
WordPress 4.1.1 での動作チェックをして、いくつかのバグを修正しました。アップグレードをお勧めします。自動アップグレードで失敗するようなら、FTPを使っての手動アップグレードを試してみてください。
== 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) =
* アップグレードしたWordPressで期待通り動作しないのを修正するために、データベース管理ユーティリティを追加しました。
* SHOW INDEXクエリにWHERE句がある場合の処理を変更しました。
* ALTER TABLEクエリのバグを修正しました。
= 1.3 (2013-09-04) =
* データベースファイルのスナップショットをzipアーカイブとしてバックアップするユーティリティを追加しました。
* ダッシュボードのスタイルをMP6プラグインに合わせたものに変えました。
* 言語カタログが読み込まれていないときのエラーメッセージの出力方法を一部変更しました。
* query_create.class.phpの_rewrite_field_types()を変更しました。dbDelta()関数が意図したとおりに実行されます。
* BETWEENステートメントが使えるようになりました。
* クエリからインデックスヒントを全て削除して実行するようにしました。
* New StatPressプラグインが使えるように、ALTER TABLE CHANGE COLUMNの扱いを修正しました。
* いくつかの小さなバグを修正しました。
= 1.2.1 (2013-08-04) =
* wp-db.phpの変更にともなって、wpdb::real_escapeプロパティを削除しました。WordPress 3.6 との互換性を保つための変更です。
= 1.2 (2013-08-03) =
* カレンダー・ウィジェットでの不具合に対応するため、日付フォーマットとそのクオートを修正しました。
* Windows マシンでパッチファイルが削除できなかったのを修正しました。
* パッチファイルをアップロードするときに textdomain のエラーが出るのを修正しました。
* ON DUPLICATE KEY UPDATEをともなったクエリの処理を変更しました。
* readme.txt と readme-ja.txt の間違いを直しました。
= 1.1 (2013-07-24) =
* DROP INDEX 単独のクエリが動作していなかったのを修正しました。
* shutdown_hook で destruct() を実行していたのをやめました。
* LOCATE() 関数を使えるようにしました。
= 1.0 (2013-07-07) =
* 最初のリリース。

262
readme.md Normal file
View File

@ -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.

View File

@ -1,167 +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.5.2
Stable tag: 1.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 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.
= 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 be 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.
== Changelog ==
= 1.1 (2013-07-24) =
* Fixed the manipulation of DROP INDEX query.
* Removed desctructor() from shutdown_hook.
* Enabled LOCATE() function in the query string.
= 1.0 (2013-07-07) =
First release version of the plugin.
== Upgrade Notice ==
When auto upgrading of SQLite Integration fails, Please try manual upgrade via FTP.

View File

@ -1,87 +1,92 @@
<?php
/**
* This file defines the make_db_sqlite() function.
*
* @package SQLite Integration
* @version 1.1
* @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
* This is run only once while installation.
* Function to create tables according to the schemas of WordPress.
*
* This is executed only once while installation.
*
* @return boolean
*/
function make_db_sqlite() {
include_once PDODIR . 'query_create.class.php';
include_once ABSPATH . 'wp-admin/includes/schema.php';
$index_array = array();
ob_end_clean();
$table_schemas = wp_get_db_schema();
$queries = explode (";", $table_schemas);
$query_parser = new CreateQuery();
include_once PDODIR . 'query_create.class.php';
include_once ABSPATH . 'wp-admin/includes/schema.php';
$index_array = array();
//ob_end_clean();
$table_schemas = wp_get_db_schema();
$queries = explode (";", $table_schemas);
$query_parser = new CreateQuery();
try {
$pdo = new PDO('sqlite:'.FQDB, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$pdo = new PDO('sqlite:'.FQDB, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
} catch (PDOException $err) {
$err_data = $err->errorInfo;
$message = __("Database connection error!<br />", 'sqlite-integration');
$message .= sprintf(__("Error message is: %s", 'sqlite-integration'), $err_data[2]);
echo $message;
return false;
$err_data = $err->errorInfo;
$message = 'Database connection error!<br />';
$message .= sprintf("Error message is: %s", $err_data[2]);
wp_die($message, 'Database Error!');
}
try {
$pdo->beginTransaction();
foreach ($queries as $query) {
$query = trim($query);
if (empty($query))
continue;
$rewritten_query = $query_parser->rewrite_query($query);
if (is_array($rewritten_query)) {
$table_query = array_shift($rewritten_query);
$index_queries = $rewritten_query;
$table_query = trim($table_query);
$pdo->exec($table_query);
// foreach($rewritten_query as $single_query) {
// $single_query = trim($single_query);
// $pdo->exec($single_query);
// }
} else {
$rewritten_query = trim($rewritten_query);
$pdo->exec($rewritten_query);
}
}
$pdo->commit();
if ($index_queries) {
// $query_parser rewrites KEY to INDEX, so we don't need KEY pattern
$pattern = '/CREATE\\s*(UNIQUE\\s*INDEX|INDEX)\\s*IF\\s*NOT\\s*EXISTS\\s*(\\w+)?\\s*.*/im';
$pdo->beginTransaction();
foreach ($index_queries as $index_query) {
preg_match($pattern, $index_query, $match);
$index_name = trim($match[2]);
if (in_array($index_name, $index_array)) {
$r = rand(0, 50);
$replacement = $index_name . "_$r";
$index_query = str_ireplace('EXISTS '.$index_name, 'EXISTS '.$replacement, $index_query);
} else {
$index_array[] = $index_name;
}
$pdo->exec($index_query);
}
$pdo->commit();
}
$pdo->beginTransaction();
foreach ($queries as $query) {
$query = trim($query);
if (empty($query))
continue;
$rewritten_query = $query_parser->rewrite_query($query);
if (is_array($rewritten_query)) {
$table_query = array_shift($rewritten_query);
$index_queries = $rewritten_query;
$table_query = trim($table_query);
$pdo->exec($table_query);
//foreach($rewritten_query as $single_query) {
// $single_query = trim($single_query);
// $pdo->exec($single_query);
//}
} else {
$rewritten_query = trim($rewritten_query);
$pdo->exec($rewritten_query);
}
}
$pdo->commit();
if ($index_queries) {
// $query_parser rewrites KEY to INDEX, so we don't need KEY pattern
$pattern = '/CREATE\\s*(UNIQUE\\s*INDEX|INDEX)\\s*IF\\s*NOT\\s*EXISTS\\s*(\\w+)?\\s*.*/im';
$pdo->beginTransaction();
foreach ($index_queries as $index_query) {
preg_match($pattern, $index_query, $match);
$index_name = trim($match[2]);
if (in_array($index_name, $index_array)) {
$r = rand(0, 50);
$replacement = $index_name . "_$r";
$index_query = str_ireplace('EXISTS '.$index_name, 'EXISTS '.$replacement, $index_query);
} else {
$index_array[] = $index_name;
}
$pdo->exec($index_query);
}
$pdo->commit();
}
} catch (PDOException $err) {
$err_data = $err->errorInfo;
$err_code = $err_data[1];
if (5 == $err_code || 6 == $err_code) {
// if the database is locked, commit again
$pdo->commit();
} else {
$pdo->rollBack();
$message = sprintf(__("Error occured while creating tables or indexes...<br />Query was: %s<br />", 'sqlite-integration'), var_export($rewritten_query, true));
$message .= sprintf(__("Error message is: %s", 'sqlite-integration'), $err_data[2]);
echo $message;
return false;
}
$err_data = $err->errorInfo;
$err_code = $err_data[1];
if (5 == $err_code || 6 == $err_code) {
// if the database is locked, commit again
$pdo->commit();
} else {
$pdo->rollBack();
$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]);
wp_die($message, 'Database Error!');
}
}
$query_parser = null;

View File

@ -1,17 +1,17 @@
<?php
/*
Plugin Name: SQLite Integration
Plugin URI: http://wordpress.org/extend/plugins/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.
Author: Kojima Toshiyasu
Version: 1.1
Version: 1.8.1
Author URI: http://dogwood.skr.jp
Text Domain: sqlite-integration
Domain Path: /languages
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
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
@ -27,210 +27,297 @@ 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');
/*
* Defines basic constants.
*/
define('SQLITE_INTEGRATION_VERSION', '1.8.1');
define('SQLiteDir', dirname(plugin_basename(__FILE__)));
define('SQLiteFilePath', dirname(__FILE__));
define('SQLiteDirName', basename(SQLiteFilePath));
define('SQLiteUrl', $siteurl . '/wp-content/plugins/' . SQLiteDir);
if (defined('UPLOADS')) {
define('SQLitePatchDir', UPLOADS . '/patches');
if (defined('WP_PLUGIN_URL')) {
define('SQLiteUrl', WP_PLUGIN_URL . '/' . SQLiteDir);
} else {
if (defined('WP_CONTENT_DIR')) {
define('SQLitePatchDir', WP_CONTENT_DIR . '/uploads/patches');
} else {
define('SQLitePatchDir', ABSPATH . 'wp-content/uploads/patches');
}
define('SQLiteUrl', $siteurl . '/wp-content/plugins/' . SQLiteDir);
}
/*
* Defines patch file upload directory.
*/
if (defined('UPLOADS')) {
define('SQLitePatchDir', UPLOADS . '/patches');
} else {
if (defined('WP_CONTENT_DIR')) {
define('SQLitePatchDir', WP_CONTENT_DIR . '/uploads/patches');
} else {
define('SQLitePatchDir', ABSPATH . 'wp-content/uploads/patches');
}
}
/*
* Plugin compatibility file in json format.
*/
define('SQLiteListFile', SQLiteFilePath . '/utilities/plugin_lists.json');
/*
* Instantiates utility classes.
*/
if (!class_exists('SQLiteIntegrationUtils')) {
require_once SQLiteFilePath . '/utilities/utility.php';
$utils = new SQLiteIntegrationUtils();
require_once SQLiteFilePath . '/utilities/utility.php';
$utils = new SQLiteIntegrationUtils();
}
if (!class_exists('SQLiteIntegrationDocument')) {
require_once SQLiteFilePath . '/utilities/documentation.php';
$doc = new SQLiteIntegrationDocument();
require_once SQLiteFilePath . '/utilities/documentation.php';
$doc = new SQLiteIntegrationDocument();
}
if (!class_exists('PatchUtils')) {
require_once SQLiteFilePath . '/utilities/patch.php';
$patch_utils = new PatchUtils();
require_once SQLiteFilePath . '/utilities/patch.php';
$patch_utils = new PatchUtils();
}
if (!class_exists('DatabaseMaintenance')) {
require_once SQLiteFilePath . '/utilities/database_maintenance.php';
$maintenance = new 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
* of the plugin.
*
* @package SQLite Integration
* @author Kojima Toshiyasu
*
*/
class SQLiteIntegration {
/**
* This constructor does everything needed
*/
function __construct() {
if (function_exists('register_activation_hook')) {
register_activation_hook(__FILE__, array($this, 'install'));
}
if (function_exists('register_deactivation_hook')) {
}
if (function_exists('register_uninstall_hook')) {
register_uninstall_hook(__FILE__, array('SQLiteIntegration', 'uninstall'));
}
if (function_exists('is_multisite') && is_multisite()) {
add_action('network_admin_menu', array($this, 'add_network_pages'));
} else {
add_action('admin_menu', array($this, 'add_pages'));
}
add_action('plugins_loaded', array($this, 'textdomain_init'));
}
/**
* Constructor.
*
* This constructor does everything needed for the administration panel.
*
* @param no parameter is provided.
*/
function __construct() {
if (function_exists('register_activation_hook')) {
register_activation_hook(__FILE__, array($this, 'install'));
}
if (function_exists('register_deactivation_hook')) {
;
}
if (function_exists('register_uninstall_hook')) {
register_uninstall_hook(__FILE__, array('SQLiteIntegration', 'uninstall'));
}
if (function_exists('is_multisite') && is_multisite()) {
add_action('network_admin_menu', array($this, 'add_network_pages'));
add_action('network_admin_notices', array('SQLiteIntegrationUtils', 'show_admin_notice'));
} else {
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'));
}
/**
* Nothing to install
* for future use...
*/
function install() {
global $wpdb;
if (function_exists('is_multisite') && is_multisite()) {
$old_blog = $wpdb->blogid;
$blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
foreach ($blog_ids as $blog_id) {
switch_to_blog($blog_id);
$this->_install();
}
switch_to_blog($old_blog);
return;
} else {
$this->_install();
return;
}
}
/**
* Nothing to do...
* We show menu and documents only to the network administrator
*/
function _install() {
}
/**
* Is it better that we remove wp-content/db.php and wp-content/patches
* directory?...
* If you migrate the site to the sever with MySQL, you have only to
* migrate the data in the database.
*/
function uninstall() {
// remove patch files and patch directory
if (file_exists(SQLitePatchDir) && is_dir(SQLitePatchDir)) {
$dir_handle = opendir(SQLitePatchDir);
while (($file_name = readdir($dir_handle)) !== false) {
if ($file_name != '.' && $file_name != '..') {
unlink(SQLitePatchDir.'/'.$file_name);
}
}
rmdir(SQLitePatchDir);
}
// remove wp-content/db.php
if (defined('WP_CONTENT_DIR')) {
$target = WP_CONTENT_DIR . 'db.php';
} else {
$target = ABSPATH . 'wp-content/db.php';
}
if (file_exists($target)) {
unlink($target);
}
}
/**
* 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
* slug set to null. This means that menu items are added but hidden from the
* users.
*/
function add_pages() {
global $utils, $doc, $patch_utils;
if (function_exists('add_options_page')) {
$welcome_page = add_options_page(__('SQLite Integration'), __('SQLite Integration'), 'manage_options', 'sqlite-integration', array($utils, 'welcome'));
$util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_options', 'sys-info', array($utils, 'show_utils'));
$edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_options', 'setting-file', array($utils, 'edit_db_file'));
$doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_options', 'doc', array($doc, 'show_doc'));
$patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_options', 'patch', array($patch_utils, 'show_patch_page'));
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-'.$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-'.$patch_page, array($this, 'add_style_sheet'));
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-'.$patch_page, array($this, 'add_sqlite_script'));
}
}
/**
* Network admin can only see documents and manipulate patch files.
* So, capability is set to manage_network_options.
*/
function add_network_pages() {
global $utils, $doc, $patch_utils;
if (function_exists('add_options_page')) {
$welcome_page = add_submenu_page('settings.php', __('SQLite Integration'), __('SQLite Integration'), 'manage_network_options', 'sqlite-integration', array($utils, 'welcome'));
$util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_network_options', 'sys-info', array($utils, 'show_utils'));
$edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_network_options', 'setting-file', array($utils, 'edit_db_file'));
$doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_network_options', 'doc', array($doc, 'show_doc'));
$patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_network_options', 'patch', array($patch_utils, 'show_patch_page'));
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-'.$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-'.$patch_page, array($this, 'add_style_sheet'));
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-'.$patch_page, array($this, 'add_sqlite_script'));
}
}
/**
* Japanese catalog is only available
*/
function textdomain_init() {
global $utils;
// $current_locale = get_locale();
// if (!empty($current_locale)) {
// $moFile = dirname(__FILE__) . "/languages/sqlite-wordpress-" . $current_locale . ".mo";
// if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('sqlite-wordpress', $moFile);
// }
load_plugin_textdomain($utils->text_domain, false, SQLiteDir.'/languages/');
}
/**
* Method to install on multisite or single site.
*
* There really is nothing to install for now. It is for future use...
*
* @param no parameter is provided.
* @return returns null.
*/
function install() {
global $wpdb;
if (function_exists('is_multisite') && is_multisite()) {
$old_blog = $wpdb->blogid;
$blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
foreach ($blog_ids as $blog_id) {
switch_to_blog($blog_id);
$this->_install();
}
switch_to_blog($old_blog);
return;
} else {
$this->_install();
return;
}
}
/**
* Styles and JavaScripts
*/
function add_style_sheet() {
$style_url = SQLiteUrl . '/styles/style.css';
$style_file = SQLiteFilePath . '/styles/style.css';
if (file_exists($style_file)) {
wp_enqueue_style('sqlite_integration_stylesheet', $style_url);
}
}
function add_doc_style_sheet() {
$style_url = SQLiteUrl . '/styles/doc.css';
$style_file = SQLiteFilePath . '/styles/doc.css';
if (file_exists($style_file)) {
wp_enqueue_style('sqlite_integration_doc_style', $style_url);
}
}
function add_sqlite_script() {
$script_url = SQLiteUrl . '/js/sqlite.js';
$script_file = SQLiteFilePath . '/js/sqlite.js';
if (file_exists($script_file)) {
wp_enqueue_script('sqlite-integration', $script_url, 'jquery');
}
}
/**
* Method to install something.
*
* 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() {
}
/**
* Method to uninstall plugin.
*
* 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
* migrate the data in the database.
*
* @param no parameter is provided.
* @return no return values.
*/
function uninstall() {
// remove patch files and patch directory
if (file_exists(SQLitePatchDir) && is_dir(SQLitePatchDir)) {
$dir_handle = opendir(SQLitePatchDir);
while (($file_name = readdir($dir_handle)) !== false) {
if ($file_name != '.' && $file_name != '..') {
unlink(SQLitePatchDir.'/'.$file_name);
}
}
rmdir(SQLitePatchDir);
}
// remove wp-content/db.php
if (defined('WP_CONTENT_DIR')) {
$target = WP_CONTENT_DIR . 'db.php';
} else {
$target = ABSPATH . 'wp-content/db.php';
}
if (file_exists($target)) {
unlink($target);
}
}
/**
* Method to manipulate the admin panel, stylesheet and JavaScript.
*
* 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
* slug set to null. This means that menu items are added but hidden from the
* users.
*
* @param no parameter is provided.
* @return no return values.
*/
function add_pages() {
global $utils, $doc, $patch_utils, $maintenance;
if (function_exists('add_options_page')) {
$welcome_page = add_options_page(__('SQLite Integration'), __('SQLite Integration'), 'manage_options', 'sqlite-integration', array($utils, 'welcome'));
$util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_options', 'sys-info', array($utils, 'show_utils'));
$edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_options', 'setting-file', array($utils, 'edit_db_file'));
$doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_options', 'doc', array($doc, 'show_doc'));
$patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_options', 'patch', array($patch_utils, 'show_patch_page'));
$maintenance_page = add_submenu_page(null, 'DB Maintenance', 'DB Maintenance', 'manage_options', 'maintenance', array($maintenance, 'show_maintenance_page'));
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-'.$edit_db, array($this, 'add_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_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-'.$patch_page, array($this, 'add_sqlite_script'));
add_action('admin_print_scripts-'.$edit_db, array($this, 'add_sqlite_script'));
add_action('admin_print_styles-'.$maintenance_page, array($this, 'add_style_sheet'));
}
}
/**
* Method to manipulate network admin panel.
*
* Capability is set to manage_network_options.
*
* @param no parameter is provided.
* @return no return values.
*/
function add_network_pages() {
global $utils, $doc, $patch_utils, $maintenance;
if (function_exists('add_options_page')) {
$welcome_page = add_submenu_page('settings.php', __('SQLite Integration'), __('SQLite Integration'), 'manage_network_options', 'sqlite-integration', array($utils, 'welcome'));
$util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_network_options', 'sys-info', array($utils, 'show_utils'));
$edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_network_options', 'setting-file', array($utils, 'edit_db_file'));
$doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_network_options', 'doc', array($doc, 'show_doc'));
$patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_network_options', 'patch', array($patch_utils, 'show_patch_page'));
$maintenance_page = add_submenu_page(null, 'DB Maintenance', 'DB Maintenance', 'manage_network_options', 'maintenance', array($maintenance, 'show_maintenance_page'));
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-'.$edit_db, array($this, 'add_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_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-'.$patch_page, array($this, 'add_sqlite_script'));
add_action('admin_print_scripts-'.$edit_db, array($this, 'add_sqlite_script'));
add_action('admin_print_styles-'.$maintenance_page, array($this, 'add_style_sheet'));
}
}
/**
* Method to initialize textdomain.
*
* Japanese catalog is only available.
*
* @param no parameter is provided.
* @return no return values.
*/
function textdomain_init() {
global $utils;
//$current_locale = get_locale();
//if (!empty($current_locale)) {
// $moFile = dirname(__FILE__) . "/languages/sqlite-wordpress-" . $current_locale . ".mo";
// if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('sqlite-wordpress', $moFile);
//}
load_plugin_textdomain($utils->text_domain, false, SQLiteDir.'/languages/');
}
/**
* 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() {
global $current_user;
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)) {
wp_enqueue_style('sqlite_integration_stylesheet', $style_url);
}
}
/**
* Method to register the JavaScript file.
*
* To register the JavaScript file. It's only for the admin dashboard.
* It won't included in web pages.
*
* @param no parameter is provided.
* @return no return value.
*/
function add_sqlite_script() {
$script_url = SQLiteUrl . '/js/sqlite.min.js';
$script_file = SQLiteFilePath . '/js/sqlite.min.js';
if (file_exists($script_file)) {
wp_enqueue_script('sqlite-integration', $script_url, 'jquery');
}
}
}
/* this is enough for initialization */

43
styles/blue.css Normal file
View File

@ -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);
}

1
styles/blue.min.css vendored Normal file
View File

@ -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}

42
styles/coffee.css Normal file
View File

@ -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);
}

1
styles/coffee.min.css vendored Normal file
View File

@ -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}

View File

@ -1,141 +0,0 @@
@CHARSET "UTF-8";
#sqlite-admin-wrap h2,
#sqlite-admin-side-wrap h2 {
background: rgb(73, 90, 88);
background: -moz-linear-gradient(bottom, rgba(73, 90, 88, 1), rgba(73, 90, 88, 0.5), rgba(73, 90, 88, 0));
background: -webkit-gradient(linear, bottom, top, from(rgba(73, 90, 88, 1)), color-stop(0.5, rgba(73, 90, 88, 0.5)), to(rgba(73, 90, 88, 0)));
background: linear-gradient(to top, rgba(73, 90, 88, 1), rgba(73, 90, 88, 0.2));
color: rgb(247, 254, 236);
-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;
text-shadow: -1px -1px 0 rgb(93, 69, 35),
1px -1px 0 rgb(93, 69, 35),
-1px 1px 0 rgb(93, 69, 35),
1px 1px 0 rgb(93, 69, 35);
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;
-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;
box-shadow: 5px 5px 5px #eee;
}
.menu-selected {
font-size: 20px;
display: inline;
min-width: 150px;
height: 50px;
margin-left: 0;
margin-right: 10px;
padding: 5px;
border: .5px solit #000;
-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;
box-shadow: 5px 5px 5px #eee;
background: rgb(73, 90, 88);
background: -moz-linear-gradient(bottom, rgba(73, 90, 88, 1), rgba(73, 90, 88, 0.5), rgba(73, 90, 88, 0));
background: -webkit-gradient(linear, bottom, top, from(rgba(73, 90, 88, 1)), color-stop(0.5, rgba(73, 90, 88, 0.5)), to(rgba(73, 90, 88, 0)));
background: linear-gradient(to top, rgba(73, 90, 88, 1), rgba(73, 90, 88, 0.2));
color: rgb(247, 254, 236);
text-shadow: -1px -1px 0 rgb(93, 69, 35),
1px -1px 0 rgb(93, 69, 35),
-1px 1px 0 rgb(93, 69, 35),
1px 1px 0 rgb(93, 69, 35);
}
.menu-item a {
text-decoration: none;
}
#sqlite-admin-wrap {
color: #1d1d1d;
font-size: 10pt;
border: 1px solid #ddd;
/* 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;
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;
/* 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;
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;
}

42
styles/ectoplasm.css Normal file
View File

@ -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);
}

1
styles/ectoplasm.min.css vendored Normal file
View File

@ -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}

2
styles/index.php Normal file
View File

@ -0,0 +1,2 @@
<?php
/* Silence is golden */

44
styles/light.css Normal file
View File

@ -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);
}

1
styles/light.min.css vendored Normal file
View File

@ -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}

46
styles/midnight.css Normal file
View File

@ -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);
}

1
styles/midnight.min.css vendored Normal file
View File

@ -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}

42
styles/ocean.css Normal file
View File

@ -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);
}

1
styles/ocean.min.css vendored Normal file
View File

@ -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}

View File

@ -1,22 +1,15 @@
/**
* This file is a part of SQLite Integration.
*
* @package SQLite Integration
* @author Kojima Toshiyasu
*/
@CHARSET "UTF-8";
#sqlite-admin-wrap h2,
#sqlite-admin-side-wrap h2 {
background: rgb(73, 90, 88);
background: -moz-linear-gradient(bottom, rgba(73, 90, 88, 1), rgba(73, 90, 88, 0.5), rgba(73, 90, 88, 0));
background: -webkit-gradient(linear, bottom, top, from(rgba(73, 90, 88, 1)), color-stop(0.5, rgba(73, 90, 88, 0.5)), to(rgba(73, 90, 88, 0)));
background: linear-gradient(to top, rgba(73, 90, 88, 1), rgba(73, 90, 88, 0.2));
color: rgb(247, 254, 236);
-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;
text-shadow: -1px -1px 0 rgb(93, 69, 35),
1px -1px 0 rgb(93, 69, 35),
-1px 1px 0 rgb(93, 69, 35),
1px 1px 0 rgb(93, 69, 35);
padding-left: 5px;
background: rgb(34, 34, 34);
color: rgb(255, 255, 255);
padding-left: 5px;
}
h3 {
clear: both;
@ -26,7 +19,6 @@ h3 {
margin-top: 0;
margin-bottom: 0;
min-height: 20px;
/* border: 1px solid #000; */
}
.navi-menu {
margin-left: 0;
@ -40,13 +32,9 @@ h3 {
margin-right: 10px;
padding: 5px;
border: .5px solit #000;
-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;
box-shadow: 5px 5px 5px #eee;
background: rgb(51, 51, 51);
color: (255, 255, 255);
line-height: 40px;
}
.menu-selected {
font-size: 20px;
@ -57,51 +45,48 @@ h3 {
margin-right: 10px;
padding: 5px;
border: .5px solit #000;
background: rgb(46, 162, 204);
color: rgb(255, 255, 255);
}
.menu-item a {
text-decoration: none;
color: rgb(255, 255, 255);
}
#sqlite-admin-wrap {
color: #1d1d1d;
font-size: 11pt;
border: 1px solid #ddd;
background: rgb(255, 255, 255);
-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;
box-shadow: 5px 5px 5px #eee;
background: rgb(73, 90, 88);
background: -moz-linear-gradient(bottom, rgba(73, 90, 88, 1), rgba(73, 90, 88, 0.5), rgba(73, 90, 88, 0));
background: -webkit-gradient(linear, bottom, top, from(rgba(73, 90, 88, 1)), color-stop(0.5, rgba(73, 90, 88, 0.5)), to(rgba(73, 90, 88, 0)));
background: linear-gradient(to top, rgba(73, 90, 88, 1), rgba(73, 90, 88, 0.2));
color: rgb(247, 254, 236);
text-shadow: -1px -1px 0 rgb(93, 69, 35),
1px -1px 0 rgb(93, 69, 35),
-1px 1px 0 rgb(93, 69, 35),
1px 1px 0 rgb(93, 69, 35);
}
.menu-item a {
text-decoration: none;
}
#sqlite-admin-wrap {
color: #1d1d1d;
font-size: 10pt;
border: 1px solid #ddd;
/* 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;
display: block;
float: left;
min-height: 100%;
position: relative;
width: 60%;
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: 10pt;
font-size: 11pt;
border: 1px solid #ddd;
background: rgb(255, 255, 255);
/* border-top: 0; */
-webkit-border-bottom-right-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
@ -109,6 +94,12 @@ h3 {
-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%;
@ -121,27 +112,33 @@ h3 {
}
p {
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{
/* width: 600px; */
width: 450px;
width: 80%;
}
table#status {
width: 450px;
width: 100%;
}
table#sqlite-table {
/* width: 700px; */
width: 650px;
width: 100%;
}
th.tbl-name {
width: 200px;
width: 25%;
}
th.tbl_owner {
width: 105px;
width: 25%;
}
th.tbl_index {
width: 350px;
width: 50%;
}
td.system {
color: rgb(153, 0, 0);
@ -150,12 +147,12 @@ td.user {
color: rgb(0, 0, 255);
}
td.menu-title {
width: 90px;
width: 95px;
}
table.statement {
width: 500px;
}
ul {
ul.in-body-list {
margin-left: 20px;
}
ol {
@ -166,6 +163,9 @@ pre.code {
margin-left: 15px;
margin-right: 10px;
background: #eee;
white-space: pre-wrap;
word-wrap: break-word;
overflow: auto;
}
tr.incompatible {
background: rgb(251, 229, 221);
@ -176,10 +176,10 @@ tr.workaround {
tr.compatible {
}
th.active-plugins {
width: 100px;
width: 20%;
}
th.compatible {
width: 80px;
width: 30%;
}
input.button-primary {
display: block;
@ -189,18 +189,23 @@ input.button-primary {
.alt {
background: rgb(247, 254, 236);
}
table#patch-files .item {
width: 40px;
.em {
font-weight: bold;
text-transform: capitalize;
}
table#patch-files .item,
table#backup-files .item {
width: 150px;
}
.alert {
color: rgb(256, 0, 0);
color: rgb(255, 0, 0);
}
div.alert {
display: block;
width: 95%;
text-align: center;
margin: 0 auto;
color: rgb(256, 0, 0);
color: rgb(255, 0, 0);
text-transform: capitalize;
}
blockquote.caution {
@ -213,4 +218,151 @@ blockquote.caution {
blockquote.caution > p {
margin: 5px;
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;
}
}

1
styles/style.min.css vendored Normal file
View File

@ -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}}

42
styles/sunrise.css Normal file
View File

@ -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);
}

1
styles/sunrise.min.css vendored Normal file
View File

@ -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}

View File

@ -0,0 +1,607 @@
<?php
/**
* 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.
*
* @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 {
/**
* 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() {
global $wpdb;
$results_table = array();
$columns_to_check = array(
$wpdb->prefix.'commentmeta' => array(
'comment_id' => '\'0\'',
'meta_key' => 'NULL'
),
$wpdb->prefix.'comments' => array(
'comment_post_ID' => '\'0\'',
'comment_author_email' => '\'\'',
'comment_author_url' => '\'\'',
'comment_author_IP' => '\'\'',
'comment_date_gmt' => '\'0000-00-00 00:00:00\'',
'comment_date' => '\'0000-00-00 00:00:00\'',
'comment_karma' => '\'0\'',
'comment_approved' => '\'1\'',
'comment_agent' => '\'\'',
'comment_type' => '\'\'',
'comment_parent' => '\'0\'',
'user_id' => '\'0\''
),
$wpdb->prefix.'links' => array(
'link_url' => '\'\'',
'link_name' => '\'\'',
'link_image' => '\'\'',
'link_target' => '\'\'',
'link_description' => '\'\'',
'link_visible' => '\'Y\'',
'link_owner' => '\'1\'',
'link_rating' => '\'0\'',
'link_updated' => '\'0000-00-00 00:00:00\'',
'link_rel' => '\'\'',
'link_rss' => '\'\''
),
$wpdb->prefix.'options' => array(
'option_name' => '\'\'',
'autoload' => '\'yes\''
),
$wpdb->prefix.'postmeta' => array(
'post_id' => '\'0\'',
'meta_key' => 'NULL'
),
$wpdb->prefix.'posts' => array(
'post_author' => '\'0\'',
'post_date_gmt' => '\'0000-00-00 00:00:00\'',
'post_date' => '\'0000-00-00 00:00:00\'',
'post_status' => '\'publish\'',
'comment_status' => '\'open\'',
'ping_status' => '\'open\'',
'post_password' => '\'\'',
'post_name' => '\'\'',
'post_modified_gmt' => '\'0000-00-00 00:00:00\'',
'post_modified' => '\'0000-00-00 00:00:00\'',
'post_parent' => '\'0\'',
'guid' => '\'\'',
'menu_order' => '\'0\'',
'post_type' => '\'post\'',
'post_mime_type' => '\'\'',
'comment_count' => '\'0\''
),
$wpdb->prefix.'term_relationships' => array(
'term_order' => '0'
),
$wpdb->prefix.'term_taxonomy' => array(
'taxonomy' => '\'\'',
'parent' => '0',
'count' => '0'
),
$wpdb->prefix.'terms' => array(
'name' => '\'\'',
'slug' => '\'\'',
'term_group' => '0'
),
$wpdb->prefix.'users' => array(
'user_login' => '\'\'',
'user_pass' => '\'\'',
'user_nicename' => '\'\'',
'user_email' => '\'\'',
'user_url' => '\'\'',
'user_registered' => '\'0000-00-00 00:00:00\'',
'user_activation_key' => '\'\'',
'user_status' => '\'0\'',
'display_name' => '\'\'',
// for network install
'spam' => '\'0\'',
'deleted' => '\'0\''
),
$wpdb->prefix.'usermeta' => array(
'user_id' => '\'0\'',
'meta_key' => 'NULL',
),
// for network install
$wpdb->prefix.'blog_versions' => array(
'blog_id' => '\'0\'',
'db_version' => '\'\'',
'last_updated' => '\'0000-00-00 00:00:00\''
),
$wpdb->prefix.'blogs' => array(
'site_id' => '\'0\'',
'domain' => '\'\'',
'path' => '\'\'',
'registered' => '\'0000-00-00 00:00:00\'',
'last_updated' => '\'0000-00-00 00:00:00\'',
'public' => '\'1\'',
'mature' => '\'0\'',
'spam' => '\'0\'',
'deleted' => '\'0\'',
'lang_id' => '\'0\''
),
$wpdb->prefix.'registration_log' => array(
'email' => '\'\'',
'IP' => '\'\'',
'blog_id' => '\'0\'',
'date_registered' => '\'0000-00-00 00:00:00\''
),
$wpdb->prefix.'signups' => array(
'domain' => '\'\'',
'path' => '\'\'',
'user_login' => '\'\'',
'user_email' => '\'\'',
'registered' => '\'0000-00-00 00:00:00\'',
'activated' => '\'0000-00-00 00:00:00\'',
'active' => '\'0\'',
'activation_key' => '\'\'',
),
$wpdb->prefix.'site' => array(
'domain' => '\'\'',
'path' => '\'\''
),
$wpdb->prefix.'sitemeta' => array(
'site_id' => '\'0\'',
'meta_key' => 'NULL',
)
);
$tables = $wpdb->tables('all');
foreach ($tables as $table) {
$col_infos = $wpdb->get_results("SHOW COLUMNS FROM $table");
foreach ($col_infos as $col) {
if (array_key_exists($col->Field, $columns_to_check[$table]) && $col->Default != $columns_to_check[$table][$col->Field]) {
$results_table[$table] = 'damaged';
break;
}
}
}
if (empty($results_table)) {
return true;
} else {
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() {
global $wpdb, $wp_version, $utils;
$global_schema_to_change = array(
$wpdb->prefix.'commentmeta' => array(
"comment_id bigint(20) unsigned NOT NULL default '0'",
"meta_key varchar(255) default NULL",
"meta_value longtext"
),
$wpdb->prefix.'comments' => array(
"comment_post_ID bigint(20) unsigned NOT NULL default '0'",
"comment_author_email varchar(100) NOT NULL default ''",
"comment_author_url varchar(200) NOT NULL default ''",
"comment_author_IP varchar(100) NOT NULL default ''",
"comment_date datetime NOT NULL default '0000-00-00 00:00:00'",
"comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00'",
"comment_karma int(11) NOT NULL default '0'",
"comment_approved varchar(20) NOT NULL default '1'",
"comment_agent varchar(255) NOT NULL default ''",
"comment_type varchar(20) NOT NULL default ''",
"comment_parent bigint(20) unsigned NOT NULL default '0'",
"user_id bigint(20) unsigned NOT NULL default '0'"
),
$wpdb->prefix.'links' => array(
"link_url varchar(255) NOT NULL default ''",
"link_name varchar(255) NOT NULL default ''",
"link_image varchar(255) NOT NULL default ''",
"link_target varchar(25) NOT NULL default ''",
"link_description varchar(255) NOT NULL default ''",
"link_visible varchar(20) NOT NULL default 'Y'",
"link_owner bigint(20) unsigned NOT NULL default '1'",
"link_rating int(11) NOT NULL default '0'",
"link_updated datetime NOT NULL default '0000-00-00 00:00:00'",
"link_rel varchar(255) NOT NULL default ''",
"link_notes mediumtext NOT NULL",
"link_rss varchar(255) NOT NULL default ''"
),
$wpdb->prefix.'options' => array(
"option_name varchar(64) NOT NULL default ''",
"option_value longtext NOT NULL",
"autoload varchar(20) NOT NULL default 'yes'"
),
$wpdb->prefix.'postmeta' => array(
"post_id bigint(20) unsigned NOT NULL default '0'",
"meta_key varchar(255) default NULL",
"meta_value longtext"
),
$wpdb->prefix.'posts' => array(
"post_author bigint(20) unsigned NOT NULL default '0'",
"post_date datetime NOT NULL default '0000-00-00 00:00:00'",
"post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00'",
"post_status varchar(20) NOT NULL default 'publish'",
"comment_status varchar(20) NOT NULL default 'open'",
"ping_status varchar(20) NOT NULL default 'open'",
"post_password varchar(20) NOT NULL default ''",
"post_name varchar(200) NOT NULL default ''",
"post_modified datetime NOT NULL default '0000-00-00 00:00:00'",
"post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00'",
"post_content_filtered longtext NOT NULL",
"post_parent bigint(20) unsigned NOT NULL default '0'",
"guid varchar(255) NOT NULL default ''",
"menu_order int(11) NOT NULL default '0'",
"post_type varchar(20) NOT NULL default 'post'",
"post_mime_type varchar(100) NOT NULL default ''",
"comment_count bigint(20) NOT NULL default '0'"
),
$wpdb->prefix.'term_relationships' => array(
"term_order int(11) NOT NULL default 0"
),
$wpdb->prefix.'term_taxonomy' => array(
"taxonomy varchar(32) NOT NULL default ''",
"description longtext NOT NULL",
"parent bigint(20) unsigned NOT NULL default 0",
"count bigint(20) NOT NULL default 0"
),
$wpdb->prefix.'terms' => array(
"name varchar(200) NOT NULL default ''",
"slug varchar(200) NOT NULL default ''",
"term_group bigint(10) NOT NULL default 0"
),
$wpdb->prefix.'users' => array(
"user_login varchar(60) NOT NULL default ''",
"user_pass varchar(64) NOT NULL default ''",
"user_nicename varchar(50) NOT NULL default ''",
"user_email varchar(100) NOT NULL default ''",
"user_url varchar(100) NOT NULL default ''",
"user_registered datetime NOT NULL default '0000-00-00 00:00:00'",
"user_activation_key varchar(60) NOT NULL default ''",
"user_status int(11) NOT NULL default '0'",
"display_name varchar(250) NOT NULL default ''"
),
$wpdb->prefix.'usermeta' => array(
"user_id bigint(20) unsigned NOT NULL default '0'",
"meta_key varchar(255) default NULL",
"meta_value longtext"
)
);
$network_schema_to_change = array(
$wpdb->prefix.'blog_versions' => array(
"blog_id bigint(20) NOT NULL default '0'",
"db_version varchar(20) NOT NULL default ''",
"last_updated datetime NOT NULL default '0000-00-00 00:00:00'"
),
$wpdb->prefix.'blogs' => array(
"site_id bigint(20) NOT NULL default '0'",
"domain varchar(200) NOT NULL default ''",
"path varchar(100) NOT NULL default ''",
"registered datetime NOT NULL default '0000-00-00 00:00:00'",
"last_updated datetime NOT NULL default '0000-00-00 00:00:00'",
"public tinyint(2) NOT NULL default '1'",
"mature tinyint(2) NOT NULL default '0'",
"spam tinyint(2) NOT NULL default '0'",
"deleted tinyint(2) NOT NULL default '0'",
"lang_id int(11) NOT NULL default '0'"
),
$wpdb->prefix.'registration_log' => array(
"email varchar(255) NOT NULL default ''",
"IP varchar(30) NOT NULL default ''",
"blog_id bigint(20) NOT NULL default '0'",
"date_registered datetime NOT NULL default '0000-00-00 00:00:00'"
),
$wpdb->prefix.'signups' => array(
"domain varchar(200) NOT NULL default ''",
"path varchar(100) NOT NULL default ''",
"title longtext NOT NULL",
"user_login varchar(60) NOT NULL default ''",
"user_email varchar(100) NOT NULL default ''",
"registered datetime NOT NULL default '0000-00-00 00:00:00'",
"activated datetime NOT NULL default '0000-00-00 00:00:00'",
"active tinyint(1) NOT NULL default '0'",
"activation_key varchar(50) NOT NULL default ''",
"meta longtext"
),
$wpdb->prefix.'site' => array(
"domain varchar(200) NOT NULL default ''",
"path varchar(100) NOT NULL default ''"
),
$wpdb->prefix.'sitemeta' => array(
"site_id bigint(20) NOT NULL default '0'",
"meta_key varchar(255) default NULL",
"meta_value longtext"
),
$wpdb->prefix.'users' => array(
"user_login varchar(60) NOT NULL default ''",
"spam tinyint(2) NOT NULL default '0'",
"deleted tinyint(2) NOT NULL default '0'"
)
);
if (version_compare($wp_version, '3.6', '<')) return false;
$return_val = array();
$queries = array();
$results = $this->sanity_check();
if ($results !== true) {
if (!$this->maintenance_backup()) {
$message = __('Can\'t create backup file.', $domain);
return $message;
}
$tables = array_keys($results);
foreach ($tables as $table) {
if (key_exists($table, $global_schema_to_change)) {
$queries = $global_schema_to_change[$table];
}
if (key_exists($table, $network_schema_to_change)) {
if (!empty($queries)) {
$queries = array_merge($queries, $network_schema_to_change[$table]);
} else {
$queries = $network_schema_to_change[$table];
}
}
foreach ($queries as $query) {
$sql = 'ALTER TABLE' . ' ' . $table . ' ' . 'CHANGE COLUMN' . ' ' . $query;
$res = $wpdb->query($sql);
if ($res === false) {
$return_val[] = __('Failed: ', $domain) . $query;
}
}
}
} else {
$message = __('Your database is OK. You don\'t have to restore it.', $domain);
return $message;
}
if (empty($return_val)) {
$message = __('Your database restoration is successfully finished!', $domain);
return $message;
} else {
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() {
$result = array();
$database_file = FQDB;
$db_name = basename(FQDB);
if (!file_exists($database_file)) {
return false;
}
$today = date("Ymd-His");
if (!extension_loaded('zip')) {
$backup_file = $database_file . '.' . $today . '.maintenance-backup';
if (copy($database_file, $backup_file)) {
$result = true;
} else {
$result = false;
}
} else {
$backup_file = $database_file . '.' . $today . '.maintenance-backup.zip';
$zip = new ZipArchive();
$res = $zip->open($backup_file, ZipArchive::CREATE | ZipArchive::OVERWRITE);
if ($res === true) {
$zip->addFile($database_file, $db_name);
$result = true;
} else {
$result = false;
}
$zip->close();
}
return $result;
}
/**
* Method to display the maintenance page on the admin panel.
*
*/
function show_maintenance_page() {
global $utils, $wpdb;
$domain = $utils->text_domain;
if (is_multisite() && !current_user_can('manage_network_options')) {
die(__('You are not allowed to access this page!', $domain));
} elseif (!current_user_can('manage_options')) {
die(__('You are not allowed to access this page!', $domain));
}
if (isset($_GET['page']) && $_GET['page'] == 'maintenance') : ?>
<div class="navigation">
<ul class="navi-menu">
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=doc"><?php _e('Documentation', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=sys-info"><?php _e('System Info', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=setting-file"><?php _e('Miscellaneous', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=patch"><?php _e('Patch Utility', $domain);?></a></li>
<li class="menu-selected"><?php _e('Maintenance', $domain);?></li>
</ul>
</div>
<div class="wrap" id="sqlite-admin-wrap">
<h2><?php _e('Database Maintenace', $domain);?></h2>
<h3><?php _e('Important Notice', $domain);?></h3>
<p>
<span style="color: red;"><?php _e('When you installed WordPress 3.5.x with SQLite Integration and upgraded to 3.6, your database might not function as expected.', $domain);?></span>
<?php _e('This page provide you the database sanity check utility and the restore utility.', $domain);?>
</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).', $domain);?>
</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.', $domain);?>
</p>
<p>
<?php _e('If you installed WordPress 3.6 (not upgraded), you don\'t have to restore the database.', $domain);?>
</p>
<form action="" method="post">
<?php
if (function_exists('wp_nonce_field')) {
wp_nonce_field('sqliteintegration-database-manip-stats');
}
?>
<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);?>')" />
</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>
<?php endif;
if (isset($_POST['do-fix-database'])) {
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));
}
$fix_results = $this->do_fix_database();
if (is_array($fix_results)) {
$title = '<h3>'. __('Results', $domain) . '</h3>';
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
echo $title;
echo '<ul>';
foreach ($fix_results as $result) {
echo '<li>' . $result . '</li>';
}
echo '</ul>';
echo '</div>';
} else {
$title = '<h3>'. __('Results', $domain) . '</h3>';
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
echo $title;
echo '<p>'.$fix_results.'</p>';
echo '</div>';
}
}
if (isset($_POST['sanity-check'])) {
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));
}
$check_results = $this->sanity_check();
if ($check_results !== true) {
$title = '<h3>'. __('Checked Results', $domain) . '</h3>';
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
echo $title;
echo '<ul>';
foreach ($check_results as $table => $damaged) {
$message = __(' needs restoring.', $domain);
echo '<li><span class="em">' . $table . '</span>' . $message . '</li>';
}
echo '</ul>';
echo '</div>';
} else {
$title = '<h3>'. __('Checked Results', $domain) . '</h3>';
$message = __('Your database is OK. You don\'t have to restore it.', $domain);
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
echo $title;
echo '<p>'.$message.'</p>';
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>';
}
}
}
}
?>

View File

@ -1,193 +1,151 @@
<?php
/**
* @package SQLite Integration
* @version 1.1
* @author Toshiyasu Kojima
* This file defines SQLiteIntegrationDocument class.
*
* @package SQLite Integration
* @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
*/
class SQLiteIntegrationDocument {
function show_doc() {
global $utils;
$domain = $utils->text_domain;
if (is_multisite() && !current_user_can('manage_network_options')) {
die(__('You are not allowed to access this page!', $domain));
} elseif (!current_user_can('manage_options')) {
die(__('You are not allowed to access this page!', $domain));
}
if (isset($_GET['page']) && $_GET['page'] == 'doc') :?>
<div class="navigation">
<ul class="navi-menu">
<li class="menu-selected"><?php _e('Documentation', $domain);?></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=sys-info"><?php _e('System Info', $domain); ?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=setting-file"><?php _e('Miscellaneous', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=patch"><?php _e('Patch Utility', $domain);?></a></li>
</ul>
</div>
<div class="wrap" id="sqlite-admin-wrap">
<h2><?php _e('Documentation', $domain); ?></h2>
<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);?>
</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);?>
</p>
<h3><?php _e('Features', $domain);?></h3>
<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.5.1 and 3.6 beta).', $domain); ?>
</p>
<p>
<?php _e('<a href="http://www.sqlite.org/">SQLite Web Page</a> says &mdash; SQLite is a &quot;software library that implements selfcontained, serverless, zero-configuration, transactional SQL database engine&quot;. It is &quot;a good choice for small to medium size websites&quot;. It\'s small and portable, and you don\'t need any database server system.', $domain); ?>
</p>
<p>
<?php _e('Unfortunately enough, WordPress only supports MySQL. Consequently it doesn\'t provide any APIs for SQLite. So if you want to create a website using WordPress without a database server, you\'ve got to write a kind of wrapper program yourself to use SQLite. This is the way SQLite Integration goes.', $domain);?>
</p>
<p>
<?php _e('SQLite Integration does the work as follows:', $domain); ?>
</p>
<ol>
<li><?php _e('Intercepts SQL statement for MySQL from WordPress', $domain); ?></li>
<li><?php _e('Rewrites it as SQLite can execute', $domain); ?></li>
<li><?php _e('Gives it to SQLite', $domain); ?></li>
<li><?php _e('Gets the results from SQLite', $domain); ?></li>
<li><?php _e('Format the results as MySQL returns, if necessary', $domain);?></li>
<li><?php _e('Gives back the results to WordPress', $domain); ?></li>
</ol>
<p>
<?php _e('WordPress doesn\'t know what has happened in the background and will be happy with it.', $domain);?>
</p>
<h3><?php _e('Limitations', $domain);?></h3>
<p>
<?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>
<ol>
<li><strong><?php _e('There are some plugins that you can\'t use in any way.<br />', $domain);?></strong>
<?php _e('Some plugins can\'t be activated or work properly. See the &quot;Plugin Compatibility/Incompatibility&quot; 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>
<?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>
</ol>
<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);?>
</p>
<h3><?php _e('User Defined Functions', $domain); ?></h3>
<p>
<?php _e('SQLite Integration replaces some functions of MySQL with the user defined functions built in PHP PDO library. But some of the functions are meaningless in SQLite database: e.g. get_lock() or release_lock(). When SQLite Integration meets those functions, it does nothing but prevent the error.', $domain); ?>
</p>
<p>
<?php _e('If you want SQLite Integration to execute more functions, you can add the definition in the file sqlite-integration/functions.php (functions-5-2.php is for PHP 5.2 or lesser).', $domain);?>
</p>
<h3><?php _e('Database Administration and Maintenance', $domain);?></h3>
<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);?>
</p>
<ul>
<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>
</ul>
<p>
<?php _e('I\'m not sure if future release may have some of the database maintenance functionality.', $domain);?>
</p>
</div>
/**
* Method to display the document page.
*
*/
function show_doc() {
// textdomain is defined in the utils class
global $utils;
$domain = $utils->text_domain;
if (is_multisite() && !current_user_can('manage_network_options')) {
die(__('You are not allowed to access this page!', $domain));
} elseif (!current_user_can('manage_options')) {
die(__('You are not allowed to access this page!', $domain));
}
if (isset($_GET['page']) && $_GET['page'] == 'doc') :?>
<div class="navigation">
<ul class="navi-menu">
<li class="menu-selected"><?php _e('Documentation', $domain);?></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=sys-info"><?php _e('System Info', $domain); ?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=setting-file"><?php _e('Miscellaneous', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=patch"><?php _e('Patch Utility', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=maintenance"><?php _e('Maintenance', $domain);?></a></li>
</ul>
</div>
<div class="wrap" id="sqlite-admin-wrap">
<h2><?php _e('Documentation', $domain); ?></h2>
<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/">SQLite Integration page</a>.', $domain);?>
</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);?>
</p>
<div class="wrap" id="sqlite-admin-side-wrap">
<h2><?php _e('Plugin Compatibility/Incompatibility', $domain);?></h2>
<p>
<?php _e('WordPress without its plugins is a king without people. Of course, you need plugins, I know.', $domain);?>
</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());?>
</p>
<table class="widefat page fixed" id="plugins-table">
<thead>
<tr>
<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":"reason"}'><?php _e('Reasons', $domain);?></th>
</tr>
</thead>
<tbody>
<?php
if (file_exists(SQLiteListFile)) :?>
<?php
$contents = file_get_contents(SQLiteListFile);
$plugin_info_list = json_decode($contents);
foreach ($plugin_info_list as $plugin_info) :?>
<?php if (in_array($plugin_info->compat, array('No', 'Probably No', 'Needs Patch'))) :?>
<tr data-table='{"name":"<?php echo $plugin_info->name;?>", "compat":"<?php echo $plugin_info->compat;?>", "reason":"<?php echo $plugin_info->reason;?>"}'>
<td><?php echo $plugin_info->name;?></a></td>
<?php if (stripos($plugin_info->compat, 'patch') !== false) :?>
<td><a href="<?php echo $plugin_info->patch_url;?>"><?php _e('Needs Patch', $domain);?></a></td>
<?php elseif (stripos($plugin_info->compat, 'probably no')) :?>
<td><?php _e('Probably No', $domain);?></td>
<?php else :?>
<td><?php _e('No', $domain);?></td>
<?php endif;?>
<td><?php echo $plugin_info->reason;?></td>
<?php endif;?>
</tr>
<?php endforeach;?>
<?php endif;?>
</tbody>
</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 &quot;full-text search&quot;. But it is not correlated with that of MySQL. In fact it is not an &quot;index&quot; 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>
<?php endif;
}
<h3><?php _e('Features', $domain);?></h3>
<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.8.1).', $domain); ?>
</p>
<p>
<?php _e('<a href="http://www.sqlite.org/">SQLite Web Page</a> says &mdash; SQLite is a &quot;software library that implements selfcontained, serverless, zero-configuration, transactional SQL database engine&quot;. It is &quot;a good choice for small to medium size websites&quot;. It\'s small and portable, and you don\'t need any database server system.', $domain); ?>
</p>
<p>
<?php _e('Unfortunately enough, WordPress only supports MySQL. Consequently it doesn\'t provide any APIs for SQLite. So if you want to create a website using WordPress without a database server, you\'ve got to write a kind of wrapper program yourself to use SQLite. This is the way SQLite Integration goes.', $domain);?>
</p>
<p>
<?php _e('SQLite Integration does the work as follows:', $domain); ?>
</p>
<ol>
<li><?php _e('Intercepts SQL statement for MySQL from WordPress', $domain); ?></li>
<li><?php _e('Rewrites it as SQLite can execute', $domain); ?></li>
<li><?php _e('Gives it to SQLite', $domain); ?></li>
<li><?php _e('Gets the results from SQLite', $domain); ?></li>
<li><?php _e('Format the results as MySQL returns, if necessary', $domain);?></li>
<li><?php _e('Gives back the results to WordPress', $domain); ?></li>
</ol>
<p>
<?php _e('WordPress doesn\'t know what has happened in the background and will be happy with it.', $domain);?>
</p>
<h3><?php _e('Limitations', $domain);?></h3>
<p>
<?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>
<ol>
<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 &quot;Plugin Compatibility/Incompatibility&quot; 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>
<?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>
<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);?>
</p>
<h3><?php _e('User Defined Functions', $domain); ?></h3>
<p>
<?php _e('SQLite Integration replaces some functions of MySQL with the user defined functions built in PHP PDO library. But some of the functions are meaningless in SQLite database: e.g. get_lock() or release_lock(). When SQLite Integration meets those functions, it does nothing but prevent the error.', $domain); ?>
</p>
<p>
<?php _e('If you want SQLite Integration to execute more functions, you can add the definition in the file sqlite-integration/functions.php (functions-5-2.php is for PHP 5.2 or lesser).', $domain);?>
</p>
<h3><?php _e('Database Administration and Maintenance', $domain);?></h3>
<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);?>
</p>
<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="http://www.sqlitemanager.org/">SQLiteManager</a>(<?php _e('unfortunately seems not to maintained...', $domain); ?>)</li>
</ul>
<p>
<?php _e('I\'m not sure if future release may have some of the database maintenance functionality.', $domain);?>
</p>
</div>
<div class="wrap" id="sqlite-admin-side-wrap">
<h2><?php _e('Plugin Compatibility/Incompatibility', $domain);?></h2>
<p>
<?php _e('WordPress without its plugins is a king without people. Of course, you need plugins, I know.', $domain);?>
</p>
<p>
<?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>
<table class="widefat page fixed" id="plugins-table">
<thead>
<tr>
<th data-sort='{"key":"name"}' class="item"><?php _e('Plugins Name', $domain); ?></th>
<th data-sort='{"key":"compat"}' class="compat"><?php _e('Compatibility', $domain); ?></th>
<th data-sort='{"key":"reason"}' class="reason"><?php _e('Reasons', $domain);?></th>
</tr>
</thead>
<tbody>
<?php
if (file_exists(SQLiteListFile)) :?>
<?php
$contents = file_get_contents(SQLiteListFile);
$plugin_info_list = json_decode($contents);
foreach ($plugin_info_list as $plugin_info) :?>
<?php if (in_array($plugin_info->compat, array('No', 'Probably No', 'Needs Patch'))) :?>
<tr data-table='{"name":"<?php echo $plugin_info->name;?>", "compat":"<?php echo $plugin_info->compat;?>", "reason":"<?php echo $plugin_info->reason;?>"}'>
<td><?php echo $plugin_info->name;?></a></td>
<?php if (stripos($plugin_info->compat, 'patch') !== false) :?>
<td><a href="<?php echo $plugin_info->patch_url;?>"><?php _e('Needs Patch', $domain);?></a></td>
<?php elseif (stripos($plugin_info->compat, 'probably no')) :?>
<td><?php _e('Probably No', $domain);?></td>
<?php else :?>
<td><?php _e('No', $domain);?></td>
<?php endif;?>
<td><?php echo $plugin_info->reason;?></td>
</tr>
<?php endif;?>
<?php endforeach;?>
<?php endif;?>
</tbody>
</table>
</div>
<?php endif;
}
}
?>

2
utilities/index.php Normal file
View File

@ -0,0 +1,2 @@
<?php
/* Silence is golden */

View File

@ -1,340 +1,421 @@
<?php
/**
* This file contains PatchUtils class
*
* This file defines PatchUtils class.
*
* @package SQLite Integration
* @since 1.1
* @author Kojima Toshiyasu
*/
/**
* This class provides the methods for patching utilities.
*
*/
class PatchUtils {
/**
* Reads wp-content/uploads/patches directory and returns file names in it.
* If directory contains none, returns empty array.
* @return array
*/
private function get_patch_files() {
$patch_files = array();
if (!is_dir(SQLitePatchDir)) {
return $patch_files;
} else {
if ($dir_handle = opendir(SQLitePatchDir)) {
while (($file_name = readdir($dir_handle)) !== false) {
if ($file_name == '.' || $file_name == '..')
continue;
$patch_files[] = $file_name;
}
}
return $patch_files;
}
}
/**
* Execute patch command and apply it to the target plugins.
* If patch file(s) is not selected, returns false.
* Or else returns array contains messages.
* @return boolean|array
*/
private function apply_patches() {
$installed_plugins = array();
$file_names = array();
$output = array();
$retval = 0;
$patch_results = array();
if (isset($_POST['plugin_checked'])) {
$file_names = $_POST['plugin_checked'];
} else {
return false;
}
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
exec('where patch 2>&1', $out, $val);
} else {
exec('which patch 2>&1', $out, $val);
}
if ($val != 0) {
$patch_results['error'] = __('Patch command is not found', $domain);
return $patch_results;
} elseif (!is_executable(trim($out[0]))) {
$patch_results['error'] = __('Patch command is not executable', $domain);
return $patch_results;
} else {
$patch_command = trim($out[0]) . ' -s -N -p1';
}
$installed_plugins = get_plugins();
foreach ($file_names as $file) {
if (preg_match('/_(.*)\.patch/i', $file, $match)) {
$plugin_version = trim($match[1]);
$plugin_basename = preg_replace('/_.*\.patch$/i', '', $file);
foreach (array_keys($installed_plugins) as $key) {
if (stripos($key, $plugin_basename) !== false) {
$installed_plugin_version = $installed_plugins[$key]['Version'];
break;
}
}
} else {
$patch_results['error'] = __('Patch file name is invalid', $domain);
break;
}
if (version_compare($installed_plugin_version, $plugin_version, '!=')) {
$patch_results['error'] = __('Patch file version does not match with that of your plugin.', $domain);
break;
}
$plugin_dir = WP_PLUGIN_DIR.'/'.$plugin_basename;
$patch_file = SQLitePatchDir.'/'.$file;
$command = $patch_command.' <'.$patch_file.' 2>&1';
if (chdir($plugin_dir)) {
exec("$command", $output, $retval);
} else {
$patch_results[$file] = __('Error! Plugin directory is not accessible.', $domain);
}
if ($retval == 0) {
$patch_results[$file] = __('is patched successfully.', $domain);
} else {
foreach ($output as $val) {
$message .= $val.'<br />';
}
$patch_results[$file] = sprintf(__('Error! Messages: %s', $domain), $message);
}
}
return $patch_results;
}
/**
* Delete uploaded patch file(s).
* If patch file(s) is not selected, returns false.
* Or else returns array contains messages.
* @return boolean|array
*/
private function delete_patch_files() {
$file_names = array();
$rm_results = array();
if (isset($_POST['plugin_checked'])) {
$file_names = $_POST['plugin_checked'];
} else {
return false;
}
$command = 'rm -f';
foreach ($file_names as $file) {
if (chdir(SQLitePatchDir)) {
exec("$command $file", $output, $retval);
} else {
$rm_results[$file] = __('Error!: patches directory is not accessible.', $domain);
}
if ($retval > 0) {
$rm_results[$file] = sprintf(__('Error! Messages: %s', $domain), $output);
} else {
$rm_results[$file] = sprintf(__('File %s is deleted.', $domain), $file);
}
}
return $rm_results;
}
/**
* Uploads a patch file.
* No return values.
*/
private function upload_file() {
if (!file_exists(SQLitePatchDir) || !is_dir(SQLitePatchDir)) {
mkdir(SQLitePatchDir, 0705, true);
}
if (is_uploaded_file($_FILES['upfile']['tmp_name'])) {
if (move_uploaded_file($_FILES['upfile']['tmp_name'], SQLitePatchDir.'/'.$_FILES['upfile']['name'])) {
$message = __('File is uploaded', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0644);
} else {
$message = __('File is not uploaded', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
}
} else {
$message = __('File is not selected', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
}
}
/**
* Displays patch util page
*/
function show_patch_page() {
global $utils;
$domain = $utils->text_domain;
if (is_multisite() && !current_user_can('manage_network_options')) {
die(__('You are not allowed to access this page!', $domain));
} elseif (!current_user_can('manage_options')) {
die(__('You are not allowed to access this page!', $domain));
}
if (isset($_POST['apply_patch'])) {
check_admin_referer('sqlitewordpress-plugin-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));
}
$result = $this->apply_patches();
if ($result === false) {
$message = __('Please select patch file(s)', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
} elseif (is_array($result) && count($result) > 0) {
echo '<div id="message" class="updated fade">';
foreach ($result as $key => $val) {
echo $key.' => '.$val.'<br />';
}
echo '</div>';
} else {
$message = __('None of the patches is applied!');
echo '<div id="message" class="updated fade">'.$message.'</div>';
}
}
if (isset($_POST['patch_file_delete'])) {
check_admin_referer('sqlitewordpress-plugin-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));
}
$result = $this->delete_patch_files();
if ($result === false) {
$message = __('Please select patch file(s)', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
} elseif (is_array($result) && count($result) > 0) {
echo '<div id="message" class="updated fade">';
foreach ($result as $key => $val) {
echo $key.' => '.$val.'<br />';
}
echo '</div>';
} else {
$message = __('Error! Please remove files manually');
echo '<div id="message" class="updated fade">'.$message.'</div>';
}
}
if (isset($_POST['upload'])) {
check_admin_referer('sqlitewordpress-plugin-patch-file-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));
}
$result = $this->upload_file();
}
if (isset($_GET['page']) && $_GET['page'] == 'patch') : ?>
<div class="navigation">
<ul class="navi-menu">
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=doc"><?php _e('Documentation', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=sys-info"><?php _e('System Info', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=setting-file"><?php _e('Miscellaneous', $domain);?></a></li>
<li class="menu-selected"><?php _e('Patch Utility', $domain);?></li>
</ul>
</div>
<div class="wrap" id="sqlite-admin-wrap">
<h2><?php _e('Patch Files Upload and Apply', $domain);?></h2>
<h3><?php _e('What you can do in this page', $domain);?></h3>
<p>
<?php _e('I made patch files for some plugins that are incompatible with SQLite Integration and need rewriting. And I wrote in the <a href="http://dogwood.skr.jp/wordpress/sqlite-integration">Plugin Page</a> about how to apply a patch file to the plugin. But the command line interface sometimes embarrasses some people, especially newbies.', $domain);?>
</p>
<p>
<?php _e('In this page, you can upload patch files and apply them automatically. But there are some requirements.', $domain)?>
</p>
<ol>
<li><?php _e('Think before you leap. Is the plugin to which you are going to apply patch really necessary for your site? Did you search in the <a href="http://wordpress.org/extend/plugins/">Plugin Directory</a> for the substitutes?', $domain)?></li>
<li><?php _e('Your PHP script has the permission to create a directory and write a file in it.', $domain);?></li>
<li><?php _e('Your PHP scripts can execute exec() function on the server.', $domain);?></li>
<li><?php _e('Your PHP script can execute &quot;patch&quot; shell command.(Script will check if it is executable or not.)', $domain);?></li>
</ol>
<p>
<?php _e('If uploading fails, it\' very likely that application will fail. When you try uploading with FTP client, the patch files must be put into the directory wp-content/uploads/patches/. When constant UPLOADS is defined, script follows it.', $domain)?>
</p>
<p>
<?php _e('You can create your patch file yourself. When you create one, please test it on your local server first and check if it works fine without PHP error or notice ( set error_reporting(E_ALL) ). If you use this utility, name your patch file as follows:', $domain);?>
</p>
<ol>
<li><?php _e('Use the file name beginning with the plugin directory name.', $domain);?></li>
<li><?php _e('Use the plugin version number after the directory name with underscore.', $domain);?></li>
<li><?php _e('Use the suffix .patch.', $domain);?></li>
<li><?php _e('Use diff command options &quot;-Naur&quot;.', $domain);?></li>
</ol>
<p>
<?php _e('For example, the patch file for the plugin &quot;Debug Bar&quot; is &quot;debug-bar_0.8.patch&quot;. Script interprets &quot;debug-bar&quot; as the target directory and &quot;0.8&quot; as the target version. If the version number doesn\'t match with the target, script shows the error message and skip applying the patch file. And script will reject any other file name.', $domain);?>
</p>
<h3><?php _e('How to install, patch and activate plugins', $domain);?></h3>
<ol>
<li><?php _e('Install the plugin (not yet activate it)', $domain);?></li>
<li><?php _e('Upload the patch file (if any) to the server and ppply it in this page', $domain);?></li>
<li><?php _e('Back to the installed plugin page and activate it', $domain);?></li>
</ol>
<h3><?php _e('How to upgrade plugins', $domain);?></h3>
<p>
<?php _e('When upgrading the plugin, it will be safer to follow next steps.', $domain);?>
</p>
<ol>
<li><?php _e('Deactivate the plugin', $domain);?></li>
<li><?php _e('Upgrade the plugin', $domain);?></li>
<li><?php _e('Upload the patch file (if any) and apply it', $domain);?></li>
<li><?php _e('Reactivate the plugin', $domain);?></li>
</ol>
<p><?php _e('If there isn\'t a patch file to match with the newest version of the plugin, it won\'t work properly. Please wait for somebody to make one or rewrite the codes checking the patch file for the previous version (it\'s not so difficult a matter, I guess, for almost all the cases, you\'ll have only to replace the MySQL functions with the WordPress built-in functions).', $domain);?></p>
<h3><?php _e('Upload and Apply', $domain)?></h3>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php _e('File Select', $domain);?></th>
<td>
<form action="" id="upload-form" class="wp-upload-form" method="post" enctype="multipart/form-data">
<?php if (function_exists('wp_nonce_field')) {
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="file" id="upload" name="upfile" size="60"/>
<input type="submit" name="upload" id="submit-upload" class="button" value="<?php _e('Upload', $domain)?>" />
</form>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Patch files uploaded', $domain)?></th>
<td>
<form action="" method="post">
<?php if (function_exists('wp_nonce_field')) {
wp_nonce_field('sqlitewordpress-plugin-manip-stats');
}
?>
<label for="plugin_check"><?php _e('Select the file(s) you want to apply to the plugin(s) or you want to delete. You can select multiple files.', $domain);?></label>
<table class="widefat page fixed" id="patch-files">
<thead>
<tr>
<th class="item"><?php _e('Apply/Hold', $domain)?></th>
<th data-sort='{"key":"name"}'><?php _e('Patch files to apply', $domain)?></th>
</tr>
</thead>
<tbody>
<?php $files = $this->get_patch_files();
if (!empty($files)) : ?>
<?php foreach ($files as $file) : ?>
<tr data-table='{"name":"<?php echo $file ?>"}'>
<td><input type="checkbox" id="plugin_check" name="plugin_checked[]" value="<?php echo $file ?>"/></td>
<td><?php echo $file ?></td>
</tr>
<?php endforeach;?>
<?php endif;?>
</tbody>
</table>
<p>
<input type="submit" name="apply_patch" class="button-primary" value="<?php _e('Apply patch', $domain);?>" onclick="return confirm('<?php _e('Are you sure to apply patch files?\n\nClick [Cancel] to stop,[OK] to continue.', $domain);?>')" />
<input type="submit" name="patch_file_delete" class="button-primary" value="<?php _e('Delete file', $domain);?>" onclick="return confirm('<?php _e('Are you sure to delete patch files?\n\nClick [Cancel] to stop,[OK] to continue.', $domain);?>')" />
</p>
</form>
</td>
</tr>
</tbody>
</table>
</div>
<div class="wrap" id="sqlite-admin-side-wrap">
<div class="alert">
<?php _e('Caution about your patch file(s)', $domain);?>
</div>
<blockquote class="caution">
<p>
<?php _e('If you don\'t know where it comes from or who created it, I strongly recommend that you should see and check the contents of the file. If a person who created it secretly inserted a malicious codes, it will be executed by the plugin and may damage your site or your server, for which damage I don\'t incur any liability. If you don\'t understand well, you\'d better use the substitute plugins. Take your own risk, please.', $domain);?>
</p>
</blockquote>
</div>
<?php endif;
}
/**
* 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.
*
* @return array
* @access private
*/
private function get_patch_files() {
$patch_files = array();
if (!is_dir(SQLitePatchDir)) {
return $patch_files;
} else {
if ($dir_handle = opendir(SQLitePatchDir)) {
while (($file_name = readdir($dir_handle)) !== false) {
if ($file_name == '.' || $file_name == '..' || $file_name == '.htaccess')
continue;
$patch_files[] = $file_name;
}
}
return $patch_files;
}
}
/**
* 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.
* Or else returns array contains messages.
*
* @return boolean|array
* @access private
*/
private function apply_patches() {
global $utils;
$domain = $utils->text_domain;
$installed_plugins = array();
$file_names = array();
$output = array();
$retval = 0;
$patch_results = array();
$message = '';
if (isset($_POST['plugin_checked'])) {
$file_names = $_POST['plugin_checked'];
} else {
return false;
}
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
exec('where patch 2>&1', $out, $val);
} else {
exec('which patch 2>&1', $out, $val);
}
if ($val != 0) {
$patch_results['error'] = __('Patch command is not found', $domain);
return $patch_results;
} elseif (!is_executable(trim($out[0]))) {
$patch_results['error'] = __('Patch command is not executable', $domain);
return $patch_results;
} else {
$patch_command = trim($out[0]) . ' -s -N -p1';
}
$installed_plugins = get_plugins();
foreach ($file_names as $file) {
if (preg_match('/_(.*)\.patch/i', $file, $match)) {
$plugin_version = trim($match[1]);
$plugin_basename = preg_replace('/_.*\.patch$/i', '', $file);
foreach (array_keys($installed_plugins) as $key) {
if (stripos($key, $plugin_basename) !== false) {
$installed_plugin_version = $installed_plugins[$key]['Version'];
break;
}
}
} else {
$patch_results['error'] = __('Patch file name is invalid', $domain);
break;
}
if (version_compare($installed_plugin_version, $plugin_version, '!=')) {
$patch_results['error'] = __('Patch file version does not match with that of your plugin.', $domain);
break;
}
$plugin_dir = WP_PLUGIN_DIR.'/'.$plugin_basename;
$patch_file = SQLitePatchDir.'/'.$file;
$command = $patch_command.' <'.$patch_file.' 2>&1';
if (chdir($plugin_dir)) {
exec("$command", $output, $retval);
} else {
$patch_results[$file] = __('Error! Plugin directory is not accessible.', $domain);
}
if ($retval == 0) {
$patch_results[$file] = __('is patched successfully.', $domain);
} else {
foreach ($output as $val) {
$message .= $val.'<br />';
}
$patch_results[$file] = sprintf(__('Error! Messages: %s', $domain), $message);
}
}
return $patch_results;
}
/**
* Method to remove patch file(s) from the server.
*
* It deletes uploaded patch file(s).
* If patch file(s) is not selected, returns false.
* Or else returns array contains messages.
*
* @return boolean|array
* @access private
*/
private function delete_patch_files() {
global $utils;
$domain = $utils->text_domain;
$file_names = array();
$rm_results = array();
if (isset($_POST['plugin_checked'])) {
$file_names = $_POST['plugin_checked'];
} else {
return false;
}
if (chdir(SQLitePatchDir)) {
foreach ($file_names as $file) {
if (unlink($file)) {
$rm_results[$file] = sprintf(__('File %s is deleted.', $domain), $file);
} else {
$rm_results[$file] = sprintf(__('Error! File %s is not deleted.', $domain), $file);
}
}
} else {
$rm_results[$file] = __('Error!: patches directory is not accessible.', $domain);
}
return $rm_results;
}
/**
* 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.
*
* @return boolean
* @access private
*/
private function upload_file() {
global $utils;
$domain = $utils->text_domain;
if (!file_exists(SQLitePatchDir) || !is_dir(SQLitePatchDir)) {
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'])) {
$file_full_path = SQLitePatchDir . '/' . $_FILES['upfile']['name'];
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>';
chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0606);
} else {
$message = __('File upload failed. Possible file upload attack.', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
return false;
}
} else {
$message = __('File is not selected', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
return false;
}
return true;
}
/**
* Method to display the patch utility page on the admin panel.
*
*/
function show_patch_page() {
global $utils;
$domain = $utils->text_domain;
if (is_multisite() && !current_user_can('manage_network_options')) {
die(__('You are not allowed to access this page!', $domain));
} elseif (!current_user_can('manage_options')) {
die(__('You are not allowed to access this page!', $domain));
}
if (isset($_POST['apply_patch'])) {
check_admin_referer('sqlitewordpress-plugin-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));
}
$result = $this->apply_patches();
if ($result === false) {
$message = __('Please select patch file(s)', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
} elseif (is_array($result) && count($result) > 0) {
echo '<div id="message" class="updated fade">';
foreach ($result as $key => $val) {
echo $key.' => '.$val.'<br />';
}
echo '</div>';
} else {
$message = __('None of the patches is applied!');
echo '<div id="message" class="updated fade">'.$message.'</div>';
}
}
if (isset($_POST['patch_file_delete'])) {
check_admin_referer('sqlitewordpress-plugin-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));
}
$result = $this->delete_patch_files();
if ($result === false) {
$message = __('Please select patch file(s)', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
} elseif (is_array($result) && count($result) > 0) {
echo '<div id="message" class="updated fade">';
foreach ($result as $key => $val) {
echo $key.' => '.$val.'<br />';
}
echo '</div>';
} else {
$message = __('Error! Please remove files manually', $domain);
echo '<div id="message" class="updated fade">'.$message.'</div>';
}
}
if (isset($_POST['upload'])) {
check_admin_referer('sqlitewordpress-plugin-patch-file-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));
}
$result = $this->upload_file();
}
if (isset($_GET['page']) && $_GET['page'] == 'patch') : ?>
<div class="navigation">
<ul class="navi-menu">
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=doc"><?php _e('Documentation', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=sys-info"><?php _e('System Info', $domain);?></a></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=setting-file"><?php _e('Miscellaneous', $domain);?></a></li>
<li class="menu-selected"><?php _e('Patch Utility', $domain);?></li>
<li class="menu-item"><a href="<?php echo $utils->show_parent();?>?page=maintenance"><?php _e('Maintenance', $domain);?></a></li>
</ul>
</div>
<div class="wrap" id="sqlite-admin-wrap">
<h2><?php _e('Patch Files Upload and Apply', $domain);?></h2>
<h3><?php _e('What you can do in this page', $domain);?></h3>
<p>
<?php _e('I made patch files for some plugins that are incompatible with SQLite Integration and need rewriting. And I wrote in the <a href="http://dogwood.skr.jp/wordpress/sqlite-integration">Plugin Page</a> about how to apply a patch file to the plugin. But the command line interface sometimes embarrasses some people, especially newbies.', $domain);?>
</p>
<p>
<?php _e('In this page, you can upload patch files and apply them automatically. But there are some requirements.', $domain)?>
</p>
<ol>
<li><?php _e('Think before you leap. Is the plugin to which you are going to apply patch really necessary for your site? Did you search in the <a href="http://wordpress.org/extend/plugins/">Plugin Directory</a> for the substitutes?', $domain)?></li>
<li><?php _e('Your PHP script has the permission to create a directory and write a file in it.', $domain);?></li>
<li><?php _e('Your PHP scripts can execute exec() function on the server.', $domain);?></li>
<li><?php _e('Your PHP script can execute &quot;patch&quot; shell command.(Script will check if it is executable or not.)', $domain);?></li>
</ol>
<p>
<?php _e('If uploading fails, it\' very likely that application will fail. When you try uploading with FTP client, the patch files must be put into the directory wp-content/uploads/patches/. When constant UPLOADS is defined, script follows it.', $domain)?>
</p>
<p>
<?php _e('You can create your patch file yourself. When you create one, please test it on your local server first and check if it works fine without PHP error or notice ( set error_reporting(E_ALL) ). If you use this utility, name your patch file as follows:', $domain);?>
</p>
<ol>
<li><?php _e('Use the file name beginning with the plugin directory name.', $domain);?></li>
<li><?php _e('Use the plugin version number after the directory name with underscore.', $domain);?></li>
<li><?php _e('Use the suffix .patch.', $domain);?></li>
<li><?php _e('Use diff command options &quot;-Naur&quot;.', $domain);?></li>
</ol>
<p>
<?php _e('For example, the patch file for the plugin &quot;Debug Bar&quot; is &quot;debug-bar_0.8.patch&quot;. Script interprets &quot;debug-bar&quot; as the target directory and &quot;0.8&quot; as the target version. If the version number doesn\'t match with the target, script shows the error message and skip applying the patch file. And script will reject any other file name.', $domain);?>
</p>
<h3><?php _e('How to install, patch and activate plugins', $domain);?></h3>
<ol>
<li><?php _e('Install the plugin (not yet activate it)', $domain);?></li>
<li><?php _e('Upload the patch file (if any) to the server and ppply it in this page', $domain);?></li>
<li><?php _e('Back to the installed plugin page and activate it', $domain);?></li>
</ol>
<h3><?php _e('How to upgrade plugins', $domain);?></h3>
<p>
<?php _e('When upgrading the plugin, it will be safer to follow next steps.', $domain);?>
</p>
<ol>
<li><?php _e('Deactivate the plugin', $domain);?></li>
<li><?php _e('Upgrade the plugin', $domain);?></li>
<li><?php _e('Upload the patch file (if any) and apply it', $domain);?></li>
<li><?php _e('Reactivate the plugin', $domain);?></li>
</ol>
<p><?php _e('If there isn\'t a patch file to match with the newest version of the plugin, it won\'t work properly. Please wait for somebody to make one or rewrite the codes checking the patch file for the previous version (it\'s not so difficult a matter, I guess, for almost all the cases, you\'ll have only to replace the MySQL functions with the WordPress built-in functions).', $domain);?></p>
<h3><?php _e('Upload and Apply', $domain)?></h3>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php _e('File Select', $domain);?></th>
<td>
<form action="" id="upload-form" class="wp-upload-form" method="post" enctype="multipart/form-data">
<?php if (function_exists('wp_nonce_field')) {
wp_nonce_field('sqlitewordpress-plugin-patch-file-stats');
}
?>
<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="submit" name="upload" id="submit-upload" class="button" value="<?php _e('Upload', $domain)?>" />
</form>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Patch files uploaded', $domain)?></th>
<td>
<form action="" method="post">
<?php if (function_exists('wp_nonce_field')) {
wp_nonce_field('sqlitewordpress-plugin-manip-stats');
}
?>
<label for="plugin_check"><?php _e('Select the file(s) you want to apply to the plugin(s) or you want to delete. You can select multiple files.', $domain);?></label>
<table class="widefat page fixed" id="patch-files">
<thead>
<tr>
<th class="item"><?php _e('Apply/Hold', $domain)?></th>
<th data-sort='{"key":"name"}'><?php _e('Patch files to apply', $domain)?></th>
</tr>
</thead>
<tbody>
<?php $files = $this->get_patch_files();
if (!empty($files)) : ?>
<?php foreach ($files as $file) : ?>
<tr data-table='{"name":"<?php echo $file ?>"}'>
<td><input type="checkbox" id="plugin_check" name="plugin_checked[]" value="<?php echo $file ?>"/></td>
<td><?php echo $file ?></td>
</tr>
<?php endforeach;?>
<?php endif;?>
</tbody>
</table>
<p>
<input type="submit" name="apply_patch" class="button-primary" value="<?php _e('Apply patch', $domain);?>" onclick="return confirm('<?php _e('Are you sure to apply patch files?\n\nClick [Cancel] to stop,[OK] to continue.', $domain);?>')" />
<input type="submit" name="patch_file_delete" class="button-primary" value="<?php _e('Delete file', $domain);?>" onclick="return confirm('<?php _e('Are you sure to delete patch files?\n\nClick [Cancel] to stop,[OK] to continue.', $domain);?>')" />
</p>
</form>
</td>
</tr>
</tbody>
</table>
</div>
<div class="wrap" id="sqlite-admin-side-wrap">
<div class="alert">
<?php _e('Caution about your patch file(s)', $domain);?>
</div>
<blockquote class="caution">
<p>
<?php _e('If you don\'t know where it comes from or who created it, I strongly recommend that you should see and check the contents of the file. If a person who created it secretly inserted a malicious codes, it will be executed by the plugin and may damage your site or your server, for which damage I don\'t incur any liability. If you don\'t understand well, you\'d better use the substitute plugins. Take your own risk, please.', $domain);?>
</p>
</blockquote>
</div>
<?php endif;
}
}
?>

View File

@ -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",
"compat":"Checked",
@ -11,18 +25,53 @@
"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",
"compat":"Checked",
"class":"compatible"
},
{
"name":"Batcache",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"BAW Manual Related Posts",
"compat":"Checked",
"class":"compatible"
},
{
"name":"bbPress",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"Better Delete Revision",
"compat":"No",
"reason":"DELETE with JOIN/etc",
"class":"incompatible"
},
{
"name":"Better Related Posts",
"compat":"No",
@ -30,6 +79,20 @@
"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",
"compat":"Checked",
@ -38,8 +101,10 @@
{
"name":"Broken Link Checker",
"compat":"Checked",
"class":"compatible"
"compat":"Needs Patch",
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
"reason":"MySQL function",
"class":"workaround"
},
{
@ -48,6 +113,20 @@
"class":"compatible"
},
{
"name":"BuddyPress",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"BuddyPress Courseware",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"Camera slideshow",
"compat":"Needs Patch",
@ -56,12 +135,40 @@
"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",
"compat":"Checked",
"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",
"compat":"Checked",
@ -74,12 +181,61 @@
"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",
"compat":"Checked",
"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",
"compat":"Probably No",
@ -105,18 +261,96 @@
"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",
"compat":"Checked",
"class":"compatible"
},
{
"name":"Easy Digital Downloads",
"compat":"Checked",
"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"
},
{
"name":"Google Analyticator",
"compat":"Checked",
"class":"compatible"
},
{
"name":"Google Analytics for WordPress",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"Google Analytics Popular Posts",
"compat":"Checked",
@ -137,6 +371,13 @@
"class":"compatible"
},
{
"name":"HTTP Digest Authentication",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"HyperDB",
"compat":"Probably No",
@ -150,6 +391,13 @@
"class":"compatible"
},
{
"name":"Jigoshop",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"Ktai Style",
"compat":"Checked",
@ -162,6 +410,104 @@
"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",
"compat":"Needs Patch",
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
"reason":"MySQL specific data",
"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",
"compat":"Probably No",
@ -169,12 +515,67 @@
"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",
"compat":"Checked",
"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",
"compat":"Checked",
"class":"compatible"
},
{
"name":"Related Posts",
"compat":"Checked",
@ -187,6 +588,13 @@
"class":"compatible"
},
{
"name":"Safer Cookies",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"Search Everything",
"compat":"Checked",
@ -199,46 +607,209 @@
"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",
"compat":"Checked",
"class":"compatible"
},
{
"name":"StatPress",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"Synchi",
"compat":"Checked",
"class":"compatible"
},
{
"name":"SysInfo",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"System information",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"Theme-Check",
"compat":"Checked",
"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",
"compat":"Checked",
"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",
"compat":"Checked",
"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",
"compat":"Checked",
"class":"compatible"
},
{
"name":"WordPress Login Redirect",
"compat":"Checked",
"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":"Checked",
"class":"compatible"
"compat":"Needs Patch",
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
"reason":"MySQL specific query",
"class":"workaround"
},
{
@ -247,12 +818,123 @@
"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",
"compat":"Checked",
"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",
"compat":"Checked",
"class":"compatible"
},
{
"name":"WP Online Store",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"WP-PageNavi",
"compat":"Checked",
@ -264,31 +946,107 @@
"compat":"Checked",
"class":"compatible"
},
{
"name":"WP-PostViews",
"compat":"Checked",
"class":"compatible"
},
{
"name":"WP-reCAPTCHA",
"compat":"Checked",
"class":"compatible"
},
{
"name":"WP Session Manager",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"WP Social Bookmarking Light",
"compat":"Checked",
"class":"compatible"
},
{
"name":"WP-Statistics",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"WP Super Cache",
"compat":"Checked",
"class":"compatible"
},
{
"name":"WP System Health",
"compat":"Checked",
"class":"compatible",
"informed":"Users' Information"
},
{
"name":"WP Video Lightbox",
"compat":"Checked",
"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",
"compat":"Needs Patch",

File diff suppressed because it is too large Load Diff