mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-08-02 02:54:26 +02:00
Merge remote-tracking branch 'origin/v3' into mb-fix-auto-increment
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
logs
|
logs
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
|
.php-cs-fixer.cache
|
@@ -31,7 +31,7 @@ $GLOBALS['pg4wp_conn'] = false;
|
|||||||
*/
|
*/
|
||||||
function wpsqli_init()
|
function wpsqli_init()
|
||||||
{
|
{
|
||||||
return new class {
|
return new class () {
|
||||||
public $sslkey;
|
public $sslkey;
|
||||||
public $sslcert;
|
public $sslcert;
|
||||||
public $sslca;
|
public $sslca;
|
||||||
@@ -101,7 +101,7 @@ function wpsqli_real_connect(&$connection, $hostname = null, $username = null, $
|
|||||||
|
|
||||||
// Must connect to a specific database unlike MySQL
|
// Must connect to a specific database unlike MySQL
|
||||||
$dbname = defined('DB_NAME') && DB_NAME ? DB_NAME : $database;
|
$dbname = defined('DB_NAME') && DB_NAME ? DB_NAME : $database;
|
||||||
$pg_connstr = $GLOBALS['pg4wp_connstr'] . ' dbname=' . $database;
|
$pg_connstr = $GLOBALS['pg4wp_connstr'] . ' dbname=' . $dbname;
|
||||||
$GLOBALS['pg4wp_conn'] = $connection = pg_connect($pg_connstr);
|
$GLOBALS['pg4wp_conn'] = $connection = pg_connect($pg_connstr);
|
||||||
|
|
||||||
return $connection;
|
return $connection;
|
||||||
|
@@ -99,7 +99,7 @@ class InsertSQLRewriter extends AbstractSQLRewriter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct the PostgreSQL ON CONFLICT DO UPDATE section
|
// Construct the PostgreSQL ON CONFLICT DO UPDATE section
|
||||||
$updateSection = implode(', ', array_map(fn($col) => "$col = EXCLUDED.$col", $updateCols));
|
$updateSection = implode(', ', array_map(fn ($col) => "$col = EXCLUDED.$col", $updateCols));
|
||||||
|
|
||||||
// Construct the PostgreSQL query
|
// Construct the PostgreSQL query
|
||||||
$postgresSQL = sprintf('%s %s ON CONFLICT (%s) DO UPDATE SET %s', $tableSection, $valuesSection, $primaryKey, $updateSection);
|
$postgresSQL = sprintf('%s %s ON CONFLICT (%s) DO UPDATE SET %s', $tableSection, $valuesSection, $primaryKey, $updateSection);
|
||||||
|
@@ -7,7 +7,7 @@ PostgreSQL for WordPress (PG4WP) gives you the possibility to install and use Wo
|
|||||||
#### Use Cases
|
#### Use Cases
|
||||||
|
|
||||||
- Run Wordpress on your Existing Postgres Cluster
|
- Run Wordpress on your Existing Postgres Cluster
|
||||||
- Run Wordpress with Georeplication with a Multi-Active Postgres instalation such as [EDB Postgres Distributed](https://www.enterprisedb.com/products/edb-postgres-distributed), or [CockroachDB](https://www.cockroachlabs.com/serverless/) for a [highly available](https://www.cockroachlabs.com/blog/brief-history-high-availability/) and resiliant Wordpress Infrastructure
|
- Run Wordpress with Georeplication with a Multi-Active Postgres instalation such as [EDB Postgres Distributed](https://www.enterprisedb.com/products/edb-postgres-distributed), or [CockroachDB](https://www.cockroachlabs.com/serverless/) for a [highly available](https://www.cockroachlabs.com/blog/brief-history-high-availability/) and resilient Wordpress Infrastructure
|
||||||
|
|
||||||
### Design
|
### Design
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
if (!defined('ABSPATH')) {
|
if (!defined('ABSPATH')) {
|
||||||
@@ -35,7 +37,7 @@ final class parseTest extends TestCase
|
|||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$wpdb = new class() {
|
$wpdb = new class () {
|
||||||
public $options = "wp_options";
|
public $options = "wp_options";
|
||||||
public $categories = "wp_categories";
|
public $categories = "wp_categories";
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
if (!defined('ABSPATH')) {
|
if (!defined('ABSPATH')) {
|
||||||
@@ -166,4 +168,16 @@ final class rewriteTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
global $wpdb;
|
||||||
|
$wpdb = new class () {
|
||||||
|
public $categories = "wp_categories";
|
||||||
|
public $comments = "wp_comments";
|
||||||
|
public $prefix = "wp_";
|
||||||
|
public $options = "wp_options";
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
if (!defined('ABSPATH')) {
|
if (!defined('ABSPATH')) {
|
||||||
@@ -13,7 +15,7 @@ require_once __DIR__ . "/../pg4wp/db.php";
|
|||||||
|
|
||||||
final class verifyAgainstStubsTest extends TestCase
|
final class verifyAgainstStubsTest extends TestCase
|
||||||
{
|
{
|
||||||
const STUBS_DIRECTORY = __DIR__ . '/stubs';
|
public const STUBS_DIRECTORY = __DIR__ . '/stubs';
|
||||||
|
|
||||||
public function test_verify_against_stubs()
|
public function test_verify_against_stubs()
|
||||||
{
|
{
|
||||||
@@ -27,7 +29,7 @@ final class verifyAgainstStubsTest extends TestCase
|
|||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$wpdb = new class() {
|
$wpdb = new class () {
|
||||||
public $categories = "wp_categories";
|
public $categories = "wp_categories";
|
||||||
public $comments = "wp_comments";
|
public $comments = "wp_comments";
|
||||||
public $prefix = "wp_";
|
public $prefix = "wp_";
|
||||||
|
Reference in New Issue
Block a user