This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Layout/structure of extensions
expandshrink

Layout/structure of extensions

Layout/structure of extensions

Wednesday 24 March 2010 11:25:43 am - 5 replies

I'm setting up an installation of ez that will contain a large number of sites and custom extensions.

My first thoughts about this, is that it would be nice to be able to use a tree-structure inside the extension directory to improve the overall usability and layout for this.

A tree-structure would also allow me to be more flexible in how each site/extension is hosted in a version control system, for example if using GIT each top "package" or "node" can be in it's own repository.

This is a first thought/blueprint of a layout:

 extension/

    ... ez core extensions ...

  common_custom_extensions/

    extension1

    extension2

  sites/

    example_site1/

      site_extension_with_design

      custom_site_extension

    example_site2/

       extensions ...

Even though nothing in the documentation or examples indicate that this is possible, it actually is, by specifying the relative path to each extension in 'ActiveExtensions', 'ActiveAccessExtensions' and 'DesignExtensions'.

Example:

[ExtensionSettings]
DesignExtensions[]=sites/example_site1/site_extension_with_design
ActiveAccessExtensions[]=sites/example_site1/custom_site_extension

So the big question is; are the ini settings meant to contain the path, or the name of the extension?

Cause if it's a coincidence that this works, and that the support for this may be broken in any future version, then I'd think again to structure it this way.

What are your thoughts?

Wednesday 24 March 2010 11:49:02 am

Let's start some brainstorming all together happy.gif Emoticon

So you are saying that specifying the full relative path to an extension in site.ini actually works ?
Tried with many different extension types ?

Cheers,

Wednesday 24 March 2010 12:05:50 pm

There are probably some extensions out there that have 'ifs' or similar logic around the names of an extensions, but those can be easily overcome by exploding the string and getting the last element.

But of course, if there are loads of extensions with logic around extension-names, it might not be that easy to specify paths like this.

I still think this is a good idea, cause you could also add support for enabling extensions based on it's parent, or parents parent etc...

Modified on Wednesday 24 March 2010 12:06:32 pm by Peter Rudolfsen

Monday 29 March 2010 8:46:53 am

I have a few additions around this...

ExtensionAutoloadPath also needs to be modified to fit the new structure.

And the worst part is that all the $eZTemplateOperatorArray arrays need to be changed too. I was hoping to make this possible without having to change any code, but I can't see how that's possible at this time.

Sunday 25 April 2010 10:50:17 am

I've managed to structure all extensions / sites in a tree, and still load them the traditional way by using this method:

http://share.ez.no/forums/setup-d...eaccess-design-solution#comment58711

Sunday 25 April 2010 3:37:09 pm

class eZExtension
{
 
....
 
 
  static function activateExtensions( $extensionType = false ){
                $extensionDirectory = eZExtension::baseDirectory();            $activeExtensions = eZExtension::activeExtensions( $extensionType );              $hasExtensions = false;
        $ini = eZINI::instance();
        foreach ( $activeExtensions as $activeExtension )
        {
          $extensionSettingsPath = $extensionDirectory . '/' . $activeExtension . '/settings';
          if ( file_exists( $extensionSettingsPath ) )                 {
             $ini->prependOverrideDir( $extensionSettingsPath, true );
             if ( isset( $GLOBALS['eZCurrentAccess'] ) )
             { 
                eZExtension::prependSiteAccess( $activeExtension );
             }                              
             $hasExtensions = true;
         }
         else if ( !file_exists( $extensionDirectory . '/' . $activeExtension ) )
         {
                eZDebug::writeWarning( "Extension '$activeExtension' does not exist, looked for directory '" .  $extensionDirectory . '/' . $activeExtension . "'" );
         }
      }
      if ( $hasExtensions )
           $ini->loadCache();
 
     }
 
.......
 
}

Peter, The operation that you describe is quite logical, above the function ez, which checks if an extension enabled exist, with the line:
! File_exists ($ extensionDirectory. '/'. ActiveExtension $);

($extensonDirectory: the directory "extension" ;
$activeExtension: name / path in the settings files for each extension)

I think if you put the name of the extension,or the path of the extension, EZ doesn't care, the important thing is that the directory of the extension exists

.
It will be useful, sometimes you end up with more that 20 extensions, it will be good to group them into separate directories, somethings like that:

extension /
ezsystem /
.... (Default extension that comes with ez)
Design /
....
webservices /
....

TKS,

Regrads

Modified on Sunday 25 April 2010 3:39:25 pm by Abdelkader RHOUATI

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from