diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-05-16 19:07:02 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-05-16 19:07:02 +0000 |
commit | 61f4dfc982fc6c1c20377691e2adfb3e4c5f68f9 (patch) | |
tree | bf9f2b40f01a4e45a6c43faba2a3d0be7e171fb4 /modules | |
parent | 196da1b876d3c2ed2c17109dcbda1ecd6f3d7d5e (diff) | |
download | brdo-61f4dfc982fc6c1c20377691e2adfb3e4c5f68f9.tar.gz brdo-61f4dfc982fc6c1c20377691e2adfb3e4c5f68f9.tar.bz2 |
- Patch #456824 by catch: add better caching to drupal_lookup_path().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/path/path.test | 25 | ||||
-rw-r--r-- | modules/system/system.install | 13 |
2 files changed, 38 insertions, 0 deletions
diff --git a/modules/path/path.test b/modules/path/path.test index f13b12fcd..421f58247 100644 --- a/modules/path/path.test +++ b/modules/path/path.test @@ -27,6 +27,31 @@ class PathTestCase extends DrupalWebTestCase { } /** + * Test the path cache. + */ + function testPathCache() { + // Create test node. + $node1 = $this->drupalCreateNode(); + + // Create alias. + $edit = array(); + $edit['src'] = 'node/' . $node1->nid; + $edit['dst'] = $this->randomName(8); + $this->drupalPost('admin/build/path/add', $edit, t('Create new alias')); + + // Visit the system path for the node and confirm a cache entry is + // created. + cache_clear_all('*', 'cache_path', TRUE); + $this->drupalGet($edit['src']); + $this->assertTrue(cache_get($edit['src'], 'cache_path'), t('Cache entry was created.')); + + // Visit the alias for the node and confirm a cache entry is created. + cache_clear_all('*', 'cache_path', TRUE); + $this->drupalGet($edit['dst']); + $this->assertTrue(cache_get($edit['src'], 'cache_path'), t('Cache entry was created.')); + } + + /** * Test alias functionality through the admin interfaces. */ function testAdminAlias() { diff --git a/modules/system/system.install b/modules/system/system.install index a2f0df89c..3538ff2b0 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -611,6 +611,8 @@ function system_schema() { $schema['cache_page']['description'] = 'Cache table used to store compressed pages for anonymous users, if page caching is enabled.'; $schema['cache_menu'] = $schema['cache']; $schema['cache_menu']['description'] = 'Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.'; + $schema['cache_path'] = $schema['cache']; + $schema['cache_path']['description'] = 'Cache table for path alias lookup.'; $schema['cache_registry'] = $schema['cache']; $schema['cache_registry']['description'] = 'Cache table for the code registry system to remember what code files need to be loaded on any given page.'; @@ -3496,6 +3498,17 @@ function system_update_7023() { } /** + * Create the cache_path table. + */ +function system_update_7024() { + $ret = array(); + $schema['cache_path'] = drupal_get_schema_unprocessed('system', 'cache'); + $schema['cache_path']['description'] = t('Cache table used for path alias lookups.'); + db_create_table($ret, 'cache_path', $schema['cache_path']); + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ |