Page 1 of 1

Bug in Install Module API?

Posted: Sat Aug 12, 2006 7:54 pm
by mahjong
I have difficulties understanding how to use the Install() function in the Module Class.
API Docs wrote:Install (line 844)

Function that will get called as module is installed. This function should do any initialization functions including creating database tables. It should return a string message if there is a failure. Returning nothing (FALSE) will allow the install procedure to proceed.

void Install ()
So I wrote something like this:

Code: Select all

	function Install() {
  if (HaveAllRequirement() == true) {
    ... //proceed with install
  } else {
    return "This module cannot be installed because of X";
  }
}
If install fails the return message isn't displayed, but --Add Me - errorinstallfailed -- instead. I've tried to add $lang['errorinstallfailed'] in the language file and a errorinstallfailed() function, but no go.

Re: Bug in Install Module API?

Posted: Sat Aug 12, 2006 8:13 pm
by calguy1000
Yes, you may have found a bug in the module api, is this in latest svn code ?

Re: Bug in Install Module API?

Posted: Sat Aug 12, 2006 8:18 pm
by mahjong
Yes, in svn revision 3284.

Found the bug in admin\lang\en_US\admin.inc.php

Line 16 : $lang['admin']['errorinstallfialed'] = 'Module installation failed';

Would be useful if one could specify the reason of the install abortion instead of displaying a generic error message. Maybe with a InstallFailedMessage() function...

Re: Bug in Install Module API?

Posted: Sun Aug 13, 2006 2:00 pm
by Dee
Was fixed in SVN by commits/revisions 3285 & 3286.