xoops forums

irmtfan

Module Developer
Posted on: 2013/5/28 4:46
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#1

xoops257 , 256 and xoops26 bug: xoops_version.php of all modules will be included more than once.

It is an obvious bug.
just put a echo in one modules/MODULE/xoops_version.php and see yourself.
It has a bad impact on site performance. specially it is worse in update and install processes when a module has some special scripts and functionality.

To solve this you should add one static $modVersions to store $modversion from all modules to avoid include xoops_version.php more than one time in XOOPS257|XOOPS256|Xoops26/kernel/module.php in loadInfo function
function loadInfo($dirname$verbose true)
    {
        
// START irmtfan add static $modVersions to store $modversion from all modules to avoid include xoops_version.php more than one time
        
static $modVersions;
        if(isset(
$modVersions[$dirname])) {
            
$this->modinfo $modVersions[$dirname];
            return 
true;
        }
        
// END irmtfan add static $modVersions to store $modversion from all modules to avoid include xoops_version.php more than one time
        
$dirname basename($dirname);
        global 
$xoopsConfig;
        if (
file_exists($file $GLOBALS['xoops']->path('modules/' $dirname '/language/' $xoopsConfig['language'] . '/modinfo.php'))) {
            include_once 
$file;
        } else if (
file_exists($file $GLOBALS['xoops']->path('modules/' $dirname '/language/english/modinfo.php'))) {
            include_once 
$file;
        }

        if (!
file_exists($file $GLOBALS['xoops']->path('modules/' $dirname '/xoops_version.php'))) {
            if (
false != $verbose) {
                echo 
"Module File for $dirname Not Found!";
            }
            return 
false;
        }
        include 
$file;
        
$this->modinfo $modVersions[$dirname] = $modversion;// irmtfan add static $modVersions
        
return true;
    }

It is a bug in xoops 26 alpha too.
Of course it is a bug in xoops256 xoops 255 and all older versions.

please somebody add this bug to sf.net bug tracker on behalf of me.

Mamba

Moderator
Posted on: 2013/5/28 5:27
Mamba
Mamba (Show more)
Moderator
Posts: 10823
Since: 2004/4/23
#2

Re: xoops257 , 256 and xoops26 bug: xoops_version.php of all modules will be included more than once.

Done:
https://sourceforge.net/p/xoops/bugs/1274/
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs