Skip to content
This repository has been archived by the owner on Mar 11, 2018. It is now read-only.

Commit

Permalink
db fixes to make v4.0.0 run on MAMP
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Stewart committed Oct 27, 2014
1 parent 029aa1b commit f96d36a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions wp-content/db.php
Expand Up @@ -10,9 +10,9 @@
function test_localhosts( ) {
/* DB URL is set with SetEnv in Apache https://github.com/mhoofman/wordpress-heroku#linux-or-manual-apache-config */

if (preg_match('/localhost/',$_SERVER['DATABASE_URL'])) {
if (preg_match('/localhost/',$_ENV['DATABASE_URL'])) {
preg_match('/(.*)\/wp-.*\/(\w*\.php)+$/', $_SERVER['REQUEST_URI'], $path);
return ("http://" . $_SERVER['SERVER_ADDR'] . $path[1]);
return ("http://" . $_SERVER['HTTP_HOST'] . $path[1]);
}

else return false; // act as normal; will pull main site info from db
Expand Down Expand Up @@ -43,6 +43,10 @@ function test_localhosts( ) {
// change this to true
define( 'PG4WP_INSECURE', false);

/** use ext mysql needs to be set when running with MAMP */
if(test_localhosts())
define('WP_USE_EXT_MYSQL', true);

// This defines the directory where PG4WP files are loaded from
// 2 places checked : wp-content and wp-content/plugins
if( file_exists( ABSPATH.'/wp-content/pg4wp'))
Expand Down

0 comments on commit f96d36a

Please sign in to comment.