This is firs of a serie of patches adding support for some i18n related features.

This patch:
- moves drupal_goto to bootstrap.inc, making it possible to use it from the module_init, even for cached pages
- moves url() to bootstrap.inc, as it is needed by drupal_goto, and includes a check for not to resolve path aliases when called from bootstrap (it is not needed and would require including lot more stuff from common.inc)
- adds a simple hook to call 'i18n_url_rewrite' from the function 'url()' , which allows outgoing urls to be rewrited, so some additional info can be placed in the path.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

I like this approach. First of all, it moves only a very little code from common to bootstrap. Second, it does not introduce new init mechanisms like all previous i18n revisions did. Third, the penalty for the code in the case i18n is off, is incredibly small -- one if per url() call.

moshe weitzman’s picture

Instead of writing a 3 line if() statement, you might use module_invoke('i18n_url_rewrite', $path). that goes for your other patches as well. improves readability slightly.

chx’s picture

moshe, I tried and failed. This early you can not call module_invoke.

chx’s picture

FileSize
8.68 KB

Upgrade to HEAD.

chx’s picture

Let's move drupal_goto and url to bootstrap and also add a conditional call to i18n. Why i18n and not a full hook_url_rewrite? Things would get ugly here 'cos of the ordering.

i18n uses this patch to redirect home page based on language.

chx’s picture

FileSize
10.52 KB

oopsie, patch.

moshe weitzman’s picture

ok with me. a few new functions in bootstrap doesn't materially increase php parse time.

Jose Reyero’s picture

Status: Needs review » Closed (fixed)

While I think drupal_goto should be in bootstrap.inc, this is not that important anymore, as with the latest changes to common.inc, we can do a plain include.

Also, for the url rewrite, there's some other issue: http://drupal.org/node/29030

So, closing this one for now