From 295ea862d2592ae43ba33a965acad2376a244f77 Mon Sep 17 00:00:00 2001 From: kjmtsh Date: Fri, 27 Sep 2013 03:45:59 +0000 Subject: [PATCH] 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 --- install.php | 4 +++- query.class.php | 28 ++++++++++++++++++++++++---- readme-ja.txt | 7 +++++++ readme.txt | 9 ++++++++- utilities/database_maintenance.php | 4 ++++ utilities/plugin_lists.json | 14 +++++++++++++- 6 files changed, 59 insertions(+), 7 deletions(-) diff --git a/install.php b/install.php index 26e6739..1c2fa99 100644 --- a/install.php +++ b/install.php @@ -57,7 +57,9 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = wp_cache_flush(); - if ((isset($_SERVER['SERVER_NAME']) && stripos('apache', $_SERVER['SERVER_NAME']) === false) || (isset($_SERVER['SERVER_SIGNATURE']) && stripos('apache', $_SERVER['SERVER_SIGNATURE']) === false)) { + if (isset($_SERVER['SERVER_NAME']) && stripos($_SERVER['SERVER_NAME'], '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 '

'; echo $server_message; diff --git a/query.class.php b/query.class.php index 640be64..74ddb05 100644 --- a/query.class.php +++ b/query.class.php @@ -54,7 +54,7 @@ class PDOSQLiteDriver { $this->_rewrite_regexp(); $this->_rewrite_boolean(); $this->_fix_date_quoting(); -// $this->_rewrite_between(); + $this->_rewrite_between(); break; case 'insert': $this->_strip_backticks(); @@ -70,7 +70,7 @@ class PDOSQLiteDriver { $this->_rewrite_limit_usage(); $this->_rewrite_order_by_usage(); $this->_rewrite_regexp(); -// $this->_rewrite_between(); + $this->_rewrite_between(); break; case 'delete': $this->_strip_backticks(); @@ -503,8 +503,28 @@ class PDOSQLiteDriver { $column_name = trim($match[1]); $min_value = trim($match[2]); $max_value = trim($match[3]); - $replacement = " $column_name >= '$min_value' AND $column_name <= '$max_value'"; - $this->_query = str_ireplace($match[0], $replacement, $this->_query); + $max_value = rtrim($max_value); + $tokens = preg_split("/(''|'|,|)/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE); + $literal = false; + $rewriting = false; + foreach ($tokens as $token) { + if (strpos($token, "'") !== false) { + if ($literal) { + $literal = false; + } else { + $literal = true; + } + } else { + if ($literal === false && stripos($token, 'between') !== false) { + $rewriting = true; + break; + } + } + } + if ($rewriting) { + $replacement = " $column_name >= '$min_value' AND $column_name <= '$max_value'"; + $this->_query = str_ireplace($match[0], $replacement, $this->_query); + } } } /** diff --git a/readme-ja.txt b/readme-ja.txt index 2c22e0c..796973b 100644 --- a/readme-ja.txt +++ b/readme-ja.txt @@ -174,6 +174,13 @@ SQLite Integrationのアップグレードに失敗するようなら、FTPを == Changelog == += 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句がある場合の処理を変更しました。 diff --git a/readme.txt b/readme.txt index f2c698a..e502a09 100644 --- a/readme.txt +++ b/readme.txt @@ -165,8 +165,15 @@ When auto upgrading of SQLite Integration fails, please try manual upgrade via F == Changelog == += 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 mulfunction of the upgraded WordPress installation. +* 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. diff --git a/utilities/database_maintenance.php b/utilities/database_maintenance.php index 65be138..14c1fcb 100644 --- a/utilities/database_maintenance.php +++ b/utilities/database_maintenance.php @@ -435,6 +435,8 @@ class DatabaseMaintenance { + +

@@ -456,6 +458,8 @@ class DatabaseMaintenance { + +