Wednesday 04 January 2006 4:51:27 am
@Kristian: Ok, I need to look at this some more - but I thought that it would prepend the extension settings before the siteaccess settings. @Martin: here's the patch :-) @all: Here's a patch for the "hierarchical siteaccess" (against 3.7.2). Originally I wanted to provide a possibility to define siteaccesses in a multi language environment. That is: you have a hierarchical siteaccess setting (e.g. project/public/eng/us - see above) and you can define general settings (like database) in project/, settings for the public siteaccesses in project/public/ and very special settings (here local settings) in project/public/eng/{us}. You can define general default settings which can be overriden by the special settings. (More comments cf. my previous posting in this thread).
--- ezini.php.org 2005-11-04 09:29:31.000000000 +0100
+++ ezini.php 2006-01-04 13:18:09.000000000 +0100
@@ -981,6 +981,36 @@
if ( eZINI::isDebugEnabled() )
eZDebug::writeNotice( "Changing override dir to '$dir'", "eZINI" );
+ // Patch for hierarchical siteaccess - start
+ // Author: Thomas Nunninger
+ // FIXME: I'm not sure if things like ezExtension::prependExtensionSiteAccesses work
+ // correctly
+ // Probably now it's not possible to call a siteaccess "siteaccess" (or does the
+ // slash at the end of 'siteaccess/' prevent from problems? in combination with the
+ // following if?).
+ $siteAccessStartPos = strpos( $dir, 'siteaccess/' );
+ if ( false !== $siteAccessStartPos )
+ {
+ $siteAccessStartPos += 11;
+ }
+ if ( $siteAccessStartPos < strlen( $dir ) )
+ {
+ $siteAccess = substr( $dir, $siteAccessStartPos );
+ $siteAccesses = explode( '/', $siteAccess );
+ $path = substr( $dir, 0, $siteAccessStartPos - 1 );
+ $newDirs = array( );
+ foreach ( $siteAccesses as $siteAccess )
+ {
+ $path .= "/$siteAccess";
+ $newDirs[] = array( $path, $globalDir, $identifier );
+ }
+ }
+ else
+ {
+ $newDirs[] = array( $dir, $globalDir, $identifier );
+ }
+ // Patch for hierarchical siteaccess - end
+
if ( $this->UseLocalOverrides == true )
$dirs =& $this->LocalOverrideDirArray;
else
@@ -1005,7 +1035,10 @@
}
if ( $overrideOverwritten == false )
- $dirs = array_merge( array( array( $dir, $globalDir, $identifier ) ), $dirs );
+ // Patch for hierarchical siteaccess - start
+ // Author: Thomas Nunninger
+ $dirs = array_merge( $newDirs, $dirs );
+ // Patch for hierarchical siteaccess - end
$this->CacheFile = false;
}
@@ -1015,6 +1048,12 @@
*/
function appendOverrideDir( $dir, $globalDir = false, $identifier = false )
{
+ // Patch for hierarchical siteaccess - start
+ // Author: Thomas Nunninger
+ // Do I need to change this function for hierarchical siteaccess too?
+ // grep shows me no call of this function in the whole eZ code
+ // Patch for hierarchical siteaccess - end
+
if ( eZINI::isDebugEnabled() )
eZDebug::writeNotice( "Changing override dir to '$dir'", "eZINI" );
I haven't tested it in all possible situations. (Un)Known behavior: - At the moment I only can say that it works for virtual setup. I know there's a problem with URI, because there is a regular expression in access.php replacing all non-alpha-numeric charactars (I had a patch against this if someone is interested) - I didn't test if the siteaccess is really right, if you do things like the version view in the admin interface for different siteaccesses - I hope there are no caching issues - I don't know if there are problems with extension settings because I haven't tested it. But I tried a generic approach to cover even this situation. Conclusion: if you want to use this code: use it in any way and don't blame me if something's wrong. Comments and experiences are wellcome. (And if you request more perhaps I extend/test this patch against the (un)known issues listed above.) Perhaps I'll create a contribution - if not everybody says: Oh my god, what have you done! I also would enjoy if this would go in eZ publish 3.8 (and something similar in eZ publish 4 - because I think it can simplify life very much). Thomas
|