From 54d9e1b02a6a43b881c690268bdfe7f0b0b298fa Mon Sep 17 00:00:00 2001 From: kjmtsh Date: Thu, 5 Mar 2015 21:01:35 +0000 Subject: [PATCH] tagged 1.8 and released git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@1106368 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- ChangeLog | 19 +++++++++++++++++++ db.php | 2 +- pdodb.class.php | 2 +- pdoengine.class.php | 6 ++++-- query.class.php | 24 +++++++++++++++++++----- query_create.class.php | 2 +- readme-ja.txt | 11 ++++++++--- readme.txt | 13 +++++++++---- sqlite-integration.php | 4 ++-- utilities/utility.php | 2 +- 10 files changed, 65 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 251009a..d485294 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +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 diff --git a/db.php b/db.php index b87178a..152c70c 100644 --- a/db.php +++ b/db.php @@ -5,7 +5,7 @@ * This file must be placed in the directory wordpress/wp-content/db.php. * WordPress loads this file automatically. * - * @version 1.7 + * @version 1.8 * @package SQLite Integration * @author Kojima Toshiyasu * diff --git a/pdodb.class.php b/pdodb.class.php index 791e3e8..dd323df 100644 --- a/pdodb.class.php +++ b/pdodb.class.php @@ -12,7 +12,7 @@ if (!defined('ABSPATH')) { die(); } require_once PDODIR . 'pdoengine.class.php'; -require_once PDODIR . 'install.php'; +//require_once PDODIR . 'install.php'; if (!defined('SAVEQUERIES')){ define ('SAVEQUERIES', false); diff --git a/pdoengine.class.php b/pdoengine.class.php index be6374a..3c91e0a 100644 --- a/pdoengine.class.php +++ b/pdoengine.class.php @@ -170,6 +170,9 @@ class PDOEngine extends PDO { */ function __construct() { register_shutdown_function(array($this, '__destruct')); + if (is_file(FQDB)) { + $this->prepare_directory(); + } $dsn = 'sqlite:' . FQDB; if (isset($GLOBALS['@pdo'])) { $this->pdo = $GLOBALS['@pdo']; @@ -245,7 +248,6 @@ class PDOEngine extends PDO { */ private function init() { if (defined('WP_INSTALLING') && WP_INSTALLING) { - $this->prepare_directory(); $statement = $this->pdo->query("SELECT COUNT(*) FROM sqlite_master WHERE type='table'"); $number_of_tables = $statement->fetchColumn(0); $statement = null; @@ -267,7 +269,7 @@ class PDOEngine extends PDO { global $wpdb; $u = umask(0000); if (!is_dir(FQDBDIR)) { - if (!@mkdir(FQDBDIR, 0707, true)) { + if (!@mkdir(FQDBDIR, 0704, true)) { umask($u); $message = 'Unable to create the required directory! Please check your server settings.'; wp_die($message, 'Error!'); diff --git a/query.class.php b/query.class.php index 658e081..19c9951 100644 --- a/query.class.php +++ b/query.class.php @@ -766,15 +766,29 @@ class PDOSQLiteDriver { $_wpdb = new PDODB(); $results = $_wpdb->get_results($query); $_wpdb = null; - $compare = function($a, $b) { - global $flipped; - return $flipped[$a->ID] - $flipped[$b->ID]; - }; - usort($results, $compare); + /* $compare = function($a, $b) { */ + /* global $flipped; */ + /* return $flipped[$a->ID] - $flipped[$b->ID]; */ + /* }; */ + /* usort($results, $compare); */ + usort($results, array($this, 'orderby_callback')); } $wpdb->dbh->pre_ordered_results = $results; } } + /** + * Callback method for sorting + * + * As PHP 5.2 doesn't allow closure function, this callback procedure + * is necessary. + * + * @param queried object + * @access private + */ + private function orderby_callback($a, $b) { + global $flipped; + return $flipped[$a->ID] - $flipped[$b->ID]; + } /** * Method to avoid DELETE with JOIN statement. * diff --git a/query_create.class.php b/query_create.class.php index 4e63e33..9693a28 100644 --- a/query_create.class.php +++ b/query_create.class.php @@ -298,7 +298,7 @@ class CreateQuery{ * @access private */ private function rewrite_key(){ - $this->_query = preg_replace_callback('/,\\s*(KEY|INDEX)\\s*(\\w+)?\\s*(\(.*(?_query); + $this->_query = preg_replace_callback('/,\\s*(KEY|INDEX)\\s*(\\w+)?\\s*(\(.+\))/im', array($this, '_rewrite_key'), $this->_query); } /** * Callback method for rewrite_key. diff --git a/readme-ja.txt b/readme-ja.txt index 501901f..204662c 100644 --- a/readme-ja.txt +++ b/readme-ja.txt @@ -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: 4.0 -Stable tag: 1.7 +Tested up to: 4.1.1 +Stable tag: 1.8 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -164,10 +164,15 @@ wp-config.php を手動で作成することが必要です。WordPress に作 == Upgrade Notice == -WordPress 4.0 での動作チェックをして、いくつかのバグを修正しました。アップグレードをお勧めします。自動アップグレードで失敗するようなら、FTPを使っての手動アップグレードを試してみてください。 +WordPress 4.1.1 での動作チェックをして、いくつかのバグを修正しました。アップグレードをお勧めします。自動アップグレードで失敗するようなら、FTPを使っての手動アップグレードを試してみてください。 == Changelog == += 1.8 (2014-03-06) = +* インストール・プロセスのバグを修正しました。 +* index query の正規表現を修正しました。いくつかのプラグインが影響を受けるかもしれません。 +* PHP 5.2.x で動作しない部分を修正しました。 + = 1.7 (2014-09-05) = * エディタ画面で、添付ファイルの並べ替えができなかったのを修正しました。 * CREATE クエリのバグを修正しました。 diff --git a/readme.txt b/readme.txt index d48acd1..cde8832 100644 --- a/readme.txt +++ b/readme.txt @@ -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: 4.0 -Stable tag: 1.7 +Tested up to: 4.1.1 +Stable tag: 1.8 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -21,7 +21,7 @@ SQLite Integration is a successor to [PDO for WordPress](http://wordpress.org/ex = Features = -SQLite Integration is a database access engine program. So 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/). +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. @@ -162,10 +162,15 @@ This plugin doesn't support 'WP_PLUGIN_URL' constant. == Upgrade Notice == -WordPress 4.0 compatibility is checked and some bugs are fixed. Upgrade is recommended. When auto upgrading fails, please try manual upgrade via FTP. +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 == += 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. diff --git a/sqlite-integration.php b/sqlite-integration.php index 668c4c1..feb181e 100644 --- a/sqlite-integration.php +++ b/sqlite-integration.php @@ -4,7 +4,7 @@ Plugin Name: 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.7 +Version: 1.8 Author URI: http://dogwood.skr.jp Text Domain: sqlite-integration Domain Path: /languages @@ -44,7 +44,7 @@ $siteurl = get_option('siteurl'); /* * Defines basic constants. */ -define('SQLITE_INTEGRATION_VERSION', '1.7'); +define('SQLITE_INTEGRATION_VERSION', '1.8'); define('SQLiteDir', dirname(plugin_basename(__FILE__))); define('SQLiteFilePath', dirname(__FILE__)); define('SQLiteDirName', basename(SQLiteFilePath)); diff --git a/utilities/utility.php b/utilities/utility.php index 0ad9eac..1b61975 100644 --- a/utilities/utility.php +++ b/utilities/utility.php @@ -39,7 +39,7 @@ class SQLiteIntegrationUtils { return; $notice_string = __('Upgrading Notice: To finish upgrading, please activate SQLite Integration and go Setting >> SQLite Integration >> Miscellaneous, and click the button "update" at the bottom of the page. Or else replace wp-content/db.php with the one in sqlite-integration directory manually.', 'sqlite-integration'); $current_version = defined('SQLITE_INTEGRATION_VERSION') ? SQLITE_INTEGRATION_VERSION : ''; - if (version_compare($current_version, '1.7', '=')) return; + if (version_compare($current_version, '1.8', '=')) return; $version = ''; if (defined('WP_CONTENT_DIR')) { $path = WP_CONTENT_DIR . '/db.php';