2009-07-15 14:07:44 +00:00
|
|
|
<?php
|
2010-02-16 22:18:56 +00:00
|
|
|
/*
|
|
|
|
|
Plugin Name: PostgreSQL for WordPress (PG4WP)
|
2023-11-07 15:29:37 -08:00
|
|
|
Plugin URI: https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress
|
|
|
|
|
Description: PG4WP is a special plugin enabling WordPress to use a PostgreSQL database.
|
2023-11-08 22:48:27 -08:00
|
|
|
Version: v3.0.0
|
2023-11-07 15:29:37 -08:00
|
|
|
Author: PostgreSQL-For-Wordpress
|
|
|
|
|
Author URI: https://github.com/PostgreSQL-For-Wordpress
|
2010-02-16 22:18:56 +00:00
|
|
|
License: GPLv2 or newer.
|
|
|
|
|
*/
|
2011-08-02 23:27:36 +00:00
|
|
|
|
2023-10-28 02:43:59 -07:00
|
|
|
// Ensure we only load this config once
|
|
|
|
|
if(!defined('PG4WP_ROOT')) {
|
2009-07-15 14:07:44 +00:00
|
|
|
|
2023-10-28 02:43:59 -07:00
|
|
|
// You can choose the driver to load here
|
|
|
|
|
if (!defined('DB_DRIVER')) {
|
2023-10-30 09:27:19 -07:00
|
|
|
define('DB_DRIVER', 'pgsql');
|
2023-10-28 02:43:59 -07:00
|
|
|
}
|
2010-01-07 23:36:15 +00:00
|
|
|
|
2023-10-28 02:43:59 -07:00
|
|
|
// Set this to 'true' and check that `pg4wp` is writable if you want debug logs to be written
|
|
|
|
|
if (!defined('PG4WP_DEBUG')) {
|
|
|
|
|
define('PG4WP_DEBUG', false);
|
|
|
|
|
}
|
2011-08-01 21:43:06 +00:00
|
|
|
|
2023-10-28 02:43:59 -07:00
|
|
|
if (!defined('PG4WP_LOG_ERRORS')) {
|
|
|
|
|
// If you just want to log queries that generate errors, leave PG4WP_DEBUG to "false"
|
|
|
|
|
// and set this to true
|
|
|
|
|
define('PG4WP_LOG_ERRORS', true);
|
|
|
|
|
}
|
2011-08-01 21:43:06 +00:00
|
|
|
|
2023-10-28 02:43:59 -07:00
|
|
|
// This defines the directory where PG4WP files are loaded from
|
|
|
|
|
// 3 places checked : wp-content, wp-content/plugins and the base directory
|
2023-11-07 15:26:03 -08:00
|
|
|
if(file_exists(ABSPATH . 'wp-content/pg4wp')) {
|
|
|
|
|
define('PG4WP_ROOT', ABSPATH . 'wp-content/pg4wp');
|
|
|
|
|
} elseif(file_exists(ABSPATH . 'wp-content/plugins/pg4wp')) {
|
|
|
|
|
define('PG4WP_ROOT', ABSPATH . 'wp-content/plugins/pg4wp');
|
|
|
|
|
} elseif(file_exists(ABSPATH . 'pg4wp')) {
|
|
|
|
|
define('PG4WP_ROOT', ABSPATH . 'pg4wp');
|
2023-10-28 02:43:59 -07:00
|
|
|
} else {
|
|
|
|
|
die('PG4WP file directory not found');
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-07 15:26:03 -08:00
|
|
|
// Logs are put in the pg4wp directory
|
2023-11-07 15:29:37 -08:00
|
|
|
if (!defined('PG4WP_LOG')) {
|
2023-11-07 15:26:03 -08:00
|
|
|
define('PG4WP_LOG', PG4WP_ROOT . '/logs/');
|
|
|
|
|
}
|
|
|
|
|
// Check if the logs directory is needed and exists or create it if possible
|
2023-11-07 15:29:37 -08:00
|
|
|
if((PG4WP_DEBUG || PG4WP_LOG_ERRORS) && !file_exists(PG4WP_LOG) && is_writable(dirname(PG4WP_LOG))) {
|
2023-11-07 15:26:03 -08:00
|
|
|
mkdir(PG4WP_LOG);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-28 02:43:59 -07:00
|
|
|
// Here happens all the magic
|
|
|
|
|
require_once(PG4WP_ROOT . '/core.php');
|
2011-08-02 23:27:36 +00:00
|
|
|
} // Protection against multiple loading
|