diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-05-29 22:28:48 -0700 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-05-29 22:28:48 -0700 |
| commit | f660eb55aa9535c10f91ad2812fa073589fcae2b (patch) | |
| tree | 11d8727061378408bbc16ede888a058ba20542fb /modules/gallery/helpers/MY_url.php | |
| parent | 0097803efc1c71711bf9ccf5015fe43e75f8f28d (diff) | |
| parent | ce285b8feba2f9c495fb153517c2a582421f50e0 (diff) | |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers/MY_url.php')
| -rw-r--r-- | modules/gallery/helpers/MY_url.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php index 5e8bfc9e..019e416f 100644 --- a/modules/gallery/helpers/MY_url.php +++ b/modules/gallery/helpers/MY_url.php @@ -38,13 +38,19 @@ class url extends url_Core { return; } - $count = count(Router::$segments); - foreach (ORM::factory("item") - ->where("name", html_entity_decode(Router::$segments[$count - 1], ENT_QUOTES)) - ->where("level", $count + 1) - ->find_all() as $match) { - if ($match->relative_path() == html_entity_decode(Router::$current_uri, ENT_QUOTES)) { - $item = $match; + $current_uri = html_entity_decode(Router::$current_uri, ENT_QUOTES); + $item = ORM::factory("item")->where("relative_path_cache", $current_uri)->find(); + if (!$item->loaded) { + // It's possible that the relative path cache for the item we're looking for is out of date, + // so find it the hard way. + $count = count(Router::$segments); + foreach (ORM::factory("item") + ->where("name", html_entity_decode(Router::$segments[$count - 1], ENT_QUOTES)) + ->where("level", $count + 1) + ->find_all() as $match) { + if ($match->relative_path() == $current_uri) { + $item = $match; + } } } |
