function replication_get_url_parts in Replication 8.2
Same name and namespace in other branches
- 8 replication.drush.inc \replication_get_url_parts()
Returns url parts (host, port, path, user and pass).
Parameters
$url:
bool $credentials:
Return value
array
1 call to replication_get_url_parts()
- drush_replication_active in ./
replication.drush.inc - Implements drush_hook_COMMAND().
File
- ./
replication.drush.inc, line 264 - Drush integration for the replication module.
Code
function replication_get_url_parts($url, $credentials = FALSE) {
$url_parts = parse_url($url);
$options = [
'host' => $url_parts['host'],
'port' => $url_parts['port'],
];
$path = trim($url_parts['path'], '/');
if ($path != '') {
$options['path'] = $path;
}
if ($credentials) {
$options['user'] = $url_parts['user'] ? $url_parts['user'] : NULL;
$options['password'] = $url_parts['pass'] ? $url_parts['pass'] : NULL;
}
return $options;
}