From drupal_is_front_page():

 $is_front_page = ($_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')));

Couldn't we store the normal path in the variable in the first place? I cannot see any use case where you would like the variable to contain a path alias.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Active » Needs review
FileSize
3.62 KB

We normalize menu paths on saving but display aliases, so why not do the same here.

Status: Needs review » Needs work

The last submitted patch failed testing.

Damien Tournoud’s picture

+++ modules/system/system.admin.inc	25 Oct 2009 03:50:58 -0000
@@ -1313,7 +1313,7 @@ function system_site_information_setting
-    '#default_value' => 'node',
+    '#default_value' => drupal_get_path_alias('node'),

site_frontpage is really an internal path. There is no need to try to convert it to an external path here (plus this will only work for the default value, not for the variable value).

I'm on crack. Are you, too?

Dave Reid’s picture

Yes, I know, but this is only for display purposes. For instance if the user has set an alias for the node path as 'frontpage' they'll see 'frontpage' here. I'm pretty sure this is how we handle menu link paths as well in the interface. If not, we can toss it out.

Damien Tournoud’s picture

@Dave: your code only apply to the default value of the variable. The value of the variable itself is automatically loaded by system_settings_form().

Dave Reid’s picture

Damn. Wish we could exclude an individual elements from the automatic default loading.

sun’s picture

Issue tags: +Performance
sun’s picture

Assigned: Unassigned » sun
Status: Needs work » Needs review
FileSize
2.99 KB

What's left?

sun’s picture

There are times when we simply can't rely on magic.

If this helper functionality doesn't support it, then we need to go back to old approaches.

Dave Reid’s picture

It's really too bad we can't exclude individual elements from the automatic default code.

catch’s picture

Assigned: sun » Unassigned
Status: Needs review » Needs work

This removes one query from nearly all pages in HEAD. Although we cache system paths and try to load all at once, we don't do this well for drupal_get_normal_path(), and we don't cache paths without aliases (which /node or a view or panel used for the front page almost always lacks).

HEAD:
Executed 70 queries in 42.97 milliseconds.

Patch:
Executed 69 queries in 41.7 milliseconds.
+ // Get the normal path of the font page.

However

+  // Get the normal path of the font page.

font page.

Otherwise RTBC.

catch’s picture

Assigned: Unassigned » sun

Didn't mean to unassign.

sun’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
5.69 KB

RTBC as per catch.

catch’s picture

Lovely.

Dries’s picture

Committed to CVS HEAD. Thanks!

Dries’s picture

Status: Reviewed & tested by the community » Fixed
yched’s picture

Title: drupal_is_front_page() should not call drupal_get_normal_path() » [HEAD BROKEN] drupal_is_front_page() should not call drupal_get_normal_path()
Priority: Normal » Critical
Status: Fixed » Active

system_update_N() needed a bump after http://drupal.org/cvs?commit=296276

cweagans’s picture

Status: Active » Needs review
FileSize
722 bytes

Please fix head. It's sorta important =P

ksenzee’s picture

Status: Needs review » Reviewed & tested by the community

Yes please.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Oopsie. ;)

Committed.

webchick’s picture

Title: [HEAD BROKEN] drupal_is_front_page() should not call drupal_get_normal_path() » drupal_is_front_page() should not call drupal_get_normal_path()

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Dave Reid’s picture

Version: 7.x-dev » 6.x-dev
Status: Closed (fixed) » Patch (to be ported)

This should be backported to D6.

sun’s picture

Assigned: sun » Unassigned
rdrh555’s picture

Assigned: Unassigned » rdrh555
Status: Patch (to be ported) » Needs review
FileSize
2.71 KB

Some things seemed to have changed in the past 8 months and others seem to have worked their way into code naturally(specifically default_value => variable_get(*) ). I've attempted a patch.

dpearcefl’s picture

Priority: Critical » Normal
Status: Needs review » Postponed (maintainer needs more info)

Has this issue been fixed in the latest D6?

sun’s picture

Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Needs review

@dpearceMN: Thanks for trying to triage the queue, but please don't mark such issues as needing more info. Obviously, it wasn't committed to D6 yet. This patch needs review and more work.

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.