From dww's comment at http://drupal.org/node/143748#comment-243164:

it's evil that this profile is forking generate-content.php. in fact, it just nailed me on a test site, where the include_once "generate-content.php"; was finding an old copy from devel, instead of the one in here, and that was ignoring what we were asking it to do and going off to generate 10K nodes on its own. :(

i'd rather we just required devel module (which we do already), and then just used devel_generate.module's functions directly (e.g. devel_create_nodes()), instead of maintaining our own fork of this code.

He is so right. :)

Comments

dww’s picture

+1. ;)

dww’s picture

see http://drupal.org/node/144695. once that lands, we can clean-up the user generation code in here and remove generate-users.php completely.

hunmonk’s picture

http://drupal.org/node/159533 would also allow us to get rid of our custom solution for generating content.

hunmonk’s picture

Assigned: Unassigned » hunmonk
Status: Active » Needs review
StatusFileSize
new4.75 KB

first crack. totally untested.

hunmonk’s picture

StatusFileSize
new5.12 KB

attached patch fixes up a few problems with my first effort. this has been tested against mysql and postgres, and it functions perfectly as far as i can tell.

dww’s picture

Status: Needs review » Needs work

This is a great start, and we're almost there. However...

A) This shouldn't include devel_generate.module as soon as http://drupal.org/node/160557 lands. That's just silly.

B) You introduced a nasty bug: you wiped out all the custom, special users since you call devel_generate_users() with the $kill argument set to TRUE. :(

C) It's unclear to me why you reversed the order of the $users array. It's a list of users and the corresponding roles they belong to. What if we want to add other roles to certain users easily? For example, for real on d.o, everone in the cvs admin role is also in the site maintainer role. That would have been easy to represent with the old code, and is much harder now.

D) This hunk has nothing to do with the rest of this patch:

@@ -468,7 +457,7 @@ function _drupalorg_testing_create_proje
 
   // Add release types.
   $vocab = array(
-    'name' => t('Release Type'),
+    'name' => t('Release type'),
     'nodes' => array('project_release' => 'project_release'),
   );
   drupal_execute('taxonomy_form_vocabulary', $vocab);

Yes, it's a trivial fix, but I really prefer not to throw in unrelated changes in patches and issues. That sort of fix doesn't even belong in a patch/issue IMHO, that could just be committed directly.

hunmonk’s picture

Status: Needs work » Needs review
StatusFileSize
new5.23 KB

in response:
a. correct. but we needed http://drupal.org/node/160557 first, which is now committed. attached patch removes that silly-ness...
b. just need to move the code back, then. attached patch corrects
c. if you'll look at the user creation code now, i'm using user_save(), which we should be using. in D5, the roles are pulled by using array_keys() in user_save(), thus the flip.
d. postgres bombs because it's case sensitive. please don't make me roll another patch for a sincle character fix :)

hunmonk’s picture

StatusFileSize
new4.73 KB

sorry, didn't fully understand C. attached patch corrects that, and doesn't contain the typo fix, either...

hunmonk’s picture

StatusFileSize
new4.33 KB

moved the random user creation back after the others -- we don't need to $kill the other users, as this is always a fresh install.

consolidated the line of code that builds the user's roles.

dww’s picture

Status: Needs review » Reviewed & tested by the community

Perfect, thanks!

dww’s picture

Status: Reviewed & tested by the community » Fixed

hunmonk committed this but forgot to mark it fixed (even after being reminded). ;)
Anyway, thanks again for the work on this, it's a great improvement.

Anonymous’s picture

Status: Fixed » Closed (fixed)