- Fixes issue with ucwords() function on older PHP versions
- Updates Supervisor/Daemon to strip port from site_url() when it's running on localhost inside a virtual machine :)
This commit is contained in:
@@ -85,7 +85,7 @@ class Daemon {
|
||||
'user-agent' => 'MailPoet (www.mailpoet.com)'
|
||||
);
|
||||
wp_remote_get(
|
||||
site_url() .
|
||||
Supervisor::getSiteUrl() .
|
||||
'/?mailpoet-api§ion=queue&action=run&payload=' . urlencode($payload),
|
||||
$args
|
||||
);
|
||||
|
@@ -52,7 +52,7 @@ class Supervisor {
|
||||
)
|
||||
);
|
||||
wp_remote_get(
|
||||
site_url() .
|
||||
self::getSiteUrl() .
|
||||
'/?mailpoet-api§ion=queue&action=start&payload=' .
|
||||
urlencode($payload),
|
||||
$args
|
||||
@@ -87,4 +87,13 @@ class Supervisor {
|
||||
throw new \Exception('Database has not been configured.');
|
||||
}
|
||||
}
|
||||
|
||||
static function getSiteUrl() {
|
||||
if(!preg_match('!:/!', site_url())) return site_url();
|
||||
preg_match('!http://(?P<host>.*?):(?P<port>\d+)!', site_url(), $server);
|
||||
$fp = fsockopen($server['host'], $server['port'], $errno, $errstr, 1);
|
||||
return ($fp) ?
|
||||
site_url() :
|
||||
preg_replace('/(?=:\d+):\d+/', '$1', site_url());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user