The required handling code wasn't loaded in some cases when a plugin created his own tables in the database

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@418968 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2011-08-03 21:30:21 +00:00
parent 725baa8cfb
commit 1a05e62dac
3 changed files with 7 additions and 6 deletions

View File

@@ -16,10 +16,6 @@
if ( !extension_loaded('pgsql') )
wp_die( 'Your PHP installation appears to be missing the PostgreSQL extension which is required by WordPress with PG4WP.' );
// Load up upgrade and install functions as required
if( defined( 'WP_INSTALLING') && WP_INSTALLING)
require_once( PG4WP_ROOT.'/driver_pgsql_install.php');
// Initializing some variables
$GLOBALS['pg4wp_result'] = 0;
$GLOBALS['pg4wp_numrows'] = '10';
@@ -283,8 +279,12 @@
$logto = 'OPTIMIZE';
$sql = str_replace( 'OPTIMIZE TABLE', 'VACUUM', $sql);
}
elseif( defined('WP_INSTALLING') && WP_INSTALLING)
// Load up upgrade and install functions as required
elseif( 0 === strpos( $sql, 'CREATE') || (defined('WP_INSTALLING') && WP_INSTALLING))
{
require_once( PG4WP_ROOT.'/driver_pgsql_install.php');
$sql = pg4wp_installing( $sql, $logto);
}
// WP 2.9.1 uses a comparison where text data is not quoted
$pattern = '/AND meta_value = (-?\d+)/';

View File

@@ -148,7 +148,7 @@ WHERE pg_class.relname='$table_name' AND pg_attribute.attnum>=1 AND NOT pg_attri
elseif( 0 === strpos($sql, 'CREATE TABLE'))
{
$logto = 'CREATE';
$pattern = '/CREATE TABLE (\w+)/';
$pattern = '/CREATE TABLE [`]?(\w+)[`]?/';
preg_match($pattern, $sql, $matches);
$table = $matches[1];

View File

@@ -51,6 +51,7 @@ There is no screenshot for this plugin
== Changelog ==
= 1.2.0b1 =
* Somewhat improved Wordpress plugins compatibility
* Added 'PG4WP_INSECURE' parameter for future use
* Split 'db.php' to be just some kind of loader for PG4WP to ease upgrading
* Improved Akismet compatibility