diff --git a/workbench_moderation.install b/workbench_moderation.install index bd788e8..afa3d79 100644 --- a/workbench_moderation.install +++ b/workbench_moderation.install @@ -128,7 +128,7 @@ function workbench_moderation_schema() { 'default' => 0, 'disp-width' => '10', ), - 'current' => array( + 'is_current' => array( 'description' => 'Indicated the current revision of a node.', 'type' => 'int', 'unsigned' => TRUE, @@ -529,3 +529,22 @@ function workbench_moderation_update_7006() { return t("Added column to store moderation state labels."); } + +/** + * Comply with SQL-99: renaming current column. + */ +function workbench_moderation_update_7007() { + $table = 'workbench_moderation_node_history'; + $field = 'current'; + $field_new = 'is_current'; + $spec = array( + 'description' => 'Indicated the current revision of a node.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'disp-width' => '10', + ); + db_change_field($table, $field, $field_new, $spec); + return t("Renamed 'current' column in node_history table"); +} \ No newline at end of file diff --git a/workbench_moderation.module b/workbench_moderation.module index 5fe5de8..a689365 100644 --- a/workbench_moderation.module +++ b/workbench_moderation.module @@ -472,7 +472,7 @@ function _workbench_moderation_moderate_access($node, $state) { $my_revision = $node->workbench_moderation['my_revision']; $next_states = workbench_moderation_states_next($my_revision->state, $user, $node->type); $access = node_access('update', $node, $user) // the user can edit the node - && $my_revision->current // this is the current revision (no branching the revision history) + && $my_revision->is_current // this is the current revision (no branching the revision history) && (!empty($next_states)) // there are next states the user may transition to && isset($next_states[$state]); // this state is in the available next states @@ -632,7 +632,7 @@ function workbench_moderation_node_update($node) { 'nid' => $node->nid, 'vid' => $node->vid, 'uid' => $user->uid, - 'current' => TRUE, + 'is_current' => TRUE, 'published' => FALSE, 'stamp' => $node->changed, ); @@ -974,7 +974,7 @@ function workbench_moderation_node_data($node) { $node->path = $path; } - // Build a default 'current' moderation record. Nodes will lack a + // Build a default current moderation record. Nodes will lack a // workbench_moderation record if moderation was not enabled for their node // type when they were created. In that case, assume the live node is at the // current revision. @@ -987,7 +987,7 @@ function workbench_moderation_node_data($node) { 'uid' => $node->uid, 'stamp' => $node->changed, 'published' => $node->status, - 'current' => 1, + 'is_current' => 1, ); // We'll store moderation state information in an array on the node. @@ -1077,7 +1077,7 @@ function workbench_moderation_node_data($node) { 'uid' => $node->uid, 'stamp' => $node->changed, 'published' => 0, - 'current' => 0, + 'is_current' => 0, ); } } @@ -1412,17 +1412,17 @@ function workbench_moderation_moderate($node, $state) { 'nid' => $node->nid, 'vid' => $node->vid, 'uid' => $user->uid, - 'current' => $current, + 'is_current' => $current, 'published' => ($state == workbench_moderation_state_published()), 'stamp' => $_SERVER['REQUEST_TIME'], ); // If this is the new 'current' moderation record, it should be the only one // flagged 'current' in {workbench_moderation_node_history}. - if ($new_revision->current) { + if ($new_revision->is_current) { $query = db_update('workbench_moderation_node_history') ->condition('nid', $node->nid) - ->fields(array('current' => 0)) + ->fields(array('is_current' => 0)) ->execute(); } @@ -1446,7 +1446,7 @@ function workbench_moderation_moderate($node, $state) { // Update the node's content_moderation information so that we can publish it // if necessary. $node->workbench_moderation['my_revision'] = $new_revision; - if ($new_revision->current) { + if ($new_revision->is_current) { $node->workbench_moderation['current'] = $new_revision; } // Handle the published revision. diff --git a/workbench_moderation.views.inc b/workbench_moderation.views.inc index 9512698..42dc06c 100644 --- a/workbench_moderation.views.inc +++ b/workbench_moderation.views.inc @@ -121,7 +121,7 @@ function workbench_moderation_views_data() { 'handler' => 'views_handler_sort', ), ); - $data['workbench_moderation_node_history']['current'] = array( + $data['workbench_moderation_node_history']['is_current'] = array( 'title' => t('Current'), 'help' => t('Whether or not this is the current revision.'), 'field' => array( @@ -145,7 +145,7 @@ function workbench_moderation_views_data() { 'title' => t('Moderation Links'), 'handler' => 'workbench_moderation_handler_field_links', 'click sortable' => FALSE, - 'additional fields' => array('nid', 'vid', 'current'), + 'additional fields' => array('nid', 'vid', 'is_current'), ), 'filter' => array( 'title' => t('User Can Moderate'),