On accessing the page at /admin/modules/module_builder
, I am recieving the following error:-
Fatal error: Call to a member function
getRootGenerator()
on a non-object in /opt/lampp/htdocs/Mysite/sites/all/modules/contrib/module_builder/includes/module_builder.pages.inc on line 85
Although this never displayed any informatory warning but just ended up with error. I though it might be issue with my new XAMPP installation and probably the module is broken in new version. However on debugging I found the error was from my side.
I have developed a rough patch for the same to show correct error message to help newbie drupal programmers.
The code is as follows
if(empty($mb_task_handler_generate)){
drupal_set_message(t("Can't read or write to sites/default/files, Please check the permissions."), 'error');
return $form;
}
$root_generator = $mb_task_handler_generate->getRootGenerator();
Thanks
Comment | File | Size | Author |
---|---|---|---|
module_builder.pages_.diff | 457 bytes | perilbrain | |
Comments
Comment #1
joachim CreditAttribution: joachim commentedCould you explain more about the problem your setup had which caused this?
There's a try-catch block just above where you're proposing adding lines. That should be handling any errors. Is what's happening that 'if ($e->needs_hooks_download)' isn't handling your problem case, and so the catch block ends, and we're left with an unstable state?
Comment #2
perilbrain CreditAttribution: perilbrain commentedHey Joachim,
yes of course, I had not set " others can write permission" on "sites/default/files" ,this code
$mb_task_handler_generate = $mb_factory->getTask
should have thrown the exception but somehow code can reach this line$root_generator = $mb_task_handler_generate->getRootGenerator();
and there it throws the exception breaking the whole site.