? desc.patch ? forums.patch ? menu.patch ? settings.patch ? taxonomy.patch ? types.patch Index: drupalorg_testing.profile =================================================================== RCS file: /cvs/drupal/contributions/profiles/drupalorg_testing/drupalorg_testing.profile,v retrieving revision 1.7 diff -u -p -r1.7 drupalorg_testing.profile --- drupalorg_testing.profile 14 May 2007 01:40:38 -0000 1.7 +++ drupalorg_testing.profile 14 May 2007 03:46:55 -0000 @@ -236,8 +236,11 @@ function _drupalorg_testing_create_proje } function _drupalorg_testing_create_content() { + // Create forums. + _drupalorg_testing_create_forums(); + #5) create a bunch of test content with the generate script. - include_once "generate-content.php"; + include_once "generate-content.php"; // create 100 pseudo-random nodes: $users = get_users(); @@ -249,6 +252,9 @@ function _drupalorg_testing_create_conte $comments = get_comments(); create_comments(200, $users, $nodes, $comments); + + // Stick forum nodes in proper forums. + _drupalorg_testing_assign_forums(); } /** @@ -271,3 +277,61 @@ function _drupalorg_testing_configure_pr variable_set("project_sort_method_used_$tid", $settings); } } + +/** + * Create drupal.org forums and containers. + */ +function _drupalorg_testing_create_forums() { + $vid = _forum_get_vid(); + // Containers. + $containers = array( + t('General') => t('Important: no support questions here!'), + t('Support') => t('Try searching the forums first or a specific project\'s bug reports. Remember all support on this site is on a volunteer basis, so please visit the forum tips for posting hints.'), + ); + foreach ($containers as $name => $description) { + drupal_execute('taxonomy_form_term', array('name' => $name, 'description' => $description), $vid); + } + + // General forums. + $terms = taxonomy_get_term_by_name('General'); + $tid = $terms[0]->tid; + $forums = array( + t('News and announcements') => t('For news and announcements to the Drupal community at large.'), + t('General discussion') => t('For less technical discussions about the Drupal project. Not for support questions!'), + ); + foreach ($forums as $name => $description) { + drupal_execute('taxonomy_form_term', array('name' => $name, 'description' => $description, 'parent' => $tid), $vid); + } + + // Support forums. + $terms = taxonomy_get_term_by_name('Support'); + $tid = $terms[0]->tid; + $forums = array( + t('Pre installation questions') => t('Is Drupal a viable solution for my website?'), + t('Installation problems') => t('For problems with installing a new Drupal site.'), + ); + foreach ($forums as $name => $description) { + drupal_execute('taxonomy_form_term', array('name' => $name, 'description' => $description, 'parent' => $tid), $vid); + } +} + +/** + * Randomly assign forum posts to forums. + */ +function _drupalorg_testing_assign_forums() { + $vid = _forum_get_vid(); + $terms = taxonomy_get_tree($vid); + $forums = array(); + foreach ($terms as $term) { + if ($term->depth >= 1) { + // Not a container. + $forums[$term->tid] = $term->tid; + } + } + $result = db_query('SELECT nid FROM {forum}'); + while ($topic = db_fetch_object($result)) { + $tid = array_rand($forums); + db_query('UPDATE {forum} SET tid = %d WHERE nid = %d', $tid, $topic->nid); + db_query('UPDATE {term_node} SET tid = %d WHERE nid = %d', $tid, $topic->nid); + } +}