Bug in Install Module API?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
mahjong

Bug in Install Module API?

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Bug in Install Module API?

Post by calguy1000 »

Yes, you may have found a bug in the module api, is this in latest svn code ?
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
mahjong

Re: Bug in Install Module API?

Post 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...
Last edited by mahjong on Sat Aug 12, 2006 8:23 pm, edited 1 time in total.
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: Bug in Install Module API?

Post by Dee »

Was fixed in SVN by commits/revisions 3285 & 3286.
Post Reply

Return to “Developers Discussion”