An important note:
You must install "SmartObject" before installing SmartClone.
SmartObject is not in the svn.
Quote:
Any Clone system (module) should evaluate and filter $dirname before cloning.
After more thoughts it seems it is better to be filtered by the XOOPS core before pre install fucnction.
Because core should not allow a bad dirname like 1000 just like a bad user name and ...
Also I repeat, the bad dirname selection for cloned module is not an eval bug. with SmartClone you can create a module with dirname = 1000 and break your website.
I still cannot see any solution other than using eval. It seems namespace cannot help us.
You have to use eval at least
one time to manipulate the pre install function or even pre install trigger.
OR
Xoops core should change this line:
$func = "xoops_module_pre_install_{$dirname}";
with this:
$func = "xoops_module_pre_install_{$dirname}";
$func = function_exists($func) ? $func : "xoops_module_pre_install_module";
because at one time there is just one function and i cannot see any reason to add $dirname to the name of the pre install function.
So these are working good:
function xoops_module_pre_install_module(&$module)
{
}
function xoops_module_install_module(&$module)
{
}
And in D3 way you still have to use eval a few times. but in D3 the main module (contain eval) is out of the root.
Uninstall is not an issue because xoops will get the table names from xoops_version.php and you can define them like this.
// Tables created by sql file (without prefix!)
$i = 0;
$modversion['tables'][$i] = $modversion['dirname'] . '_log';
$i++;
$modversion['tables'][$i] = $modversion['dirname'] . '_set';
$i++;
$modversion['tables'][$i] = $modversion['dirname'] . '_stats';