some bug fixes
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@908000 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
4c4d7022a9
commit
7d94787d40
2
db.php
2
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.6.1
|
||||
* @version 1.6.2
|
||||
* @package SQLite Integration
|
||||
* @author Kojima Toshiyasu
|
||||
*
|
||||
|
|
|
@ -200,6 +200,8 @@ class PDODB extends wpdb {
|
|||
$this->bail(sprintf(__("<h1>Error establlishing a database connection</h1><p>We have been unable to connect to the specified database. <br />The error message received was %s"), $this->dbh->errorInfo()));
|
||||
return;
|
||||
}
|
||||
$is_enabled_foreign_keys = @$this->get_var('PRAGMA foreign_keys');
|
||||
if ($is_enabled_foreign_keys == '0') @$this->query('PRAGMA foreign_keys = ON');
|
||||
$this->ready = true;
|
||||
}
|
||||
/**
|
||||
|
@ -333,7 +335,5 @@ class PDODB extends wpdb {
|
|||
if (!isset($wpdb)) {
|
||||
global $wpdb;
|
||||
$wpdb = new PDODB();
|
||||
$is_enabled_foreign_keys = @$wpdb->get_var('PRAGMA foreign_keys');
|
||||
if ($is_enabled_foreign_keys == '0') @$wpdb->query('PRAGMA foreign_keys = ON');
|
||||
}
|
||||
?>
|
|
@ -781,9 +781,9 @@ class PDOEngine extends PDO {
|
|||
if (stripos($this->query_type, 'show') !== false) {
|
||||
if (stripos($this->query_type, 'show table status') !== false) {
|
||||
$this->query_type = 'showstatus';
|
||||
} elseif (stripos($this->query_type, 'show tables') !== false) {
|
||||
} elseif (stripos($this->query_type, 'show tables') !== false || stripos($this->query_type, 'show full tables') !== false) {
|
||||
$this->query_type = 'show';
|
||||
} elseif (stripos($this->query_type, 'show columns') !== false || stripos($this->query_type, 'show fields') !== false) {
|
||||
} elseif (stripos($this->query_type, 'show columns') !== false || stripos($this->query_type, 'show fields') !== false || stripos($this->query_type, 'show full columns') !== false) {
|
||||
$this->query_type = 'showcolumns';
|
||||
} elseif (stripos($this->query_type, 'show index') !== false || stripos($this->query_type, 'show indexes') !== false || stripos($this->query_type, 'show keys') !== false) {
|
||||
$this->query_type = 'showindex';
|
||||
|
|
|
@ -146,7 +146,7 @@ class PDOSQLiteDriver {
|
|||
* @access private
|
||||
*/
|
||||
private function parse_query() {
|
||||
$tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$tokens = preg_split("/(\\\'|''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$literal = false;
|
||||
$query_string = '';
|
||||
foreach ($tokens as $token) {
|
||||
|
@ -161,10 +161,10 @@ class PDOSQLiteDriver {
|
|||
if (strpos($token, '`') !== false) {
|
||||
$token = str_replace('`', '', $token);
|
||||
}
|
||||
if (stripos($token, 'TRUE') !== false) {
|
||||
if (preg_match('/\\bTRUE\\b/i', $token)) {
|
||||
$token = str_ireplace('TRUE', '1', $token);
|
||||
}
|
||||
if (stripos($token, 'FALSE') !== false) {
|
||||
if (preg_match('/\\bFALSE\\b/i', $token)) {
|
||||
$token = str_ireplace('FALSE', '0', $token);
|
||||
}
|
||||
if (stripos($token, 'SQL_CALC_FOUND_ROWS') !== false) {
|
||||
|
@ -197,6 +197,7 @@ class PDOSQLiteDriver {
|
|||
* @access private
|
||||
*/
|
||||
private function handle_show_query(){
|
||||
$this->_query = str_ireplace(' FULL', '', $this->_query);
|
||||
$table_name = '';
|
||||
$pattern = '/^\\s*SHOW\\s*TABLES\\s*.*?(LIKE\\s*(.*))$/im';
|
||||
if (preg_match($pattern, $this->_query, $matches)) {
|
||||
|
@ -538,6 +539,7 @@ class PDOSQLiteDriver {
|
|||
* @access private
|
||||
*/
|
||||
private function handle_show_columns_query() {
|
||||
$this->_query = str_ireplace(' FULL', '', $this->_query);
|
||||
$pattern_like = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?\\s*LIKE\\s*(.*)?/i';
|
||||
$pattern = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?/i';
|
||||
if (preg_match($pattern_like, $this->_query, $matches)) {
|
||||
|
|
|
@ -70,6 +70,7 @@ class CreateQuery{
|
|||
// we don't use it for now.
|
||||
return $this->_query;
|
||||
}
|
||||
$this->strip_backticks();
|
||||
$this->get_table_name();
|
||||
$this->rewrite_comments();
|
||||
$this->rewrite_field_types();
|
||||
|
@ -84,7 +85,6 @@ class CreateQuery{
|
|||
$this->rewrite_set();
|
||||
$this->rewrite_key();
|
||||
$this->add_if_not_exists();
|
||||
$this->strip_backticks();
|
||||
|
||||
return $this->post_process();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ Author: Kojima Toshiyasu
|
|||
Author URI: http://dogwood.skr.jp/
|
||||
Requires at least: 3.3
|
||||
Tested up to: 3.9
|
||||
Stable tag: 1.6
|
||||
Stable tag: 1.6.2
|
||||
License: GPLv2
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
|
@ -161,6 +161,10 @@ query_posts() や WP_Query() を使うときに、オプションの一部が機
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 1.6.2 (2014-05-05) =
|
||||
* 正規表現に関するバグを修正しました。
|
||||
* 管理画面のドキュメント(表示されていなかった)を修正しました。
|
||||
|
||||
= 1.6.1 (2014-04-22) =
|
||||
* WP Slimstat を使うために、いくつかのバグを修正しました。
|
||||
* 古い db.php を使い続けている場合は、ダッシュボードに注意を表示するようにしました(必要な場合のみ)。
|
||||
|
|
|
@ -7,7 +7,7 @@ Author: Kojima Toshiyasu
|
|||
Author URI: http://dogwood.skr.jp/
|
||||
Requires at least: 3.3
|
||||
Tested up to: 3.9
|
||||
Stable tag: 1.6.1
|
||||
Stable tag: 1.6.2
|
||||
License: GPLv2
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
|
@ -159,6 +159,10 @@ When query_posts() or WP_Query() is used, some options didn't work properly. Whe
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 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).
|
||||
|
|
|
@ -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.6.1
|
||||
Version: 1.6.2
|
||||
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.6.1');
|
||||
define('SQLITE_INTEGRATION_VERSION', '1.6.2');
|
||||
define('SQLiteDir', dirname(plugin_basename(__FILE__)));
|
||||
define('SQLiteFilePath', dirname(__FILE__));
|
||||
define('SQLiteDirName', basename(SQLiteFilePath));
|
||||
|
|
|
@ -101,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"
|
||||
},
|
||||
|
||||
{
|
||||
|
|
|
@ -31,12 +31,15 @@ class SQLiteIntegrationUtils {
|
|||
* Check if db.php file is replaced with the apropriate version,
|
||||
* and if not, display notice.
|
||||
*
|
||||
* This is not required for now. So this method only returns and
|
||||
* do nothing.
|
||||
*
|
||||
*/
|
||||
public static function show_admin_notice() {
|
||||
return;
|
||||
$notice_string = __('Upgrading Notice: To finish upgrading, please activate SQLite Integration and go Setting >> SQLite Integration >> Miscellaneous, and click the button "update" at the bottom of the page. Or else replace wp-content/db.php with the one in sqlite-integration directory manually.', 'sqlite-integration');
|
||||
$current_version = defined('SQLITE_INTEGRATION_VERSION') ? SQLITE_INTEGRATION_VERSION : '';
|
||||
if (version_compare($current_version, '1.6.1', '=')) return;
|
||||
if (version_compare($current_version, '1.6.2', '=')) return;
|
||||
$version = '';
|
||||
if (defined('WP_CONTENT_DIR')) {
|
||||
$path = WP_CONTENT_DIR . '/db.php';
|
||||
|
@ -932,8 +935,13 @@ class SQLiteIntegrationUtils {
|
|||
$message = __('Couldn"t update db.php file. Please replace it manually.', $domain);
|
||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||
} else {
|
||||
echo
|
||||
'<script type="text/javascript">(function() {jQuery(".sqlite-notice").addClass("hidden");})(jQuery);</script>';
|
||||
echo <<<JS
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
(function() {jQuery(".sqlite-notice").addClass("hidden");})(jQuery);
|
||||
//]]>
|
||||
</script>
|
||||
JS;
|
||||
$message = __('Your db.php is updated.', $domain);
|
||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||
}
|
||||
|
@ -1038,8 +1046,8 @@ class SQLiteIntegrationUtils {
|
|||
<?php printf('<input type="submit" name="sqlitewordpress_db_save" value="%s" onclick="return confirm(\'%s\')" class="button-primary">', __('Save', $domain), __('Are you sure to save this file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain)); ?>
|
||||
<?php echo '</p></form>'; ?>
|
||||
<?php endif;?>
|
||||
<h3><?php __('Update db.php', $domain);?></h3>
|
||||
<p><?php __('Replace the old db.php with the new one.', $domain);?></p>
|
||||
<h3><?php _e('Update db.php', $domain);?></h3>
|
||||
<p><?php _e('Replace the old db.php with the new one.', $domain);?></p>
|
||||
<form action="" method="post">
|
||||
<?php if (function_exists('wp_nonce_field')) {
|
||||
wp_nonce_field('sqliteintegration-db-update-stats');
|
||||
|
|
Loading…
Reference in New Issue