Hi,

I just found the two files
trunk/doc/features/4.0/autoload.txt and
trunk/bin/php/ezpgenerateautoloads.php

in the eZP SVN checkout. The doc file says, that 
ezproot/autoload/ezp_autoload.php
should be used for extensions.

I see two problems with the described approach:

* I have to change files in the ezproot when installing / uninstalling
   extensions. I'm sure, that there are many setups of eZP, where all
   developing is done in extensions and the ezproot can't be changed at all.

* The script to generate autoloads includes only extensions that are
   activated. What am I supposed to do, if I activate different extensions for
   different siteaccesses? Or if I even dare to have equal classnames in
   different extensions for different clients. (Not nice, but happens.)

May I propose an alternative?

Every extension, which wants to make use of autoload, should contain an 
autoload directory, while leaving the autoloads (with s) directory untouched.

The following code gives should be executed for every scriptrun and 
automatically registers all autoload dirs to ezcBase:

$dirs = glob(
                'extension/{'
                .implode( eZExtension::activeExtensions(), ',' )
                .'}/autoload',
                GLOB_BRACE | GLOB_ONLYDIR | GLOB_NOSORT
        );

foreach( $dirs as $dir )
{
            ezcBase::addClassRepository(
                substr( $dir, 0, -9 ),
                $dir
            );
}

Cheers,
-- 
Thomas Koch, Software Developer
http://www.koch.ro
-- 
Sdk-public mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/sdk-public

Reply via email to