xoops forums

wishcraft

Module Developer
Posted on: 2017/12/5 12:02
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3691
Since: 2007/5/18
#1

Not Executing: function xoops_module_pre_install_dirname()

I am working on a bug ticketing module, for release in a number of weeks, for some reason in XOOPS 2.5.9 I am not sure how long this bug has existed by for example in xoops_version.php the following is specified:

$modversion['onInstall']                 = "include/install.php";
$modversion['onUpdate']                 = "include/onupdate.php";
$modversion['onUninstall']                 = "include/uninstall.php";


and in include/install.php the following function is specified but not being called by the installation in system:-

function xoops_module_pre_install_tickets($module) {
    ....
}


the problem is the call is incorrect on line 98 of /system/admin/modulesadmin/modulesadmin.php when backtracking it for some reason the call for single parthensis is being used in double quote

ie with the code
$func "xoops_module_pre_install_{$dirname}";


Should read as follows
$func "xoops_module_pre_install_$dirname";


it doesn't require double brackets from PHP 2

iHackCode

Module Developer
Posted on: 2017/12/5 14:13
iHackCode
iHackCode (Show more)
Module Developer
Posts: 1025
Since: 2004/6/29
#2

Re: Not Executing: function xoops_module_pre_install_dirname()

What version of PHP were you using?

zyspec

Module Developer
Posted on: 2017/12/5 22:03
zyspec
zyspec (Show more)
Module Developer
Posts: 1021
Since: 2004/9/21
#3

Re: Not Executing: function xoops_module_pre_install_dirname()

@wishcraft,

I haven't checked to see if the pre_install function is being called but the line you called out above is perfectly valid. The "double brackets" (curly braces) {} is only there for code clarity and does not affect the string's interpretation by the PHP compiler. If the string's within the double-quote then the brackets are preferred by most PHP coding standards.

In fact, it makes it much easier to read if you want to include an array element in the string directly. Something like:
$myVar "This is a string that identifies a value from the array:  {$someArray['anIndex']}";