Details
-
Improvement
-
Resolution: Fixed
-
Medium
-
4.0.1
-
None
Description
Currently a url alias lookup is always done, even when you type in the system url like:
content/view/full/2
This is a feature, because you can currently add a manual url_alias that could redirect the above url to another one. But it should be possible to disable this so the 2 db calls needed on each request could be saved when the url is a system url.
The idea is to add a function that checks first url part against ModuleList to see if it's matches IF TranslatableSystemUrls === disabled:
Index: settings/site.ini =================================================================== --- settings/site.ini (revision 22346) +++ settings/site.ini (working copy) @@ -216,6 +216,8 @@ # Use either enabled or disabled Translation=enabled##! #!Translation=enabled +# Controls if a lookup should be done for system urls as well +TranslatableSystemUrls=enabled # Type of word separator for url aliases, can be one of: # dash - Use a dash Index: kernel/classes/ezurlaliasml.php =================================================================== --- kernel/classes/ezurlaliasml.php (revision 22346) +++ kernel/classes/ezurlaliasml.php (working copy) @@ -1677,6 +1677,32 @@ /*! \static + Checks if url translation should be used on the current url. + + \param $uri The current eZUri object + */ + static public function urlTranslationEnabledByUri( eZURI $uri ) + { + if ( $uri->isEmpty() ) + return false; + + $ini = eZINI::instance(); + if ( $ini->variable( 'URLTranslator', 'Translation' ) === 'enabled' ) + { + if ( $ini->variable( 'URLTranslator', 'TranslatableSystemUrls' ) === 'disabled' ) + { + $moduleName = $uri->element( 0 ); + $moduleINI = eZINI::instance( 'module.ini' ); + $moduleList = $moduleINI->variable( 'ModuleSettings', 'ModuleList' ); + if ( in_array( $moduleName, $moduleList, true ) ) + return false; + } + return true; + } + return false; + } + /*! + \static Checks if the text entry $text is unique on the current level in the URL path. If not the name is adjusted with a number at the end until it becomes unique. The unique text string is returned. Index: index.php =================================================================== --- index.php (revision 22346) +++ index.php (working copy) @@ -530,8 +530,7 @@ // Check for URL translation if ( $urlTranslatorAllowed and - $ini->variable( 'URLTranslator', 'Translation' ) == 'enabled' and - !$uri->isEmpty() ) + eZURLAliasML::urlTranslationEnabledByUri( $uri ) ) { ////include_once( 'kernel/classes/ezurlaliasml.php' ); $translateResult = eZURLAliasML::translate( $uri );
Attachments
Issue Links
- relates to
-
EZP-13410 Don't do a url alias lookup for redirects to modules
- Closed