[development] A core commit without community involvement...

Darrel O'Pry dopry at thing.net
Mon Nov 28 22:18:33 UTC 2005


On Sat, 2005-11-26 at 16:23 -0500, Morbus Iff wrote:
> I just wanted to get the *community's* opinion on the following Issue, 
> which arose when a change made it into core WITHOUT a formal Issue, 
> Patch, Comment, Commit workflow:
> 
>   http://drupal.org/node/38841
> 
> I, and others, think it's a step backwards.
> Would others care to comment?
> 

I'm not very aware of the workflow, but this topic has me thinking about
a problem that came up a few weeks ago regarding secure user login. The
issue was switching protocol between http and https. Offhand user.module
and ecommerce.module could take advantage of that functionality in core.

I proposed adding an SSL flag to url/l, but that  seemed to meet with
some resistance... 

Since both issues involve drupal's existing $base_url and how its
handled... I was interested in knowing if my time would be wasted by try
to push a patch that changes settings.php to use a format like...


this could be put in settings.php 

$url['base'] = $base_url
$url['ssl'] = https://www.example.com/
$url['ecommerce_ssl'] = https://sharedssl.example.com/example.com/

bootstrap.inc
+ $url_name = (isset($_SESSION['default_url'])) ? '
$_SESSION['default_url'] : 'base';

+url_set_active($url_name);

....................................................................

The in common.inc add

function url_set_active($url_name = 'base') {
	global $active_url
	if (array_key_exists($url[$url_name]) {
		$active_url = $url[$urlname];
	}
	else {
		//maybe some sort of error instead.
		//but this should at least keep things functioning.
		$active_url = $url['base'];
        }
}

....

and for 
function url(...)
- 	global $base_url
+	global $active_url

-       $base = ($absolute ? $base_url .'/' : '');
+       $base = ($absolute ? $active_url .'/' : '');



.....................................................................

I can roll the idea as a patch against whatever if it seems like
something that would fit in core. 

It would give module developers a familiar method for switching
base_urls(see db_set_active), will not change any existing api function
calls, can be made backwards compatible to hide it from end users. I
also think its performance impact is minimal with only a few assignments
and smidgeon of memory for a few more globals. With an option to store
the url array key in the session it enables users the option to switch
their browsing context between http and https....

any suggestions are welcome.







More information about the development mailing list