? modules/blogapi/blogapi56.test
? modules/blogapi/blogapi56.txt
? modules/simpletest/variable-profile-279455-1.patch
Index: modules/blog/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v
retrieving revision 1.310
diff -u -p -r1.310 blog.module
--- modules/blog/blog.module 6 Oct 2008 11:30:11 -0000 1.310
+++ modules/blog/blog.module 8 Oct 2008 03:09:59 -0000
@@ -13,7 +13,7 @@ function blog_node_info() {
return array(
'blog' => array(
'name' => t('Blog entry'),
- 'module' => 'blog',
+ 'base' => 'blog',
'description' => t('A blog entry is a single post to an online journal, or blog.'),
)
);
Index: modules/book/book.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.install,v
retrieving revision 1.22
diff -u -p -r1.22 book.install
--- modules/book/book.install 15 May 2008 21:19:24 -0000 1.22
+++ modules/book/book.install 8 Oct 2008 03:09:59 -0000
@@ -27,14 +27,14 @@ function _book_install_type_create() {
$book_node_type = array(
'type' => 'book',
'name' => t('Book page'),
- 'module' => 'node',
+ 'base' => 'node_content',
'description' => t('A book page is a page of content, organized into a collection of related entries collectively known as a book. A book page automatically displays links to adjacent pages, providing a simple navigation system for organizing and reviewing structured content.'),
- 'custom' => TRUE,
- 'modified' => TRUE,
- 'locked' => FALSE,
+ 'custom' => 1,
+ 'modified' => 1,
+ 'locked' => 0,
);
- $book_node_type = (object)_node_type_set_defaults($book_node_type);
+ $book_node_type = node_type_set_defaults($book_node_type);
node_type_save($book_node_type);
// Default to not promoted.
variable_set('node_options_book', array('status'));
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.465
diff -u -p -r1.465 forum.module
--- modules/forum/forum.module 6 Oct 2008 12:55:54 -0000 1.465
+++ modules/forum/forum.module 8 Oct 2008 03:10:00 -0000
@@ -356,7 +356,7 @@ function forum_node_info() {
return array(
'forum' => array(
'name' => t('Forum topic'),
- 'module' => 'forum',
+ 'base' => 'forum',
'description' => t('A forum topic is the initial post to a new discussion thread within a forum.'),
'title_label' => t('Subject'),
)
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.57
diff -u -p -r1.57 content_types.inc
--- modules/node/content_types.inc 16 Jul 2008 21:59:27 -0000 1.57
+++ modules/node/content_types.inc 8 Oct 2008 03:10:00 -0000
@@ -50,19 +50,12 @@ function node_overview_types() {
*/
function node_type_form(&$form_state, $type = NULL) {
if (!isset($type->type)) {
- $type = new stdClass();
- $type->type = $type->name = $type->module = $type->description = $type->help = '';
- $type->min_word_count = 0;
- $type->has_title = TRUE;
- $type->has_body = TRUE;
- $type->title_label = t('Title');
- $type->body_label = t('Body');
- $type->custom = TRUE;
- $type->modified = FALSE;
- $type->locked = FALSE;
+ // This is a new type. Node module managed types are custom and unlocked.
+ $type = node_type_set_defaults(array('custom' => 1, 'locked' => 0));
}
- $form['#node_type'] = $type; // Make the type object available to implementations of hook_form_alter.
+ // Make the type object available to implementations of hook_form_alter.
+ $form['#node_type'] = $type;
$form['identity'] = array(
'#type' => 'fieldset',
@@ -170,9 +163,9 @@ function node_type_form(&$form_state, $t
'#type' => 'value',
'#value' => isset($type->orig_type) ? $type->orig_type : '',
);
- $form['module'] = array(
+ $form['base'] = array(
'#type' => 'value',
- '#value' => $type->module,
+ '#value' => $type->base,
);
$form['custom'] = array(
'#type' => 'value',
@@ -253,7 +246,7 @@ function node_type_form_validate($form,
function node_type_form_submit($form, &$form_state) {
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
- $type = new stdClass();
+ $type = node_type_set_defaults();
$type->type = trim($form_state['values']['type']);
$type->name = trim($form_state['values']['name']);
@@ -271,7 +264,7 @@ function node_type_form_submit($form, &$
$type->has_title = ($type->title_label != '');
$type->has_body = ($type->body_label != '');
- $type->module = !empty($form_state['values']['module']) ? $form_state['values']['module'] : 'node';
+ $type->base = !empty($form_state['values']['base']) ? $form_state['values']['base'] : 'node_content';
$type->custom = $form_state['values']['custom'];
$type->modified = TRUE;
$type->locked = $form_state['values']['locked'];
@@ -365,7 +358,7 @@ function node_type_reset(&$type) {
$info_array = module_invoke_all('node_info');
if (isset($info_array[$type->orig_type])) {
$info_array[$type->orig_type]['type'] = $type->orig_type;
- $info = _node_type_set_defaults($info_array[$type->orig_type]);
+ $info = node_type_set_defaults($info_array[$type->orig_type]);
foreach ($info as $field => $value) {
$type->$field = $value;
Index: modules/node/node.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.install,v
retrieving revision 1.6
diff -u -p -r1.6 node.install
--- modules/node/node.install 15 Apr 2008 08:39:03 -0000 1.6
+++ modules/node/node.install 8 Oct 2008 03:10:00 -0000
@@ -293,8 +293,8 @@ function node_schema() {
'not null' => TRUE,
'default' => '',
),
- 'module' => array(
- 'description' => t('The module that implements this type.'),
+ 'base' => array(
+ 'description' => t('The base string used to construct callbacks corresponding to this node type.'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
@@ -380,3 +380,23 @@ function node_schema() {
return $schema;
}
+
+/**
+ * Drupal 6.x to 7.x updates
+ */
+
+/**
+ * Fix node type 'module' attribute to avoid name-space conflicts.
+ */
+function node_update_7000() {
+ $ret = array();
+
+ $ret[] = update_sql("UPDATE {node_type} SET module = 'node_content' WHERE module = 'node'");
+ db_change_field($ret, 'node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
+
+ return $ret;
+}
+
+/**
+ * End of 6.x to 7.x updates
+ */
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.980
diff -u -p -r1.980 node.module
--- modules/node/node.module 6 Oct 2008 12:55:54 -0000 1.980
+++ modules/node/node.module 8 Oct 2008 03:10:00 -0000
@@ -465,8 +465,8 @@ function node_get_types($op = 'types', $
return $_node_types;
case 'type':
return isset($_node_types[$type]) ? $_node_types[$type] : FALSE;
- case 'module':
- return isset($_node_types[$type]->module) ? $_node_types[$type]->module : FALSE;
+ case 'base':
+ return isset($_node_types[$type]->base) ? $_node_types[$type]->base : FALSE;
case 'names':
return $_node_names;
case 'name':
@@ -508,32 +508,35 @@ function node_type_save($info) {
$is_existing = FALSE;
$existing_type = !empty($info->old_type) ? $info->old_type : $info->type;
$is_existing = db_result(db_query("SELECT COUNT(*) FROM {node_type} WHERE type = '%s'", $existing_type));
- if (!isset($info->help)) {
- $info->help = '';
- }
- if (empty($info->min_word_count)) {
- $info->min_word_count = 0;
- }
- if (!isset($info->body_label)) {
- $info->body_label = '';
- }
- if (empty($info->custom)) {
- $info->custom = 0;
- }
- if (empty($info->locked)) {
- $info->locked = 0;
- }
+ $type = node_type_set_defaults($info);
+
+ $fields = array(
+ 'type' => (string) $type->type,
+ 'name' => (string) $type->name,
+ 'base' => (string) $type->base,
+ 'has_title' => (int) $type->has_title,
+ 'title_label' => (string) $type->title_label,
+ 'has_body' => (int) $type->has_body,
+ 'body_label' => (string) $type->body_label,
+ 'description' => (string) $type->description,
+ 'help' => (string) $type->help,
+ 'min_word_count' => (int) $type->min_word_count,
+ 'custom' => (int) $type->custom,
+ 'modified' => (int) $type->modified,
+ 'locked' => (int) $type->locked,
+ );
if ($is_existing) {
- db_query("UPDATE {node_type} SET type = '%s', name = '%s', module = '%s', has_title = %d, title_label = '%s', has_body = %d, body_label = '%s', description = '%s', help = '%s', min_word_count = %d, custom = %d, modified = %d, locked = %d WHERE type = '%s'", $info->type, $info->name, $info->module, $info->has_title, $info->title_label, $info->has_body, $info->body_label, $info->description, $info->help, $info->min_word_count, $info->custom, $info->modified, $info->locked, $existing_type);
+ db_update('node_type')->fields($fields)->condition('type', $existing_type)->execute();
- module_invoke_all('node_type', 'update', $info);
+ module_invoke_all('node_type', 'update', $type);
return SAVED_UPDATED;
}
else {
- db_query("INSERT INTO {node_type} (type, name, module, has_title, title_label, has_body, body_label, description, help, min_word_count, custom, modified, locked, orig_type) VALUES ('%s', '%s', '%s', %d, '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d, '%s')", $info->type, $info->name, $info->module, $info->has_title, $info->title_label, $info->has_body, $info->body_label, $info->description, $info->help, $info->min_word_count, $info->custom, $info->modified, $info->locked, $info->orig_type);
+ $fields['orig_type'] = (string) $type->orig_type;
+ db_insert('node_type')->fields($fields)->execute();
- module_invoke_all('node_type', 'insert', $info);
+ module_invoke_all('node_type', 'insert', $type);
return SAVED_NEW;
}
}
@@ -580,7 +583,7 @@ function _node_types_build() {
$info_array = module_invoke_all('node_info');
foreach ($info_array as $type => $info) {
$info['type'] = $type;
- $_node_types[$type] = (object) _node_type_set_defaults($info);
+ $_node_types[$type] = node_type_set_defaults($info);
$_node_names[$type] = $info['name'];
}
@@ -588,8 +591,8 @@ function _node_types_build() {
while ($type_object = db_fetch_object($type_result)) {
// Check for node types from disabled modules and mark their types for removal.
// Types defined by the node module in the database (rather than by a separate
- // module using hook_node_info) have a module value of 'node'.
- if ($type_object->module != 'node' && empty($info_array[$type_object->type])) {
+ // module using hook_node_info) have a base value of 'node_content'.
+ if ($type_object->base != 'node_content' && empty($info_array[$type_object->type])) {
$type_object->disabled = TRUE;
}
if (!isset($_node_types[$type_object->type]) || $type_object->modified) {
@@ -609,43 +612,54 @@ function _node_types_build() {
}
/**
- * Set default values for a node type defined through hook_node_info().
+ * Set the default values for a node type.
+ *
+ * The defaults are for a type defined through hook_node_info().
+ * When populating a custom node type $info should have the 'custom'
+ * key set to 1.
+ *
+ * @param $info
+ * An object or array containing values to override the defaults.
+ *
+ * @return
+ * A node type object.
*/
-function _node_type_set_defaults($info) {
- if (!isset($info['has_title'])) {
- $info['has_title'] = TRUE;
- }
- if ($info['has_title'] && !isset($info['title_label'])) {
- $info['title_label'] = t('Title');
- }
-
- if (!isset($info['has_body'])) {
- $info['has_body'] = TRUE;
- }
- if ($info['has_body'] && !isset($info['body_label'])) {
- $info['body_label'] = t('Body');
- }
+function node_type_set_defaults($info = array()) {
+ static $type;
- if (!isset($info['help'])) {
- $info['help'] = '';
- }
- if (!isset($info['min_word_count'])) {
- $info['min_word_count'] = 0;
+ if (!isset($type)) {
+ $type = new stdClass();
+ $type->type = '';
+ $type->name = '';
+ $type->base = '';
+ $type->description = '';
+ $type->help = '';
+ $type->min_word_count = 0;
+ $type->has_title = 1;
+ $type->has_body = 1;
+ $type->title_label = t('Title');
+ $type->body_label = t('Body');
+ $type->custom = 0;
+ $type->modified = 0;
+ $type->locked = 1;
+ $type->is_new = 1;
+ }
+
+ $new_type = clone $type;
+ $info = (array) $info;
+ foreach ($info as $key => $data) {
+ $new_type->$key = $data;
+ }
+ // If the type has no title or body, set an empty label.
+ if (!$new_type->has_title) {
+ $new_type->title_label = '';
}
- if (!isset($info['custom'])) {
- $info['custom'] = FALSE;
+ if (!$new_type->has_body) {
+ $new_type->body_label = '';
}
- if (!isset($info['modified'])) {
- $info['modified'] = FALSE;
- }
- if (!isset($info['locked'])) {
- $info['locked'] = TRUE;
- }
-
- $info['orig_type'] = $info['type'];
- $info['is_new'] = TRUE;
+ $new_type->orig_type = isset($info['type']) ? $info['type'] : '';
- return $info;
+ return $new_type;
}
/**
@@ -659,12 +673,8 @@ function _node_type_set_defaults($info)
* TRUE iff the $hook exists in the node type of $node.
*/
function node_hook(&$node, $hook) {
- $module = node_get_types('module', $node);
- if ($module == 'node') {
- // Avoid function name collisions.
- $module = 'node_content';
- }
- return module_hook($module, $hook);
+ $base = node_get_types('base', $node);
+ return module_hook($base, $hook);
}
/**
@@ -681,11 +691,8 @@ function node_hook(&$node, $hook) {
*/
function node_invoke(&$node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
if (node_hook($node, $hook)) {
- $module = node_get_types('module', $node);
- if ($module == 'node') {
- $module = 'node_content'; // Avoid function name collisions.
- }
- $function = $module . '_' . $hook;
+ $base = node_get_types('base', $node);
+ $function = $base . '_' . $hook;
return ($function($node, $a2, $a3, $a4));
}
}
@@ -1172,7 +1179,7 @@ function node_perm() {
);
foreach (node_get_types() as $type) {
- if ($type->module == 'node') {
+ if ($type->base == 'node_content') {
$perms += node_list_permissions($type);
}
}
@@ -2085,11 +2092,8 @@ function node_access($op, $node, $accoun
// Can't use node_invoke('access', $node), because the access hook takes the
// $op parameter before the $node parameter.
- $module = node_get_types('module', $node);
- if ($module == 'node') {
- $module = 'node_content'; // Avoid function name collisions.
- }
- $access = module_invoke($module, 'access', $op, $node, $account);
+ $base = node_get_types('base', $node);
+ $access = module_invoke($base, 'access', $op, $node, $account);
if (!is_null($access)) {
return $access;
}
Index: modules/poll/poll.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v
retrieving revision 1.273
diff -u -p -r1.273 poll.module
--- modules/poll/poll.module 6 Oct 2008 11:30:11 -0000 1.273
+++ modules/poll/poll.module 8 Oct 2008 03:10:00 -0000
@@ -174,7 +174,7 @@ function poll_node_info() {
return array(
'poll' => array(
'name' => t('Poll'),
- 'module' => 'poll',
+ 'base' => 'poll',
'description' => t('A poll is a question with a set of possible responses. A poll, once created, automatically provides a simple running count of the number of votes received for each response.'),
'title_label' => t('Question'),
'has_body' => FALSE,
Index: profiles/default/default.profile
===================================================================
RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v
retrieving revision 1.29
diff -u -p -r1.29 default.profile
--- profiles/default/default.profile 18 Sep 2008 10:44:19 -0000 1.29
+++ profiles/default/default.profile 8 Oct 2008 03:10:00 -0000
@@ -98,29 +98,25 @@ function default_profile_tasks(&$task, $
array(
'type' => 'page',
'name' => st('Page'),
- 'module' => 'node',
+ 'base' => 'node_content',
'description' => st("A page, similar in form to an article, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a page entry does not allow visitor comments and is not featured on the site's initial home page."),
- 'custom' => TRUE,
- 'modified' => TRUE,
- 'locked' => FALSE,
- 'help' => '',
- 'min_word_count' => '',
+ 'custom' => 1,
+ 'modified' => 1,
+ 'locked' => 0,
),
array(
'type' => 'article',
'name' => st('Article'),
- 'module' => 'node',
+ 'base' => 'node_content',
'description' => st("An article, similar in form to a page, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with an article entry. By default, an article entry is automatically featured on the site's initial home page, and provides the ability to post comments."),
- 'custom' => TRUE,
- 'modified' => TRUE,
- 'locked' => FALSE,
- 'help' => '',
- 'min_word_count' => '',
+ 'custom' => 1,
+ 'modified' => 1,
+ 'locked' => 0,
),
);
foreach ($types as $type) {
- $type = (object) _node_type_set_defaults($type);
+ $type = node_type_set_defaults($type);
node_type_save($type);
}