Forums / Install & configuration / Layout/structure of extensions

Layout/structure of extensions

Author Message

Peter Rudolfsen

Wednesday 24 March 2010 3:25:43 am

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?

Nicolas Pastorino

Wednesday 24 March 2010 3:49:02 am

Let's start some brainstorming all together :)

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,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Peter Rudolfsen

Wednesday 24 March 2010 4:05:50 am

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...

Peter Rudolfsen

Sunday 28 March 2010 11:46:53 pm

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.

Peter Rudolfsen

Sunday 25 April 2010 1: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-design/multiple-siteaccess-design-solution#comment58711

Abdelkader RHOUATI

Sunday 25 April 2010 6:37:09 am

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

Abdelkader RHOUATI

Blog (french) : http://arhouati.com
----
Extension arh_jdebug : EzDebug using jquery

eZ debug

Timing: Jan 18 2025 02:19:21
Script start
Timing: Jan 18 2025 02:19:21
Module start 'content'
Timing: Jan 18 2025 02:19:22
Module end 'content'
Timing: Jan 18 2025 02:19:22
Script end

Main resources:

Total runtime0.6907 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.9453180.8281
Module start 'content' 0.00570.5613 769.7734630.8906
Module end 'content' 0.56700.1237 1,400.6641341.0703
Script end 0.6907  1,741.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.5483210.0002
Check MTime0.00140.2010210.0001
Mysql Total
Database connection0.00090.131010.0009
Mysqli_queries0.614288.91782050.0030
Looping result0.00190.26982030.0000
Template Total0.664096.120.3320
Template load0.00210.306320.0011
Template processing0.661995.820620.3309
Template load and register function0.00010.019610.0001
states
state_id_array0.00250.362810.0025
state_identifier_array0.00090.131020.0005
Override
Cache load0.00180.2605500.0000
Sytem overhead
Fetch class attribute can translate value0.00130.183840.0003
Fetch class attribute name0.00070.108180.0001
XML
Image XML parsing0.00110.159340.0003
class_abstraction
Instantiating content class attribute0.00000.001480.0000
General
dbfile0.00200.2832330.0001
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 30
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs