diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index 8f4eff2..e448b15 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -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+)/'; diff --git a/pg4wp/driver_pgsql_install.php b/pg4wp/driver_pgsql_install.php index 2c02eae..75b2fe2 100644 --- a/pg4wp/driver_pgsql_install.php +++ b/pg4wp/driver_pgsql_install.php @@ -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]; diff --git a/readme.txt b/readme.txt index b47fcce..d7db692 100644 --- a/readme.txt +++ b/readme.txt @@ -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