The create_nodes() function hard-codes the content types it creates as:

   $possible_types = array("story", "blog", "forum", "page");

We'll either need to allow for extending these types or come up with a custom function to generate project* data.

Comments

webchick’s picture

As an experiment, I changed that line to:

  $possible_types = array("project", "project_release", "project_issue", "page");

Although releases and issues are created, no projects are (presumably because of missing data) and therefore, the test data is useless.

So looks like we'll need custom content creation functions for these types.

webchick’s picture

Status: Active » Needs review
StatusFileSize
new1.48 KB

Teehee. It's project_project, not project. ;)

This patch extends the create_nodes() function so you can pass in an array of additional allowed types, and then passes project_* types in.

I would've assumed that I should patch generate-content.php upstream in devel module, but it no longer seems to be around. :(

webchick’s picture

Status: Needs review » Active

Meh. While this works, it's not ideal, because all the relevant metadata info (project category, status/priority for issues, etc.) aren't there. Back to the drawing board...

dww’s picture

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.

webchick’s picture

Status: Active » Needs work

dww, I moved your last comment to its own issue... http://drupal.org/node/143803 because, while important, it doesn't have specifically to do with bootstrapping project* data.

Here is a script that auto-generates a sample project in each category (other than modules -- need to figure that out some other time when it's not 1am ;)).. I broke function _drupalorg_testing_get_tid_by_term($term) { into its own function because this is the second time I've had to do that now (also in project admin settings).

$values['Drupal project'] = array (
  'title' => 'Drupal',
  'body' => 'Drupal is an open-source platform and content management system for building dynamic web sites offering a broad range of features and services including user administration, publishing workflow, discussion capabilities, news aggregation, metadata functionalities using controlled vocabularies and XML publishing for content sharing purposes. Equipped with a powerful blend of features and configurability, Drupal can support a diverse range of web projects ranging from personal weblogs to large community-driven sites.',
  'uri' => 'drupal',
);

$values['Installation profiles'] = array(
  'title' => 'Drupal.org Testing',
  'body' => 'This profile installs a site with the structure, content, permissions, etc of Drupal.org to facilitate the reproduction of bugs and testing of patches for the project modules.',
  'uri' => 'drupalorg_testing',
);

$values['Theme engines'] = array(
  'title' => 'PHPTAL theme engine',
  'body' => 'This is a theme engine for Drupal 5.x, which allows the use of templates written in the PHPTAL language. This engine does most of its work by calls to the <a href="/node/11810">PHPtemplate engine</a>, just replacing the underlying template engine with the one from phptal.sourceforge.net.',
  'uri' => 'phptal',
);

$values['Themes'] = array(
  'title' => 'Zen',
  'body' => 'Zen is the ultimate <em>starting theme</em> for Drupal 5. If you are building your own standards-compliant theme, you will find it much easier to start with Zen than to start with Garland or Bluemarine. This theme has LOTs of documentation in the form of code comments for both the PHP (template.php) and HTML (page.tpl.php, node.tpl.php).',
  'uri' => 'zen',
);

$values['Translations'] = array(
  'title' => 'Afrikaans Translation',
  'body' => "This page is the official translation of Drupal core into Afrikaans. This translation is currently available for Drupal 4.6's and Drupal 4.7's (cvs) core. Modules are being added as we progress with the translation effort.",
  'uri' => 'af',
);

// TODO: Modules...

foreach ($values as $category => $project) {
  $project['project_type'] = _drupalorg_testing_get_tid_by_term($category);
  $project['mail'] = variable_get('site_mail', 'a@a.a');
  $project['name'] = 'a'; // Assign projects to admin account.
  drupal_execute('project_project_node_form', $project, array('type' => 'project_project'));
}

function _drupalorg_testing_get_tid_by_term($term) {
  $terms = taxonomy_get_term_by_name($term);
  return $terms[0]->tid;
}

webchick’s picture

StatusFileSize
new6.95 KB

Good news! Here's a patch that auto-generates several projects when pasted into a PHP node body. WOOHOO.

Bad news! It doesn't work on install. :( The projects create, but they are not assigned any taxonomy. :( :( I have no idea how to get around this problem. On the Sony Multisite work, we did a hack in a hook_menu() of a specic install.module, but we can't upload modules to the /profile directory so I have no idea what to do. :(

webchick’s picture

StatusFileSize
new7.66 KB

dww suggested it might be because we're trying to use drupal_execute rather than node_save, so I switched the code around a bit... same result. :( Works fine when pasted into a PHP node, but category assignment fails when run at install time...

webchick’s picture

Title: Generate content scripts don't generate projects/releases/issues. » Generate content scripts don't generate projects
Status: Needs work » Needs review
StatusFileSize
new7.93 KB

Ok. Enter the cheesy hack patch. ;)

This one does raw db manipulation to get the term associations in there. It's ugly. But it works.

I'm also changing the title to deal only with projects. This was a big enough pain in the rear, that I don't want to even try and do releases and issues on the same ticket. ;)

