devel_generate.inc not included on /admin/generate/content

marcvangend - June 24, 2009 - 19:38
Project:Devel
Version:6.x-1.x-dev
Component:devel_generate
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

In the current 6.x dev version, the devel_generate_content_types function has been moved to devel_generate.inc. I'm not sure why this was changed, so I can't judge what the best solution is. That's why I didn't make a patch for this. Anyway, I was able to do a quick fix by adding these lines to the /admin/generate/content item in devel_generate_menu():

    'file' => 'devel_generate.inc',
    'file path' => drupal_get_path('module', 'devel'),

#1

smk-ka - July 2, 2009 - 20:32
Status:active» needs review

Yes, that's annoying. A simple require() seems more fitting here, though.

AttachmentSize
501236-devel_generate.patch 596 bytes

#2

moshe weitzman - July 2, 2009 - 23:46
Status:needs review» fixed

committed. thx.

#3

sun - July 3, 2009 - 00:20
Status:fixed» reviewed & tested by the community

Don't want to be too nitpicky, but that require_once relies on a certain PHP config ;)

AttachmentSize
devel.generate-include.patch 719 bytes

#4

moshe weitzman - July 3, 2009 - 00:30
Status:reviewed & tested by the community» fixed

committed. thx.

#5

marcvangend - July 3, 2009 - 07:52

Thanks for the fix, guys. I trust you chose the best solution, but can you help me understand some of the things said here?

>> A simple require() seems more fitting here
Why is that? Is the file property on menu items reserved for special cases, or does it have performance drawbacks?

>> require_once relies on a certain PHP config
The other methods discussed ($item['file'] and module_load_include()) both end up using require_once, so what is the difference?

Thanks.

#6

sun - July 3, 2009 - 12:10

@marcvangend: The difference is that the menu callback itself - devel_generate_users_form[_submit]() - lives in devel_generate.module. So, registering it in the menu system to be pseudo-located in devel_generate.inc to get some sort of auto-loading for the include file would not be correct technically.

#7

marcvangend - July 3, 2009 - 12:32

@sun: That's funny, I always interpreted the file property as an auto loading mechanism for include files (exactly like you say), not necessarily as the location of the callback function. Thanks for the explanation.

#8

System Message - July 17, 2009 - 12:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.