diff --git a/db.php b/db.php index 3724300..371243a 100644 --- a/db.php +++ b/db.php @@ -5,12 +5,23 @@ * wordpress/wp-content/db.php * * @package SQLite Integration - * @version 1.1 * @author Kojima Toshiyasu, Justin Adie * */ +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) { +/** + * Notice: + * 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. + * define('USE_MYSQL', true); + */ +if (defined('USE_MYSQL') && USE_MYSQL === true) return; + +function pdo_log_error($message, $data = null) { if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin') !== false) { $admin_dir = ''; @@ -38,15 +49,15 @@ 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.'); } /** diff --git a/functions-5-2.php b/functions-5-2.php index 6867473..934b57b 100644 --- a/functions-5-2.php +++ b/functions-5-2.php @@ -1,7 +1,6 @@ 'inet_ntoa', 'inet_aton' => 'inet_aton', 'datediff' => 'datediff', - 'locate' => 'locate' + 'locate' => 'locate', + 'version' => 'version' ); public function month($field){ @@ -385,5 +385,12 @@ class PDOSQLiteUDFS { } } } + /** + * + */ + public function version() { + global $required_mysql_version; + return $required_mysql_version; + } } ?> \ No newline at end of file diff --git a/functions.php b/functions.php index 8cb715c..e97e373 100644 --- a/functions.php +++ b/functions.php @@ -1,7 +1,6 @@ 'inet_ntoa', 'inet_aton' => 'inet_aton', 'datediff' => 'datediff', - 'locate' => 'locate' + 'locate' => 'locate', + 'version' => 'version' ); public function month($field){ @@ -359,5 +359,12 @@ class PDOSQLiteUDFS { } } } + /** + * + */ + public function version() { + global $required_mysql_version; + return $required_mysql_version; + } } ?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..29d690a --- /dev/null +++ b/index.php @@ -0,0 +1,2 @@ +
'; + echo $server_message; + echo '
'; + } + return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message); } ?> \ No newline at end of file diff --git a/js/index.php b/js/index.php new file mode 100644 index 0000000..29d690a --- /dev/null +++ b/js/index.php @@ -0,0 +1,2 @@ +') diff --git a/js/sqlite.min.js b/js/sqlite.min.js new file mode 100644 index 0000000..a27987e --- /dev/null +++ b/js/sqlite.min.js @@ -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('').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('').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")}); \ No newline at end of file diff --git a/languages/index.php b/languages/index.php new file mode 100644 index 0000000..29d690a --- /dev/null +++ b/languages/index.php @@ -0,0 +1,2 @@ +, 2013. +# FIRST AUTHORWe have been unable to "
"connect to the specified database.
The error message received was %s"
msgstr ""
-"
データベースに接続できませんでした。
エラーメッセージは、%sです。"
+"
データベースに接続できません。
エラーメッセージは、%s"
-#: pdoengine.class.php:80 pdoengine.class.php:96 schema.php:26
+#: pdoengine.class.php:82 pdoengine.class.php:98
msgid "Database connection error!
"
msgstr "データベース接続エラー!
"
-#: pdoengine.class.php:81 pdoengine.class.php:97 schema.php:27 schema.php:81
+#: pdoengine.class.php:83 pdoengine.class.php:99
+#, php-format
msgid "Error message is: %s"
-msgstr "エラーメッセージは: "
+msgstr "エラーメッセージ: %s"
-#: pdoengine.class.php:115
-msgid ""
-"Unable to create the required directory! Please check your server settings."
-msgstr ""
-"必要なディレクトリが作成できませんでした。サーバ設定を確認してください。"
-
-#: pdoengine.class.php:120 pdoengine.class.php:126
-msgid ""
-"Unable to create a file in the directory! Please check your server settings."
-msgstr ""
-"ディレクトリにファイルを作成できませんでした。サーバ設定を確認してください。"
-
-#: pdoengine.class.php:148
+#: pdoengine.class.php:156
#, php-format
msgid ""
"
Sorry, we cannot determine the type of query " "that is requested.
The query is %s
" msgstr "" -"申し訳ありません、要求されたクエリのタイプを決定できません。
クエリは%s" -"です。
" +"申し訳ありません。要求されたクエリのタイプを判別できませんでした。
" +"クエリ: %s
" -#: pdoengine.class.php:294 +#: pdoengine.class.php:315 #, php-format msgid "Problem preparing the PDO SQL Statement. Error was: %s" -msgstr "SQLステートメントの準備中に問題。エラーは: %s" +msgstr "PDO SQLステートメントを準備中に問題がありました。エラー: %s" -#: pdoengine.class.php:327 +#: pdoengine.class.php:372 #, php-format msgid "Error while executing query! Error message was: %s" -msgstr "クエリの実行中にエラー! エラーメッセージは: %s" +msgstr "クエリを実行中にエラーが発生しました。エラーメッセージ: %s" -#: pdoengine.class.php:381 +#: pdoengine.class.php:426 msgid "The query is too big to parse properly" -msgstr "クエリが長すぎて解析できません" +msgstr "クエリが長すぎてちゃんと解析できません" -#: pdoengine.class.php:583 +#: pdoengine.class.php:635 #, php-format msgid "Problem in creating table or index. Error was: %s" -msgstr "テーブルまたはインデックスを作成中に問題発生。エラーは: %s" +msgstr "テーブルかインデックスを作るときに問題がありました。エラー: %s" -#: pdoengine.class.php:626 +#: pdoengine.class.php:678 #, php-format msgid "Problem in executing alter query. Error was: %s" -msgstr "ALTERクエリを実行中に問題発生。エラーは: %s" - -#: schema.php:80 -#, php-format -msgid "" -"Error occured while creating tables or indexes...We have been unable to "
"connect to the specified database.
The error message received was %s"
msgstr ""
-#: pdoengine.class.php:80 pdoengine.class.php:96 schema.php:26
+#: trunk/pdoengine.class.php:82 trunk/pdoengine.class.php:98
msgid "Database connection error!
"
msgstr ""
-#: pdoengine.class.php:81 pdoengine.class.php:97 schema.php:27 schema.php:81
+#: trunk/pdoengine.class.php:83 trunk/pdoengine.class.php:99
+#, php-format
msgid "Error message is: %s"
msgstr ""
-#: pdoengine.class.php:115
-msgid ""
-"Unable to create the required directory! Please check your server settings."
-msgstr ""
-
-#: pdoengine.class.php:120 pdoengine.class.php:126
-msgid ""
-"Unable to create a file in the directory! Please check your server settings."
-msgstr ""
-
-#: pdoengine.class.php:148
+#: trunk/pdoengine.class.php:156
#, php-format
msgid ""
"
Sorry, we cannot determine the type of query " "that is requested.
The query is %s
" msgstr "" -#: pdoengine.class.php:294 +#: trunk/pdoengine.class.php:315 #, php-format msgid "Problem preparing the PDO SQL Statement. Error was: %s" msgstr "" -#: pdoengine.class.php:327 +#: trunk/pdoengine.class.php:372 #, php-format msgid "Error while executing query! Error message was: %s" msgstr "" -#: pdoengine.class.php:381 +#: trunk/pdoengine.class.php:426 msgid "The query is too big to parse properly" msgstr "" -#: pdoengine.class.php:583 +#: trunk/pdoengine.class.php:635 #, php-format msgid "Problem in creating table or index. Error was: %s" msgstr "" -#: pdoengine.class.php:626 +#: trunk/pdoengine.class.php:678 #, php-format msgid "Problem in executing alter query. Error was: %s" msgstr "" -#: schema.php:80 -#, php-format -msgid "" -"Error occured while creating tables or indexes..." . ob_get_contents() . ""; + $output .= '
' . ob_get_contents() . ''; ob_end_clean(); return $output; @@ -299,7 +298,7 @@ class PDOEngine extends PDO { } private function prepare_query(){ - $this->queries[] = "Prepare:\t". $this->prepared_query; + $this->queries[] = 'Prepare: ' . $this->prepared_query; $reason = 0; $message = ''; $statement = null; @@ -313,7 +312,7 @@ class PDOEngine extends PDO { } while (5 == $reason || 6 == $reason); if ($reason > 0){ - $err_message = sprintf(__("Problem preparing the PDO SQL Statement. Error was: %s", 'sqlite-integration'), $message); + $err_message = sprintf("Problem preparing the PDO SQL Statement. Error was: %s", $message); $this->set_error(__LINE__, __FUNCTION__, $err_message); } return $statement; @@ -325,7 +324,7 @@ class PDOEngine extends PDO { if (!is_object($statement)) return; if (count($this->extracted_variables) > 0) { - $this->queries[] = "Executing: ". var_export($this->extracted_variables, true); + $this->queries[] = 'Executing: ' . var_export($this->extracted_variables, true); do { if ($this->query_type == 'update' || $this->query_type == 'replace') { try { @@ -347,7 +346,7 @@ class PDOEngine extends PDO { } } while (5 == $reason || 6 == $reason); } else { - $this->queries[] = "Executing: (no parameters)\t "; + $this->queries[] = 'Executing: (no parameters)'; do{ if ($this->query_type == 'update' || $this->query_type == 'replace') { try { @@ -370,7 +369,7 @@ class PDOEngine extends PDO { } while (5 == $reason || 6 == $reason); } if ($reason > 0) { - $err_message = sprintf(__("Error while executing query! Error message was: %s", 'sqlite-integration'), $message); + $err_message = sprintf("Error while executing query! Error message was: %s", $message); $this->set_error(__LINE__, __FUNCTION__, $err_message); return false; } else { @@ -378,32 +377,34 @@ class PDOEngine extends PDO { } //generate the results that $wpdb will want to see switch ($this->query_type) { - case "insert": - case "update": - case "replace": + case 'insert': + case 'update': + case 'replace': $this->last_insert_id = $this->pdo->lastInsertId(); $this->affected_rows = $statement->rowCount(); $this->return_value = $this->affected_rows; break; - case "select": - case "show": - case "showcolumns": - case "showindex": - case "describe": - case "desc": + case 'select': + case 'show': + case 'showcolumns': + case 'showindex': + case 'describe': + case 'desc': + case 'check': + case 'analyze': // case "foundrows": $this->num_rows = count($this->_results); $this->return_value = $this->num_rows; break; - case "delete": + case 'delete': $this->affected_rows = $statement->rowCount(); $this->return_value = $this->affected_rows; break; - case "alter": - case "drop": - case "create": - case "optimize": - case "truncate": + case 'alter': + case 'drop': + case 'create': + case 'optimize': + case 'truncate': if ($this->is_error) { $this->return_value = false; } else { @@ -424,7 +425,7 @@ class PDOEngine extends PDO { $_limit = $limit = ini_get('pcre.backtrack_limit'); do { if ($limit > 10000000) { - $message = __("The query is too big to parse properly", 'sqlite-integration'); + $message = 'The query is too big to parse properly'; $this->set_error(__LINE__, __FUNCTION__, $message); break; //no point in continuing execution, would get into a loop } else { @@ -436,7 +437,7 @@ class PDOEngine extends PDO { //reset the pcre.backtrack_limist ini_set('pcre.backtrack_limit', $_limit); - $this->queries[]= "With Placeholders: $query "; + $this->queries[]= 'With Placeholders: ' . $query; $this->prepared_query = $query; } @@ -469,7 +470,7 @@ class PDOEngine extends PDO { * @return boolean|string */ private function determine_query_type($query) { - $result = preg_match('/^\\s*(EXPLAIN|PRAGMA|SELECT\\s*FOUND_ROWS|SELECT|INSERT|UPDATE|REPLACE|DELETE|ALTER|CREATE|DROP\\s*INDEX|DROP|SHOW\\s*\\w+\\s*\\w+\\s*|DESCRIBE|DESC|TRUNCATE|OPTIMIZE)/i', $query, $match); + $result = preg_match('/^\\s*(EXPLAIN|PRAGMA|SELECT\\s*FOUND_ROWS|SELECT|INSERT|UPDATE|REPLACE|DELETE|ALTER|CREATE|DROP\\s*INDEX|DROP|SHOW\\s*\\w+\\s*\\w+\\s*|DESCRIBE|DESC|TRUNCATE|OPTIMIZE|CHECK|ANALYZE)/i', $query, $match); if (!$result) { return false; @@ -505,7 +506,7 @@ class PDOEngine extends PDO { private function execute_insert_query_new($query) { $engine = $this->prepare_engine($this->query_type); $this->rewritten_query = $engine->rewrite_query($query, $this->query_type); - $this->queries[] = "Rewritten: $this->rewritten_query"; + $this->queries[] = 'Rewritten: ' . $this->rewritten_query; $this->extract_variables(); $statement = $this->prepare_query(); $this->execute_query($statement); @@ -544,7 +545,7 @@ class PDOEngine extends PDO { } $query_string = $query_prefix . ' ' . $value . $suffix; $this->rewritten_query = $engine->rewrite_query($query_string, $this->query_type); - $this->queries[] = "Rewritten: $this->rewritten_query"; + $this->queries[] = 'Rewritten: ' . $this->rewritten_query; $this->extracted_variables = array(); $this->extract_variables(); if ($first) { @@ -557,7 +558,7 @@ class PDOEngine extends PDO { } } else { $this->rewritten_query = $engine->rewrite_query($query, $this->query_type); - $this->queries[] = "Rewritten: $this->rewritten_query"; + $this->queries[] = 'Rewritten: ' . $this->rewritten_query; $this->extract_variables(); $statement = $this->prepare_query(); $this->execute_query($statement); @@ -633,7 +634,7 @@ class PDOEngine extends PDO { } } if ($reason > 0) { - $err_message = sprintf(__("Problem in creating table or index. Error was: %s", 'sqlite-integration'), $message); + $err_message = sprintf("Problem in creating table or index. Error was: %s", $message); $this->set_error(__LINE__, __FUNCTION__, $err_message); return false; } @@ -649,7 +650,12 @@ class PDOEngine extends PDO { $engine = $this->prepare_engine($this->query_type); $reason = 0; $message = ''; + $re_query = ''; $rewritten_query = $engine->rewrite_query($query, $this->query_type); + if (is_array($rewritten_query) && array_key_exists('recursion', $rewritten_query)) { + $re_query = $rewritten_query['recursion']; + unset($rewritten_query['recursion']); + } try { $this->beginTransaction(); if (is_array($rewritten_query)) { @@ -675,8 +681,11 @@ class PDOEngine extends PDO { $this->rollBack(); } } + if ($re_query != '') { + $this->query($re_query); + } if ($reason > 0) { - $err_message = sprintf(__("Problem in executing alter query. Error was: %s", 'sqlite-integration'), $message); + $err_message = sprintf("Problem in executing alter query. Error was: %s", $message); $this->set_error(__LINE__, __FUNCTION__, $err_message); return false; } @@ -699,7 +708,11 @@ class PDOEngine extends PDO { $value = str_replace("'", '', $match[1]); $dummy_data['Variable_name'] = trim($value); // this is set for Wordfence Security Plugin - if ($value == 'max_allowed_packet') $dummy_data['Value'] = 1047552; + if ($value == 'max_allowed_packet') { + $dummy_data['Value'] = 1047552; + } else { + $dummy_data['Value'] = ''; + } } $_results[] = new ObjectArray($dummy_data); $this->results = $_results; @@ -713,6 +726,8 @@ class PDOEngine extends PDO { $this->convert_to_columns_object(); } elseif ('showindex' === $this->query_type){ $this->convert_to_index_object(); + } elseif (in_array($this->query_type, array('check', 'analyze'))) { + $this->convert_result_check_or_analyze(); } else { $this->results = $this->_results; } @@ -774,6 +789,7 @@ class PDOEngine extends PDO { } /** * rewrites the result of SHOW INDEX to the Object compatible with MySQL + * added the WHERE clause manipulation (ver 1.3.1) */ private function convert_to_index_object() { $_results = array(); @@ -840,10 +856,44 @@ class PDOEngine extends PDO { $_columns['Comment'] = ''; $_results[] = new ObjectArray($_columns); } + if (stripos($this->queries[0], 'WHERE') !== false) { + preg_match('/WHERE\\s*(.*)$/im', $this->queries[0], $match); + list($key, $value) = explode('=', $match[1]); + $key = trim($key); + $value = preg_replace("/[\';]/", '', $value); + $value = trim($value); + foreach ($_results as $result) { + if (stripos($value, $result->$key) !== false) { + unset($_results); + $_results[] = $result; + break; + } + } + } } $this->results = $_results; } + private function convert_result_check_or_analyze() { + $results = array(); + if ($this->query_type == 'check') { + $_columns = array( + 'Table' => '', + 'Op' => 'check', + 'Msg_type' => 'status', + 'Msg_text' => 'OK' + ); + } else { + $_columns = array( + 'Table' => '', + 'Op' => 'analyze', + 'Msg_type' => 'status', + 'Msg_text' => 'Table is already up to date' + ); + } + $_results[] = new ObjectArray($_columns); + $this->results = $_results; + } /** * function to get SQLite library version * this is used for checking if SQLite can execute multiple rows insert diff --git a/query.class.php b/query.class.php index 0f0a396..959738e 100644 --- a/query.class.php +++ b/query.class.php @@ -1,7 +1,6 @@ _delete_index_hints(); $this->_rewrite_regexp(); $this->_rewrite_boolean(); + $this->_fix_date_quoting(); + $this->_rewrite_between(); break; case 'insert': $this->_strip_backticks(); $this->_execute_duplicate_key_update(); $this->_rewrite_insert_ignore(); $this->_rewrite_regexp(); + $this->_fix_date_quoting(); break; case 'update': $this->_strip_backticks(); @@ -68,6 +70,7 @@ class PDOSQLiteDriver { $this->_rewrite_limit_usage(); $this->_rewrite_order_by_usage(); $this->_rewrite_regexp(); + $this->_rewrite_between(); break; case 'delete': $this->_strip_backticks(); @@ -85,7 +88,15 @@ class PDOSQLiteDriver { case 'optimize': $this->_rewrite_optimize(); break; + case 'pragma': + break; default: + if (defined(WP_DEBUG) && WP_DEBUG) { + break; + } else { + $this->_return_true(); + break; + } } return $this->_query; } @@ -95,7 +106,7 @@ class PDOSQLiteDriver { */ private function _handle_show_query(){ $table_name = ''; - $pattern = '/^\\s*SHOW\\s*TABLES\\s*(LIKE\\s*(.*))$/im'; + $pattern = '/^\\s*SHOW\\s*TABLES\\s*.*?(LIKE\\s*(.*))$/im'; if (preg_match($pattern, $this->_query, $matches)) { $table_name = str_replace(array("'", ';'), '', $matches[2]); } @@ -238,6 +249,11 @@ class PDOSQLiteDriver { * We need to exclude sub query's LIMIT. */ private function _rewrite_limit_usage(){ + $_wpdb = new PDODB(); + $options = $_wpdb->get_results('PRAGMA compile_options'); + foreach ($options as $opt) { + if (stripos($opt->compile_option, 'ENABLE_UPDATE_DELETE_LIMIT') !== false) return; + } if (stripos($this->_query, '(select') === false) { $this->_query = preg_replace('/\\s*LIMIT\\s*[0-9]$/i', '', $this->_query); } @@ -285,25 +301,28 @@ class PDOSQLiteDriver { * @return void */ private function _delete_index_hints(){ - $pattern = '/use\s+index\s*\(.*?\)/i'; + $pattern = '/\\s*(use|ignore|force)\\s+index\\s*\(.*?\)/i'; $this->_query = preg_replace($pattern, '', $this->_query); } /** - * Justin Adie says: - * method to fix inconsistent use of quoted, unquoted etc date values in query function - * this is ironic, given the above rewrite badlyformed dates method - * examples + * Fix the date string and quote. This is required for the calendar widget. + * * where month(fieldname)=08 becomes month(fieldname)='8' * where month(fieldname)='08' becomes month(fieldname)='8' * - * I don't understand... + * I use preg_replace_callback instead of 'e' option because of security reason. + * cf. PHP manual (regular expression) * * @return void */ - private function _fix_date_quoting(){ - $pattern = '/(month|year|second|day|minute|hour|dayofmonth)\s*\((.*?)\)\s*=\s*["\']?(\d{1,4})[\'"]?\s*/ei'; - $this->_query = preg_replace($pattern, "'\\1(\\2)=\'' . intval('\\3') . '\' ' ", $this->_query); + private function _fix_date_quoting() { + $pattern = '/(month|year|second|day|minute|hour|dayofmonth)\\s*\((.*?)\)\\s*=\\s*["\']?(\d{1,4})[\'"]?\\s*/im'; + $this->_query = preg_replace_callback($pattern, array($this, '__fix_date_quoting'), $this->_query); + } + private function __fix_date_quoting($match) { + $fixed_val = "{$match[1]}({$match[2]})='" . intval($match[3]) . "' "; + return $fixed_val; } private function _rewrite_regexp(){ @@ -341,28 +360,12 @@ class PDOSQLiteDriver { /** * method to execute SHOW INDEX query + * Moved the WHERE clause manipulation to pdoengin.class.php (ver 1.3.1) */ private function _handle_show_index() { - $_columns = array(// No, you'll get no meaningful information.. - 'Key_name' => 'name', - ); - $pattern_0 = '/^\\s*SHOW\\s*(?:INDEX|INDEXES|KEYS)\\s*FROM\\s*(\\w+)?\\s*WHERE\\s*(.*)$/im'; - $pattern_1 = '/^\\s*SHOW\\s*(?:INDEX|INDEXES|KEYS)\\s*FROM\\s*(\\w+)?/im'; - if (preg_match($pattern_0, $this->_query, $match_0)) { - $table_name = str_replace("'", '', $match_0[1]); - list($key, $value) = explode('=', $match_0[2]); - $key = trim($key); - $value = preg_replace("/[\';]/", '', $value); - $value = trim($value); - if (array_key_exists($key, $_columns)) { - $key = $_columns[$key]; - $where_clause = 'AND ' . $key . ' LIKE ' . "'" . $value . "%'"; - } else { - $where_clause = ''; - } - $this->_query = "SELECT * FROM sqlite_master WHERE tbl_name='$table_name' $where_clause"; - } elseif (preg_match($pattern_1, $this->_query, $match_1)) { - $table_name = preg_replace("/[\';]/", '', $match_1[1]); + $pattern = '/^\\s*SHOW\\s*(?:INDEX|INDEXES|KEYS)\\s*FROM\\s*(\\w+)?/im'; + if (preg_match($pattern, $this->_query, $match)) { + $table_name = preg_replace("/[\';]/", '', $match[1]); $table_name = trim($table_name); $this->_query = "SELECT * FROM sqlite_master WHERE tbl_name='$table_name'"; } @@ -408,7 +411,7 @@ class PDOSQLiteDriver { return; } // data check - if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/im', $insert_data, $match_1)) { + if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/ims', $insert_data, $match_1)) { $col_array = explode(',', $match_1[1]); $ins_data_array = explode(',', $match_1[2]); foreach ($col_array as $col) { @@ -498,15 +501,45 @@ class PDOSQLiteDriver { $this->_query = $update_query; } } - } else { - // wordaround... - $pattern = '/ ON DUPLICATE KEY UPDATE.*$/im'; - $replace_query = preg_replace($pattern, '', $this->_query); - $replace_query = str_ireplace('INSERT ', 'INSERT OR REPLACE ', $replace_query); - $this->_query = $replace_query; } +// else { +// $pattern = '/ ON DUPLICATE KEY UPDATE.*$/im'; +// $replace_query = preg_replace($pattern, '', $this->_query); +// $replace_query = str_ireplace('INSERT ', 'INSERT OR REPLACE ', $replace_query); +// $this->_query = $replace_query; +// } } + private function _rewrite_between() { + $pattern = '/\\s*(\\w+)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s]*)?\\s*/ims'; + if (preg_match($pattern, $this->_query, $match)) { + $column_name = trim($match[1]); + $min_value = trim($match[2]); + $max_value = trim($match[3]); + $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); + } + } + } /** * workaround function to avoid DELETE with JOIN * wp-admin/includes/upgrade.php contains 'DELETE ... JOIN' statement. @@ -522,5 +555,11 @@ class PDOSQLiteDriver { $this->_query = $rewritten; } } + /** + * + */ + private function _return_true() { + $this->_query = 'SELECT 1=1'; + } } ?> \ No newline at end of file diff --git a/query_alter.class.php b/query_alter.class.php index 5061546..38d5d44 100644 --- a/query_alter.class.php +++ b/query_alter.class.php @@ -3,56 +3,71 @@ * The class for manipulating ALTER query * newly supports multiple variants * @package SQLite Integration - * @version 1.1 * @author Kojima Toshiyasu */ class AlterQuery { public $_query = null; public function rewrite_query($query, $query_type) { - $tokens = array(); if (stripos($query, $query_type) === false) { return false; } $query = str_replace('`', '', $query); if (preg_match('/^\\s*(ALTER\\s*TABLE)\\s*(\\w+)?\\s*/ims', $query, $match)) { + $tmp_query = array(); + $tokens = array(); + $re_command = ''; $command = str_ireplace($match[0], '', $query); $tmp_tokens['query_type'] = trim($match[1]); $tmp_tokens['table_name'] = trim($match[2]); - $command_array = $this->split_multiple($command); - foreach ($command_array as $single_command) { - $command_tokens = $this->command_tokenizer($single_command); - if (!empty($command_tokens)) { - $tokens[] = array_merge($tmp_tokens, $command_tokens); - } else { - $this->_query = 'SELECT 1=1'; - } +// $command_array = $this->split_multiple($command); + $command_array = explode(',', $command); + + $single_command = array_shift($command_array); + if (!empty($command_array)) { + $re_command = 'ALTER TABLE ' . $tmp_tokens['table_name'] . ' '; + $re_command .= implode(',', $command_array); + } + $command_tokens = $this->command_tokenizer($single_command); + if (!empty($command_tokens)) { + $tokens = array_merge($tmp_tokens, $command_tokens); + } else { + $this->_query = 'SELECT 1=1'; + return $this->_query; } - foreach ($tokens as $token) { - $command_name = $token['command']; - switch ($command_name) { - case 'add column': case 'rename to': case 'add index': case 'drop index': - $this->_query = $this->handle_single_command($token); - break; - case 'add primary key': - $this->_query = $this->handle_add_primary_key($token); - break; - case 'drop primary key': - $this->_query = $this->handle_drop_primary_key($token); - break; - case 'modify column': - $this->_query = $this->handle_modify_command($token); - break; - case 'change column': - $this->_query = $this->handle_change_command($token); - break; - case 'alter column': - $this->_query = $this->handle_alter_command($token); - break; - default: - break; +// foreach ($tokens as $token) { + $command_name = strtolower($tokens['command']); + switch ($command_name) { + case 'add column': case 'rename to': case 'add index': case 'drop index': + $tmp_query = $this->handle_single_command($tokens); + break; + case 'add primary key': + $tmp_query = $this->handle_add_primary_key($tokens); + break; + case 'drop primary key': + $tmp_query = $this->handle_drop_primary_key($tokens); + break; + case 'modify column': + $tmp_query = $this->handle_modify_command($tokens); + break; + case 'change column': + $tmp_query = $this->handle_change_command($tokens); + break; + case 'alter column': + $tmp_query = $this->handle_alter_command($tokens); + break; + default: + break; } - } +// } + if (!is_array($tmp_query)) { + $this->_query[] = $tmp_query; + } else { + $this->_query = $tmp_query; + } + if ($re_command != '') { + $this->_query = array_merge($this->_query, array('recursion' => $re_command)); + } } else { $this->_query = 'SELECT 1=1'; } @@ -61,110 +76,125 @@ class AlterQuery { private function command_tokenizer($command) { $tokens = array(); - if (preg_match('/^(ADD|DROP|RENAME|MODIFY|CHANGE|ALTER)\\s*(\\w+)?\\s*(\\w+)?\\s*/ims', $command, $match)) { + if (preg_match('/^(ADD|DROP|RENAME|MODIFY|CHANGE|ALTER)\\s*(\\w+)?\\s*(\\w+(\(.+\)|))?\\s*/ims', $command, $match)) { $the_rest = str_ireplace($match[0], '', $command); - $match_1 = strtolower(trim($match[1])); - $match_2 = strtolower(trim($match[2])); - $match_3 = isset($match[3]) ? strtolower(trim($match[3])) : ''; - switch ($match_1) { + $match_1 = trim($match[1]); + $match_2 = trim($match[2]); + $match_3 = isset($match[3]) ? trim($match[3]) : ''; + switch (strtolower($match_1)) { case 'add': - if (in_array($match_2, array('fulltext', 'constraint', 'foreign'))) { + if (in_array(strtolower($match_2), array('fulltext', 'constraint', 'foreign'))) { break; - } elseif ($match_2 == 'column') { + } elseif (stripos('column', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = $match_3; $tokens['column_def'] = trim($the_rest); - } elseif ($match_2 == 'primary') { + } elseif (stripos('primary', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2.' '.$match_3; $tokens['column_name'] = $the_rest; - } elseif ($match_2 == 'unique') { + } elseif (stripos('unique', $match_2) !== false) { list($index_name, $col_name) = preg_split('/[\(\)]/s', trim($the_rest), -1, PREG_SPLIT_DELIM_CAPTURE); $tokens['unique'] = true; $tokens['command'] = $match_1.' '.$match_3; $tokens['index_name'] = trim($index_name); $tokens['column_name'] = '('.trim($col_name).')'; - } elseif (in_array($match_2, array('index', 'key'))) { + } elseif (in_array(strtolower($match_2), array('index', 'key'))) { $tokens['command'] = $match_1.' '.$match_2; - $tokens['index_name'] = $match_3; + if ($match_3 == '') { + $tokens['index_name'] = str_replace(array('(', ')'), '', $the_rest); + } else { + $tokens['index_name'] = $match_3; + } $tokens['column_name'] = trim($the_rest); } else { - $tokens['command'] = $match_1.' column'; + $tokens['command'] = $match_1.' COLUMN'; $tokens['column_name'] = $match_2; $tokens['column_def'] = $match_3.' '.$the_rest; } break; case 'drop': - if ($match_2 == 'column') { + if (stripos('column', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = trim($match_3); - } elseif ($match_2 == 'primary') { + } elseif (stripos('primary', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2.' '.$match_3; - } elseif (in_array($match_2, array('index', 'key'))) { + } elseif (in_array(strtolower($match_2), array('index', 'key'))) { $tokens['command'] = $match_1.' '.$match_2; $tokens['index_name'] = $match_3; - } elseif ($match_2 == 'primary') { + } elseif (stripos('primary', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2.' '.$match_3; } else { - $tokens['command'] = $match_1.' column'; + $tokens['command'] = $match_1.' COLUMN'; $tokens['column_name'] = $match_2; } break; case 'rename': - if ($match_2 == 'to') { + if (stripos('to', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = $match_3; } else { - $tokens['command'] = $match_1.' to'; + $tokens['command'] = $match_1.' TO'; $tokens['column_name'] = $match_2; } break; case 'modify': - if ($match_2 == 'column') { + if (stripos('column', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = $match_3; $tokens['column_def'] = trim($the_rest); } else { - $tokens['command'] = $match_1.' column'; + $tokens['command'] = $match_1.' COLUMN'; $tokens['column_name'] = $match_2; $tokens['column_def'] = $match_3.' '.trim($the_rest); } break; case 'change': - if ($match_2 == 'column') { + $the_rest = trim($the_rest); + if (stripos('column', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2; $tokens['old_column'] = $match_3; - list($new_col) = preg_split('/\s/s', trim($the_rest), -1, PREG_SPLIT_DELIM_CAPTURE); - $tokens['new_column'] = $new_col; - $col_def = str_ireplace($new_col, '', $the_rest); - $tokens['column_def'] = trim($col_def); - } else { - $tokens['command'] = $match_1.' column'; - $tokens['old_column'] = $match_2; - $tokens['new_column'] = $match_3; - $tokens['column_def'] = trim($the_rest); - } - break; - case 'alter': - if ($match_2 == 'column') { - $tokens['command'] = $match_1.' '.$match_2; - $tokens['column_name'] = $match_3; - list($set_or_drop) = explode(' ', $the_rest); - if ($set_or_drop == 'set') { - $tokens['default_command'] = 'set default'; - $default_value = str_ireplace('set default', '', $the_rest); - $tokens['default_value'] = trim($default_value); + list($new_col) = explode(' ', $the_rest); + $tmp_col = preg_replace('/\(.+?\)/im', '', $new_col); + if (array_key_exists(strtolower($tmp_col), $this->array_types)) { + $tokens['column_def'] = $the_rest; } else { - $tokens['default_command'] = 'drop default'; + $tokens['new_column'] = $new_col; + $col_def = str_replace($new_col, '', $the_rest); + $tokens['column_def'] = trim($col_def); } } else { $tokens['command'] = $match_1.' column'; + $tokens['old_column'] = $match_2; + $tmp_col = preg_replace('/\(.+?\)/im', '', $match_3); + if (array_key_exists(strtolower($tmp_col), $this->array_types)) { + $tokens['column_def'] = $match_3 . ' ' . $the_rest; + } else { + $tokens['new_column'] = $match_3; + $tokens['column_def'] = $the_rest; + } + } + break; + case 'alter': + if (stripos('column', $match_2) !== false) { + $tokens['command'] = $match_1.' '.$match_2; + $tokens['column_name'] = $match_3; + list($set_or_drop) = explode(' ', $the_rest); + if (stripos('set', $set_or_drop) !== false) { + $tokens['default_command'] = 'SET DEFAULT'; + $default_value = str_ireplace('set default', '', $the_rest); + $tokens['default_value'] = trim($default_value); + } else { + $tokens['default_command'] = 'DROP DEFAULT'; + } + } else { + $tokens['command'] = $match_1.' COLUMN'; $tokens['column_name'] = $match_2; - if ($match_3 == 'set') { - $tokens['default_command'] = 'set default'; + if (stripos('set', $match_3) !== false) { + $tokens['default_command'] = 'SET DEFAULT'; $default_value = str_ireplace('default', '', $the_rest); $tokens['default_value'] = trim($default_value); } else { - $tokens['default_command'] = 'drop default'; + $tokens['default_command'] = 'DROP DEFAULT'; } } break; @@ -299,14 +329,14 @@ class AlterQuery { $create_query = array_shift($index_queries); if (stripos($create_query, $tokenized_query['column_name']) === false) { return 'SELECT 1=1'; - } elseif (preg_match("/{$tokenized_query['column_name']}\\s*{$tokenized_query['column_def']}\\s*[,)]/i", $create_query)) { + } elseif (preg_match("/{$tokenized_query['column_name']}\\s*{$column_def}\\s*[,)]/i", $create_query)) { return 'SELECT 1=1'; } $create_query = preg_replace("/{$tokenized_query['table_name']}/i", $temp_table, $create_query); if (preg_match("/\\b{$tokenized_query['column_name']}\\s*.*(?=,)/ims", $create_query)) { - $create_query = preg_replace("/\\b{$tokenized_query['column_name']}\\s*.*(?=,)/ims", "{$tokenized_query['column_name']} {$tokenized_query['column_def']}", $create_query); + $create_query = preg_replace("/\\b{$tokenized_query['column_name']}\\s*.*(?=,)/ims", "{$tokenized_query['column_name']} {$column_def}", $create_query); } elseif (preg_match("/\\b{$tokenized_query['column_name']}\\s*.*(?=\))/ims", $create_query)) { - $create_query = preg_replace("/\\b{$tokenized_query['column_name']}\\s*.*(?=\))/ims", "{$tokenized_query['column_name']} {$tokenized_query['column_def']}", $create_query); + $create_query = preg_replace("/\\b{$tokenized_query['column_name']}\\s*.*(?=\))/ims", "{$tokenized_query['column_name']} {$column_def}", $create_query); } $query[] = $create_query; $query[] = "INSERT INTO $temp_table SELECT * FROM {$tokenized_query['table_name']}"; @@ -324,11 +354,16 @@ class AlterQuery { $new_fields = ''; $tokenized_query = $queries; $temp_table = 'temp_'.$tokenized_query['table_name']; - $column_def = $this->convert_field_types($tokenized_query['new_column'], $tokenized_query['column_def']); + if (isset($tokenized_query['new_column'])) { + $column_name = $tokenized_query['new_column']; + } else { + $column_name = $tokenized_query['old_column']; + } + $column_def = $this->convert_field_types($column_name, $tokenized_query['column_def']); $_wpdb = new PDODB(); $col_obj = $_wpdb->get_results("SHOW COLUMNS FROM {$tokenized_query['table_name']}"); foreach ($col_obj as $col) { - if ($col->Field == $tokenized_query['old_column']) $col_check = true; + if (stripos($col->Field, $tokenized_query['old_column']) !== false) $col_check = true; $old_fields .= $col->Field . ','; } if ($col_check == false) { @@ -336,7 +371,7 @@ class AlterQuery { return 'SELECT 1=1'; } $old_fields = rtrim($old_fields, ','); - $new_fields = str_replace($tokenized_query['old_column'], $tokenized_query['new_column'], $old_fields); + $new_fields = str_ireplace($tokenized_query['old_column'], $column_name, $old_fields); $query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'"); $_wpdb = null; for ($i = 0; $i < count($query_obj); $i++) { @@ -345,16 +380,16 @@ class AlterQuery { $create_query = array_shift($index_queries); $create_query = preg_replace("/{$tokenized_query['table_name']}/i", $temp_table, $create_query); if (preg_match("/\\b{$tokenized_query['old_column']}\\s*(.+?)(?=,)/ims", $create_query, $match)) { - if ($tokenized_query['column_def'] == trim($match[1])) { + if (stripos(trim($match[1]), $column_def) !== false) { return 'SELECT 1=1'; } else { - $create_query = preg_replace("/\\b{$tokenized_query['old_column']}\\s*.*?(?=,)/ims", "{$tokenized_query['new_column']} {$tokenized_query['column_def']}", $create_query); + $create_query = preg_replace("/\\b{$tokenized_query['old_column']}\\s*.+?(?=,)/ims", "{$column_name} {$column_def}", $create_query, 1); } } elseif (preg_match("/\\b{$tokenized_query['old_column']}\\s*(.+?)(?=\))/ims", $create_query, $match)) { - if ($tokenized_query['column_def'] == trim($match[1])) { + if (stripos(trim($match[1]), $column_def) !== false) { return 'SELECT 1=1'; } else { - $create_query = preg_replace("/\\b{$tokenized_query['old_column']}\\s*.*?(?=\))/ims", "{$tokenized_query['new_column']} {$tokenized_query['column_def']}", $create_query); + $create_query = preg_replace("/\\b{$tokenized_query['old_column']}\\s*.*(?=\))/ims", "{$column_name} {$column_def}", $create_query, 1); } } $query[] = $create_query; @@ -370,11 +405,11 @@ class AlterQuery { private function handle_alter_command($queries) { $tokenized_query = $queries; $temp_table = 'temp_'.$tokenized_query['table_name']; - if (stripos($tokenized_query['default_command'], 'set') !== false) { + if (isset($tokenized_query['default_value'])) { $def_value = $this->convert_field_types($tokenized_query['column_name'], $tokenized_query['default_value']); $def_value = 'DEFAULT '.$def_value; } else { - $def_value = ''; + $def_value = null; } $_wpdb = new PDODB(); $query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'"); @@ -386,12 +421,34 @@ class AlterQuery { if (stripos($create_query, $tokenized_query['column_name']) === false) { return 'SELECT 1=1'; } - if (preg_match("/\\s*({$tokenized_query['column_name']}\\s*.*?)\\s*(DEFAULT\\s*.*)[,)]/im", $create_query, $match)) { - $col_def = trim($match[1]); - $old_default = trim($match[2]); - $create_query = preg_replace("/($col_def)\\s*$old_default/im", "\\1 $def_value", $create_query); + if (preg_match("/\\s*({$tokenized_query['column_name']})\\s*(.*)?(DEFAULT\\s*.*)[,)]/im", $create_query, $match)) { + $col_name = trim($match[1]); + $col_def = trim($match[2]); + $col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def); + $checked_col_def = $this->convert_field_types($col_name, $col_def); + $old_default = trim($match[3]); + $pattern = "/$col_name\\s*$col_def_esc\\s*$old_default/im"; + if (is_null($def_value)) { + $replacement = $col_name . ' ' . $checked_col_def; + } else { + $replacement = $col_name . ' ' . $checked_col_def . ' ' . $def_value; + } + $create_query = preg_replace($pattern, $replacement, $create_query); $create_query = str_ireplace($tokenized_query['table_name'], $temp_table, $create_query); - } else { + } elseif (preg_match("/\\s*({$tokenized_query['column_name']})\\s*(.*)?[,)]/im", $create_query, $match)) { + $col_name = trim($match[1]); + $col_def = trim($match[2]); + $col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def); + $checked_col_def = $this->convert_field_types($col_name, $col_def); + $pattern = "/$col_name\\s*$col_def_esc/im"; + if (is_null($def_value)) { + $replacement = $col_name . ' ' . $checked_col_def; + } else { + $replacement = $col_name . ' ' . $checked_col_def . ' ' . $def_value; + } + $create_query = preg_replace($pattern, $replacement, $create_query); + $create_query = str_ireplace($tokenized_query['table_name'], $temp_table, $create_query); + } else { return 'SELECT 1=1'; } $query[] = $create_query; @@ -410,29 +467,11 @@ class AlterQuery { * @return string */ private function convert_field_types($col_name, $col_def){ - $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' - ); $array_curtime = array('current_timestamp', 'current_time', 'current_date'); $array_reptime = array("'0000-00-00 00:00:00'", "'0000-00-00 00:00:00'", "'0000-00-00'"); $def_string = str_replace('`', '', $col_def); - foreach ($array_types as $o=>$r){ - $pattern = "/\\b" . $o . "\\s*(\([^\)]*\))?\\s*/imsx"; + foreach ($this->array_types as $o=>$r){ + $pattern = "/\\b$o\\s*(\([^\)]*\)*)?\\s*/ims"; if (preg_match($pattern, $def_string)) { $def_string = preg_replace($pattern, "$r ", $def_string); break; @@ -449,5 +488,24 @@ class AlterQuery { } return $def_string; } + + private $array_types = array( + 'bit' => 'INTEGER', 'bool' => 'INTEGER', + 'boolean' => 'INTEGER', 'tinyint' => 'INTEGER', + 'smallint' => 'INTEGER', 'mediumint' => 'INTEGER', + 'bigint' => 'INTEGER', 'integer' => 'INTEGER', + 'int' => 'INTEGER', 'float' => 'REAL', + 'double' => 'REAL', 'decimal' => 'REAL', + 'dec' => 'REAL', 'numeric' => 'REAL', + 'fixed' => 'REAL', 'datetime' => 'TEXT', + 'date' => 'TEXT', 'timestamp' => 'TEXT', + 'time' => 'TEXT', 'year' => 'TEXT', + 'varchar' => 'TEXT', 'char' => 'TEXT', + 'varbinary' => 'BLOB', 'binary' => 'BLOB', + 'tinyblob' => 'BLOB', 'mediumblob' => 'BLOB', + 'longblob' => 'BLOB', 'blob' => 'BLOB', + 'tinytext' => 'TEXT', 'mediumtext' => 'TEXT', + 'longtext' => 'TEXT', 'text' => 'TEXT' + ); } ?> \ No newline at end of file diff --git a/query_create.class.php b/query_create.class.php index 6e41e2c..13bdc2a 100644 --- a/query_create.class.php +++ b/query_create.class.php @@ -1,7 +1,6 @@ _query; } + } elseif (preg_match('/^CREATE\\s*(TEMP|TEMPORARY|)\\s*TRIGGER\\s*/im', $this->_query)) { + return $this->_query; } - $this->strip_backticks(); $this->get_table_name(); $this->rewrite_comments(); $this->rewrite_field_types(); @@ -46,6 +46,7 @@ class CreateQuery{ $this->rewrite_set(); $this->rewrite_key(); $this->add_if_not_exists(); + $this->strip_backticks(); return $this->post_process(); } @@ -86,8 +87,12 @@ class CreateQuery{ 'longblob' => 'blob', 'longtext' => 'text' ); foreach ($array_types as $o=>$r){ - $pattern = '/\\b(?_query = preg_replace($pattern, " $r ", $this->_query); + $pattern = "/\\b(?_query)) { + ; + } else { + $this->_query = preg_replace($pattern, " $r ", $this->_query); + } } } diff --git a/readme-ja.txt b/readme-ja.txt index 5d7ca86..35b96a5 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: 3.5.2 -Stable tag: 1.1 +Tested up to: 3.8 +Stable tag: 1.5 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -30,47 +30,69 @@ WordPressはMySQLと話していると思っていて、背後で何が起こっ SQLite Integrationは[PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress)プラグインの後継です。後者は残念なことに、もうメンテナンスされていないようです。SQLite IntegrationはPDO for WordPressの基本的なアイディアと構造を借りて、より多くの機能とユーティリティを追加しました。 -= Features = += 特徴 = -SQLite Integrationは普通の「プラグイン」ではありません。WordPressをインストールするときに使います。そのため、少し準備が必要です。インストールのセクションを参照してください。[SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/)をご覧になると、もっと詳しい説明を読むことができます。 +SQLite Integrationは普通の「プラグイン」ではありません。WordPressをインストールするときに使わなければなりません。そのため、少し準備が必要です。インストールのセクションを参照してください。[SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/)をご覧になると、もっと詳しい説明を読むことができます。 インストールに成功したら、MySQLを使う他のWordPressと同じように使うことができます。オプションとして、管理パネルでこのプラグインを有効化することができます。有効化すると有益な情報と説明を見ることができます。これは必須ではありませんが、お勧めします。 -= Backward Compatibility = +ローカルマシンにこのプラグインを使ってWordPressをインストールし、本番の環境ではMySQLを使いたいという場合を考えて、wp-config.phpでどちらのデータベースを使うかを制御できるようにしました。 + += 後方互換性 = 現在[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 = += 翻訳 = ドキュメントは英語で書かれています。日本語のカタログファイルと、.potファイルがアーカイブに含まれています。もしあなたの言語に翻訳をしたら、知らせてください。 -== Installation == +== インストール == このプラグインは他のプラグインとはちがいます。管理パネルのプラグイン・ページでインストールすることはできません。 まず、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)に書いてあるように、少し編集する必要があります。データベースの設定*以外*の部分を設定してください。 +必要要件をチェックし、WordPressのアーカイブを展開したら、wp-config-sample.phpをwp-config.phpにリネームして、[Codex page](http://codex.wordpress.org/Editing_wp-config.php)に書いてあるように、少し編集する必要があります。 -終わったら、オプションの設定を書き加えることができます。次の説明に従ってください。 += 基本設定 = + +SQLiteだけを使いたい場合は、wp-conifg.phpの下の部分だけを編集してください。 + +* 認証用ユニークキー +* WordPressデータベーステーブルの接頭辞 +* ローカル言語(日本語版では、jaがすでに設定されています) + +これでお終いです。他の部分は変更する必要はありません。 + +SQLiteとMySQLを交互に使いたい場合は、「MySQLの設定」セクションを編集する必要があります。また、wp-config.phpに下の1行を追加してください。 + +`define('USE_MYSQL', false); +// 編集が必要なのはここまでです !` + +この定義は、WordPressがSQLiteを使うようにさせるものです。MySQLを使いたい場合は、'false'を'true'に変えるか、この行自体を削除してください。 + += オプションの設定 = + +基本設定が終わったら、オプションの設定を書き加えることができます。これは必須ではありませんので、必要がなければ、編集作業は終了です。 * デフォルト(wp-content/database)とは違うディレクトリにSQLiteデータベース・ファイルを置きたい場合は、次の行を追加してください(最後のスラッシュを忘れずに)。 - `define('DB_DIR', '/home/youraccount/database_directory/');` +`define('DB_DIR', '/home/youraccount/database_directory/');` 注意: PHPスクリプトがこのディレクトリを作ったり、中にファイルを書き込んだりする権限を持っていることが必要です。 * デフォルト(.ht.sqlite)とは違うデータベース・ファイル名を使いたい場合は、次の行を追加してください。 - `define('DB_FILE', 'database_file_name');` +`define('DB_FILE', 'database_file_name');` 注意: PDO for WordPressをお使いの方は、「データベースを移行する」のセクションをご覧ください。 @@ -78,11 +100,13 @@ SQLite Integrationは普通の「プラグイン」ではありません。WordP wp-config.phpの準備が終わったら、次のステップに進みます。 -1. プラグインのアーカイブを展開します。 +1. SQLite Integrationのアーカイブをダウンロードします。 -2. アーカイブに含まれるdb.phpファイルをwp-contentディレクトリに移動(またはコピー)してください。 +2. プラグインのアーカイブを展開します。 -3. sqlite-wordpressディレクトリをwp-content/plugin/ディレクトリの下に移動してください。 +3. アーカイブに含まれるdb.phpファイルをwp-contentディレクトリにコピーしてください。 + +4. sqlite-wordpressディレクトリをwp-content/plugin/ディレクトリの下に移動してください。 `wordpress/wp-contents/db.php` @@ -118,7 +142,7 @@ wp-config.phpの準備が終わったら、次のステップに進みます。 これでおしまいです。忘れずに必要要件とWordPressのバージョンをチェックしてください。*SQLite IntegrationはWordPress 3.2.x以前のものでは動作しません。* -== Frequently Asked Questions == +== よくある質問 == = データベース・ファイルが作られません = @@ -158,18 +182,64 @@ wp-config.phpの準備が終わったら、次のステップに進みます。 * [Yet Another Related Posts](http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/) * [Better Related Posts](http://wordpress.org/extend/plugins/better-related/) -たぶん、もっとあるでしょう。 +たぶん、もっとあるでしょう。動作しないプラグインを見つけたら、お知らせいただけると助かります。 -== Changelog == - -= 1.1 (2013-07-24) = -* DROP INDEX 単独のクエリが動作していなかったのを修正しました。 -* shutdown_hook で descructor を実行していたのをやめました。 -* LOCATE() 関数を使えるようにしました。 - -= 1.0 (2013-07-07) = -最初のリリース。 == Upgrade Notice == -SQLite Integrationのアップグレードに失敗するようなら、FTPを使っての手動アップグレードを試してみてください。 +WordPress 3.8 に対応しました。バグフィクスが少し、機能拡張も少しあります。自動アップグレードで失敗するようなら、FTPを使っての手動アップグレードを試してみてください。 + +== Changelog == + += 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) = +* 最初のリリース。 diff --git a/readme.txt b/readme.txt index c8c56bb..c3774f6 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: 3.5.2 -Stable tag: 1.1 +Tested up to: 3.8 +Stable tag: 1.5 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -15,7 +15,7 @@ SQLite Integration is the plugin that enables WordPress to use SQLite. If you wa == 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. +This plugin enables WordPress to work with [SQLite](http://www.sqlite.org/). You don't have to prepare MySQL database server or 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: @@ -32,21 +32,24 @@ SQLite Integration is a successor to [PDO for WordPress](http://wordpress.org/ex = 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). +SQLite Integration is not an ordinary 'plugin'. It must be be used when you install WordPress itself, which requires you 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. +Once you succeed 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. + +If you want to test WordPress with this plugin on the local machine but want to use MySQL on the server machine, you can control which database to use with the simple directive in the wp-config.php file. See the install instruction section. = 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. +If you are using [PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for-wordpress), you can migrate your database. See install instruction section. = Support = Please contact us with the methods below: -Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/). +1. Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/). +2. Visti the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/) or [SQLite Integration(ja) Page](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/) and leave a message. -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. +Notes: WordPress.org doesn't officially support using any other database than MySQL. So there will be no supports from WordPress.org. Even if you post to the general Forum, you have few chances to get the answer. And if you use patched plugins, you will have no support from the plugin authors, eithter. = Translation = @@ -56,31 +59,54 @@ Documentation is written in English. Japanese catalog file and .pot file are inc 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. +First of all, you've got to prepare WordPress installation. See also [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. +After checking the prerequisites and downloading 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. -When you finish, you can add optional settings. Follow the steps below: += Basic settings = + +If you only use SQLite for your database, you don't have to edit the MySQL settings section. Edit the three sections below: + +* Authentication Unique keys and Salts +* WordPress Database Table prefix +* WordPress Localized Language + +That's all. You don't have to change any other sections. + +If you want to use SQLite and MySQL interchangeably, you must edit the database server settings at the top of the file as well as the sections above mentioned. And add the line below. + +`define('USE_MYSQL', false); +/* That's all, stop editing! Happy blogging. */` + +This definition makes WordPress use SQLite. If you want to change the database to MySQL, change 'false' to 'true' or just delete this line. + += Optional settings = + +When you finish basic settings, you can add optional ones. This is not required. If you don't need them, you don't have to edit wp-config.php any more. * 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/');` +`define('DB_DIR', '/home/youraccount/database_directory/');` - Note: Your PHP scripts must be able to create that directory and files in it. + Note: Your PHP scripts must have the permission 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: +* If you want to change the database file name to another one different from the default (.ht.sqlite), you can add the line below: - `define('DB_FILE', 'database_file_name');` +`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. += Preparing SQLite Integration = + After you finish preparing wp-config.php, follow the next steps: -1. Unzip the plugin archive file. +1. Download SQLite Integration archive file. -2. Move db.php file contained in the archive to wp-content directory. +2. Unzip the plugin archive file. + +3. Copy db.php file contained in the archive to wp-content directory. 3. Move the sqlite-integration directory to wp-content/plugin/ directory. @@ -135,7 +161,7 @@ Just deactivate the plugin, and you can remove them. Activation and deactivation == 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. +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: @@ -150,18 +176,63 @@ These are other examples: * [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. +Probably there are more, I'm afraid. If you find one, please let me know. == Upgrade Notice == -When auto upgrading of SQLite Integration fails, Please try manual upgrade via FTP. +WordPress 3.8 compatible. Some minor bug fixes and optional features. When auto upgrading fails, please try manual upgrade via FTP. + +== Changelog == + += 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. diff --git a/schema.php b/schema.php index 185ee0a..8c1fb01 100644 --- a/schema.php +++ b/schema.php @@ -1,7 +1,6 @@ PDO::ERRMODE_EXCEPTION)); } catch (PDOException $err) { $err_data = $err->errorInfo; - $message = __("Database connection error!
+ + +
++ +
++ +
++ +
+ + + + + ++ +
+ tables('all'); + ?> + + + +'.$fix_results.'
'; + echo ''.$message.'
'; + echo ''. $column_header . ' | '. $type_header . ' | ' . $null_header . ' | ' . $default_header . ' |
---|---|---|---|
' . $column->Field . ' | '; + echo '' . $column->Type . ' | '; + echo '' . $column->Null . ' | '; + echo '' . $column->Default . ' | '; + echo '
' . $results; + echo '
- PDO for WordPress, 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); ?> + PDO for WordPress, 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).', $domain); ?>
SQLite Web Page says — SQLite is a "software library that implements selfcontained, serverless, zero-configuration, transactional SQL database engine". It is "a good choice for small to medium size websites". It\'s small and portable, and you don\'t need any database server system.', $domain); ?> @@ -86,7 +86,7 @@ class SQLiteIntegrationDocument {
-
@@ -632,7 +740,43 @@ class SQLiteIntegrationUtils {
- + ++ +
++ +
+ get_backup_files();?> + +@@ -641,7 +785,7 @@ class SQLiteIntegrationUtils { wp_nonce_field('sqlitewordpress-log-reset-stats'); } ?> -