#34 rule for naming Module Preload

open-accepted
nobody
Bug Fix (7)
5
2010-01-17
2009-08-19
GIJOE
No

(Dirname)_(FileName) will cause fatal error if the dirname is started with number like "4dimensions".

This is a patch considering the backward compatibility.

===================================================================
--- Legacy_Controller.class.php (revision 890)
+++ Legacy_Controller.class.php (working copy)
@@ -694,14 +694,16 @@
foreach($files as $file) {
require_once $file;
if (preg_match("/(\w+)\.class\.php/", $file, $matches)) {
- $className = ucfirst($mod_dir) . "_" . $matches[1];
-
+ $classNames = array( ucfirst($mod_dir) . "_" . $matches[1] , 'Preload_' . ucfirst($mod_dir) . "_" . $matches[1] ) ;
+ foreach( $classNames as $className ) {
if (XC_CLASS_EXISTS($className) && !isset($this->_mLoadedFilterNames[$className])) {
$this->_mLoadedFilterNames[$className] = true;
$instance =& new $className($this);
$this->addActionFilter($instance);
+ break ;
}
}
+ }
}
}
}

Discussion

  • minahito
    minahito
    2010-01-17

    • status: open --> open-accepted