The current code checks, if the provided "domain" begins with http:// or https:// -- and prepends "http://" if it does not.
I wish, it made no such check at all -- garbage in, garbage out. But, if a check is needed, I propose it be relaxed -- don't modify user's input, if the entered string contains "://" anywhere in it.
This allows, for example, a URL like file:/// -- which is fantastically faster than downloading files from a web-server (even from localhost). Other obvious alternatives may be rsync://, or ssh:// -- or whatever else the local php installation is prepared to handle.
I personally used file:/// -- and I wish, the module had more shortcuts for that fairly common case, when the Drupal and the phpBB versions of a site are hosted on the same box.
This would also resolve the Phpbb files location bug issue, BTW.
--- phpbb2drupal/phpbb2drupal.pages.inc.orig 2013-02-04 11:56:17.000000000 -0500
+++ phpbb2drupal/phpbb2drupal.pages.inc 2014-01-24 22:58:55.000000000 -0500
@@ -297,5 +297,5 @@
}
- if (drupal_strlen($domain) > 0 && !preg_match('/^http(s)?:\/\//i', $domain)) {
+ if (drupal_strlen($domain) > 0 && !preg_match('/:\/\//i', $domain)) {
$domain = "http://{$domain}";
}
Comments
Comment #1
unitedwallabies CreditAttribution: unitedwallabies commentedOh, and, in particular, the file-importing process ought to check, if a particular file is already present in the destination directory -- and quietly skip the download if so.
This would allow people to, for example, rsync the entire directories locally (much faster, than fetching one file at a time via HTTP) ahead of importing.