Added a new user defined function version() and a utility for displaying column information. Fixed for the plugin that uses SHOW VARIABLES query. Added the message for other server than Apache.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@772930 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
faff964bcd
commit
c906f23f46
|
@ -56,7 +56,8 @@ class PDOSQLiteUDFS {
|
|||
'inet_ntoa' => 'inet_ntoa',
|
||||
'inet_aton' => 'inet_aton',
|
||||
'datediff' => 'datediff',
|
||||
'locate' => 'locate'
|
||||
'locate' => 'locate',
|
||||
'version' => 'version'
|
||||
);
|
||||
|
||||
public function month($field){
|
||||
|
@ -384,5 +385,12 @@ class PDOSQLiteUDFS {
|
|||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function version() {
|
||||
global $required_mysql_version;
|
||||
return $required_mysql_version;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -57,7 +57,8 @@ class PDOSQLiteUDFS {
|
|||
'inet_ntoa' => 'inet_ntoa',
|
||||
'inet_aton' => 'inet_aton',
|
||||
'datediff' => 'datediff',
|
||||
'locate' => 'locate'
|
||||
'locate' => 'locate',
|
||||
'version' => 'version'
|
||||
);
|
||||
|
||||
public function month($field){
|
||||
|
@ -358,5 +359,12 @@ class PDOSQLiteUDFS {
|
|||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function version() {
|
||||
global $required_mysql_version;
|
||||
return $required_mysql_version;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -57,6 +57,13 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated =
|
|||
|
||||
wp_cache_flush();
|
||||
|
||||
if ((isset($_SERVER['SERVER_NAME']) && stripos('apache', $_SERVER['SERVER_NAME']) === false) || (isset($_SERVER['SERVER_SIGNATURE']) && stripos('apache', $_SERVER['SERVER_SIGNATURE']) === false)) {
|
||||
$server_message = sprintf('Your webserver doesn\'t seem to be Apache. So the database directory access restriction by the .htaccess file may not function. We strongly recommend that you should restrict the access to the directory %s in some other way.', FQDBDIR);
|
||||
echo '<div style="position: absolute; margin-top: 250px; width: 700px; border: .5px dashed rgb(0, 0, 0);"><p style="margin: 10px;">';
|
||||
echo $server_message;
|
||||
echo '</p></div>';
|
||||
}
|
||||
|
||||
return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
|
||||
}
|
||||
?>
|
|
@ -112,7 +112,7 @@ class PDOEngine extends PDO {
|
|||
global $wpdb;
|
||||
$u = umask(0000);
|
||||
if (!is_dir(FQDBDIR)) {
|
||||
if (!@mkdir(FQDBDIR, 0777, true)) {
|
||||
if (!@mkdir(FQDBDIR, 0707, true)) {
|
||||
umask($u);
|
||||
$message = 'Unable to create the required directory! Please check your server settings.';
|
||||
echo $message;
|
||||
|
@ -706,7 +706,11 @@ class PDOEngine extends PDO {
|
|||
$value = str_replace("'", '', $match[1]);
|
||||
$dummy_data['Variable_name'] = trim($value);
|
||||
// this is set for Wordfence Security Plugin
|
||||
if ($value == 'max_allowed_packet') $dummy_data['Value'] = 1047552;
|
||||
if ($value == 'max_allowed_packet') {
|
||||
$dummy_data['Value'] = 1047552;
|
||||
} else {
|
||||
$dummy_data['Value'] = '';
|
||||
}
|
||||
}
|
||||
$_results[] = new ObjectArray($dummy_data);
|
||||
$this->results = $_results;
|
||||
|
|
|
@ -17,13 +17,12 @@ class DatabaseMaintenance {
|
|||
'comment_author_email' => '\'\'',
|
||||
'comment_author_url' => '\'\'',
|
||||
'comment_author_IP' => '\'\'',
|
||||
'comment_date' => '\'0000-00-00 00:00:00\'',
|
||||
'comment_date_gmt' => '\'0000-00-00 00:00:00\'',
|
||||
'comment_date' => '\'0000-00-00 00:00:00\'',
|
||||
'comment_karma' => '\'0\'',
|
||||
'comment_approved' => '\'1\'',
|
||||
'comment_agent' => '\'\'',
|
||||
'comment_type' => '\'\'',
|
||||
'comment_type' => '\'\'',
|
||||
'comment_parent' => '\'0\'',
|
||||
'user_id' => '\'0\''
|
||||
),
|
||||
|
@ -50,15 +49,15 @@ class DatabaseMaintenance {
|
|||
),
|
||||
$wpdb->prefix.'posts' => array(
|
||||
'post_author' => '\'0\'',
|
||||
'post_date' => '\'0000-00-00 00:00:00\'',
|
||||
'post_date_gmt' => '\'0000-00-00 00:00:00\'',
|
||||
'post_date' => '\'0000-00-00 00:00:00\'',
|
||||
'post_status' => '\'publish\'',
|
||||
'comment_status' => '\'open\'',
|
||||
'ping_status' => '\'open\'',
|
||||
'post_password' => '\'\'',
|
||||
'post_name' => '\'\'',
|
||||
'post_modified' => '\'0000-00-00 00:00:00\'',
|
||||
'post_modified_gmt' => '\'0000-00-00 00:00:00\'',
|
||||
'post_modified' => '\'0000-00-00 00:00:00\'',
|
||||
'post_parent' => '\'0\'',
|
||||
'guid' => '\'\'',
|
||||
'menu_order' => '\'0\'',
|
||||
|
@ -90,7 +89,6 @@ class DatabaseMaintenance {
|
|||
'user_status' => '\'0\'',
|
||||
'display_name' => '\'\'',
|
||||
// for network install
|
||||
'user_login' => '\'\'',
|
||||
'spam' => '\'0\'',
|
||||
'deleted' => '\'0\''
|
||||
),
|
||||
|
@ -345,6 +343,23 @@ class DatabaseMaintenance {
|
|||
}
|
||||
}
|
||||
|
||||
private function show_columns() {
|
||||
global $wpdb, $utils;
|
||||
$domain = $utils->text_domain;
|
||||
$tables = $wpdb->tables('all');
|
||||
if (!isset($_POST['table'])) {
|
||||
$message = __('Table name is not selected.', $domain);
|
||||
return $message;
|
||||
} elseif (!in_array($_POST['table'], $tables)) {
|
||||
$message = __('There\'s no such table', $domain);
|
||||
return $message;
|
||||
} else {
|
||||
$table_name = $_POST['table'];
|
||||
$results = $wpdb->get_results("SHOW COLUMNS FROM $table_name");
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
||||
private function maintenance_backup() {
|
||||
$result = array();
|
||||
$database_file = FQDB;
|
||||
|
@ -420,6 +435,24 @@ class DatabaseMaintenance {
|
|||
?>
|
||||
<input type="submit" name="sanity-check" class="button-primary" value="<?php _e('Sanity Check', $domain);?>" onclick="return confirm('<?php _e('Are you sure to check the database? This will take some time.\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||
<input type="submit" name="do-fix-database" class="button-primary" value="<?php _e('Fix database', $domain);?>" onclick="return confirm('<?php _e('Are you sure to do fix the database? This will take some time.\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||
</form>
|
||||
<h3><?php _e('Columns Information', $domain);?></h3>
|
||||
<p>
|
||||
<?php _e('Select a table name and click "Display Columns" button, and you\'ll see the column property of that table. This information is for debug use.', $domain);?>
|
||||
</p>
|
||||
<form action="" method="post">
|
||||
<?php
|
||||
if (function_exists('wp_nonce_field')) {
|
||||
wp_nonce_field('sqliteintegration-database-manip-stats');
|
||||
}
|
||||
?>
|
||||
<label for="table"/>Table Name: </label>
|
||||
<select name="table" id="table">
|
||||
<?php foreach ($wp_tables as $table) :?>
|
||||
<option value="<?php echo $table;?>"><?php echo $table;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<input type="submit" name="show-columns" class="button-secondary" value="<?php _e('Display Columns', $domain);?>" onclick="return confirm('<?php _e('Display columns in the selected table.\n\nClick [Cancel] to stop, [OK] to continue.', $domain);?>')" />
|
||||
</form>
|
||||
</div>
|
||||
<?php endif;
|
||||
|
@ -479,6 +512,38 @@ class DatabaseMaintenance {
|
|||
echo '</div>';
|
||||
}
|
||||
}
|
||||
if (isset($_POST['show-columns'])) {
|
||||
check_admin_referer('sqliteintegration-database-manip-stats');
|
||||
if (is_multisite() && !current_user_can('manage_network_options')) {
|
||||
die(__('You are not allowed to do this operation!', $domain));
|
||||
} elseif (!current_user_can('manage_options')) {
|
||||
die(__('You are not allowed to do this operation!', $domain));
|
||||
}
|
||||
$results = $this->show_columns();
|
||||
if (is_array($results)) {
|
||||
$title = '<h3>'. sprintf(__('Columns In %s', $domain), $_POST['table']) . '</h3>';
|
||||
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||
echo $title;
|
||||
echo '<table><thead><tr><th>Column</th><th>Type</th><th>Null</th><th>Default</th></tr></thead>';
|
||||
echo '<tbody>';
|
||||
foreach ($results as $column) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $column->Field . '</td>';
|
||||
echo '<td>' . $column->Type . '</td>';
|
||||
echo '<td>' . $column->Null . '</td>';
|
||||
echo '<td>' . $column->Default . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody></table></div>';
|
||||
} else {
|
||||
$title = '<h3>'. __('Columns Info', $domain) . '</h3>';
|
||||
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||
echo $title;
|
||||
echo '<ul>';
|
||||
echo $results;
|
||||
echo '</ul></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -120,8 +120,10 @@
|
|||
|
||||
{
|
||||
"name":"FeedWordPress",
|
||||
"compat":"Checked",
|
||||
"class":"compatible"
|
||||
"compat":"Needs patch",
|
||||
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||
"reason":"MySQL specific function",
|
||||
"class":"workaround"
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -183,6 +185,14 @@
|
|||
"class":"workaround"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"NextGEN Gallery",
|
||||
"compat":"Needs patch",
|
||||
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||
"reason":"MySQL specific function",
|
||||
"class":"workaround"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"Optimize Database after Deleting Revisions",
|
||||
"compat":"Probably No",
|
||||
|
@ -264,8 +274,10 @@
|
|||
|
||||
{
|
||||
"name":"Wordpress Popular Posts",
|
||||
"compat":"Checked",
|
||||
"class":"compatible"
|
||||
"compat":"Needs patch",
|
||||
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||
"reason":"MySQL specific query",
|
||||
"class":"workaround"
|
||||
},
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue