Fixed some bugs and added more features.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@852178 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
22a658ac3a
commit
71a1df03db
8
db.php
8
db.php
|
@ -18,9 +18,17 @@ if (!defined('ABSPATH')) { // Oh, you are not WordPress!
|
||||||
* USE_MYSQL is a directive for using MySQL for database.
|
* 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,
|
* 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.
|
* the line below in the wp-config.php will enable you to use MySQL.
|
||||||
|
*
|
||||||
* <code>
|
* <code>
|
||||||
* define('USE_MYSQL', true);
|
* define('USE_MYSQL', true);
|
||||||
* </code>
|
* </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 === true) return;
|
if (defined('USE_MYSQL') && USE_MYSQL === true) return;
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,9 @@ class PDOSQLiteUDFS {
|
||||||
'inet_aton' => 'inet_aton',
|
'inet_aton' => 'inet_aton',
|
||||||
'datediff' => 'datediff',
|
'datediff' => 'datediff',
|
||||||
'locate' => 'locate',
|
'locate' => 'locate',
|
||||||
|
'utc_date' => 'utc_date',
|
||||||
|
'utc_time' => 'utc_time',
|
||||||
|
'utc_timestamp' => 'utc_timestamp',
|
||||||
'version' => 'version'
|
'version' => 'version'
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -224,7 +227,8 @@ class PDOSQLiteUDFS {
|
||||||
/**
|
/**
|
||||||
* Method to emulate MySQL SUBSTRING() function.
|
* Method to emulate MySQL SUBSTRING() function.
|
||||||
*
|
*
|
||||||
* This function rewrites the function name to SQLite compatible substr().
|
* This function rewrites the function name to SQLite compatible substr(),
|
||||||
|
* which can manipulate UTF-8 characters.
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @param integer $pos representing the start point.
|
* @param integer $pos representing the start point.
|
||||||
|
@ -667,17 +671,45 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Method to return MySQL version.
|
* Method to return GMT date in the string format.
|
||||||
*
|
|
||||||
* This function only returns WordPress $required_mysql_version, because it is
|
|
||||||
* meaningless for SQLite database.
|
|
||||||
*
|
*
|
||||||
* @param none
|
* @param none
|
||||||
* @return string representing the version number
|
* @return string formatted GMT date 'dddd-mm-dd'
|
||||||
|
*/
|
||||||
|
public function utc_date() {
|
||||||
|
return gmdate('Y-m-d', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT time in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT time '00:00:00'
|
||||||
|
*/
|
||||||
|
public function utc_time() {
|
||||||
|
return gmdate('H:i:s', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT time stamp in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT timestamp 'yyyy-mm-dd 00:00:00'
|
||||||
|
*/
|
||||||
|
public function utc_timestamp() {
|
||||||
|
return gmdate('Y-m-d H:i:s', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return MySQL version.
|
||||||
|
*
|
||||||
|
* This function only returns the current newest version number of MySQL,
|
||||||
|
* because it is meaningless for SQLite database.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string representing the version number: major_version.minor_version
|
||||||
*/
|
*/
|
||||||
public function version() {
|
public function version() {
|
||||||
global $required_mysql_version;
|
// global $required_mysql_version;
|
||||||
return $required_mysql_version;
|
// return $required_mysql_version;
|
||||||
|
return '5.5';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -84,6 +84,9 @@ class PDOSQLiteUDFS {
|
||||||
'inet_aton' => 'inet_aton',
|
'inet_aton' => 'inet_aton',
|
||||||
'datediff' => 'datediff',
|
'datediff' => 'datediff',
|
||||||
'locate' => 'locate',
|
'locate' => 'locate',
|
||||||
|
'utc_date' => 'utc_date',
|
||||||
|
'utc_time' => 'utc_time',
|
||||||
|
'utc_timestamp' => 'utc_timestamp',
|
||||||
'version' => 'version'
|
'version' => 'version'
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -225,7 +228,8 @@ class PDOSQLiteUDFS {
|
||||||
/**
|
/**
|
||||||
* Method to emulate MySQL SUBSTRING() function.
|
* Method to emulate MySQL SUBSTRING() function.
|
||||||
*
|
*
|
||||||
* This function rewrites the function name to SQLite compatible substr().
|
* This function rewrites the function name to SQLite compatible substr(),
|
||||||
|
* which can manipulate UTF-8 characters.
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @param integer $pos representing the start point.
|
* @param integer $pos representing the start point.
|
||||||
|
@ -640,17 +644,45 @@ class PDOSQLiteUDFS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Method to return MySQL version.
|
* Method to return GMT date in the string format.
|
||||||
*
|
|
||||||
* This function only returns WordPress $required_mysql_version, because it is
|
|
||||||
* meaningless for SQLite database.
|
|
||||||
*
|
*
|
||||||
* @param none
|
* @param none
|
||||||
* @return string representing the version number
|
* @return string formatted GMT date 'dddd-mm-dd'
|
||||||
|
*/
|
||||||
|
public function utc_date() {
|
||||||
|
return gmdate('Y-m-d', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT time in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT time '00:00:00'
|
||||||
|
*/
|
||||||
|
public function utc_time() {
|
||||||
|
return gmdate('H:i:s', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return GMT time stamp in the string format.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string formatted GMT timestamp 'yyyy-mm-dd 00:00:00'
|
||||||
|
*/
|
||||||
|
public function utc_timestamp() {
|
||||||
|
return gmdate('Y-m-d H:i:s', time());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Method to return MySQL version.
|
||||||
|
*
|
||||||
|
* This function only returns the current newest version number of MySQL,
|
||||||
|
* because it is meaningless for SQLite database.
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
* @return string representing the version number: major_version.minor_version
|
||||||
*/
|
*/
|
||||||
public function version() {
|
public function version() {
|
||||||
global $required_mysql_version;
|
// global $required_mysql_version;
|
||||||
return $required_mysql_version;
|
// return $required_mysql_version;
|
||||||
|
return '5.5';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -3,6 +3,7 @@
|
||||||
*
|
*
|
||||||
* This script is only included on the documentation and utility page.
|
* This script is only included on the documentation and utility page.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
|
Binary file not shown.
|
@ -129,12 +129,11 @@ msgstr "パッチ"
|
||||||
|
|
||||||
#: utilities/documentation.php:32
|
#: utilities/documentation.php:32
|
||||||
msgid ""
|
msgid ""
|
||||||
"This is a brief documentation about this plugin. For more details, see also "
|
"This is a brief documentation about this plugin. For more details, see also the "
|
||||||
"the <a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration\">Plugin "
|
"<a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration/\">SQLite Integration page</a>."
|
||||||
"Page</a>."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"このプラグインについての短いドキュメントです。詳しくは、<a href=\"http://dogwood.skr.jp/wordpress/"
|
"このプラグインについての短いドキュメントです。詳しくは、<a href=\"http://dogwood.skr.jp/wordpress/"
|
||||||
"sqlite-integration\">プラグインのページ</a>をご覧ください。"
|
"sqlite-integration/\">SQLite Integration</a> のページ</a>をご覧ください。"
|
||||||
|
|
||||||
#: utilities/documentation.php:35
|
#: utilities/documentation.php:35
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -266,12 +265,12 @@ msgstr ""
|
||||||
msgid ""
|
msgid ""
|
||||||
"Some plugins do work fine if you rewrite MySQL functions. I made some patch "
|
"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="
|
"files and <a href=\"%s?page=patch\">Patch Utility</a>. See also the <a href="
|
||||||
"\"http://dogwood.skr.jp/wordpress/sqlite-integration\">SQLite Integration page</a> for "
|
"\"http://dogwood.skr.jp/wordpress/sqlite-integration/#plugin-compat\">SQLite Integration"
|
||||||
"more details."
|
" Page</a> for more details."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"MySQLの関数を書き換えると動作するプラグインがあります。いくつかはパッチファイルと、<a href=\"%s?page=patch\">"
|
"MySQLの関数を書き換えると動作するプラグインがあります。いくつかはパッチファイルと、<a href=\"%s?page=patch\">"
|
||||||
"パッチをあてる</a>ページを作りました。<a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration\">"
|
"パッチをあてる</a>ページを作りました。<a href=\"http://dogwood.skr.jp/wordpress/sqlite-integration-ja/#plugin-compat\">"
|
||||||
"プラグインのページ</a>もご覧ください。"
|
"SQLite Integration のページ</a>もご覧ください。"
|
||||||
|
|
||||||
#: utilities/documentation.php:74
|
#: utilities/documentation.php:74
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -429,13 +428,40 @@ msgstr "エラー! ファイル%sは削除されていません。"
|
||||||
msgid "Error!: patches directory is not accessible."
|
msgid "Error!: patches directory is not accessible."
|
||||||
msgstr "エラー! パッチ・ディレクトリにアクセスできません。"
|
msgstr "エラー! パッチ・ディレクトリにアクセスできません。"
|
||||||
|
|
||||||
|
msgid "Unable to create a patch directory."
|
||||||
|
msgstr "パッチ・ディレクトリを作成できませんでした。"
|
||||||
|
|
||||||
|
msgid "Unable to create a .htaccess file."
|
||||||
|
msgstr ".htaccess ファイルを作成できませんでした。"
|
||||||
|
|
||||||
|
msgid "Invalid operation."
|
||||||
|
msgstr "不正な操作です。"
|
||||||
|
|
||||||
|
msgid "File is too large to upload."
|
||||||
|
msgstr "ファイルサイズが制限を越えています。"
|
||||||
|
|
||||||
|
msgid "File upload is not complete."
|
||||||
|
msgstr "ファイルアップロードは完了しませんでした。"
|
||||||
|
|
||||||
|
msgid "File is not uploaded."
|
||||||
|
msgstr "ファイルはアップロードされませんでした。"
|
||||||
|
|
||||||
|
msgid "Temporary directory is not writable."
|
||||||
|
msgstr "テンポラリ・ディレクトリに書込みできません。"
|
||||||
|
|
||||||
|
msgid "File cannot be written on the disk."
|
||||||
|
msgstr "ファイルをディスクに書き込めません。"
|
||||||
|
|
||||||
|
msgid "Unknown error."
|
||||||
|
msgstr "不明なエラーです。"
|
||||||
|
|
||||||
#: utilities/patch.php:142
|
#: utilities/patch.php:142
|
||||||
msgid "File is uploaded"
|
msgid "File is successfully uploaded."
|
||||||
msgstr "ファイルをアップロードしました"
|
msgstr "ファイルをアップロードしました"
|
||||||
|
|
||||||
#: utilities/patch.php:146
|
#: utilities/patch.php:146
|
||||||
msgid "File is not uploaded"
|
msgid "File upload failed. Possible file upload attack."
|
||||||
msgstr "ファイルはアップロードされていません"
|
msgstr "アップロードに失敗しました。不正なファイルです。"
|
||||||
|
|
||||||
#: utilities/patch.php:150
|
#: utilities/patch.php:150
|
||||||
msgid "File is not selected"
|
msgid "File is not selected"
|
||||||
|
@ -630,9 +656,11 @@ msgstr "ファイルを選択"
|
||||||
#: utilities/patch.php:286
|
#: utilities/patch.php:286
|
||||||
msgid ""
|
msgid ""
|
||||||
"Select file from your computer. If the file name is the same as existent "
|
"Select file from your computer. If the file name is the same as existent "
|
||||||
"file, this operation will override it."
|
"file, this operation will override it. You can't upload the file whose "
|
||||||
|
"size is over 500kB."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"あなたのコンピュータにあるファイルを選択します。ファイル名がすでに存在する場合は、それを上書きします。"
|
"あなたのコンピュータにあるファイルを選択します。ファイル名がすでに存在する場合は、それを上書きします。"
|
||||||
|
"500kB を越えるサイズのファイルはアップロードできません。"
|
||||||
|
|
||||||
#: utilities/patch.php:288
|
#: utilities/patch.php:288
|
||||||
msgid "Upload"
|
msgid "Upload"
|
||||||
|
@ -705,6 +733,16 @@ msgstr "たぶん可"
|
||||||
msgid "Checked"
|
msgid "Checked"
|
||||||
msgstr "チェック済"
|
msgstr "チェック済"
|
||||||
|
|
||||||
|
msgid "Checked*"
|
||||||
|
msgstr "チェック済*"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"\"Checked*\" with an asterisk is from the users' information. "
|
||||||
|
"I didn't check myself yet. If you found any malfunctioning, please let me know."
|
||||||
|
msgstr ""
|
||||||
|
"「チェック済*」のようにアステリスクのついたものは、ユーザからの情報にもとづいたものです。"
|
||||||
|
"私自身はチェックしていません。もし、不具合があるようでしたら、お知らせください。"
|
||||||
|
|
||||||
#: utilities/utility.php:257 utilities/utility.php:263
|
#: utilities/utility.php:257 utilities/utility.php:263
|
||||||
msgid "Not Checked"
|
msgid "Not Checked"
|
||||||
msgstr "未確認"
|
msgstr "未確認"
|
||||||
|
@ -968,12 +1006,18 @@ msgstr "データベースの最適化、エラーログ、初期化ファイル
|
||||||
|
|
||||||
#: utilities/utility.php:695
|
#: utilities/utility.php:695
|
||||||
msgid "Please select backup file(s)."
|
msgid "Please select backup file(s)."
|
||||||
msgstr "データベースを最適化する"
|
msgstr "バックアップファイルを選択してください。"
|
||||||
|
|
||||||
#: utilities/utility.php:704
|
#: utilities/utility.php:704
|
||||||
msgid "Error! Please remove file(s) manyally."
|
msgid "Error! Please remove file(s) manyally."
|
||||||
msgstr "エラー! 手動でファイルを削除してください。"
|
msgstr "エラー! 手動でファイルを削除してください。"
|
||||||
|
|
||||||
|
msgid "Please select backup file."
|
||||||
|
msgstr "バックアップファイルを選択してください。"
|
||||||
|
|
||||||
|
msgid "Please select one file at a time."
|
||||||
|
msgstr "複数ファイルは選択できません。"
|
||||||
|
|
||||||
#: utilities/utility.php:718
|
#: utilities/utility.php:718
|
||||||
msgid "Database Optimization, Error Log, Init File"
|
msgid "Database Optimization, Error Log, Init File"
|
||||||
msgstr "データベース最適化、エラー・ログ、初期化ファイル"
|
msgstr "データベース最適化、エラー・ログ、初期化ファイル"
|
||||||
|
@ -1025,9 +1069,16 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"バックアップファイルを削除したい場合は、ファイルをチェックして削除ボタンをクリックしてください。複数ファイルを選択できます。"
|
"バックアップファイルを削除したい場合は、ファイルをチェックして削除ボタンをクリックしてください。複数ファイルを選択できます。"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"If you want to download a file, check the file name and click the Download button."
|
||||||
|
" Please check one file at a time."
|
||||||
|
msgstr ""
|
||||||
|
"バックアップファイルをダウンロードしたい場合は、ファイルをチェックしてダウンロードボタンをクリックしてください。"
|
||||||
|
"1ファイルのみ選択できます。"
|
||||||
|
|
||||||
#: utilities/utility.php:748
|
#: utilities/utility.php:748
|
||||||
msgid "Delete"
|
msgid "Delete/Download"
|
||||||
msgstr "削除"
|
msgstr "削除/ダウンロード"
|
||||||
|
|
||||||
#: utilities/utility.php:749
|
#: utilities/utility.php:749
|
||||||
msgid "Backup Files"
|
msgid "Backup Files"
|
||||||
|
@ -1051,6 +1102,11 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"バックアップファイルを削除します。\\n\\n中止する場合は[Cancel]を、続ける場合は[OK]をクリックしてください。"
|
"バックアップファイルを削除します。\\n\\n中止する場合は[Cancel]を、続ける場合は[OK]をクリックしてください。"
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
"Are you sure to download backup file?\\n\\nClick [Cancel] to stop, [OK] to continue."
|
||||||
|
msgstr ""
|
||||||
|
"バックアップファイルをダウンロードします。\\n\\n中止する場合は[Cancel]を、続ける場合は[OK]をクリックしてください。"
|
||||||
|
|
||||||
#: utilities/utility.php:768
|
#: utilities/utility.php:768
|
||||||
msgid "SQLite Integration Error Log"
|
msgid "SQLite Integration Error Log"
|
||||||
msgstr "SQLite Integrationのエラーログ"
|
msgstr "SQLite Integrationのエラーログ"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -149,7 +149,22 @@ class PDODB extends wpdb {
|
||||||
</div>";
|
</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to flush cached data.
|
||||||
|
*
|
||||||
|
* This overrides wpdb::flush(). This is not necessarily overridden, because
|
||||||
|
* $result will never be resource.
|
||||||
|
*
|
||||||
|
* @see wpdb::flush
|
||||||
|
*/
|
||||||
|
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.
|
* Method to do the database connection.
|
||||||
*
|
*
|
||||||
|
@ -234,8 +249,9 @@ class PDODB extends wpdb {
|
||||||
* This overrides wpdb::load_col_info(), which uses a mysql function.
|
* This overrides wpdb::load_col_info(), which uses a mysql function.
|
||||||
*
|
*
|
||||||
* @see wpdb::load_col_info()
|
* @see wpdb::load_col_info()
|
||||||
|
* @access protected
|
||||||
*/
|
*/
|
||||||
function load_col_info() {
|
protected function load_col_info() {
|
||||||
if ($this->col_info)
|
if ($this->col_info)
|
||||||
return;
|
return;
|
||||||
$this->col_info = $this->dbh->get_columns();
|
$this->col_info = $this->dbh->get_columns();
|
||||||
|
@ -266,13 +282,14 @@ class PDODB extends wpdb {
|
||||||
*
|
*
|
||||||
* This overrides wpdb::db_version() to avoid using MySQL function.
|
* This overrides wpdb::db_version() to avoid using MySQL function.
|
||||||
* It returns mysql version number, but it means nothing for SQLite.
|
* It returns mysql version number, but it means nothing for SQLite.
|
||||||
* So it return the required mysql version.
|
* So it return the newest mysql version.
|
||||||
*
|
*
|
||||||
* @see wpdb::db_version()
|
* @see wpdb::db_version()
|
||||||
*/
|
*/
|
||||||
function db_version() {
|
function db_version() {
|
||||||
global $required_mysql_version;
|
// global $required_mysql_version;
|
||||||
return $required_mysql_version;
|
// return $required_mysql_version;
|
||||||
|
return '5.5';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,18 +110,44 @@ class PDOEngine extends PDO {
|
||||||
*/
|
*/
|
||||||
private $affected_rows;
|
private $affected_rows;
|
||||||
/**
|
/**
|
||||||
* Class variable to store the queried column names.
|
* Class variable to store the queried column info.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $column_names;
|
private $column_data;
|
||||||
|
/**
|
||||||
|
* Variable to emulate MySQL affected row.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
private $num_rows;
|
private $num_rows;
|
||||||
|
/**
|
||||||
|
* Return value from query().
|
||||||
|
*
|
||||||
|
* Each query has its own return value.
|
||||||
|
*
|
||||||
|
* @var mixed
|
||||||
|
*/
|
||||||
private $return_value;
|
private $return_value;
|
||||||
|
/**
|
||||||
|
* Variable to determine which insert query to use.
|
||||||
|
*
|
||||||
|
* Whether VALUES clause in the INSERT query can take multiple values or not
|
||||||
|
* depends on the version of SQLite library. We check the version and set
|
||||||
|
* this varable to true or false.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
private $can_insert_multiple_rows = false;
|
private $can_insert_multiple_rows = false;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
private $param_num;
|
private $param_num;
|
||||||
/**
|
/**
|
||||||
* Varible to check if there is an active transaction.
|
* Varible to check if there is an active transaction.
|
||||||
* @var boolean
|
* @var boolean
|
||||||
|
* @access protected
|
||||||
*/
|
*/
|
||||||
protected $has_active_transaction = false;
|
protected $has_active_transaction = false;
|
||||||
|
|
||||||
|
@ -144,7 +170,7 @@ class PDOEngine extends PDO {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to initialize database.
|
* Function to initialize database, executed in the contructor.
|
||||||
*
|
*
|
||||||
* It checks if there's a database directory and database file, creates the tables,
|
* It checks if there's a database directory and database file, creates the tables,
|
||||||
* and binds the user defined function to the pdo object.
|
* and binds the user defined function to the pdo object.
|
||||||
|
@ -152,7 +178,7 @@ class PDOEngine extends PDO {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function init() {
|
private function init() {
|
||||||
$dsn = 'sqlite:' . FQDB;
|
$dsn = 'sqlite:' . FQDB;
|
||||||
$result = $this->prepare_directory();
|
$result = $this->prepare_directory();
|
||||||
if (!$result) return false;
|
if (!$result) return false;
|
||||||
if (is_file(FQDB)) {
|
if (is_file(FQDB)) {
|
||||||
|
@ -167,9 +193,9 @@ class PDOEngine extends PDO {
|
||||||
array( // PDO options
|
array( // PDO options
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
||||||
));
|
));
|
||||||
$statement = $this->pdo->query("SELECT COUNT(*) FROM sqlite_master WHERE type='table'");
|
$statement = $this->pdo->query("SELECT COUNT(*) FROM sqlite_master WHERE type='table'");
|
||||||
$number_of_tables = $statement->fetchColumn(0);
|
$number_of_tables = $statement->fetchColumn(0);
|
||||||
$statement = null;
|
$statement = null;
|
||||||
if ($number_of_tables == 0) {
|
if ($number_of_tables == 0) {
|
||||||
$this->make_sqlite_tables();
|
$this->make_sqlite_tables();
|
||||||
}
|
}
|
||||||
|
@ -180,7 +206,7 @@ class PDOEngine extends PDO {
|
||||||
if ($status == 5 || $status == 6) {
|
if ($status == 5 || $status == 6) {
|
||||||
$locked = true;
|
$locked = true;
|
||||||
} else {
|
} else {
|
||||||
$message = 'Database connection error!<br />';
|
$message = 'Database connection error!<br />';
|
||||||
$message .= sprintf("Error message is: %s", $err->getMessage());
|
$message .= sprintf("Error message is: %s", $err->getMessage());
|
||||||
$this->set_error(__LINE__, __FUNCTION__, $message);
|
$this->set_error(__LINE__, __FUNCTION__, $message);
|
||||||
return false;
|
return false;
|
||||||
|
@ -196,7 +222,7 @@ class PDOEngine extends PDO {
|
||||||
try {
|
try {
|
||||||
$this->pdo = new PDO($dsn, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
$this->pdo = new PDO($dsn, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||||
} catch (PDOException $err) {
|
} catch (PDOException $err) {
|
||||||
$message = 'Database initialization error!<br />';
|
$message = 'Database initialization error!<br />';
|
||||||
$message .= sprintf("Error message is: %s", $err->getMessage());
|
$message .= sprintf("Error message is: %s", $err->getMessage());
|
||||||
$this->set_error(__LINE__, __FUNCTION__, $message);
|
$this->set_error(__LINE__, __FUNCTION__, $message);
|
||||||
return false;
|
return false;
|
||||||
|
@ -259,7 +285,7 @@ class PDOEngine extends PDO {
|
||||||
public function query($query) {
|
public function query($query) {
|
||||||
$this->flush();
|
$this->flush();
|
||||||
|
|
||||||
$this->queries[] = "Raw query:\t$query";
|
$this->queries[] = "Raw query:\n$query";
|
||||||
$res = $this->determine_query_type($query);
|
$res = $this->determine_query_type($query);
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
$bailoutString = sprintf(__("<h1>Unknown query type</h1><p>Sorry, we cannot determine the type of query that is requested.</p><p>The query is %s</p>", 'sqlite-integration'), $query);
|
$bailoutString = sprintf(__("<h1>Unknown query type</h1><p>Sorry, we cannot determine the type of query that is requested.</p><p>The query is %s</p>", 'sqlite-integration'), $query);
|
||||||
|
@ -268,14 +294,14 @@ class PDOEngine extends PDO {
|
||||||
switch (strtolower($this->query_type)) {
|
switch (strtolower($this->query_type)) {
|
||||||
case 'foundrows':
|
case 'foundrows':
|
||||||
$_column = array('FOUND_ROWS()' => '');
|
$_column = array('FOUND_ROWS()' => '');
|
||||||
$column = array();
|
$column = array();
|
||||||
if (!is_null($this->found_rows_result)) {
|
if (!is_null($this->found_rows_result)) {
|
||||||
$this->num_rows = count($this->found_rows_result);
|
$this->num_rows = count($this->found_rows_result);
|
||||||
foreach ($this->found_rows_result[0] as $key => $value) {
|
foreach ($this->found_rows_result[0] as $key => $value) {
|
||||||
$_column['FOUND_ROWS()'] = $value;
|
$_column['FOUND_ROWS()'] = $value;
|
||||||
}
|
}
|
||||||
$column[] = new ObjectArray($_column);
|
$column[] = new ObjectArray($_column);
|
||||||
$this->results = $column;
|
$this->results = $column;
|
||||||
$this->found_rows_result = null;
|
$this->found_rows_result = null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -300,9 +326,9 @@ class PDOEngine extends PDO {
|
||||||
case 'drop_index':
|
case 'drop_index':
|
||||||
$pattern = '/^\\s*(DROP\\s*INDEX\\s*.*?)\\s*ON\\s*(.*)/im';
|
$pattern = '/^\\s*(DROP\\s*INDEX\\s*.*?)\\s*ON\\s*(.*)/im';
|
||||||
if (preg_match($pattern, $query, $match)) {
|
if (preg_match($pattern, $query, $match)) {
|
||||||
$drop_query = 'ALTER TABLE ' . trim($match[2]) . ' ' . trim($match[1]);
|
$drop_query = 'ALTER TABLE ' . trim($match[2]) . ' ' . trim($match[1]);
|
||||||
$this->query_type = 'alter';
|
$this->query_type = 'alter';
|
||||||
$result = $this->execute_alter_query($drop_query);
|
$result = $this->execute_alter_query($drop_query);
|
||||||
$this->return_value = $result;
|
$this->return_value = $result;
|
||||||
} else {
|
} else {
|
||||||
$this->return_value = false;
|
$this->return_value = false;
|
||||||
|
@ -311,7 +337,7 @@ class PDOEngine extends PDO {
|
||||||
default:
|
default:
|
||||||
$engine = $this->prepare_engine($this->query_type);
|
$engine = $this->prepare_engine($this->query_type);
|
||||||
$this->rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
$this->rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
||||||
$this->queries[] = "Rewritten: $this->rewritten_query";
|
$this->queries[] = "Rewritten:\n$this->rewritten_query";
|
||||||
$this->extract_variables();
|
$this->extract_variables();
|
||||||
$statement = $this->prepare_query();
|
$statement = $this->prepare_query();
|
||||||
$this->execute_query($statement);
|
$this->execute_query($statement);
|
||||||
|
@ -346,10 +372,58 @@ class PDOEngine extends PDO {
|
||||||
/**
|
/**
|
||||||
* Function to return the queried column names.
|
* Function to return the queried column names.
|
||||||
*
|
*
|
||||||
* @return string
|
* These data are meaningless for SQLite. So they are dummy emulating
|
||||||
|
* MySQL columns data.
|
||||||
|
*
|
||||||
|
* @return array of the object
|
||||||
*/
|
*/
|
||||||
public function get_columns() {
|
public function get_columns() {
|
||||||
return $this->column_names;
|
if (!empty($this->results)) {
|
||||||
|
$primary_key = array(
|
||||||
|
'meta_id', 'comment_ID', 'link_ID', 'option_id',
|
||||||
|
'blog_id', 'option_name', 'ID', 'term_id', 'object_id',
|
||||||
|
'term_taxonomy_id', 'umeta_id', 'id');
|
||||||
|
$unique_key = array('term_id', 'taxonomy', 'slug');
|
||||||
|
$data = array(
|
||||||
|
'name' => '', // column name
|
||||||
|
'table' => '', // table name
|
||||||
|
'max_length' => 0, // max length of the column
|
||||||
|
'not_null' => 1, // 1 if not null
|
||||||
|
'primary_key' => 0, // 1 if column has primary key
|
||||||
|
'unique_key' => 0, // 1 if column has unique key
|
||||||
|
'multiple_key' => 0, // 1 if column doesn't have unique key
|
||||||
|
'numeric' => 0, // 1 if column has numeric value
|
||||||
|
'blob' => 0, // 1 if column is blob
|
||||||
|
'type' => '', // type of the column
|
||||||
|
'unsigned' => 0, // 1 if column is unsigned integer
|
||||||
|
'zerofill' => 0 // 1 if column is zero-filled
|
||||||
|
);
|
||||||
|
if (preg_match("/\s*FROM\s*(.*)?\s*/i", $this->rewritten_query, $match)) {
|
||||||
|
$table_name = trim($match[1]);
|
||||||
|
} else {
|
||||||
|
$table_name = '';
|
||||||
|
}
|
||||||
|
foreach ($this->results[0] as $key => $value) {
|
||||||
|
$data['name'] = $key;
|
||||||
|
$data['table'] = $table_name;
|
||||||
|
if (in_array($key, $primary_key)) {
|
||||||
|
$data['primary_key'] = 1;
|
||||||
|
} elseif (in_array($key, $unique_key)) {
|
||||||
|
$data['unique_key'] = 1;
|
||||||
|
} else {
|
||||||
|
$data['multiple_key'] = 1;
|
||||||
|
}
|
||||||
|
$this->column_data[] = new ObjectArray($data);
|
||||||
|
$data['name'] = '';
|
||||||
|
$data['table'] = '';
|
||||||
|
$data['primary_key'] = 0;
|
||||||
|
$data['unique_key'] = 0;
|
||||||
|
$data['multiple_key'] = 0;
|
||||||
|
}
|
||||||
|
return $this->column_data;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Function to return the queried result data.
|
* Function to return the queried result data.
|
||||||
|
@ -382,7 +456,7 @@ class PDOEngine extends PDO {
|
||||||
*/
|
*/
|
||||||
public function get_error_message(){
|
public function get_error_message(){
|
||||||
if (count($this->error_messages) === 0){
|
if (count($this->error_messages) === 0){
|
||||||
$this->is_error = false;
|
$this->is_error = false;
|
||||||
$this->error_messages = array();
|
$this->error_messages = array();
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -429,7 +503,7 @@ class PDOEngine extends PDO {
|
||||||
$this->_results = null;
|
$this->_results = null;
|
||||||
$this->last_insert_id = null;
|
$this->last_insert_id = null;
|
||||||
$this->affected_rows = null;
|
$this->affected_rows = null;
|
||||||
$this->column_names = array();
|
$this->column_data = array();
|
||||||
$this->num_rows = null;
|
$this->num_rows = null;
|
||||||
$this->return_value = null;
|
$this->return_value = null;
|
||||||
$this->extracted_variables = array();
|
$this->extracted_variables = array();
|
||||||
|
@ -466,15 +540,15 @@ class PDOEngine extends PDO {
|
||||||
* @return PDOStatement
|
* @return PDOStatement
|
||||||
*/
|
*/
|
||||||
private function prepare_query(){
|
private function prepare_query(){
|
||||||
$this->queries[] = 'Prepare: ' . $this->prepared_query;
|
$this->queries[] = "Prepare:\n" . $this->prepared_query;
|
||||||
$reason = 0;
|
$reason = 0;
|
||||||
$message = '';
|
$message = '';
|
||||||
$statement = null;
|
$statement = null;
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
$statement = $this->pdo->prepare($this->prepared_query);
|
$statement = $this->pdo->prepare($this->prepared_query);
|
||||||
} catch (PDOException $err) {
|
} catch (PDOException $err) {
|
||||||
$reason = $err->getCode();
|
$reason = $err->getCode();
|
||||||
$message = $err->getMessage();
|
$message = $err->getMessage();
|
||||||
}
|
}
|
||||||
} while (5 == $reason || 6 == $reason);
|
} while (5 == $reason || 6 == $reason);
|
||||||
|
@ -496,12 +570,12 @@ class PDOEngine extends PDO {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function execute_query($statement) {
|
private function execute_query($statement) {
|
||||||
$reason = 0;
|
$reason = 0;
|
||||||
$message = '';
|
$message = '';
|
||||||
if (!is_object($statement))
|
if (!is_object($statement))
|
||||||
return false;
|
return false;
|
||||||
if (count($this->extracted_variables) > 0) {
|
if (count($this->extracted_variables) > 0) {
|
||||||
$this->queries[] = 'Executing: ' . var_export($this->extracted_variables, true);
|
$this->queries[] = "Executing:\n" . var_export($this->extracted_variables, true);
|
||||||
do {
|
do {
|
||||||
if ($this->query_type == 'update' || $this->query_type == 'replace') {
|
if ($this->query_type == 'update' || $this->query_type == 'replace') {
|
||||||
try {
|
try {
|
||||||
|
@ -509,7 +583,7 @@ class PDOEngine extends PDO {
|
||||||
$statement->execute($this->extracted_variables);
|
$statement->execute($this->extracted_variables);
|
||||||
$this->commit();
|
$this->commit();
|
||||||
} catch (PDOException $err) {
|
} catch (PDOException $err) {
|
||||||
$reason = $err->getCode();
|
$reason = $err->getCode();
|
||||||
$message = $err->getMessage();
|
$message = $err->getMessage();
|
||||||
$this->rollBack();
|
$this->rollBack();
|
||||||
}
|
}
|
||||||
|
@ -517,7 +591,7 @@ class PDOEngine extends PDO {
|
||||||
try {
|
try {
|
||||||
$statement->execute($this->extracted_variables);
|
$statement->execute($this->extracted_variables);
|
||||||
} catch (PDOException $err) {
|
} catch (PDOException $err) {
|
||||||
$reason = $err->getCode();
|
$reason = $err->getCode();
|
||||||
$message = $err->getMessage();
|
$message = $err->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,7 +605,7 @@ class PDOEngine extends PDO {
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
$this->commit();
|
$this->commit();
|
||||||
} catch (PDOException $err) {
|
} catch (PDOException $err) {
|
||||||
$reason = $err->getCode();
|
$reason = $err->getCode();
|
||||||
$message = $err->getMessage();
|
$message = $err->getMessage();
|
||||||
$this->rollBack();
|
$this->rollBack();
|
||||||
}
|
}
|
||||||
|
@ -539,7 +613,7 @@ class PDOEngine extends PDO {
|
||||||
try {
|
try {
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
} catch (PDOException $err) {
|
} catch (PDOException $err) {
|
||||||
$reason = $err->getCode();
|
$reason = $err->getCode();
|
||||||
$message = $err->getMessage();
|
$message = $err->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,8 +632,8 @@ class PDOEngine extends PDO {
|
||||||
case 'update':
|
case 'update':
|
||||||
case 'replace':
|
case 'replace':
|
||||||
$this->last_insert_id = $this->pdo->lastInsertId();
|
$this->last_insert_id = $this->pdo->lastInsertId();
|
||||||
$this->affected_rows = $statement->rowCount();
|
$this->affected_rows = $statement->rowCount();
|
||||||
$this->return_value = $this->affected_rows;
|
$this->return_value = $this->affected_rows;
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
case 'show':
|
case 'show':
|
||||||
|
@ -570,12 +644,12 @@ class PDOEngine extends PDO {
|
||||||
case 'check':
|
case 'check':
|
||||||
case 'analyze':
|
case 'analyze':
|
||||||
// case "foundrows":
|
// case "foundrows":
|
||||||
$this->num_rows = count($this->_results);
|
$this->num_rows = count($this->_results);
|
||||||
$this->return_value = $this->num_rows;
|
$this->return_value = $this->num_rows;
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$this->affected_rows = $statement->rowCount();
|
$this->affected_rows = $statement->rowCount();
|
||||||
$this->return_value = $this->affected_rows;
|
$this->return_value = $this->affected_rows;
|
||||||
break;
|
break;
|
||||||
case 'alter':
|
case 'alter':
|
||||||
case 'drop':
|
case 'drop':
|
||||||
|
@ -606,7 +680,7 @@ class PDOEngine extends PDO {
|
||||||
|
|
||||||
//long queries can really kill this
|
//long queries can really kill this
|
||||||
$pattern = '/(?<!\\\\)([\'"])(.*?)(?<!\\\\)\\1/imsx';
|
$pattern = '/(?<!\\\\)([\'"])(.*?)(?<!\\\\)\\1/imsx';
|
||||||
$_limit = $limit = ini_get('pcre.backtrack_limit');
|
$_limit = $limit = ini_get('pcre.backtrack_limit');
|
||||||
do {
|
do {
|
||||||
if ($limit > 10000000) {
|
if ($limit > 10000000) {
|
||||||
$message = 'The query is too big to parse properly';
|
$message = 'The query is too big to parse properly';
|
||||||
|
@ -621,7 +695,7 @@ class PDOEngine extends PDO {
|
||||||
|
|
||||||
//reset the pcre.backtrack_limist
|
//reset the pcre.backtrack_limist
|
||||||
ini_set('pcre.backtrack_limit', $_limit);
|
ini_set('pcre.backtrack_limit', $_limit);
|
||||||
$this->queries[]= 'With Placeholders: ' . $query;
|
$this->queries[] = "With Placeholders:\n" . $query;
|
||||||
$this->prepared_query = $query;
|
$this->prepared_query = $query;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -699,11 +773,11 @@ class PDOEngine extends PDO {
|
||||||
* @param string $query
|
* @param string $query
|
||||||
*/
|
*/
|
||||||
private function execute_insert_query_new($query) {
|
private function execute_insert_query_new($query) {
|
||||||
$engine = $this->prepare_engine($this->query_type);
|
$engine = $this->prepare_engine($this->query_type);
|
||||||
$this->rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
$this->rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
||||||
$this->queries[] = 'Rewritten: ' . $this->rewritten_query;
|
$this->queries[] = "Rewritten:\n" . $this->rewritten_query;
|
||||||
$this->extract_variables();
|
$this->extract_variables();
|
||||||
$statement = $this->prepare_query();
|
$statement = $this->prepare_query();
|
||||||
$this->execute_query($statement);
|
$this->execute_query($statement);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -717,11 +791,11 @@ class PDOEngine extends PDO {
|
||||||
private function execute_insert_query($query) {
|
private function execute_insert_query($query) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$multi_insert = false;
|
$multi_insert = false;
|
||||||
$statement = null;
|
$statement = null;
|
||||||
$engine = $this->prepare_engine($this->query_type);
|
$engine = $this->prepare_engine($this->query_type);
|
||||||
if (preg_match('/(INSERT.*?VALUES\\s*)(\(.*\))/imsx', $query, $matched)) {
|
if (preg_match('/(INSERT.*?VALUES\\s*)(\(.*\))/imsx', $query, $matched)) {
|
||||||
$query_prefix = $matched[1];
|
$query_prefix = $matched[1];
|
||||||
$values_data = $matched[2];
|
$values_data = $matched[2];
|
||||||
if (stripos($values_data, 'ON DUPLICATE KEY') !== false) {
|
if (stripos($values_data, 'ON DUPLICATE KEY') !== false) {
|
||||||
$exploded_parts = $values_data;
|
$exploded_parts = $values_data;
|
||||||
} elseif (stripos($query_prefix, "INSERT INTO $wpdb->comments") !== false) {
|
} elseif (stripos($query_prefix, "INSERT INTO $wpdb->comments") !== false) {
|
||||||
|
@ -742,9 +816,9 @@ class PDOEngine extends PDO {
|
||||||
} else {
|
} else {
|
||||||
$suffix = ')';
|
$suffix = ')';
|
||||||
}
|
}
|
||||||
$query_string = $query_prefix . ' ' . $value . $suffix;
|
$query_string = $query_prefix . ' ' . $value . $suffix;
|
||||||
$this->rewritten_query = $engine->rewrite_query($query_string, $this->query_type);
|
$this->rewritten_query = $engine->rewrite_query($query_string, $this->query_type);
|
||||||
$this->queries[] = 'Rewritten: ' . $this->rewritten_query;
|
$this->queries[] = "Rewritten:\n" . $this->rewritten_query;
|
||||||
$this->extracted_variables = array();
|
$this->extracted_variables = array();
|
||||||
$this->extract_variables();
|
$this->extract_variables();
|
||||||
if ($first) {
|
if ($first) {
|
||||||
|
@ -757,7 +831,7 @@ class PDOEngine extends PDO {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
$this->rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
||||||
$this->queries[] = 'Rewritten: ' . $this->rewritten_query;
|
$this->queries[] = "Rewritten:\n" . $this->rewritten_query;
|
||||||
$this->extract_variables();
|
$this->extract_variables();
|
||||||
$statement = $this->prepare_query();
|
$statement = $this->prepare_query();
|
||||||
$this->execute_query($statement);
|
$this->execute_query($statement);
|
||||||
|
@ -813,22 +887,22 @@ class PDOEngine extends PDO {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function execute_create_query($query) {
|
private function execute_create_query($query) {
|
||||||
$engine = $this->prepare_engine($this->query_type);
|
$engine = $this->prepare_engine($this->query_type);
|
||||||
$rewritten_query = $engine->rewrite_query($query);
|
$rewritten_query = $engine->rewrite_query($query);
|
||||||
$reason = 0;
|
$reason = 0;
|
||||||
$message = '';
|
$message = '';
|
||||||
// $queries = explode(";", $this->rewritten_query);
|
// $queries = explode(";", $this->rewritten_query);
|
||||||
try {
|
try {
|
||||||
$this->beginTransaction();
|
$this->beginTransaction();
|
||||||
foreach ($rewritten_query as $single_query) {
|
foreach ($rewritten_query as $single_query) {
|
||||||
$this->queries[] = "Executing:\t" . $single_query;
|
$this->queries[] = "Executing:\n" . $single_query;
|
||||||
$single_query = trim($single_query);
|
$single_query = trim($single_query);
|
||||||
if (empty($single_query)) continue;
|
if (empty($single_query)) continue;
|
||||||
$this->pdo->exec($single_query);
|
$this->pdo->exec($single_query);
|
||||||
}
|
}
|
||||||
$this->commit();
|
$this->commit();
|
||||||
} catch (PDOException $err) {
|
} catch (PDOException $err) {
|
||||||
$reason = $err->getCode();
|
$reason = $err->getCode();
|
||||||
$message = $err->getMessage();
|
$message = $err->getMessage();
|
||||||
if (5 == $reason || 6 == $reason) {
|
if (5 == $reason || 6 == $reason) {
|
||||||
$this->commit();
|
$this->commit();
|
||||||
|
@ -850,10 +924,10 @@ class PDOEngine extends PDO {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function execute_alter_query($query) {
|
private function execute_alter_query($query) {
|
||||||
$engine = $this->prepare_engine($this->query_type);
|
$engine = $this->prepare_engine($this->query_type);
|
||||||
$reason = 0;
|
$reason = 0;
|
||||||
$message = '';
|
$message = '';
|
||||||
$re_query = '';
|
$re_query = '';
|
||||||
$rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
$rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
||||||
if (is_array($rewritten_query) && array_key_exists('recursion', $rewritten_query)) {
|
if (is_array($rewritten_query) && array_key_exists('recursion', $rewritten_query)) {
|
||||||
$re_query = $rewritten_query['recursion'];
|
$re_query = $rewritten_query['recursion'];
|
||||||
|
@ -863,19 +937,19 @@ class PDOEngine extends PDO {
|
||||||
$this->beginTransaction();
|
$this->beginTransaction();
|
||||||
if (is_array($rewritten_query)) {
|
if (is_array($rewritten_query)) {
|
||||||
foreach ($rewritten_query as $single_query) {
|
foreach ($rewritten_query as $single_query) {
|
||||||
$this->queries[] = "Executing:\t" . $single_query;
|
$this->queries[] = "Executing:\n" . $single_query;
|
||||||
$single_query = trim($single_query);
|
$single_query = trim($single_query);
|
||||||
if (empty($single_query)) continue;
|
if (empty($single_query)) continue;
|
||||||
$this->pdo->exec($single_query);
|
$this->pdo->exec($single_query);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->queries[] = "Executing:\t" . $rewritten_query;
|
$this->queries[] = "Executing:\n" . $rewritten_query;
|
||||||
$rewritten_query = trim($rewritten_query);
|
$rewritten_query = trim($rewritten_query);
|
||||||
$this->pdo->exec($rewritten_query);
|
$this->pdo->exec($rewritten_query);
|
||||||
}
|
}
|
||||||
$this->commit();
|
$this->commit();
|
||||||
} catch (PDOException $err) {
|
} catch (PDOException $err) {
|
||||||
$reason = $err->getCode();
|
$reason = $err->getCode();
|
||||||
$message = $err->getMessage();
|
$message = $err->getMessage();
|
||||||
if (5 == $reason || 6 == $reason) {
|
if (5 == $reason || 6 == $reason) {
|
||||||
$this->commit();
|
$this->commit();
|
||||||
|
@ -906,7 +980,7 @@ class PDOEngine extends PDO {
|
||||||
*/
|
*/
|
||||||
private function show_variables_workaround($query) {
|
private function show_variables_workaround($query) {
|
||||||
$dummy_data = array('Variable_name' => '', 'Value' => null);
|
$dummy_data = array('Variable_name' => '', 'Value' => null);
|
||||||
$pattern = '/SHOW\\s*VARIABLES\\s*LIKE\\s*(.*)?$/im';
|
$pattern = '/SHOW\\s*VARIABLES\\s*LIKE\\s*(.*)?$/im';
|
||||||
if (preg_match($pattern, $query, $match)) {
|
if (preg_match($pattern, $query, $match)) {
|
||||||
$value = str_replace("'", '', $match[1]);
|
$value = str_replace("'", '', $match[1]);
|
||||||
$dummy_data['Variable_name'] = trim($value);
|
$dummy_data['Variable_name'] = trim($value);
|
||||||
|
@ -917,9 +991,9 @@ class PDOEngine extends PDO {
|
||||||
$dummy_data['Value'] = '';
|
$dummy_data['Value'] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_results[] = new ObjectArray($dummy_data);
|
$_results[] = new ObjectArray($dummy_data);
|
||||||
$this->results = $_results;
|
$this->results = $_results;
|
||||||
$this->num_rows = count($this->results);
|
$this->num_rows = count($this->results);
|
||||||
$this->return_value = $this->num_rows;
|
$this->return_value = $this->num_rows;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -952,9 +1026,9 @@ class PDOEngine extends PDO {
|
||||||
*/
|
*/
|
||||||
private function set_error ($line, $function, $message){
|
private function set_error ($line, $function, $message){
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$this->errors[] = array("line"=>$line, "function"=>$function);
|
$this->errors[] = array("line"=>$line, "function"=>$function);
|
||||||
$this->error_messages[] = $message;
|
$this->error_messages[] = $message;
|
||||||
$this->is_error = true;
|
$this->is_error = true;
|
||||||
if ($wpdb->suppress_errors) return false;
|
if ($wpdb->suppress_errors) return false;
|
||||||
if (!$wpdb->show_errors) return false;
|
if (!$wpdb->show_errors) return false;
|
||||||
file_put_contents (FQDBDIR .'debug.txt', "Line $line, Function: $function, Message: $message \n", FILE_APPEND);
|
file_put_contents (FQDBDIR .'debug.txt', "Line $line, Function: $function, Message: $message \n", FILE_APPEND);
|
||||||
|
@ -1005,7 +1079,7 @@ class PDOEngine extends PDO {
|
||||||
$_columns['Null'] = $row->notnull ? "NO" : "YES";
|
$_columns['Null'] = $row->notnull ? "NO" : "YES";
|
||||||
$_columns['Key'] = $row->pk ? "PRI" : "";
|
$_columns['Key'] = $row->pk ? "PRI" : "";
|
||||||
$_columns['Default'] = $row->dflt_value;
|
$_columns['Default'] = $row->dflt_value;
|
||||||
$_results[] = new ObjectArray($_columns);
|
$_results[] = new ObjectArray($_columns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->results = $_results;
|
$this->results = $_results;
|
||||||
|
@ -1081,7 +1155,7 @@ class PDOEngine extends PDO {
|
||||||
$_columns['Null'] = 'NO';
|
$_columns['Null'] = 'NO';
|
||||||
$_columns['Index_type'] = 'BTREE';
|
$_columns['Index_type'] = 'BTREE';
|
||||||
$_columns['Comment'] = '';
|
$_columns['Comment'] = '';
|
||||||
$_results[] = new ObjectArray($_columns);
|
$_results[] = new ObjectArray($_columns);
|
||||||
}
|
}
|
||||||
if (stripos($this->queries[0], 'WHERE') !== false) {
|
if (stripos($this->queries[0], 'WHERE') !== false) {
|
||||||
preg_match('/WHERE\\s*(.*)$/im', $this->queries[0], $match);
|
preg_match('/WHERE\\s*(.*)$/im', $this->queries[0], $match);
|
||||||
|
@ -1122,7 +1196,7 @@ class PDOEngine extends PDO {
|
||||||
'Msg_text' => 'Table is already up to date'
|
'Msg_text' => 'Table is already up to date'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$_results[] = new ObjectArray($_columns);
|
$_results[] = new ObjectArray($_columns);
|
||||||
$this->results = $_results;
|
$this->results = $_results;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
187
query.class.php
187
query.class.php
|
@ -37,68 +37,68 @@ class PDOSQLiteDriver {
|
||||||
$this->_query = $query;
|
$this->_query = $query;
|
||||||
switch ($this->query_type) {
|
switch ($this->query_type) {
|
||||||
case 'truncate':
|
case 'truncate':
|
||||||
$this->_handle_truncate_query();
|
$this->handle_truncate_query();
|
||||||
break;
|
break;
|
||||||
case 'alter':
|
case 'alter':
|
||||||
$this->_handle_alter_query();
|
$this->handle_alter_query();
|
||||||
break;
|
break;
|
||||||
case 'create':
|
case 'create':
|
||||||
$this->_handle_create_query();
|
$this->handle_create_query();
|
||||||
break;
|
break;
|
||||||
case 'describe':
|
case 'describe':
|
||||||
case 'desc':
|
case 'desc':
|
||||||
$this->_handle_describe_query();
|
$this->handle_describe_query();
|
||||||
break;
|
break;
|
||||||
case 'show':
|
case 'show':
|
||||||
$this->_handle_show_query();
|
$this->handle_show_query();
|
||||||
break;
|
break;
|
||||||
case 'showcolumns':
|
case 'showcolumns':
|
||||||
$this->_handle_show_columns_query();
|
$this->handle_show_columns_query();
|
||||||
break;
|
break;
|
||||||
case 'showindex':
|
case 'showindex':
|
||||||
$this->_handle_show_index();
|
$this->handle_show_index();
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
$this->_strip_backticks();
|
$this->strip_backticks();
|
||||||
$this->_handle_sql_count();
|
$this->handle_sql_count();
|
||||||
$this->_rewrite_date_sub();
|
$this->rewrite_date_sub();
|
||||||
$this->_delete_index_hints();
|
$this->delete_index_hints();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
$this->_rewrite_boolean();
|
$this->rewrite_boolean();
|
||||||
$this->_fix_date_quoting();
|
$this->fix_date_quoting();
|
||||||
$this->_rewrite_between();
|
$this->rewrite_between();
|
||||||
break;
|
break;
|
||||||
case 'insert':
|
case 'insert':
|
||||||
$this->_safe_strip_backticks();
|
$this->safe_strip_backticks();
|
||||||
$this->_execute_duplicate_key_update();
|
$this->execute_duplicate_key_update();
|
||||||
$this->_rewrite_insert_ignore();
|
$this->rewrite_insert_ignore();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
$this->_fix_date_quoting();
|
$this->fix_date_quoting();
|
||||||
break;
|
break;
|
||||||
case 'update':
|
case 'update':
|
||||||
$this->_safe_strip_backticks();
|
$this->safe_strip_backticks();
|
||||||
$this->_rewrite_update_ignore();
|
$this->rewrite_update_ignore();
|
||||||
// $this->_rewrite_date_sub();
|
// $this->_rewrite_date_sub();
|
||||||
$this->_rewrite_limit_usage();
|
$this->rewrite_limit_usage();
|
||||||
$this->_rewrite_order_by_usage();
|
$this->rewrite_order_by_usage();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
$this->_rewrite_between();
|
$this->rewrite_between();
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$this->_strip_backticks();
|
$this->strip_backticks();
|
||||||
$this->_rewrite_limit_usage();
|
$this->rewrite_limit_usage();
|
||||||
$this->_rewrite_order_by_usage();
|
$this->rewrite_order_by_usage();
|
||||||
$this->_rewrite_date_sub();
|
$this->rewrite_date_sub();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
$this->_delete_workaround();
|
$this->delete_workaround();
|
||||||
break;
|
break;
|
||||||
case 'replace':
|
case 'replace':
|
||||||
$this->_safe_strip_backticks();
|
$this->safe_strip_backticks();
|
||||||
$this->_rewrite_date_sub();
|
$this->rewrite_date_sub();
|
||||||
$this->_rewrite_regexp();
|
$this->rewrite_regexp();
|
||||||
break;
|
break;
|
||||||
case 'optimize':
|
case 'optimize':
|
||||||
$this->_rewrite_optimize();
|
$this->rewrite_optimize();
|
||||||
break;
|
break;
|
||||||
case 'pragma':
|
case 'pragma':
|
||||||
break;
|
break;
|
||||||
|
@ -106,7 +106,7 @@ class PDOSQLiteDriver {
|
||||||
if (defined(WP_DEBUG) && WP_DEBUG) {
|
if (defined(WP_DEBUG) && WP_DEBUG) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
$this->_return_true();
|
$this->return_true();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,9 +118,9 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_show_query(){
|
private function handle_show_query(){
|
||||||
$table_name = '';
|
$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)) {
|
if (preg_match($pattern, $this->_query, $matches)) {
|
||||||
$table_name = str_replace(array("'", ';'), '', $matches[2]);
|
$table_name = str_replace(array("'", ';'), '', $matches[2]);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _strip_backticks(){
|
private function strip_backticks(){
|
||||||
$this->_query = str_replace('`', '', $this->_query);
|
$this->_query = str_replace('`', '', $this->_query);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -150,10 +150,10 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _safe_strip_backticks() {
|
private function safe_strip_backticks() {
|
||||||
$query_string = '';
|
$query_string = '';
|
||||||
$tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE);
|
$tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
$literal = false;
|
$literal = false;
|
||||||
$query_string = '';
|
$query_string = '';
|
||||||
foreach ($tokens as $token) {
|
foreach ($tokens as $token) {
|
||||||
if ($token == "'") {
|
if ($token == "'") {
|
||||||
|
@ -188,16 +188,15 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_sql_count(){
|
private function handle_sql_count(){
|
||||||
if (stripos($this->_query, 'SELECT SQL_CALC_FOUND_ROWS') !== false){
|
if (stripos($this->_query, 'SELECT SQL_CALC_FOUND_ROWS') !== false){
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
// first strip the code. this is the end of rewriting process
|
// first strip the code. this is the end of rewriting process
|
||||||
$this->_query = str_ireplace('SQL_CALC_FOUND_ROWS', '', $this->_query);
|
$this->_query = str_ireplace('SQL_CALC_FOUND_ROWS', '', $this->_query);
|
||||||
// we make the data for next SELECE FOUND_ROWS() statement
|
// we make the data for next SELECE FOUND_ROWS() statement
|
||||||
$unlimited_query = preg_replace('/\\bLIMIT\\s*.*/imsx', '', $this->_query);
|
$unlimited_query = preg_replace('/\\bLIMIT\\s*.*/imsx', '', $this->_query);
|
||||||
// $unlimited_query = preg_replace('/\\bFALSE\\s*.*/imsx', '0', $unlimited_query);
|
|
||||||
$unlimited_query = preg_replace('/\\bGROUP\\s*BY\\s*.*/imsx', '', $unlimited_query);
|
$unlimited_query = preg_replace('/\\bGROUP\\s*BY\\s*.*/imsx', '', $unlimited_query);
|
||||||
$unlimited_query = $this->__transform_to_count($unlimited_query);
|
$unlimited_query = $this->_transform_to_count($unlimited_query);
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$result = $_wpdb->query($unlimited_query);
|
$result = $_wpdb->query($unlimited_query);
|
||||||
$wpdb->dbh->found_rows_result = $_wpdb->last_result;
|
$wpdb->dbh->found_rows_result = $_wpdb->last_result;
|
||||||
|
@ -213,7 +212,7 @@ class PDOSQLiteDriver {
|
||||||
* @return string the transformed query
|
* @return string the transformed query
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function __transform_to_count($query){
|
private function _transform_to_count($query){
|
||||||
$pattern = '/^\\s*SELECT\\s*(DISTINCT|)?.*?FROM\b/isx';
|
$pattern = '/^\\s*SELECT\\s*(DISTINCT|)?.*?FROM\b/isx';
|
||||||
$_query = preg_replace($pattern, 'SELECT \\1 COUNT(*) FROM ', $query);
|
$_query = preg_replace($pattern, 'SELECT \\1 COUNT(*) FROM ', $query);
|
||||||
return $_query;
|
return $_query;
|
||||||
|
@ -223,7 +222,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_insert_ignore(){
|
private function rewrite_insert_ignore(){
|
||||||
$this->_query = str_ireplace('INSERT IGNORE', 'INSERT OR IGNORE ', $this->_query);
|
$this->_query = str_ireplace('INSERT IGNORE', 'INSERT OR IGNORE ', $this->_query);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -231,7 +230,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_update_ignore(){
|
private function rewrite_update_ignore(){
|
||||||
$this->_query = str_ireplace('UPDATE IGNORE', 'UPDATE OR IGNORE ', $this->_query);
|
$this->_query = str_ireplace('UPDATE IGNORE', 'UPDATE OR IGNORE ', $this->_query);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -242,11 +241,11 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_date_add(){
|
private function rewrite_date_add(){
|
||||||
//(date,interval expression unit)
|
//(date,interval expression unit)
|
||||||
$pattern = '/\\s*date_add\\s*\(([^,]*),([^\)]*)\)/imsx';
|
$pattern = '/\\s*date_add\\s*\(([^,]*),([^\)]*)\)/imsx';
|
||||||
if (preg_match($pattern, $this->_query, $matches)) {
|
if (preg_match($pattern, $this->_query, $matches)) {
|
||||||
$expression = "'".trim($matches[2])."'";
|
$expression = "'".trim($matches[2])."'";
|
||||||
$this->_query = preg_replace($pattern, " date_add($matches[1], $expression) ", $this->_query);
|
$this->_query = preg_replace($pattern, " date_add($matches[1], $expression) ", $this->_query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,11 +257,11 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_date_sub(){
|
private function rewrite_date_sub(){
|
||||||
//(date,interval expression unit)
|
//(date,interval expression unit)
|
||||||
$pattern = '/\\s*date_sub\\s*\(([^,]*),([^\)]*)\)/imsx';
|
$pattern = '/\\s*date_sub\\s*\(([^,]*),([^\)]*)\)/imsx';
|
||||||
if (preg_match($pattern, $this->_query, $matches)) {
|
if (preg_match($pattern, $this->_query, $matches)) {
|
||||||
$expression = "'".trim($matches[2])."'";
|
$expression = "'".trim($matches[2])."'";
|
||||||
$this->_query = preg_replace($pattern, " date_sub($matches[1], $expression) ", $this->_query);
|
$this->_query = preg_replace($pattern, " date_sub($matches[1], $expression) ", $this->_query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +273,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_create_query(){
|
private function handle_create_query(){
|
||||||
require_once PDODIR . 'query_create.class.php';
|
require_once PDODIR . 'query_create.class.php';
|
||||||
$engine = new CreateQuery();
|
$engine = new CreateQuery();
|
||||||
$this->_query = $engine->rewrite_query($this->_query);
|
$this->_query = $engine->rewrite_query($this->_query);
|
||||||
|
@ -289,7 +288,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_alter_query(){
|
private function handle_alter_query(){
|
||||||
require_once PDODIR . 'query_alter.class.php';
|
require_once PDODIR . 'query_alter.class.php';
|
||||||
$engine = new AlterQuery();
|
$engine = new AlterQuery();
|
||||||
$this->_query = $engine->rewrite_query($this->_query, 'alter');
|
$this->_query = $engine->rewrite_query($this->_query, 'alter');
|
||||||
|
@ -304,7 +303,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_describe_query(){
|
private function handle_describe_query(){
|
||||||
// $this->_query = "select 1=1";
|
// $this->_query = "select 1=1";
|
||||||
$pattern = '/^\\s*(DESCRIBE|DESC)\\s*(.*)/i';
|
$pattern = '/^\\s*(DESCRIBE|DESC)\\s*(.*)/i';
|
||||||
if (preg_match($pattern, $this->_query, $match)) {
|
if (preg_match($pattern, $this->_query, $match)) {
|
||||||
|
@ -323,7 +322,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_limit_usage(){
|
private function rewrite_limit_usage(){
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$options = $_wpdb->get_results('PRAGMA compile_options');
|
$options = $_wpdb->get_results('PRAGMA compile_options');
|
||||||
foreach ($options as $opt) {
|
foreach ($options as $opt) {
|
||||||
|
@ -342,7 +341,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_order_by_usage() {
|
private function rewrite_order_by_usage() {
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$options = $_wpdb->get_results('PRAGMA compile_options');
|
$options = $_wpdb->get_results('PRAGMA compile_options');
|
||||||
foreach ($options as $opt) {
|
foreach ($options as $opt) {
|
||||||
|
@ -357,7 +356,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_truncate_query(){
|
private function handle_truncate_query(){
|
||||||
$pattern = '/TRUNCATE TABLE (.*)/im';
|
$pattern = '/TRUNCATE TABLE (.*)/im';
|
||||||
$this->_query = preg_replace($pattern, 'DELETE FROM $1', $this->_query);
|
$this->_query = preg_replace($pattern, 'DELETE FROM $1', $this->_query);
|
||||||
}
|
}
|
||||||
|
@ -369,7 +368,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_optimize(){
|
private function rewrite_optimize(){
|
||||||
$this->_query ="VACUUM";
|
$this->_query ="VACUUM";
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -384,7 +383,7 @@ class PDOSQLiteDriver {
|
||||||
* @return void
|
* @return void
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_badly_formed_dates(){
|
private function rewrite_badly_formed_dates(){
|
||||||
$pattern = '/([12]\d{3,}-\d{2}-)(\d )/ims';
|
$pattern = '/([12]\d{3,}-\d{2}-)(\d )/ims';
|
||||||
$this->_query = preg_replace($pattern, '${1}0$2', $this->_query);
|
$this->_query = preg_replace($pattern, '${1}0$2', $this->_query);
|
||||||
}
|
}
|
||||||
|
@ -394,7 +393,7 @@ class PDOSQLiteDriver {
|
||||||
* @return void
|
* @return void
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _delete_index_hints(){
|
private function delete_index_hints(){
|
||||||
$pattern = '/\\s*(use|ignore|force)\\s+index\\s*\(.*?\)/i';
|
$pattern = '/\\s*(use|ignore|force)\\s+index\\s*\(.*?\)/i';
|
||||||
$this->_query = preg_replace($pattern, '', $this->_query);
|
$this->_query = preg_replace($pattern, '', $this->_query);
|
||||||
}
|
}
|
||||||
|
@ -412,9 +411,9 @@ class PDOSQLiteDriver {
|
||||||
* @return void
|
* @return void
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _fix_date_quoting() {
|
private function fix_date_quoting() {
|
||||||
$pattern = '/(month|year|second|day|minute|hour|dayofmonth)\\s*\((.*?)\)\\s*=\\s*["\']?(\d{1,4})[\'"]?\\s*/im';
|
$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);
|
$this->_query = preg_replace_callback($pattern, array($this, '_fix_date_quoting'), $this->_query);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Call back method to rewrite date string.
|
* Call back method to rewrite date string.
|
||||||
|
@ -423,7 +422,7 @@ class PDOSQLiteDriver {
|
||||||
* @return string
|
* @return string
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function __fix_date_quoting($match) {
|
private function _fix_date_quoting($match) {
|
||||||
$fixed_val = "{$match[1]}({$match[2]})='" . intval($match[3]) . "' ";
|
$fixed_val = "{$match[1]}({$match[2]})='" . intval($match[3]) . "' ";
|
||||||
return $fixed_val;
|
return $fixed_val;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +434,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_regexp(){
|
private function rewrite_regexp(){
|
||||||
$pattern = '/\s([^\s]*)\s*regexp\s*(\'.*?\')/im';
|
$pattern = '/\s([^\s]*)\s*regexp\s*(\'.*?\')/im';
|
||||||
$this->_query = preg_replace($pattern, ' regexpp(\1, \2)', $this->_query);
|
$this->_query = preg_replace($pattern, ' regexpp(\1, \2)', $this->_query);
|
||||||
}
|
}
|
||||||
|
@ -446,7 +445,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_boolean() {
|
private function rewrite_boolean() {
|
||||||
$query = str_ireplace('TRUE', "1", $this->_query);
|
$query = str_ireplace('TRUE', "1", $this->_query);
|
||||||
$query = str_ireplace('FALSE', "0", $query);
|
$query = str_ireplace('FALSE', "0", $query);
|
||||||
$this->_query = $query;
|
$this->_query = $query;
|
||||||
|
@ -456,16 +455,16 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_show_columns_query() {
|
private function handle_show_columns_query() {
|
||||||
$pattern_like = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?\\s*LIKE\\s*(.*)?/i';
|
$pattern_like = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?\\s*LIKE\\s*(.*)?/i';
|
||||||
$pattern = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?/i';
|
$pattern = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?/i';
|
||||||
if (preg_match($pattern_like, $this->_query, $matches)) {
|
if (preg_match($pattern_like, $this->_query, $matches)) {
|
||||||
$table_name = str_replace("'", "", trim($matches[2]));
|
$table_name = str_replace("'", "", trim($matches[2]));
|
||||||
$column_name = str_replace("'", "", trim($matches[3]));
|
$column_name = str_replace("'", "", trim($matches[3]));
|
||||||
$query_string = "SELECT sql FROM sqlite_master WHERE tbl_name='$table_name' AND sql LIKE '%$column_name%'";
|
$query_string = "SELECT sql FROM sqlite_master WHERE tbl_name='$table_name' AND sql LIKE '%$column_name%'";
|
||||||
$this->_query = $query_string;
|
$this->_query = $query_string;
|
||||||
} elseif (preg_match($pattern, $this->_query, $matches)) {
|
} elseif (preg_match($pattern, $this->_query, $matches)) {
|
||||||
$table_name = $matches[2];
|
$table_name = $matches[2];
|
||||||
$query_string = preg_replace($pattern, "PRAGMA table_info($table_name)", $this->_query);
|
$query_string = preg_replace($pattern, "PRAGMA table_info($table_name)", $this->_query);
|
||||||
$this->_query = $query_string;
|
$this->_query = $query_string;
|
||||||
}
|
}
|
||||||
|
@ -477,11 +476,11 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _handle_show_index() {
|
private function handle_show_index() {
|
||||||
$pattern = '/^\\s*SHOW\\s*(?:INDEX|INDEXES|KEYS)\\s*FROM\\s*(\\w+)?/im';
|
$pattern = '/^\\s*SHOW\\s*(?:INDEX|INDEXES|KEYS)\\s*FROM\\s*(\\w+)?/im';
|
||||||
if (preg_match($pattern, $this->_query, $match)) {
|
if (preg_match($pattern, $this->_query, $match)) {
|
||||||
$table_name = preg_replace("/[\';]/", '', $match[1]);
|
$table_name = preg_replace("/[\';]/", '', $match[1]);
|
||||||
$table_name = trim($table_name);
|
$table_name = trim($table_name);
|
||||||
$this->_query = "SELECT * FROM sqlite_master WHERE tbl_name='$table_name'";
|
$this->_query = "SELECT * FROM sqlite_master WHERE tbl_name='$table_name'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,8 +493,8 @@ class PDOSQLiteDriver {
|
||||||
* @return void
|
* @return void
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _execute_duplicate_key_update() {
|
private function execute_duplicate_key_update() {
|
||||||
$update = false;
|
$update = false;
|
||||||
$unique_keys_for_cond = array();
|
$unique_keys_for_cond = array();
|
||||||
$unique_keys_for_check = array();
|
$unique_keys_for_check = array();
|
||||||
$pattern = '/^\\s*INSERT\\s*INTO\\s*(\\w+)?\\s*(.*)\\s*ON\\s*DUPLICATE\\s*KEY\\s*UPDATE\\s*(.*)$/ims';
|
$pattern = '/^\\s*INSERT\\s*INTO\\s*(\\w+)?\\s*(.*)\\s*ON\\s*DUPLICATE\\s*KEY\\s*UPDATE\\s*(.*)$/ims';
|
||||||
|
@ -521,14 +520,14 @@ class PDOSQLiteDriver {
|
||||||
$unique_keys_for_check = array_map('trim', $unique_keys_for_check);
|
$unique_keys_for_check = array_map('trim', $unique_keys_for_check);
|
||||||
} else {
|
} else {
|
||||||
// Without unique key or primary key, UPDATE statement will affect all the rows!
|
// Without unique key or primary key, UPDATE statement will affect all the rows!
|
||||||
$query = 'INSERT INTO '.$table_name.' '.$insert_data;
|
$query = 'INSERT INTO '.$table_name.' '.$insert_data;
|
||||||
$this->_query = $query;
|
$this->_query = $query;
|
||||||
$_wpdb = null;
|
$_wpdb = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// data check
|
// data check
|
||||||
if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/ims', $insert_data, $match_1)) {
|
if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/ims', $insert_data, $match_1)) {
|
||||||
$col_array = explode(',', $match_1[1]);
|
$col_array = explode(',', $match_1[1]);
|
||||||
$ins_data_array = explode(',', $match_1[2]);
|
$ins_data_array = explode(',', $match_1[2]);
|
||||||
foreach ($col_array as $col) {
|
foreach ($col_array as $col) {
|
||||||
$val = trim(array_shift($ins_data_array));
|
$val = trim(array_shift($ins_data_array));
|
||||||
|
@ -539,7 +538,7 @@ class PDOSQLiteDriver {
|
||||||
foreach ($unique_keys_for_cond as $unique_key) {
|
foreach ($unique_keys_for_cond as $unique_key) {
|
||||||
if (strpos($unique_key, ',') !== false) {
|
if (strpos($unique_key, ',') !== false) {
|
||||||
$unique_key_array = explode(',', $unique_key);
|
$unique_key_array = explode(',', $unique_key);
|
||||||
$counter = count($unique_key_array);
|
$counter = count($unique_key_array);
|
||||||
for ($i = 0; $i < $counter; ++$i) {
|
for ($i = 0; $i < $counter; ++$i) {
|
||||||
$col = trim($unique_key_array[$i]);
|
$col = trim($unique_key_array[$i]);
|
||||||
if (isset($ins_data_assoc[$col]) && $i == $counter - 1) {
|
if (isset($ins_data_assoc[$col]) && $i == $counter - 1) {
|
||||||
|
@ -560,9 +559,9 @@ class PDOSQLiteDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$condition = rtrim($condition, ' OR ');
|
$condition = rtrim($condition, ' OR ');
|
||||||
$test_query = "SELECT * FROM {$table_name} WHERE {$condition}";
|
$test_query = "SELECT * FROM {$table_name} WHERE {$condition}";
|
||||||
$results = $_wpdb->query($test_query);
|
$results = $_wpdb->query($test_query);
|
||||||
$_wpdb = null;
|
$_wpdb = null;
|
||||||
if ($results == 0) {
|
if ($results == 0) {
|
||||||
$this->_query = 'INSERT INTO '.$table_name.' '.$insert_data;
|
$this->_query = 'INSERT INTO '.$table_name.' '.$insert_data;
|
||||||
|
@ -572,7 +571,7 @@ class PDOSQLiteDriver {
|
||||||
if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/im', $insert_data, $match_2)) {
|
if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/im', $insert_data, $match_2)) {
|
||||||
$col_array = explode(',', $match_2[1]);
|
$col_array = explode(',', $match_2[1]);
|
||||||
$ins_array = explode(',', $match_2[2]);
|
$ins_array = explode(',', $match_2[2]);
|
||||||
$count = count($col_array);
|
$count = count($col_array);
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$col = trim($col_array[$i]);
|
$col = trim($col_array[$i]);
|
||||||
$val = trim($ins_array[$i]);
|
$val = trim($ins_array[$i]);
|
||||||
|
@ -582,17 +581,17 @@ class PDOSQLiteDriver {
|
||||||
// change col = data, col = data to array(col=>data, col=>data)
|
// change col = data, col = data to array(col=>data, col=>data)
|
||||||
// some plugins have semi-colon at the end of the query
|
// some plugins have semi-colon at the end of the query
|
||||||
$update_data = rtrim($update_data, ';');
|
$update_data = rtrim($update_data, ';');
|
||||||
$tmp_array = explode(',', $update_data);
|
$tmp_array = explode(',', $update_data);
|
||||||
foreach ($tmp_array as $pair) {
|
foreach ($tmp_array as $pair) {
|
||||||
list($col, $value) = explode('=', $pair);
|
list($col, $value) = explode('=', $pair);
|
||||||
$col = trim($col);
|
$col = trim($col);
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
$update_array_assoc[$col] = $value;
|
$update_array_assoc[$col] = $value;
|
||||||
}
|
}
|
||||||
// change array(col=>values(col)) to array(col=>data)
|
// change array(col=>values(col)) to array(col=>data)
|
||||||
foreach ($update_array_assoc as $key => &$value) {
|
foreach ($update_array_assoc as $key => &$value) {
|
||||||
if (preg_match('/^VALUES\\s*\((.*)\)$/im', $value, $match_3)) {
|
if (preg_match('/^VALUES\\s*\((.*)\)$/im', $value, $match_3)) {
|
||||||
$col = trim($match_3[1]);
|
$col = trim($match_3[1]);
|
||||||
$value = $ins_array_assoc[$col];
|
$value = $ins_array_assoc[$col];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,8 +609,8 @@ class PDOSQLiteDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$update_strings = rtrim($update_strings, ',');
|
$update_strings = rtrim($update_strings, ',');
|
||||||
$unique_where = array_unique($where_array, SORT_REGULAR);
|
$unique_where = array_unique($where_array, SORT_REGULAR);
|
||||||
$where_string = ' WHERE ' . implode(' AND ', $unique_where);
|
$where_string = ' WHERE ' . implode(' AND ', $unique_where);
|
||||||
// $where_string = ' WHERE ' . rtrim($where_string, ',');
|
// $where_string = ' WHERE ' . rtrim($where_string, ',');
|
||||||
$update_query = 'UPDATE ' . $table_name . ' SET ' . $update_strings . $where_string;
|
$update_query = 'UPDATE ' . $table_name . ' SET ' . $update_strings . $where_string;
|
||||||
$this->_query = $update_query;
|
$this->_query = $update_query;
|
||||||
|
@ -633,7 +632,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _rewrite_between() {
|
private function rewrite_between() {
|
||||||
$pattern = '/\\s*(\\w+)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s]*)?\\s*/ims';
|
$pattern = '/\\s*(\\w+)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s]*)?\\s*/ims';
|
||||||
if (preg_match($pattern, $this->_query, $match)) {
|
if (preg_match($pattern, $this->_query, $match)) {
|
||||||
$column_name = trim($match[1]);
|
$column_name = trim($match[1]);
|
||||||
|
@ -641,7 +640,7 @@ class PDOSQLiteDriver {
|
||||||
$max_value = trim($match[3]);
|
$max_value = trim($match[3]);
|
||||||
$max_value = rtrim($max_value);
|
$max_value = rtrim($max_value);
|
||||||
$tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE);
|
$tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
$literal = false;
|
$literal = false;
|
||||||
$rewriting = false;
|
$rewriting = false;
|
||||||
foreach ($tokens as $token) {
|
foreach ($tokens as $token) {
|
||||||
if ($token == "'") {
|
if ($token == "'") {
|
||||||
|
@ -674,10 +673,10 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _delete_workaround() {
|
private function delete_workaround() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
// $pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (option_name) WHERE o2.option_id > o1.option_id";
|
// $pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (option_name) WHERE o2.option_id > o1.option_id";
|
||||||
$pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2";
|
$pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2";
|
||||||
$rewritten = "DELETE FROM $wpdb->options WHERE option_id IN (SELECT MIN(option_id) FROM $wpdb->options GROUP BY option_name HAVING COUNT(*) > 1)";
|
$rewritten = "DELETE FROM $wpdb->options WHERE option_id IN (SELECT MIN(option_id) FROM $wpdb->options GROUP BY option_name HAVING COUNT(*) > 1)";
|
||||||
if (stripos($this->_query, $pattern) !== false) {
|
if (stripos($this->_query, $pattern) !== false) {
|
||||||
$this->_query = $rewritten;
|
$this->_query = $rewritten;
|
||||||
|
@ -692,7 +691,7 @@ class PDOSQLiteDriver {
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function _return_true() {
|
private function return_true() {
|
||||||
$this->_query = 'SELECT 1=1';
|
$this->_query = 'SELECT 1=1';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,10 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
$query = str_replace('`', '', $query);
|
$query = str_replace('`', '', $query);
|
||||||
if (preg_match('/^\\s*(ALTER\\s*TABLE)\\s*(\\w+)?\\s*/ims', $query, $match)) {
|
if (preg_match('/^\\s*(ALTER\\s*TABLE)\\s*(\\w+)?\\s*/ims', $query, $match)) {
|
||||||
$tmp_query = array();
|
$tmp_query = array();
|
||||||
$tokens = array();
|
$tokens = array();
|
||||||
$re_command = '';
|
$re_command = '';
|
||||||
$command = str_ireplace($match[0], '', $query);
|
$command = str_ireplace($match[0], '', $query);
|
||||||
$tmp_tokens['query_type'] = trim($match[1]);
|
$tmp_tokens['query_type'] = trim($match[1]);
|
||||||
$tmp_tokens['table_name'] = trim($match[2]);
|
$tmp_tokens['table_name'] = trim($match[2]);
|
||||||
// $command_array = $this->split_multiple($command);
|
// $command_array = $this->split_multiple($command);
|
||||||
|
@ -38,7 +38,7 @@ class AlterQuery {
|
||||||
|
|
||||||
$single_command = array_shift($command_array);
|
$single_command = array_shift($command_array);
|
||||||
if (!empty($command_array)) {
|
if (!empty($command_array)) {
|
||||||
$re_command = 'ALTER TABLE ' . $tmp_tokens['table_name'] . ' ';
|
$re_command = 'ALTER TABLE ' . $tmp_tokens['table_name'] . ' ';
|
||||||
$re_command .= implode(',', $command_array);
|
$re_command .= implode(',', $command_array);
|
||||||
}
|
}
|
||||||
$command_tokens = $this->command_tokenizer($single_command);
|
$command_tokens = $this->command_tokenizer($single_command);
|
||||||
|
@ -105,17 +105,17 @@ class AlterQuery {
|
||||||
if (in_array(strtolower($match_2), array('fulltext', 'constraint', 'foreign'))) {
|
if (in_array(strtolower($match_2), array('fulltext', 'constraint', 'foreign'))) {
|
||||||
break;
|
break;
|
||||||
} elseif (stripos('column', $match_2) !== false) {
|
} elseif (stripos('column', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2;
|
$tokens['command'] = $match_1.' '.$match_2;
|
||||||
$tokens['column_name'] = $match_3;
|
$tokens['column_name'] = $match_3;
|
||||||
$tokens['column_def'] = trim($the_rest);
|
$tokens['column_def'] = trim($the_rest);
|
||||||
} elseif (stripos('primary', $match_2) !== false) {
|
} elseif (stripos('primary', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2.' '.$match_3;
|
$tokens['command'] = $match_1.' '.$match_2.' '.$match_3;
|
||||||
$tokens['column_name'] = $the_rest;
|
$tokens['column_name'] = $the_rest;
|
||||||
} elseif (stripos('unique', $match_2) !== false) {
|
} elseif (stripos('unique', $match_2) !== false) {
|
||||||
list($index_name, $col_name) = preg_split('/[\(\)]/s', trim($the_rest), -1, PREG_SPLIT_DELIM_CAPTURE);
|
list($index_name, $col_name) = preg_split('/[\(\)]/s', trim($the_rest), -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
$tokens['unique'] = true;
|
$tokens['unique'] = true;
|
||||||
$tokens['command'] = $match_1.' '.$match_3;
|
$tokens['command'] = $match_1.' '.$match_3;
|
||||||
$tokens['index_name'] = trim($index_name);
|
$tokens['index_name'] = trim($index_name);
|
||||||
$tokens['column_name'] = '('.trim($col_name).')';
|
$tokens['column_name'] = '('.trim($col_name).')';
|
||||||
} elseif (in_array(strtolower($match_2), array('index', 'key'))) {
|
} elseif (in_array(strtolower($match_2), array('index', 'key'))) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2;
|
$tokens['command'] = $match_1.' '.$match_2;
|
||||||
|
@ -126,65 +126,65 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
$tokens['column_name'] = trim($the_rest);
|
$tokens['column_name'] = trim($the_rest);
|
||||||
} else {
|
} else {
|
||||||
$tokens['command'] = $match_1.' COLUMN';
|
$tokens['command'] = $match_1.' COLUMN';
|
||||||
$tokens['column_name'] = $match_2;
|
$tokens['column_name'] = $match_2;
|
||||||
$tokens['column_def'] = $match_3.' '.$the_rest;
|
$tokens['column_def'] = $match_3.' '.$the_rest;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'drop':
|
case 'drop':
|
||||||
if (stripos('column', $match_2) !== false) {
|
if (stripos('column', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2;
|
$tokens['command'] = $match_1.' '.$match_2;
|
||||||
$tokens['column_name'] = trim($match_3);
|
$tokens['column_name'] = trim($match_3);
|
||||||
} elseif (stripos('primary', $match_2) !== false) {
|
} elseif (stripos('primary', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2.' '.$match_3;
|
$tokens['command'] = $match_1.' '.$match_2.' '.$match_3;
|
||||||
} elseif (in_array(strtolower($match_2), array('index', 'key'))) {
|
} elseif (in_array(strtolower($match_2), array('index', 'key'))) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2;
|
$tokens['command'] = $match_1.' '.$match_2;
|
||||||
$tokens['index_name'] = $match_3;
|
$tokens['index_name'] = $match_3;
|
||||||
} elseif (stripos('primary', $match_2) !== false) {
|
} elseif (stripos('primary', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2.' '.$match_3;
|
$tokens['command'] = $match_1.' '.$match_2.' '.$match_3;
|
||||||
} else {
|
} else {
|
||||||
$tokens['command'] = $match_1.' COLUMN';
|
$tokens['command'] = $match_1.' COLUMN';
|
||||||
$tokens['column_name'] = $match_2;
|
$tokens['column_name'] = $match_2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'rename':
|
case 'rename':
|
||||||
if (stripos('to', $match_2) !== false) {
|
if (stripos('to', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2;
|
$tokens['command'] = $match_1.' '.$match_2;
|
||||||
$tokens['column_name'] = $match_3;
|
$tokens['column_name'] = $match_3;
|
||||||
} else {
|
} else {
|
||||||
$tokens['command'] = $match_1.' TO';
|
$tokens['command'] = $match_1.' TO';
|
||||||
$tokens['column_name'] = $match_2;
|
$tokens['column_name'] = $match_2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'modify':
|
case 'modify':
|
||||||
if (stripos('column', $match_2) !== false) {
|
if (stripos('column', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2;
|
$tokens['command'] = $match_1.' '.$match_2;
|
||||||
$tokens['column_name'] = $match_3;
|
$tokens['column_name'] = $match_3;
|
||||||
$tokens['column_def'] = trim($the_rest);
|
$tokens['column_def'] = trim($the_rest);
|
||||||
} else {
|
} else {
|
||||||
$tokens['command'] = $match_1.' COLUMN';
|
$tokens['command'] = $match_1.' COLUMN';
|
||||||
$tokens['column_name'] = $match_2;
|
$tokens['column_name'] = $match_2;
|
||||||
$tokens['column_def'] = $match_3.' '.trim($the_rest);
|
$tokens['column_def'] = $match_3.' '.trim($the_rest);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'change':
|
case 'change':
|
||||||
$the_rest = trim($the_rest);
|
$the_rest = trim($the_rest);
|
||||||
if (stripos('column', $match_2) !== false) {
|
if (stripos('column', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2;
|
$tokens['command'] = $match_1.' '.$match_2;
|
||||||
$tokens['old_column'] = $match_3;
|
$tokens['old_column'] = $match_3;
|
||||||
list($new_col) = explode(' ', $the_rest);
|
list($new_col) = explode(' ', $the_rest);
|
||||||
$tmp_col = preg_replace('/\(.+?\)/im', '', $new_col);
|
$tmp_col = preg_replace('/\(.+?\)/im', '', $new_col);
|
||||||
if (array_key_exists(strtolower($tmp_col), $this->array_types)) {
|
if (array_key_exists(strtolower($tmp_col), $this->array_types)) {
|
||||||
$tokens['column_def'] = $the_rest;
|
$tokens['column_def'] = $the_rest;
|
||||||
} else {
|
} else {
|
||||||
$tokens['new_column'] = $new_col;
|
$tokens['new_column'] = $new_col;
|
||||||
$col_def = str_replace($new_col, '', $the_rest);
|
$col_def = str_replace($new_col, '', $the_rest);
|
||||||
$tokens['column_def'] = trim($col_def);
|
$tokens['column_def'] = trim($col_def);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$tokens['command'] = $match_1.' column';
|
$tokens['command'] = $match_1.' column';
|
||||||
$tokens['old_column'] = $match_2;
|
$tokens['old_column'] = $match_2;
|
||||||
$tmp_col = preg_replace('/\(.+?\)/im', '', $match_3);
|
$tmp_col = preg_replace('/\(.+?\)/im', '', $match_3);
|
||||||
if (array_key_exists(strtolower($tmp_col), $this->array_types)) {
|
if (array_key_exists(strtolower($tmp_col), $this->array_types)) {
|
||||||
$tokens['column_def'] = $match_3 . ' ' . $the_rest;
|
$tokens['column_def'] = $match_3 . ' ' . $the_rest;
|
||||||
} else {
|
} else {
|
||||||
|
@ -195,23 +195,23 @@ class AlterQuery {
|
||||||
break;
|
break;
|
||||||
case 'alter':
|
case 'alter':
|
||||||
if (stripos('column', $match_2) !== false) {
|
if (stripos('column', $match_2) !== false) {
|
||||||
$tokens['command'] = $match_1.' '.$match_2;
|
$tokens['command'] = $match_1.' '.$match_2;
|
||||||
$tokens['column_name'] = $match_3;
|
$tokens['column_name'] = $match_3;
|
||||||
list($set_or_drop) = explode(' ', $the_rest);
|
list($set_or_drop) = explode(' ', $the_rest);
|
||||||
if (stripos('set', $set_or_drop) !== false) {
|
if (stripos('set', $set_or_drop) !== false) {
|
||||||
$tokens['default_command'] = 'SET DEFAULT';
|
$tokens['default_command'] = 'SET DEFAULT';
|
||||||
$default_value = str_ireplace('set default', '', $the_rest);
|
$default_value = str_ireplace('set default', '', $the_rest);
|
||||||
$tokens['default_value'] = trim($default_value);
|
$tokens['default_value'] = trim($default_value);
|
||||||
} else {
|
} else {
|
||||||
$tokens['default_command'] = 'DROP DEFAULT';
|
$tokens['default_command'] = 'DROP DEFAULT';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$tokens['command'] = $match_1.' COLUMN';
|
$tokens['command'] = $match_1.' COLUMN';
|
||||||
$tokens['column_name'] = $match_2;
|
$tokens['column_name'] = $match_2;
|
||||||
if (stripos('set', $match_3) !== false) {
|
if (stripos('set', $match_3) !== false) {
|
||||||
$tokens['default_command'] = 'SET DEFAULT';
|
$tokens['default_command'] = 'SET DEFAULT';
|
||||||
$default_value = str_ireplace('default', '', $the_rest);
|
$default_value = str_ireplace('default', '', $the_rest);
|
||||||
$tokens['default_value'] = trim($default_value);
|
$tokens['default_value'] = trim($default_value);
|
||||||
} else {
|
} else {
|
||||||
$tokens['default_command'] = 'DROP DEFAULT';
|
$tokens['default_command'] = 'DROP DEFAULT';
|
||||||
}
|
}
|
||||||
|
@ -233,10 +233,10 @@ class AlterQuery {
|
||||||
* @return multitype:string unknown Ambigous <string, unknown>
|
* @return multitype:string unknown Ambigous <string, unknown>
|
||||||
*/
|
*/
|
||||||
private function split_multiple($command) {
|
private function split_multiple($command) {
|
||||||
$out = true;
|
$out = true;
|
||||||
$command_array = array();
|
$command_array = array();
|
||||||
$command_string = '';
|
$command_string = '';
|
||||||
$tokens = preg_split('/\b/s', $command, -1, PREG_SPLIT_DELIM_CAPTURE);
|
$tokens = preg_split('/\b/s', $command, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
foreach ($tokens as $token) {
|
foreach ($tokens as $token) {
|
||||||
switch (trim($token)) {
|
switch (trim($token)) {
|
||||||
case ';':
|
case ';':
|
||||||
|
@ -251,13 +251,13 @@ class AlterQuery {
|
||||||
break;
|
break;
|
||||||
case '),':
|
case '),':
|
||||||
$command_array[] = $command_string;
|
$command_array[] = $command_string;
|
||||||
$command_string = '';
|
$command_string = '';
|
||||||
$out = true;
|
$out = true;
|
||||||
break;
|
break;
|
||||||
case ',':
|
case ',':
|
||||||
if ($out) {
|
if ($out) {
|
||||||
$command_array[] = $command_string;
|
$command_array[] = $command_string;
|
||||||
$command_string = '';
|
$command_string = '';
|
||||||
} else {
|
} else {
|
||||||
$command_string .= $token;
|
$command_string .= $token;
|
||||||
}
|
}
|
||||||
|
@ -305,8 +305,8 @@ class AlterQuery {
|
||||||
*/
|
*/
|
||||||
private function handle_add_primary_key($queries) {
|
private function handle_add_primary_key($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$tbl_name = $tokenized_query['table_name'];
|
$tbl_name = $tokenized_query['table_name'];
|
||||||
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='$tbl_name'");
|
$query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='$tbl_name'");
|
||||||
$_wpdb = null;
|
$_wpdb = null;
|
||||||
|
@ -335,7 +335,7 @@ class AlterQuery {
|
||||||
*/
|
*/
|
||||||
private function handle_drop_primary_key($queries) {
|
private function handle_drop_primary_key($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'");
|
$query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'");
|
||||||
$_wpdb = null;
|
$_wpdb = null;
|
||||||
|
@ -343,18 +343,18 @@ class AlterQuery {
|
||||||
$index_queries[$i] = $query_obj[$i]->sql;
|
$index_queries[$i] = $query_obj[$i]->sql;
|
||||||
}
|
}
|
||||||
$table_query = array_shift($index_queries);
|
$table_query = array_shift($index_queries);
|
||||||
$pattern1 = '/^\\s*PRIMARY\\s*KEY\\s*\(.*\)/im';
|
$pattern1 = '/^\\s*PRIMARY\\s*KEY\\s*\(.*\)/im';
|
||||||
$pattern2 = '/^\\s*.*(PRIMARY\\s*KEY\\s*(:?AUTOINCREMENT|))\\s*(?!\()/im';
|
$pattern2 = '/^\\s*.*(PRIMARY\\s*KEY\\s*(:?AUTOINCREMENT|))\\s*(?!\()/im';
|
||||||
if (preg_match($pattern1, $table_query, $match)) {
|
if (preg_match($pattern1, $table_query, $match)) {
|
||||||
$table_query = str_replace($match[0], '', $table_query);
|
$table_query = str_replace($match[0], '', $table_query);
|
||||||
} elseif (preg_match($pattern2, $table_query, $match)) {
|
} elseif (preg_match($pattern2, $table_query, $match)) {
|
||||||
$table_query = str_replace($match[1], '', $table_query);
|
$table_query = str_replace($match[1], '', $table_query);
|
||||||
}
|
}
|
||||||
$table_query = str_replace($tokenized_query['table_name'], $temp_table, $table_query);
|
$table_query = str_replace($tokenized_query['table_name'], $temp_table, $table_query);
|
||||||
$query[] = $table_query;
|
$query[] = $table_query;
|
||||||
$query[] = "INSERT INTO $temp_table SELECT * FROM {$tokenized_query['table_name']}";
|
$query[] = "INSERT INTO $temp_table SELECT * FROM {$tokenized_query['table_name']}";
|
||||||
$query[] = "DROP TABLE IF EXISTS {$tokenized_query['table_name']}";
|
$query[] = "DROP TABLE IF EXISTS {$tokenized_query['table_name']}";
|
||||||
$query[] = "ALTER TABLE $temp_table RENAME TO {$tokenized_query['table_name']}";
|
$query[] = "ALTER TABLE $temp_table RENAME TO {$tokenized_query['table_name']}";
|
||||||
foreach ($index_queries as $index) {
|
foreach ($index_queries as $index) {
|
||||||
$query[] = $index;
|
$query[] = $index;
|
||||||
}
|
}
|
||||||
|
@ -369,8 +369,8 @@ class AlterQuery {
|
||||||
*/
|
*/
|
||||||
private function handle_modify_command($queries) {
|
private function handle_modify_command($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
||||||
$column_def = $this->convert_field_types($tokenized_query['column_name'], $tokenized_query['column_def']);
|
$column_def = $this->convert_field_types($tokenized_query['column_name'], $tokenized_query['column_def']);
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'");
|
$query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'");
|
||||||
$_wpdb = null;
|
$_wpdb = null;
|
||||||
|
@ -406,11 +406,11 @@ class AlterQuery {
|
||||||
* @return string|array of string
|
* @return string|array of string
|
||||||
*/
|
*/
|
||||||
private function handle_change_command($queries) {
|
private function handle_change_command($queries) {
|
||||||
$col_check = false;
|
$col_check = false;
|
||||||
$old_fields = '';
|
$old_fields = '';
|
||||||
$new_fields = '';
|
$new_fields = '';
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
||||||
if (isset($tokenized_query['new_column'])) {
|
if (isset($tokenized_query['new_column'])) {
|
||||||
$column_name = $tokenized_query['new_column'];
|
$column_name = $tokenized_query['new_column'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -429,7 +429,7 @@ class AlterQuery {
|
||||||
}
|
}
|
||||||
$old_fields = rtrim($old_fields, ',');
|
$old_fields = rtrim($old_fields, ',');
|
||||||
$new_fields = str_ireplace($tokenized_query['old_column'], $column_name, $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']}'");
|
$query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'");
|
||||||
$_wpdb = null;
|
$_wpdb = null;
|
||||||
for ($i = 0; $i < count($query_obj); $i++) {
|
for ($i = 0; $i < count($query_obj); $i++) {
|
||||||
$index_queries[$i] = $query_obj[$i]->sql;
|
$index_queries[$i] = $query_obj[$i]->sql;
|
||||||
|
@ -467,7 +467,7 @@ class AlterQuery {
|
||||||
*/
|
*/
|
||||||
private function handle_alter_command($queries) {
|
private function handle_alter_command($queries) {
|
||||||
$tokenized_query = $queries;
|
$tokenized_query = $queries;
|
||||||
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
$temp_table = 'temp_'.$tokenized_query['table_name'];
|
||||||
if (isset($tokenized_query['default_value'])) {
|
if (isset($tokenized_query['default_value'])) {
|
||||||
$def_value = $this->convert_field_types($tokenized_query['column_name'], $tokenized_query['default_value']);
|
$def_value = $this->convert_field_types($tokenized_query['column_name'], $tokenized_query['default_value']);
|
||||||
$def_value = 'DEFAULT '.$def_value;
|
$def_value = 'DEFAULT '.$def_value;
|
||||||
|
@ -485,12 +485,12 @@ class AlterQuery {
|
||||||
return 'SELECT 1=1';
|
return 'SELECT 1=1';
|
||||||
}
|
}
|
||||||
if (preg_match("/\\s*({$tokenized_query['column_name']})\\s*(.*)?(DEFAULT\\s*.*)[,)]/im", $create_query, $match)) {
|
if (preg_match("/\\s*({$tokenized_query['column_name']})\\s*(.*)?(DEFAULT\\s*.*)[,)]/im", $create_query, $match)) {
|
||||||
$col_name = trim($match[1]);
|
$col_name = trim($match[1]);
|
||||||
$col_def = trim($match[2]);
|
$col_def = trim($match[2]);
|
||||||
$col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def);
|
$col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def);
|
||||||
$checked_col_def = $this->convert_field_types($col_name, $col_def);
|
$checked_col_def = $this->convert_field_types($col_name, $col_def);
|
||||||
$old_default = trim($match[3]);
|
$old_default = trim($match[3]);
|
||||||
$pattern = "/$col_name\\s*$col_def_esc\\s*$old_default/im";
|
$pattern = "/$col_name\\s*$col_def_esc\\s*$old_default/im";
|
||||||
if (is_null($def_value)) {
|
if (is_null($def_value)) {
|
||||||
$replacement = $col_name . ' ' . $checked_col_def;
|
$replacement = $col_name . ' ' . $checked_col_def;
|
||||||
} else {
|
} else {
|
||||||
|
@ -499,11 +499,11 @@ class AlterQuery {
|
||||||
$create_query = preg_replace($pattern, $replacement, $create_query);
|
$create_query = preg_replace($pattern, $replacement, $create_query);
|
||||||
$create_query = str_ireplace($tokenized_query['table_name'], $temp_table, $create_query);
|
$create_query = str_ireplace($tokenized_query['table_name'], $temp_table, $create_query);
|
||||||
} elseif (preg_match("/\\s*({$tokenized_query['column_name']})\\s*(.*)?[,)]/im", $create_query, $match)) {
|
} elseif (preg_match("/\\s*({$tokenized_query['column_name']})\\s*(.*)?[,)]/im", $create_query, $match)) {
|
||||||
$col_name = trim($match[1]);
|
$col_name = trim($match[1]);
|
||||||
$col_def = trim($match[2]);
|
$col_def = trim($match[2]);
|
||||||
$col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def);
|
$col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def);
|
||||||
$checked_col_def = $this->convert_field_types($col_name, $col_def);
|
$checked_col_def = $this->convert_field_types($col_name, $col_def);
|
||||||
$pattern = "/$col_name\\s*$col_def_esc/im";
|
$pattern = "/$col_name\\s*$col_def_esc/im";
|
||||||
if (is_null($def_value)) {
|
if (is_null($def_value)) {
|
||||||
$replacement = $col_name . ' ' . $checked_col_def;
|
$replacement = $col_name . ' ' . $checked_col_def;
|
||||||
} else {
|
} else {
|
||||||
|
@ -534,7 +534,7 @@ class AlterQuery {
|
||||||
private function convert_field_types($col_name, $col_def){
|
private function convert_field_types($col_name, $col_def){
|
||||||
$array_curtime = array('current_timestamp', 'current_time', 'current_date');
|
$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'");
|
$array_reptime = array("'0000-00-00 00:00:00'", "'0000-00-00 00:00:00'", "'0000-00-00'");
|
||||||
$def_string = str_replace('`', '', $col_def);
|
$def_string = str_replace('`', '', $col_def);
|
||||||
foreach ($this->array_types as $o=>$r){
|
foreach ($this->array_types as $o=>$r){
|
||||||
$pattern = "/\\b$o\\s*(\([^\)]*\)*)?\\s*/ims";
|
$pattern = "/\\b$o\\s*(\([^\)]*\)*)?\\s*/ims";
|
||||||
if (preg_match($pattern, $def_string)) {
|
if (preg_match($pattern, $def_string)) {
|
||||||
|
|
|
@ -12,10 +12,40 @@
|
||||||
*/
|
*/
|
||||||
class CreateQuery{
|
class CreateQuery{
|
||||||
|
|
||||||
private $_query = '';
|
/**
|
||||||
private $index_queries = array();
|
* The query string to be rewritten in this class.
|
||||||
private $_errors = array();
|
*
|
||||||
private $table_name = '';
|
* @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;
|
private $has_primary_key = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +55,7 @@ class CreateQuery{
|
||||||
* @return string|array the processed (rewritten) query
|
* @return string|array the processed (rewritten) query
|
||||||
*/
|
*/
|
||||||
public function rewrite_query($query){
|
public function rewrite_query($query){
|
||||||
$this->_query = $query;
|
$this->_query = $query;
|
||||||
$this->_errors [] = '';
|
$this->_errors [] = '';
|
||||||
if (preg_match('/^CREATE\\s*(UNIQUE|FULLTEXT|)\\s*INDEX/ims', $this->_query, $match)) {
|
if (preg_match('/^CREATE\\s*(UNIQUE|FULLTEXT|)\\s*INDEX/ims', $this->_query, $match)) {
|
||||||
// we manipulate CREATE INDEX query in PDOEngine.class.php
|
// we manipulate CREATE INDEX query in PDOEngine.class.php
|
||||||
|
@ -60,8 +90,9 @@ class CreateQuery{
|
||||||
/**
|
/**
|
||||||
* Method to get table name from the query string.
|
* Method to get table name from the query string.
|
||||||
*
|
*
|
||||||
* IF NOT EXISTS is removed for the easy regular expression usage.
|
* 'IF NOT EXISTS' clause is removed for the easy regular expression usage.
|
||||||
* It will be added at the end of the process.
|
* It will be added at the end of the process.
|
||||||
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function get_table_name(){
|
private function get_table_name(){
|
||||||
|
@ -74,6 +105,8 @@ class CreateQuery{
|
||||||
/**
|
/**
|
||||||
* Method to change the MySQL field types to SQLite compatible types.
|
* Method to change the MySQL field types to SQLite compatible types.
|
||||||
*
|
*
|
||||||
|
* Order of the key value is important. Don't change it.
|
||||||
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_field_types(){
|
private function rewrite_field_types(){
|
||||||
|
@ -126,7 +159,8 @@ class CreateQuery{
|
||||||
/**
|
/**
|
||||||
* Method for stripping unsigned.
|
* Method for stripping unsigned.
|
||||||
*
|
*
|
||||||
* UNSIGNED INT(EGER) is converted to INTEGER here.
|
* SQLite doesn't have unsigned int data type. So UNSIGNED INT(EGER) is converted
|
||||||
|
* to INTEGER here.
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
|
@ -178,8 +212,8 @@ class CreateQuery{
|
||||||
*/
|
*/
|
||||||
private function _rewrite_unique_key($matches){
|
private function _rewrite_unique_key($matches){
|
||||||
$index_name = trim($matches[1]);
|
$index_name = trim($matches[1]);
|
||||||
$col_name = trim($matches[2]);
|
$col_name = trim($matches[2]);
|
||||||
$tbl_name = $this->table_name;
|
$tbl_name = $this->table_name;
|
||||||
$_wpdb = new PDODB();
|
$_wpdb = new PDODB();
|
||||||
$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
|
$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
|
||||||
$_wpdb = null;
|
$_wpdb = null;
|
||||||
|
@ -246,7 +280,7 @@ class CreateQuery{
|
||||||
*/
|
*/
|
||||||
private function _rewrite_key($matches){
|
private function _rewrite_key($matches){
|
||||||
$index_name = trim($matches[2]);
|
$index_name = trim($matches[2]);
|
||||||
$col_name = trim($matches[3]);
|
$col_name = trim($matches[3]);
|
||||||
if (preg_match('/\([0-9]+?\)/', $col_name, $match)) {
|
if (preg_match('/\([0-9]+?\)/', $col_name, $match)) {
|
||||||
$col_name = preg_replace_callback('/\([0-9]+?\)/', array($this, '_remove_length'), $col_name);
|
$col_name = preg_replace_callback('/\([0-9]+?\)/', array($this, '_remove_length'), $col_name);
|
||||||
}
|
}
|
||||||
|
@ -282,21 +316,22 @@ class CreateQuery{
|
||||||
* Method to assemble the main query and index queries into an array.
|
* Method to assemble the main query and index queries into an array.
|
||||||
*
|
*
|
||||||
* It return the array of the queries to be executed separately.
|
* It return the array of the queries to be executed separately.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function post_process(){
|
private function post_process(){
|
||||||
$mainquery = $this->_query;
|
$mainquery = $this->_query;
|
||||||
do{
|
do{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$mainquery = preg_replace('/,\\s*\)/imsx',')', $mainquery, -1, $count);
|
$mainquery = preg_replace('/,\\s*\)/imsx',')', $mainquery, -1, $count);
|
||||||
} while ($count > 0);
|
} while ($count > 0);
|
||||||
do {
|
do {
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$mainquery = preg_replace('/\(\\s*?,/imsx', '(', $mainquery, -1, $count);
|
$mainquery = preg_replace('/\(\\s*?,/imsx', '(', $mainquery, -1, $count);
|
||||||
} while ($count > 0);
|
} while ($count > 0);
|
||||||
$return_val[] = $mainquery;
|
$return_val[] = $mainquery;
|
||||||
$return_val = array_merge($return_val, $this->index_queries);
|
$return_val = array_merge($return_val, $this->index_queries);
|
||||||
return $return_val;
|
return $return_val;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -309,14 +344,14 @@ class CreateQuery{
|
||||||
*/
|
*/
|
||||||
private function add_if_not_exists(){
|
private function add_if_not_exists(){
|
||||||
$pattern_table = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*/ims';
|
$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';
|
$pattern_index = '/^\\s*CREATE\\s*(UNIQUE)?\\s*INDEX\\s*(IF NOT EXISTS)?\\s*/ims';
|
||||||
for ($i = 0; $i < count($this->index_queries); $i++) {
|
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
|
* @access private
|
||||||
*/
|
*/
|
||||||
|
@ -335,10 +370,11 @@ class CreateQuery{
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function rewrite_character_set(){
|
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_collate1 = '/\\s*collate\\s*[^ ]*(?=,)/im';
|
||||||
$pattern_collate2 = '/\\s*collate\\s*[^ ]*(?<!;)/im';
|
$pattern_collate2 = '/\\s*collate\\s*[^ ]*(?<!;)/im';
|
||||||
$patterns = array($pattern_charset, $pattern_collate1, $pattern_collate2);
|
$patterns = array($pattern_charset, $pattern_collate1, $pattern_collate2);
|
||||||
$this->_query = preg_replace($patterns, '', $this->_query);
|
$this->_query = preg_replace($patterns, '', $this->_query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
?>
|
|
@ -159,13 +159,17 @@ query_posts() や WP_Query() を使うときに、オプションの一部が機
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
= 1.5.1 (2014-01-00) =
|
= 1.5.1 (2014-02-06) =
|
||||||
* SQL_CALC_FOUND_ROW ステートメントのバグを修正しました。メインクエリと WP_Query のページング情報に関連したものです。
|
* SQL_CALC_FOUND_ROW ステートメントのバグを修正しました。メインクエリと WP_Query のページング情報に関連したものです。
|
||||||
* コメント本文からバッククォートが削除されるバグを修正しました。
|
* コメント本文からバッククォートが削除されるバグを修正しました。
|
||||||
|
* バックアップファイルをローカルにダウンロードできるようにしました。
|
||||||
* PHP documentor で使えるように、ソースコードのドキュメントを書き直しました。
|
* PHP documentor で使えるように、ソースコードのドキュメントを書き直しました。
|
||||||
* このドキュメントを変えました。
|
* このドキュメントを変えました。
|
||||||
* マイナーな変更、修正がいくつかありました。
|
* マイナーな変更、修正がいくつかありました。
|
||||||
* WordPress 3.8.1 と 3.9 alpha でインストールテストをしました。
|
* WordPress 3.8.1 と 3.9 alpha でインストールテストをしました。
|
||||||
|
* プラグイン互換リストを増補しました。
|
||||||
|
* これまで使えなかった WordPress の関数が使えるようになりました。
|
||||||
|
* いくつかのユーザ定義関数を追加しました。
|
||||||
|
|
||||||
= 1.5 (2013-12-17) =
|
= 1.5 (2013-12-17) =
|
||||||
* WordPress 3.8 でのインストールと動作テストをしました。
|
* WordPress 3.8 でのインストールと動作テストをしました。
|
||||||
|
|
|
@ -157,13 +157,17 @@ When query_posts() or WP_Query() is used, some options didn't work properly. Whe
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
= 1.5.1 (2014-01-00) =
|
= 1.5.1 (2014-02-06) =
|
||||||
* Fixed the bug for 'SQL_CALC_FOUND_ROW' statement. This is for the main query and WP_Query concerning paging information.
|
* Fixed the bug for 'SQL_CALC_FOUND_ROW' statement. This is for the main query and WP_Query concerning paging information.
|
||||||
* Fixed the bug that the back quote in the comments was removed.
|
* 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.
|
* Revised all the doc strings in the sourcse code for PHP documentor.
|
||||||
* Changed the documentation.
|
* Changed the documentation.
|
||||||
* Fixed minor bugs and typos.
|
* Fixed minor bugs and typos.
|
||||||
* Tested to install WordPress 3.8.1 and 3.9 beta.
|
* Tested to install WordPress 3.8.1 and 3.9 beta.
|
||||||
|
* Augumented the plugin compatibility list.
|
||||||
|
* Some functions in WordPress that can't be used are made to work.
|
||||||
|
* Some more user defined functions are added.
|
||||||
|
|
||||||
= 1.5 (2013-12-17) =
|
= 1.5 (2013-12-17) =
|
||||||
* Tested WordPress 3.8 installation and compatibility.
|
* Tested WordPress 3.8 installation and compatibility.
|
||||||
|
|
15
schema.php
15
schema.php
|
@ -14,22 +14,23 @@ if (!defined('ABSPATH')) {
|
||||||
* Function to create tables according to the schemas of WordPress.
|
* Function to create tables according to the schemas of WordPress.
|
||||||
*
|
*
|
||||||
* This is executed only once while installation.
|
* This is executed only once while installation.
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function make_db_sqlite() {
|
function make_db_sqlite() {
|
||||||
include_once PDODIR . 'query_create.class.php';
|
include_once PDODIR . 'query_create.class.php';
|
||||||
include_once ABSPATH . 'wp-admin/includes/schema.php';
|
include_once ABSPATH . 'wp-admin/includes/schema.php';
|
||||||
$index_array = array();
|
$index_array = array();
|
||||||
|
|
||||||
// ob_end_clean();
|
// ob_end_clean();
|
||||||
$table_schemas = wp_get_db_schema();
|
$table_schemas = wp_get_db_schema();
|
||||||
$queries = explode (";", $table_schemas);
|
$queries = explode (";", $table_schemas);
|
||||||
$query_parser = new CreateQuery();
|
$query_parser = new CreateQuery();
|
||||||
try {
|
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) {
|
} catch (PDOException $err) {
|
||||||
$err_data = $err->errorInfo;
|
$err_data = $err->errorInfo;
|
||||||
$message = 'Database connection error!<br />';
|
$message = 'Database connection error!<br />';
|
||||||
$message .= sprintf("Error message is: %s", $err_data[2]);
|
$message .= sprintf("Error message is: %s", $err_data[2]);
|
||||||
echo $message;
|
echo $message;
|
||||||
return false;
|
return false;
|
||||||
|
@ -43,9 +44,9 @@ function make_db_sqlite() {
|
||||||
continue;
|
continue;
|
||||||
$rewritten_query = $query_parser->rewrite_query($query);
|
$rewritten_query = $query_parser->rewrite_query($query);
|
||||||
if (is_array($rewritten_query)) {
|
if (is_array($rewritten_query)) {
|
||||||
$table_query = array_shift($rewritten_query);
|
$table_query = array_shift($rewritten_query);
|
||||||
$index_queries = $rewritten_query;
|
$index_queries = $rewritten_query;
|
||||||
$table_query = trim($table_query);
|
$table_query = trim($table_query);
|
||||||
$pdo->exec($table_query);
|
$pdo->exec($table_query);
|
||||||
// foreach($rewritten_query as $single_query) {
|
// foreach($rewritten_query as $single_query) {
|
||||||
// $single_query = trim($single_query);
|
// $single_query = trim($single_query);
|
||||||
|
@ -83,7 +84,7 @@ function make_db_sqlite() {
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
} else {
|
} else {
|
||||||
$pdo->rollBack();
|
$pdo->rollBack();
|
||||||
$message = sprintf("Error occured while creating tables or indexes...<br />Query was: %s<br />", var_export($rewritten_query, true));
|
$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]);
|
$message .= sprintf("Error message is: %s", $err_data[2]);
|
||||||
echo $message;
|
echo $message;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -36,12 +36,21 @@ if (!defined('ABSPATH')) {
|
||||||
echo 'Thank you, but you are not allowed to access this file.';
|
echo 'Thank you, but you are not allowed to access this file.';
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* This will be activated after the installation is finished.
|
||||||
|
* So you can use all the functionality of WordPress.
|
||||||
|
*/
|
||||||
$siteurl = get_option('siteurl');
|
$siteurl = get_option('siteurl');
|
||||||
|
/*
|
||||||
|
* Defines basic constants.
|
||||||
|
*/
|
||||||
define('SQLiteDir', dirname(plugin_basename(__FILE__)));
|
define('SQLiteDir', dirname(plugin_basename(__FILE__)));
|
||||||
define('SQLiteFilePath', dirname(__FILE__));
|
define('SQLiteFilePath', dirname(__FILE__));
|
||||||
define('SQLiteDirName', basename(SQLiteFilePath));
|
define('SQLiteDirName', basename(SQLiteFilePath));
|
||||||
define('SQLiteUrl', $siteurl . '/wp-content/plugins/' . SQLiteDir);
|
define('SQLiteUrl', $siteurl . '/wp-content/plugins/' . SQLiteDir);
|
||||||
|
/*
|
||||||
|
* Defines patch file upload directory.
|
||||||
|
*/
|
||||||
if (defined('UPLOADS')) {
|
if (defined('UPLOADS')) {
|
||||||
define('SQLitePatchDir', UPLOADS . '/patches');
|
define('SQLitePatchDir', UPLOADS . '/patches');
|
||||||
} else {
|
} else {
|
||||||
|
@ -51,9 +60,13 @@ if (defined('UPLOADS')) {
|
||||||
define('SQLitePatchDir', ABSPATH . 'wp-content/uploads/patches');
|
define('SQLitePatchDir', ABSPATH . 'wp-content/uploads/patches');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Plugin compatibility file in json format.
|
||||||
|
*/
|
||||||
define('SQLiteListFile', SQLiteFilePath . '/utilities/plugin_lists.json');
|
define('SQLiteListFile', SQLiteFilePath . '/utilities/plugin_lists.json');
|
||||||
|
/*
|
||||||
|
* Instantiates utility classes.
|
||||||
|
*/
|
||||||
if (!class_exists('SQLiteIntegrationUtils')) {
|
if (!class_exists('SQLiteIntegrationUtils')) {
|
||||||
require_once SQLiteFilePath . '/utilities/utility.php';
|
require_once SQLiteFilePath . '/utilities/utility.php';
|
||||||
$utils = new SQLiteIntegrationUtils();
|
$utils = new SQLiteIntegrationUtils();
|
||||||
|
@ -83,6 +96,8 @@ class SQLiteIntegration {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* This constructor does everything needed for the administration panel.
|
* This constructor does everything needed for the administration panel.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
*/
|
*/
|
||||||
function __construct() {
|
function __construct() {
|
||||||
if (function_exists('register_activation_hook')) {
|
if (function_exists('register_activation_hook')) {
|
||||||
|
@ -98,14 +113,19 @@ class SQLiteIntegration {
|
||||||
} else {
|
} else {
|
||||||
add_action('admin_menu', array($this, 'add_pages'));
|
add_action('admin_menu', array($this, 'add_pages'));
|
||||||
}
|
}
|
||||||
|
// 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'));
|
add_action('plugins_loaded', array($this, 'textdomain_init'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to install on multisite or single site.
|
* Method to install on multisite or single site.
|
||||||
*
|
*
|
||||||
* There really is nothing to install for now. It is for future use...
|
* There really is nothing to install for now. It is for future use...
|
||||||
*
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return returns null.
|
||||||
*/
|
*/
|
||||||
function install() {
|
function install() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
@ -125,25 +145,31 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to install something.
|
* Method to install something.
|
||||||
*
|
*
|
||||||
* We have nothing to do for now.
|
* We have nothing to do for now.
|
||||||
* We show menu and documents only to the network administrator
|
* We show menu and documents only to the network administrator.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function _install() {
|
function _install() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to uninstall plugin.
|
* Method to uninstall plugin.
|
||||||
*
|
*
|
||||||
* This will remove wp-content/db.php and wp-content/patches direcotry.
|
* 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
|
* If you migrate the site to the sever with MySQL, you have only to
|
||||||
* migrate the data in the database.
|
* migrate the data in the database.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function uninstall() {
|
function uninstall() {
|
||||||
// remove patch files and patch directory
|
// remove patch files and patch directory
|
||||||
if (file_exists(SQLitePatchDir) && is_dir(SQLitePatchDir)) {
|
if (file_exists(SQLitePatchDir) && is_dir(SQLitePatchDir)) {
|
||||||
$dir_handle = opendir(SQLitePatchDir);
|
$dir_handle = opendir(SQLitePatchDir);
|
||||||
while (($file_name = readdir($dir_handle)) !== false) {
|
while (($file_name = readdir($dir_handle)) !== false) {
|
||||||
if ($file_name != '.' && $file_name != '..') {
|
if ($file_name != '.' && $file_name != '..') {
|
||||||
unlink(SQLitePatchDir.'/'.$file_name);
|
unlink(SQLitePatchDir.'/'.$file_name);
|
||||||
|
@ -163,21 +189,24 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to manipulate the admin panel, stylesheet and JavaScript.
|
* Method to manipulate the admin panel, stylesheet and JavaScript.
|
||||||
*
|
*
|
||||||
* We use class method to show pages and want to load style files and script
|
* 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
|
* 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
|
* slug set to null. This means that menu items are added but hidden from the
|
||||||
* users.
|
* users.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function add_pages() {
|
function add_pages() {
|
||||||
global $utils, $doc, $patch_utils, $maintenance;
|
global $utils, $doc, $patch_utils, $maintenance;
|
||||||
if (function_exists('add_options_page')) {
|
if (function_exists('add_options_page')) {
|
||||||
$welcome_page = add_options_page(__('SQLite Integration'), __('SQLite Integration'), 'manage_options', 'sqlite-integration', array($utils, 'welcome'));
|
$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'));
|
$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'));
|
$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'));
|
$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'));
|
$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'));
|
$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-'.$welcome_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet'));
|
||||||
|
@ -193,18 +222,21 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to manipulate network admin panel.
|
* Method to manipulate network admin panel.
|
||||||
*
|
*
|
||||||
* Capability is set to manage_network_options.
|
* Capability is set to manage_network_options.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function add_network_pages() {
|
function add_network_pages() {
|
||||||
global $utils, $doc, $patch_utils, $maintenance;
|
global $utils, $doc, $patch_utils, $maintenance;
|
||||||
if (function_exists('add_options_page')) {
|
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'));
|
$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'));
|
$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'));
|
$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'));
|
$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'));
|
$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'));
|
$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-'.$welcome_page, array($this, 'add_style_sheet'));
|
||||||
add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet'));
|
add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet'));
|
||||||
|
@ -220,9 +252,12 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to initialize textdomain.
|
* Method to initialize textdomain.
|
||||||
*
|
*
|
||||||
* Japanese catalog is only available.
|
* Japanese catalog is only available.
|
||||||
|
*
|
||||||
|
* @param no parameter is provided.
|
||||||
|
* @return no return values.
|
||||||
*/
|
*/
|
||||||
function textdomain_init() {
|
function textdomain_init() {
|
||||||
global $utils;
|
global $utils;
|
||||||
|
@ -235,10 +270,14 @@ class SQLiteIntegration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to initialize stylesheet on the admin panel.
|
* Method to initialize stylesheet on the admin panel.
|
||||||
*
|
*
|
||||||
* This determines which stylesheet to use depending on the users' choice
|
* This determines which stylesheet to use depending on the users' choice
|
||||||
* of admin_color.
|
* 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() {
|
function add_style_sheet() {
|
||||||
global $current_user;
|
global $current_user;
|
||||||
|
@ -249,18 +288,23 @@ class SQLiteIntegration {
|
||||||
} else {
|
} else {
|
||||||
$stylesheet_file = $admin_color . '.min.css';
|
$stylesheet_file = $admin_color . '.min.css';
|
||||||
}
|
}
|
||||||
$style_url = SQLiteUrl . '/styles/' . $stylesheet_file;
|
$style_url = SQLiteUrl . '/styles/' . $stylesheet_file;
|
||||||
$style_file = SQLiteFilePath . '/styles/' . $stylesheet_file;
|
$style_file = SQLiteFilePath . '/styles/' . $stylesheet_file;
|
||||||
if (file_exists($style_file)) {
|
if (file_exists($style_file)) {
|
||||||
wp_enqueue_style('sqlite_integration_stylesheet', $style_url);
|
wp_enqueue_style('sqlite_integration_stylesheet', $style_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Function to register the JavaScript file.
|
* 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() {
|
function add_sqlite_script() {
|
||||||
$script_url = SQLiteUrl . '/js/sqlite.min.js';
|
$script_url = SQLiteUrl . '/js/sqlite.min.js';
|
||||||
$script_file = SQLiteFilePath . '/js/sqlite.min.js';
|
$script_file = SQLiteFilePath . '/js/sqlite.min.js';
|
||||||
if (file_exists($script_file)) {
|
if (file_exists($script_file)) {
|
||||||
wp_enqueue_script('sqlite-integration', $script_url, 'jquery');
|
wp_enqueue_script('sqlite-integration', $script_url, 'jquery');
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of SQLite Integration.
|
* This file is a part of SQLite Integration.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
@import url('./style.min.css');
|
@import url('./style.min.css');
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of SQLite Integration.
|
* This file is a part of SQLite Integration.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
@import url('./style.min.css');
|
@import url('./style.min.css');
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of SQLite Integration.
|
* This file is a part of SQLite Integration.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
@import url('./style.min.css');
|
@import url('./style.min.css');
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of SQLite Integration.
|
* This file is a part of SQLite Integration.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
@import url('./style.min.css');
|
@import url('./style.min.css');
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of SQLite Integration.
|
* This file is a part of SQLite Integration.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
@import url('./style.min.css');
|
@import url('./style.min.css');
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of SQLite Integration.
|
* This file is a part of SQLite Integration.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
@import url('./style.min.css');
|
@import url('./style.min.css');
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of SQLite Integration.
|
* This file is a part of SQLite Integration.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
#sqlite-admin-wrap h2,
|
#sqlite-admin-wrap h2,
|
||||||
|
@ -110,11 +112,14 @@ h3 {
|
||||||
}
|
}
|
||||||
p {
|
p {
|
||||||
text-indent: 15px;
|
text-indent: 15px;
|
||||||
line-height: 150%;
|
line-height: 160%;
|
||||||
font-size: 11pt;
|
font-size: 11pt;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
li {
|
||||||
|
line-height: 130%;
|
||||||
|
}
|
||||||
table#sys-info{
|
table#sys-info{
|
||||||
/* width: 600px; */
|
/* width: 600px; */
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
@ -190,7 +195,7 @@ input.button-primary {
|
||||||
}
|
}
|
||||||
table#patch-files .item,
|
table#patch-files .item,
|
||||||
table#backup-files .item {
|
table#backup-files .item {
|
||||||
width: 40px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
.alert {
|
.alert {
|
||||||
color: rgb(255, 0, 0);
|
color: rgb(255, 0, 0);
|
||||||
|
|
|
@ -1 +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:150%;font-size:11pt;margin-left:10px;margin-right:10px}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:40px}.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}}
|
@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}}
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of SQLite Integration.
|
* This file is a part of SQLite Integration.
|
||||||
*
|
*
|
||||||
|
* @package SQLite Integration
|
||||||
|
* @author Kojima Toshiyasu
|
||||||
*/
|
*/
|
||||||
@import url('./style.min.css');
|
@import url('./style.min.css');
|
||||||
@CHARSET "UTF-8";
|
@CHARSET "UTF-8";
|
||||||
|
|
|
@ -3,15 +3,20 @@
|
||||||
* This file defines DatabaseMaintenance class.
|
* This file defines DatabaseMaintenance class.
|
||||||
*
|
*
|
||||||
* When WordPress was upgraded from 3.5.x to 3.6, SQLite Integration couldn't manipulate
|
* When WordPress was upgraded from 3.5.x to 3.6, SQLite Integration couldn't manipulate
|
||||||
* dbDelta() function of WordPress. As a result, there are some tables whose default
|
* dbDelta() function of WordPress as expected. As a result, there are some tables whose
|
||||||
* values are missing.
|
* default values are missing.
|
||||||
*
|
*
|
||||||
* This class checks the table schemas and restore the default value if necessary.
|
|
||||||
* This file is for temporary use and will be removed or changed in the future release.
|
* This file is for temporary use and will be removed or changed in the future release.
|
||||||
*
|
*
|
||||||
* @package SQLite Integration
|
* @package SQLite Integration
|
||||||
* @author Kojima Toshiyasu
|
* @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 {
|
class DatabaseMaintenance {
|
||||||
/**
|
/**
|
||||||
* Method to check the table schemas.
|
* Method to check the table schemas.
|
||||||
|
|
|
@ -37,7 +37,7 @@ class SQLiteIntegrationDocument {
|
||||||
<div class="wrap" id="sqlite-admin-wrap">
|
<div class="wrap" id="sqlite-admin-wrap">
|
||||||
<h2><?php _e('Documentation', $domain); ?></h2>
|
<h2><?php _e('Documentation', $domain); ?></h2>
|
||||||
<p>
|
<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);?>
|
<?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>
|
||||||
<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);?>
|
<?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);?>
|
||||||
|
@ -76,7 +76,7 @@ class SQLiteIntegrationDocument {
|
||||||
<li><strong><?php _e('There are some plugins that you can\'t use. No way around.<br />', $domain);?></strong>
|
<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 "Plugin Compatibility/Incompatibility" section.', $domain);?></li>
|
<?php _e('Some plugins can\'t be activated or work properly. See the "Plugin Compatibility/Incompatibility" 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>
|
<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>
|
<?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>
|
</ol>
|
||||||
<p>
|
<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);?>
|
<?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);?>
|
||||||
|
|
|
@ -26,7 +26,7 @@ class PatchUtils {
|
||||||
} else {
|
} else {
|
||||||
if ($dir_handle = opendir(SQLitePatchDir)) {
|
if ($dir_handle = opendir(SQLitePatchDir)) {
|
||||||
while (($file_name = readdir($dir_handle)) !== false) {
|
while (($file_name = readdir($dir_handle)) !== false) {
|
||||||
if ($file_name == '.' || $file_name == '..')
|
if ($file_name == '.' || $file_name == '..' || $file_name == '.htaccess')
|
||||||
continue;
|
continue;
|
||||||
$patch_files[] = $file_name;
|
$patch_files[] = $file_name;
|
||||||
}
|
}
|
||||||
|
@ -148,31 +148,82 @@ class PatchUtils {
|
||||||
*
|
*
|
||||||
* It uploads a patch file to the server. You must have the permission to write to the
|
* 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
|
* temporary directory. If there isn't SQLitePatchDir, this method will create it and
|
||||||
* set the permission to 0705.
|
* set the permission to 0707.
|
||||||
*
|
*
|
||||||
* No return values.
|
* No return values.
|
||||||
*
|
*
|
||||||
|
* @return boolean
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function upload_file() {
|
private function upload_file() {
|
||||||
global $utils;
|
global $utils;
|
||||||
$domain = $utils->text_domain;
|
$domain = $utils->text_domain;
|
||||||
if (!file_exists(SQLitePatchDir) || !is_dir(SQLitePatchDir)) {
|
if (!file_exists(SQLitePatchDir) || !is_dir(SQLitePatchDir)) {
|
||||||
mkdir(SQLitePatchDir, 0705, true);
|
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'])) {
|
if (is_uploaded_file($_FILES['upfile']['tmp_name'])) {
|
||||||
if (move_uploaded_file($_FILES['upfile']['tmp_name'], SQLitePatchDir.'/'.$_FILES['upfile']['name'])) {
|
$file_full_path = SQLitePatchDir . '/' . $_FILES['upfile']['name'];
|
||||||
$message = __('File is uploaded', $domain);
|
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>';
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0644);
|
chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0606);
|
||||||
} else {
|
} else {
|
||||||
$message = __('File is not uploaded', $domain);
|
$message = __('File upload failed. Possible file upload attack.', $domain);
|
||||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$message = __('File is not selected', $domain);
|
$message = __('File is not selected', $domain);
|
||||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Method to display the patch utility page on the admin panel.
|
* Method to display the patch utility page on the admin panel.
|
||||||
|
@ -308,7 +359,8 @@ class PatchUtils {
|
||||||
wp_nonce_field('sqlitewordpress-plugin-patch-file-stats');
|
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="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="file" id="upload" name="upfile" size="60"/>
|
||||||
<input type="submit" name="upload" id="submit-upload" class="button" value="<?php _e('Upload', $domain)?>" />
|
<input type="submit" name="upload" id="submit-upload" class="button" value="<?php _e('Upload', $domain)?>" />
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -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",
|
"name":"Akismet",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -11,18 +25,46 @@
|
||||||
"class":"compatible"
|
"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",
|
"name":"Any Mobile Theme Switcher",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Batcache",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"BAW Manual Related Posts",
|
"name":"BAW Manual Related Posts",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"bbPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Better Delete Revision",
|
"name":"Better Delete Revision",
|
||||||
"compat":"No",
|
"compat":"No",
|
||||||
|
@ -37,6 +79,20 @@
|
||||||
"class":"incompatible"
|
"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",
|
"name":"Breadcrumb NavXT",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -55,6 +111,20 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"BuddyPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"BuddyPress Courseware",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Camera slideshow",
|
"name":"Camera slideshow",
|
||||||
"compat":"Needs Patch",
|
"compat":"Needs Patch",
|
||||||
|
@ -63,12 +133,40 @@
|
||||||
"class":"workaround"
|
"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",
|
"name":"Category Order and Taxonomy Terms Order",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"Contact Form 7",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -81,12 +179,61 @@
|
||||||
"class":"compatible"
|
"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",
|
"name":"Crayon Syntax Highlighter",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"DB Cache Reloaded Fix",
|
||||||
"compat":"Probably No",
|
"compat":"Probably No",
|
||||||
|
@ -112,12 +259,68 @@
|
||||||
"class":"compatible"
|
"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",
|
"name":"Dynamic To Top",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"FeedWordPress",
|
||||||
"compat":"Needs patch",
|
"compat":"Needs patch",
|
||||||
|
@ -126,12 +329,26 @@
|
||||||
"class":"workaround"
|
"class":"workaround"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"FlexiCache",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Google Analyticator",
|
"name":"Google Analyticator",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Google Analytics for WordPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Google Analytics Popular Posts",
|
"name":"Google Analytics Popular Posts",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -152,6 +369,13 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"HTTP Digest Authentication",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"HyperDB",
|
"name":"HyperDB",
|
||||||
"compat":"Probably No",
|
"compat":"Probably No",
|
||||||
|
@ -165,6 +389,13 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Jigoshop",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Ktai Style",
|
"name":"Ktai Style",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -177,18 +408,81 @@
|
||||||
"class":"compatible"
|
"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",
|
"name":"Mathjax Latex",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Members",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Members Category",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"MP6",
|
"name":"MP6",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"NewStatPress",
|
||||||
"compat":"Needs Patch",
|
"compat":"Needs Patch",
|
||||||
|
@ -199,12 +493,19 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"NextGEN Gallery",
|
"name":"NextGEN Gallery",
|
||||||
"compat":"Needs patch",
|
"compat":"Needs Patch",
|
||||||
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||||
"reason":"MySQL specific function",
|
"reason":"MySQL specific function",
|
||||||
"class":"workaround"
|
"class":"workaround"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"StatCounter - Free Real Time Visitor Stats",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Optimize Database after Deleting Revisions",
|
"name":"Optimize Database after Deleting Revisions",
|
||||||
"compat":"Probably No",
|
"compat":"Probably No",
|
||||||
|
@ -212,12 +513,61 @@
|
||||||
"class":"workaround"
|
"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",
|
"name":"Polylang",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"Redirection",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -236,6 +586,13 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"Safer Cookies",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Search Everything",
|
"name":"Search Everything",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -248,42 +605,203 @@
|
||||||
"class":"compatible"
|
"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",
|
"name":"SQLite Integration",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"StatPress",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Synchi",
|
"name":"Synchi",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"SysInfo",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"System information",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Theme-Check",
|
"name":"Theme-Check",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"Wordfence Security",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"WordPress Beta Tester",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"WordPress Importer",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"Wordpress Popular Posts",
|
||||||
"compat":"Needs Patch",
|
"compat":"Needs Patch",
|
||||||
|
@ -298,18 +816,123 @@
|
||||||
"class":"compatible"
|
"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",
|
"name":"WP Emmet",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"WP Multibyte Patch",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Online Store",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP-PageNavi",
|
"name":"WP-PageNavi",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
|
@ -334,24 +957,94 @@
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP Session Manager",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP Social Bookmarking Light",
|
"name":"WP Social Bookmarking Light",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP-Statistics",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP Super Cache",
|
"name":"WP Super Cache",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"class":"compatible"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"WP System Health",
|
||||||
|
"compat":"Checked",
|
||||||
|
"class":"compatible",
|
||||||
|
"informed":"Users' Information"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"WP Video Lightbox",
|
"name":"WP Video Lightbox",
|
||||||
"compat":"Checked",
|
"compat":"Checked",
|
||||||
"class":"compatible"
|
"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",
|
"name":"Wysija Newsletters",
|
||||||
"compat":"Needs Patch",
|
"compat":"Needs Patch",
|
||||||
|
|
|
@ -306,7 +306,11 @@ class SQLiteIntegrationUtils {
|
||||||
$compat = __('No', $domain);
|
$compat = __('No', $domain);
|
||||||
break;
|
break;
|
||||||
case 'Checked':
|
case 'Checked':
|
||||||
$compat = __('Checked', $domain);
|
if (!empty($plugin_info->informed) && stripos($plugin_info->informed, 'Users\' Information') !== false) {
|
||||||
|
$compat = __('Checked*', $domain);
|
||||||
|
} else {
|
||||||
|
$compat = __('Checked', $domain);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$compat = __('Not Checked', $domain);
|
$compat = __('Not Checked', $domain);
|
||||||
|
@ -416,6 +420,7 @@ class SQLiteIntegrationUtils {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function backup_db() {
|
private function backup_db() {
|
||||||
|
$domain = $this->text_domain;
|
||||||
$result = array();
|
$result = array();
|
||||||
$database_file = FQDB;
|
$database_file = FQDB;
|
||||||
$db_name = basename(FQDB);
|
$db_name = basename(FQDB);
|
||||||
|
@ -447,12 +452,13 @@ class SQLiteIntegrationUtils {
|
||||||
/**
|
/**
|
||||||
* Method to delete backup database file(s).
|
* Method to delete backup database file(s).
|
||||||
*
|
*
|
||||||
* @return boolean|string
|
* Users can delete multiple files at a time.
|
||||||
|
*
|
||||||
|
* @return false if file names aren't checked, empty array if failed, array of messages if succeeded.
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
private function delete_backup_db() {
|
private function delete_backup_db() {
|
||||||
global $utils;
|
$domain = $this->text_domain;
|
||||||
$domain = $utils->text_domain;
|
|
||||||
$file_names = array();
|
$file_names = array();
|
||||||
$results = array();
|
$results = array();
|
||||||
if (isset($_POST['backup_checked'])) {
|
if (isset($_POST['backup_checked'])) {
|
||||||
|
@ -471,6 +477,53 @@ class SQLiteIntegrationUtils {
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method to download a backup file.
|
||||||
|
*
|
||||||
|
* This method uses header() function, so we have to register this function using
|
||||||
|
* admin_init action hook. It must also be declared as public. We check HTTP_REFERER
|
||||||
|
* and input button name, and ,after that, wp_nonce. When the admin_init is executed
|
||||||
|
* it only returns true.
|
||||||
|
*
|
||||||
|
* The database file might be several hundred mega bytes, so we don't use readfile()
|
||||||
|
* but use fread() instead.
|
||||||
|
*
|
||||||
|
* Users can download one file at a time.
|
||||||
|
*
|
||||||
|
* @return 1 if the file name isn't checked, 2 if multiple files are checked, true if succeeded.
|
||||||
|
*/
|
||||||
|
static function download_backup_db() {
|
||||||
|
if (is_multisite()) {
|
||||||
|
$script_url = network_admin_url('settings.php?page=setting-file');
|
||||||
|
} else {
|
||||||
|
$script_url = admin_url('options-general.php?page=setting-file');
|
||||||
|
}
|
||||||
|
if (isset($_POST['download_backup_file']) && stripos($_SERVER['HTTP_REFERER'], $script_url) !== false) {
|
||||||
|
check_admin_referer('sqliteintegration-backup-manip-stats');
|
||||||
|
if (!isset($_POST['backup_checked'])) return 1;
|
||||||
|
$file_names = array();
|
||||||
|
$file_names = $_POST['backup_checked'];
|
||||||
|
if (count($file_names) != 1) return 2;
|
||||||
|
$file_name = $file_names[0];
|
||||||
|
$file_path = FQDBDIR . $file_name;
|
||||||
|
$download_file_name = get_bloginfo('name') . '_' . $file_name;
|
||||||
|
header('Pragma: public');
|
||||||
|
header('Cache-Control: must-revalidate,post-check=0,pre-check=0');
|
||||||
|
header('Content-Type: application/force-download');
|
||||||
|
header('Content-Type: application/octet-stream');
|
||||||
|
header('Content-Type: application/download');
|
||||||
|
header('Content-Disposition: attachment; filename='.$download_file_name.';');
|
||||||
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
header('Content-Length: '.filesize($file_path));
|
||||||
|
$fp = fopen($file_path, 'r');
|
||||||
|
while (!feof($fp)) {
|
||||||
|
echo fread($fp, 65536);
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Method to show Welcome page.
|
* Method to show Welcome page.
|
||||||
*
|
*
|
||||||
|
@ -705,6 +758,9 @@ class SQLiteIntegrationUtils {
|
||||||
<?php $this->show_plugins_info();?>
|
<?php $this->show_plugins_info();?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<p>
|
||||||
|
<?php _e('"Checked*" with an asterisk is from the users\' information. I didn\'t check myself yet. If you found any malfunctioning, please let me know.', $domain);?>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
}
|
}
|
||||||
|
@ -788,6 +844,24 @@ class SQLiteIntegrationUtils {
|
||||||
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
echo '<div id="message" class="updated fade">'.$message.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($_POST['download_backup_file'])) {
|
||||||
|
check_admin_referer('sqliteintegration-backup-manip-stats');
|
||||||
|
$message = '';
|
||||||
|
$result = self::download_backup_db();
|
||||||
|
if ($result !== true) {
|
||||||
|
switch($result) {
|
||||||
|
case 1:
|
||||||
|
$message = __('Please select backup file.', $domain);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$message = __('Please select one file at a time.', $domain);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
echo '<div id="message" class="updated fade">' . $message . '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isset($_GET['page']) && $_GET['page'] == 'setting-file') :?>
|
if (isset($_GET['page']) && $_GET['page'] == 'setting-file') :?>
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
<ul class="navi-menu">
|
<ul class="navi-menu">
|
||||||
|
@ -820,6 +894,9 @@ class SQLiteIntegrationUtils {
|
||||||
<p>
|
<p>
|
||||||
<?php _e('If you want to delete the file(s), check the file name and click the Delete button. You can check multiple files.', $domain);?>
|
<?php _e('If you want to delete the file(s), check the file name and click the Delete button. You can check multiple files.', $domain);?>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<?php _e('If you want to download a file, check the file name and click the Download button. Please check one file at a time.', $domain);?>
|
||||||
|
</p>
|
||||||
<?php $backup_files = $this->get_backup_files();?>
|
<?php $backup_files = $this->get_backup_files();?>
|
||||||
<form action="" method="post" id="delete-backup-form">
|
<form action="" method="post" id="delete-backup-form">
|
||||||
<?php if (function_exists('wp_nonce_field')) {
|
<?php if (function_exists('wp_nonce_field')) {
|
||||||
|
@ -829,7 +906,7 @@ class SQLiteIntegrationUtils {
|
||||||
<table class="widefat page fixed" id="backup-files">
|
<table class="widefat page fixed" id="backup-files">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="item"><?php _e('Delete', $domain);?></th>
|
<th class="item"><?php _e('Delete/Download', $domain);?></th>
|
||||||
<th data-sort='{"key":"name"}'><?php _e('Backup Files', $domain);?></th>
|
<th data-sort='{"key":"name"}'><?php _e('Backup Files', $domain);?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -847,7 +924,8 @@ class SQLiteIntegrationUtils {
|
||||||
<p>
|
<p>
|
||||||
<input type="submit" name="backup_db" class="button-primary" value="<?php _e('Backup', $domain);?>" onclick="return confirm('<?php _e('Are you sure to make a backup file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
<input type="submit" name="backup_db" class="button-primary" value="<?php _e('Backup', $domain);?>" onclick="return confirm('<?php _e('Are you sure to make a backup file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||||
<input type="submit" name="delete_backup_files" class="button-primary" value="<?php _e('Delete file', $domain);?>" onclick="return confirm('<?php _e('Are you sure to delete backup file(s)?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
<input type="submit" name="delete_backup_files" class="button-primary" value="<?php _e('Delete file', $domain);?>" onclick="return confirm('<?php _e('Are you sure to delete backup file(s)?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||||
</p>
|
<input type="submit" name="download_backup_file" class="button-primary" value="<?php _e('Download', $domain);?>" onclick="return confirm('<?php _e('Are you sure to download backup file?\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')"/>
|
||||||
|
</p>
|
||||||
</form>
|
</form>
|
||||||
<h3><?php _e('SQLite Integration Error Log', $domain);?></h3>
|
<h3><?php _e('SQLite Integration Error Log', $domain);?></h3>
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in New Issue