dww’s picture

Status: Needs review » Needs work

patch doesn't apply. looks like your copy of drupalorg_testing.profile is stale, and doesn't include my changes in revision 1.9.

also, i wonder about assigning *all* the projects to be owned by the admin. part of the fun on d.o is that different kinds of users have different permissions and own different projects. i'd like to see a spread of project ownerships. among some of the well-known users at different roles. see also http://drupal.org/node/144427.

finally, i wonder how things work regarding the CVS integration for these newly added projects. i know none of the CVS stuff is really even started yet (e.g. an actual same CVS repository configured to talk to the test site, with some dummy code for the projects we're defining). but, for example, on the project edit pages, we should at least fill in the CVS directory setting and repository, no? if drupal_execute() does what i think it does, i wonder why this is passing validation at all. probably because hook_form_alter() isn't available yet due to evil bootstrapping bugs (if that's all true), so cvs.module's extensions and custom validation of the project form isn't actually happening. :(

the CVS stuff isn't a reason to hold up this patch (see http://drupal.org/node/144429 instead), but the fact it doesn't apply and the project ownership stuff are why i'm setting to CNW.

thanks for all your work on this, webchick! this profile is going to *seriously* improve life for the entire drupal project.

webchick’s picture

Status: Needs work » Needs review
StatusFileSize
new8.6 KB

There was some deal with the CVS fields... I didn't have a repository to select, so it wouldn't submit the name, I think. But if possible, I'd really rather handle that in a separate "initialize CVS starer data" patch. We can amend the create scripts here in the future.

Right you are about the stale copy and the random users. So this patch adds that.

dww’s picture

Status: Needs review » Needs work

webchick, you're gonna kill me, but _drupalorg_testing_get_random_user() isn't what i had in mind. ;) from comment #9:
...among some of the well-known users at different roles. see also http://drupal.org/node/144427.

for the issues, followups, forum posts, etc, etc, random users is great. however, for the projects themselves, it'd be nice to be able to have all of them owned by the users in the 'user switcher' role, so that you can easily test all of those things among a known set of users.

webchick’s picture

StatusFileSize
new8.19 KB

Ok, here's a re-roll that ditches the random stuff and goes with names that will be generated in the other patch (dww's working on this atm). Still CNW because I can't test it until those are done, but we agreed on these naming conventions so hopefully it should "just work" once the users patch gets in.

I went with *1 as the names rather than mixing it up too much, because I thought that way we could test a few with more than one project. I don't really have a preference though. ;)

webchick’s picture

Status: Needs work » Needs review
StatusFileSize
new8.46 KB

Ok, this should be ready to go.

dww’s picture

Status: Needs review » Reviewed & tested by the community

works like a charm, and the code looks good, too. thanks!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed! :) Thanks, dww.

Anonymous’s picture

Status: Fixed » Closed (fixed)