| 1 |
<?php
|
| 2 |
// $Id: node.install,v 1.33 2009/10/11 03:07:18 webchick Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Install, update and uninstall functions for the node module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implement hook_schema().
|
| 11 |
*/
|
| 12 |
function node_schema() {
|
| 13 |
$schema['node'] = array(
|
| 14 |
'description' => 'The base table for nodes.',
|
| 15 |
'fields' => array(
|
| 16 |
'nid' => array(
|
| 17 |
'description' => 'The primary identifier for a node.',
|
| 18 |
'type' => 'serial',
|
| 19 |
'unsigned' => TRUE,
|
| 20 |
'not null' => TRUE,
|
| 21 |
),
|
| 22 |
'vid' => array(
|
| 23 |
'description' => 'The current {node_revision}.vid version identifier.',
|
| 24 |
'type' => 'int',
|
| 25 |
'unsigned' => TRUE,
|
| 26 |
'not null' => TRUE,
|
| 27 |
'default' => 0,
|
| 28 |
),
|
| 29 |
'type' => array(
|
| 30 |
'description' => 'The {node_type}.type of this node.',
|
| 31 |
'type' => 'varchar',
|
| 32 |
'length' => 32,
|
| 33 |
'not null' => TRUE,
|
| 34 |
'default' => '',
|
| 35 |
),
|
| 36 |
'language' => array(
|
| 37 |
'description' => 'The {languages}.language of this node.',
|
| 38 |
'type' => 'varchar',
|
| 39 |
'length' => 12,
|
| 40 |
'not null' => TRUE,
|
| 41 |
'default' => '',
|
| 42 |
),
|
| 43 |
'title' => array(
|
| 44 |
'description' => 'The title of this node, always treated as non-markup plain text.',
|
| 45 |
'type' => 'varchar',
|
| 46 |
'length' => 255,
|
| 47 |
'not null' => TRUE,
|
| 48 |
'default' => '',
|
| 49 |
),
|
| 50 |
'uid' => array(
|
| 51 |
'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.',
|
| 52 |
'type' => 'int',
|
| 53 |
'not null' => TRUE,
|
| 54 |
'default' => 0,
|
| 55 |
),
|
| 56 |
'status' => array(
|
| 57 |
'description' => 'Boolean indicating whether the node is published (visible to non-administrators).',
|
| 58 |
'type' => 'int',
|
| 59 |
'not null' => TRUE,
|
| 60 |
'default' => 1,
|
| 61 |
),
|
| 62 |
'created' => array(
|
| 63 |
'description' => 'The Unix timestamp when the node was created.',
|
| 64 |
'type' => 'int',
|
| 65 |
'not null' => TRUE,
|
| 66 |
'default' => 0,
|
| 67 |
),
|
| 68 |
'changed' => array(
|
| 69 |
'description' => 'The Unix timestamp when the node was most recently saved.',
|
| 70 |
'type' => 'int',
|
| 71 |
'not null' => TRUE,
|
| 72 |
'default' => 0,
|
| 73 |
),
|
| 74 |
'comment' => array(
|
| 75 |
'description' => 'Whether comments are allowed on this node: 0 = no, 1 = closed (read only), 2 = open (read/write).',
|
| 76 |
'type' => 'int',
|
| 77 |
'not null' => TRUE,
|
| 78 |
'default' => 0,
|
| 79 |
),
|
| 80 |
'promote' => array(
|
| 81 |
'description' => 'Boolean indicating whether the node should be displayed on the front page.',
|
| 82 |
'type' => 'int',
|
| 83 |
'not null' => TRUE,
|
| 84 |
'default' => 0,
|
| 85 |
),
|
| 86 |
'sticky' => array(
|
| 87 |
'description' => 'Boolean indicating whether the node should be displayed at the top of lists in which it appears.',
|
| 88 |
'type' => 'int',
|
| 89 |
'not null' => TRUE,
|
| 90 |
'default' => 0,
|
| 91 |
),
|
| 92 |
'tnid' => array(
|
| 93 |
'description' => 'The translation set id for this node, which equals the node id of the source post in each set.',
|
| 94 |
'type' => 'int',
|
| 95 |
'unsigned' => TRUE,
|
| 96 |
'not null' => TRUE,
|
| 97 |
'default' => 0,
|
| 98 |
),
|
| 99 |
'translate' => array(
|
| 100 |
'description' => 'A boolean indicating whether this translation page needs to be updated.',
|
| 101 |
'type' => 'int',
|
| 102 |
'not null' => TRUE,
|
| 103 |
'default' => 0,
|
| 104 |
),
|
| 105 |
),
|
| 106 |
'indexes' => array(
|
| 107 |
'node_changed' => array('changed'),
|
| 108 |
'node_created' => array('created'),
|
| 109 |
'node_frontpage' => array('promote', 'status', 'sticky', 'created'),
|
| 110 |
'node_status_type' => array('status', 'type', 'nid'),
|
| 111 |
'node_title_type' => array('title', array('type', 4)),
|
| 112 |
'node_type' => array(array('type', 4)),
|
| 113 |
'uid' => array('uid'),
|
| 114 |
'tnid' => array('tnid'),
|
| 115 |
'translate' => array('translate'),
|
| 116 |
),
|
| 117 |
'unique keys' => array(
|
| 118 |
'vid' => array('vid'),
|
| 119 |
),
|
| 120 |
'foreign keys' => array(
|
| 121 |
'vid' => array('node_revision' => 'vid'),
|
| 122 |
'uid' => array('users' => 'uid'),
|
| 123 |
),
|
| 124 |
'primary key' => array('nid'),
|
| 125 |
);
|
| 126 |
|
| 127 |
$schema['node_access'] = array(
|
| 128 |
'description' => 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.',
|
| 129 |
'fields' => array(
|
| 130 |
'nid' => array(
|
| 131 |
'description' => 'The {node}.nid this record affects.',
|
| 132 |
'type' => 'int',
|
| 133 |
'unsigned' => TRUE,
|
| 134 |
'not null' => TRUE,
|
| 135 |
'default' => 0,
|
| 136 |
),
|
| 137 |
'gid' => array(
|
| 138 |
'description' => "The grant ID a user must possess in the specified realm to gain this row's privileges on the node.",
|
| 139 |
'type' => 'int',
|
| 140 |
'unsigned' => TRUE,
|
| 141 |
'not null' => TRUE,
|
| 142 |
'default' => 0,
|
| 143 |
),
|
| 144 |
'realm' => array(
|
| 145 |
'description' => 'The realm in which the user must possess the grant ID. Each node access node can define one or more realms.',
|
| 146 |
'type' => 'varchar',
|
| 147 |
'length' => 255,
|
| 148 |
'not null' => TRUE,
|
| 149 |
'default' => '',
|
| 150 |
),
|
| 151 |
'grant_view' => array(
|
| 152 |
'description' => 'Boolean indicating whether a user with the realm/grant pair can view this node.',
|
| 153 |
'type' => 'int',
|
| 154 |
'unsigned' => TRUE,
|
| 155 |
'not null' => TRUE,
|
| 156 |
'default' => 0,
|
| 157 |
'size' => 'tiny',
|
| 158 |
),
|
| 159 |
'grant_update' => array(
|
| 160 |
'description' => 'Boolean indicating whether a user with the realm/grant pair can edit this node.',
|
| 161 |
'type' => 'int',
|
| 162 |
'unsigned' => TRUE,
|
| 163 |
'not null' => TRUE,
|
| 164 |
'default' => 0,
|
| 165 |
'size' => 'tiny',
|
| 166 |
),
|
| 167 |
'grant_delete' => array(
|
| 168 |
'description' => 'Boolean indicating whether a user with the realm/grant pair can delete this node.',
|
| 169 |
'type' => 'int',
|
| 170 |
'unsigned' => TRUE,
|
| 171 |
'not null' => TRUE,
|
| 172 |
'default' => 0,
|
| 173 |
'size' => 'tiny',
|
| 174 |
),
|
| 175 |
),
|
| 176 |
'primary key' => array('nid', 'gid', 'realm'),
|
| 177 |
'foreign keys' => array('node' => 'nid'),
|
| 178 |
);
|
| 179 |
|
| 180 |
$schema['node_revision'] = array(
|
| 181 |
'description' => 'Stores information about each saved version of a {node}.',
|
| 182 |
'fields' => array(
|
| 183 |
'nid' => array(
|
| 184 |
'description' => 'The {node} this version belongs to.',
|
| 185 |
'type' => 'int',
|
| 186 |
'unsigned' => TRUE,
|
| 187 |
'not null' => TRUE,
|
| 188 |
'default' => 0,
|
| 189 |
),
|
| 190 |
'vid' => array(
|
| 191 |
'description' => 'The primary identifier for this version.',
|
| 192 |
'type' => 'serial',
|
| 193 |
'unsigned' => TRUE,
|
| 194 |
'not null' => TRUE,
|
| 195 |
),
|
| 196 |
'uid' => array(
|
| 197 |
'description' => 'The {users}.uid that created this version.',
|
| 198 |
'type' => 'int',
|
| 199 |
'not null' => TRUE,
|
| 200 |
'default' => 0,
|
| 201 |
),
|
| 202 |
'title' => array(
|
| 203 |
'description' => 'The title of this version.',
|
| 204 |
'type' => 'varchar',
|
| 205 |
'length' => 255,
|
| 206 |
'not null' => TRUE,
|
| 207 |
'default' => '',
|
| 208 |
),
|
| 209 |
'log' => array(
|
| 210 |
'description' => 'The log entry explaining the changes in this version.',
|
| 211 |
'type' => 'text',
|
| 212 |
'not null' => TRUE,
|
| 213 |
'size' => 'big',
|
| 214 |
),
|
| 215 |
'timestamp' => array(
|
| 216 |
'description' => 'A Unix timestamp indicating when this version was created.',
|
| 217 |
'type' => 'int',
|
| 218 |
'not null' => TRUE,
|
| 219 |
'default' => 0,
|
| 220 |
),
|
| 221 |
'status' => array(
|
| 222 |
'description' => 'Boolean indicating whether the node (at the time of this revision) is published (visible to non-administrators).',
|
| 223 |
'type' => 'int',
|
| 224 |
'not null' => TRUE,
|
| 225 |
'default' => 1,
|
| 226 |
),
|
| 227 |
'comment' => array(
|
| 228 |
'description' => 'Whether comments are allowed on this node (at the time of this revision): 0 = no, 1 = closed (read only), 2 = open (read/write).',
|
| 229 |
'type' => 'int',
|
| 230 |
'not null' => TRUE,
|
| 231 |
'default' => 0,
|
| 232 |
),
|
| 233 |
'promote' => array(
|
| 234 |
'description' => 'Boolean indicating whether the node (at the time of this revision) should be displayed on the front page.',
|
| 235 |
'type' => 'int',
|
| 236 |
'not null' => TRUE,
|
| 237 |
'default' => 0,
|
| 238 |
),
|
| 239 |
'sticky' => array(
|
| 240 |
'description' => 'Boolean indicating whether the node (at the time of this revision) should be displayed at the top of lists in which it appears.',
|
| 241 |
'type' => 'int',
|
| 242 |
'not null' => TRUE,
|
| 243 |
'default' => 0,
|
| 244 |
),
|
| 245 |
),
|
| 246 |
'indexes' => array(
|
| 247 |
'nid' => array('nid'),
|
| 248 |
'uid' => array('uid'),
|
| 249 |
),
|
| 250 |
'primary key' => array('vid'),
|
| 251 |
'foreign keys' => array(
|
| 252 |
'node' => 'nid',
|
| 253 |
'users' => 'uid'
|
| 254 |
),
|
| 255 |
);
|
| 256 |
|
| 257 |
$schema['node_type'] = array(
|
| 258 |
'description' => 'Stores information about all defined {node} types.',
|
| 259 |
'fields' => array(
|
| 260 |
'type' => array(
|
| 261 |
'description' => 'The machine-readable name of this type.',
|
| 262 |
'type' => 'varchar',
|
| 263 |
'length' => 32,
|
| 264 |
'not null' => TRUE,
|
| 265 |
),
|
| 266 |
'name' => array(
|
| 267 |
'description' => 'The human-readable name of this type.',
|
| 268 |
'type' => 'varchar',
|
| 269 |
'length' => 255,
|
| 270 |
'not null' => TRUE,
|
| 271 |
'default' => '',
|
| 272 |
'translatable' => TRUE,
|
| 273 |
),
|
| 274 |
'base' => array(
|
| 275 |
'description' => 'The base string used to construct callbacks corresponding to this node type.',
|
| 276 |
'type' => 'varchar',
|
| 277 |
'length' => 255,
|
| 278 |
'not null' => TRUE,
|
| 279 |
),
|
| 280 |
'description' => array(
|
| 281 |
'description' => 'A brief description of this type.',
|
| 282 |
'type' => 'text',
|
| 283 |
'not null' => TRUE,
|
| 284 |
'size' => 'medium',
|
| 285 |
'translatable' => TRUE,
|
| 286 |
),
|
| 287 |
'help' => array(
|
| 288 |
'description' => 'Help information shown to the user when creating a {node} of this type.',
|
| 289 |
'type' => 'text',
|
| 290 |
'not null' => TRUE,
|
| 291 |
'size' => 'medium',
|
| 292 |
'translatable' => TRUE,
|
| 293 |
),
|
| 294 |
'has_title' => array(
|
| 295 |
'description' => 'Boolean indicating whether this type uses the {node}.title field.',
|
| 296 |
'type' => 'int',
|
| 297 |
'unsigned' => TRUE,
|
| 298 |
'not null' => TRUE,
|
| 299 |
'size' => 'tiny',
|
| 300 |
),
|
| 301 |
'title_label' => array(
|
| 302 |
'description' => 'The label displayed for the title field on the edit form.',
|
| 303 |
'type' => 'varchar',
|
| 304 |
'length' => 255,
|
| 305 |
'not null' => TRUE,
|
| 306 |
'default' => '',
|
| 307 |
'translatable' => TRUE,
|
| 308 |
),
|
| 309 |
'has_body' => array(
|
| 310 |
'description' => 'Boolean indicating whether this type has the body field attached.',
|
| 311 |
'type' => 'int',
|
| 312 |
'unsigned' => TRUE,
|
| 313 |
'not null' => TRUE,
|
| 314 |
'size' => 'tiny',
|
| 315 |
),
|
| 316 |
'body_label' => array(
|
| 317 |
'description' => 'The label displayed for the body field on the edit form.',
|
| 318 |
'type' => 'varchar',
|
| 319 |
'length' => 255,
|
| 320 |
'not null' => TRUE,
|
| 321 |
'default' => '',
|
| 322 |
'translatable' => TRUE,
|
| 323 |
),
|
| 324 |
'custom' => array(
|
| 325 |
'description' => 'A boolean indicating whether this type is defined by a module (FALSE) or by a user via Add content type (TRUE).',
|
| 326 |
'type' => 'int',
|
| 327 |
'not null' => TRUE,
|
| 328 |
'default' => 0,
|
| 329 |
'size' => 'tiny',
|
| 330 |
),
|
| 331 |
'modified' => array(
|
| 332 |
'description' => 'A boolean indicating whether this type has been modified by an administrator; currently not used in any way.',
|
| 333 |
'type' => 'int',
|
| 334 |
'not null' => TRUE,
|
| 335 |
'default' => 0,
|
| 336 |
'size' => 'tiny',
|
| 337 |
),
|
| 338 |
'locked' => array(
|
| 339 |
'description' => 'A boolean indicating whether the administrator can change the machine name of this type.',
|
| 340 |
'type' => 'int',
|
| 341 |
'not null' => TRUE,
|
| 342 |
'default' => 0,
|
| 343 |
'size' => 'tiny',
|
| 344 |
),
|
| 345 |
'orig_type' => array(
|
| 346 |
'description' => 'The original machine-readable name of this node type. This may be different from the current type name if the locked field is 0.',
|
| 347 |
'type' => 'varchar',
|
| 348 |
'length' => 255,
|
| 349 |
'not null' => TRUE,
|
| 350 |
'default' => '',
|
| 351 |
),
|
| 352 |
),
|
| 353 |
'primary key' => array('type'),
|
| 354 |
);
|
| 355 |
|
| 356 |
return $schema;
|
| 357 |
}
|
| 358 |
|
| 359 |
/**
|
| 360 |
* @defgroup updates-6.x-to-7.x System updates from 6.x to 7.x
|
| 361 |
* @{
|
| 362 |
*/
|
| 363 |
|
| 364 |
/**
|
| 365 |
* Fix node type 'module' attribute to avoid name-space conflicts.
|
| 366 |
*/
|
| 367 |
function node_update_7000() {
|
| 368 |
db_update('node_type')
|
| 369 |
->fields(array('module' => 'node_content'))
|
| 370 |
->condition('module', 'node')
|
| 371 |
->execute();
|
| 372 |
}
|
| 373 |
|
| 374 |
/**
|
| 375 |
* Rename {node_revisions} table to {node_revision}.
|
| 376 |
*/
|
| 377 |
function node_update_7001() {
|
| 378 |
db_rename_table('node_revisions', 'node_revision');
|
| 379 |
}
|
| 380 |
|
| 381 |
/**
|
| 382 |
* Extend the node_promote_status index to include all fields required for the node page query.
|
| 383 |
*/
|
| 384 |
function node_update_7002() {
|
| 385 |
db_drop_index('node', 'node_promote_status');
|
| 386 |
db_add_index('node', 'node_frontpage', array('promote', 'status', 'sticky', 'created'));
|
| 387 |
}
|
| 388 |
|
| 389 |
/**
|
| 390 |
* Remove the node_counter if the statistics module is uninstalled.
|
| 391 |
*/
|
| 392 |
function node_update_7003() {
|
| 393 |
if (drupal_get_installed_schema_version('statistics') == SCHEMA_UNINSTALLED) {
|
| 394 |
db_drop_table('node_counter');
|
| 395 |
}
|
| 396 |
}
|
| 397 |
|
| 398 |
/**
|
| 399 |
* Extend the existing default preview and teaser settings to all node types.
|
| 400 |
*/
|
| 401 |
function node_update_7004() {
|
| 402 |
// Get original settings and all types.
|
| 403 |
$original_length = variable_get('teaser_length', 600);
|
| 404 |
$original_preview = variable_get('node_preview', 0);
|
| 405 |
|
| 406 |
// Map old preview setting to new values order.
|
| 407 |
$original_preview ? $original_preview = 2 : $original_preview = 1;
|
| 408 |
drupal_static_reset('_node_types_build');
|
| 409 |
$type_list = node_type_get_types();
|
| 410 |
|
| 411 |
// Apply original settings to all types.
|
| 412 |
foreach ($type_list as $type => $object) {
|
| 413 |
variable_set('teaser_length_' . $type, $original_length);
|
| 414 |
variable_set('node_preview_' . $type, $original_preview);
|
| 415 |
}
|
| 416 |
// Delete old variable but leave 'teaser_length' for aggregator module upgrade.
|
| 417 |
variable_del('node_preview');
|
| 418 |
}
|
| 419 |
|
| 420 |
/**
|
| 421 |
* Add status/comment/promote and sticky columns to the {node_revision} table.
|
| 422 |
*/
|
| 423 |
function node_update_7005() {
|
| 424 |
foreach(array('status', 'comment', 'promote', 'sticky') as $column) {
|
| 425 |
db_add_field('node_revision', $column, array(
|
| 426 |
'type' => 'int',
|
| 427 |
'not null' => TRUE,
|
| 428 |
'default' => 0,
|
| 429 |
));
|
| 430 |
}
|
| 431 |
}
|
| 432 |
|
| 433 |
/**
|
| 434 |
* Convert body and teaser from node properties to fields, and migrate status/comment/promote and sticky columns to the {node_revision} table.
|
| 435 |
*/
|
| 436 |
function node_update_7006(&$context) {
|
| 437 |
$context['#finished'] = 0;
|
| 438 |
|
| 439 |
// Get node type info for every invocation.
|
| 440 |
drupal_static_reset('_node_types_build');
|
| 441 |
$node_types = node_type_get_types();
|
| 442 |
|
| 443 |
if (!isset($context['total'])) {
|
| 444 |
// Initial invocation.
|
| 445 |
|
| 446 |
// Re-save node types to create title and body field instances.
|
| 447 |
foreach ($node_types as $type => $info) {
|
| 448 |
if ($info->has_title || $info->has_body) {
|
| 449 |
node_type_save($info);
|
| 450 |
}
|
| 451 |
}
|
| 452 |
|
| 453 |
// Initialize state for future calls.
|
| 454 |
$context['last'] = 0;
|
| 455 |
$context['count'] = 0;
|
| 456 |
|
| 457 |
$query = db_select('node', 'n');
|
| 458 |
$query->join('node_revision', 'nr', 'n.vid = nr.vid');
|
| 459 |
$context['total'] = $query->countQuery()->execute()->fetchField();
|
| 460 |
}
|
| 461 |
else {
|
| 462 |
// Subsequent invocations.
|
| 463 |
|
| 464 |
$found = FALSE;
|
| 465 |
if ($context['total']) {
|
| 466 |
// Operate on every revision of every node (whee!), in batches.
|
| 467 |
$batch_size = 50;
|
| 468 |
$query = db_select('node', 'n');
|
| 469 |
$nr = $query->innerJoin('node_revision', 'nr', 'n.vid = nr.vid');
|
| 470 |
$revisions = $query
|
| 471 |
->fields('n', array('type', 'status', 'comment', 'promote', 'sticky'))
|
| 472 |
->fields($nr)
|
| 473 |
->condition('nr.vid', $context['last'], '>')
|
| 474 |
->orderBy('nr.vid', 'ASC')
|
| 475 |
->execute();
|
| 476 |
|
| 477 |
// Load each reversion of each node, set up 'body'
|
| 478 |
// appropriately, and save the node's field data. Note that
|
| 479 |
// node_load() will not return the body or teaser values from
|
| 480 |
// {node_revision} because those columns have been removed from the
|
| 481 |
// schema structure in memory (but not yet from the database),
|
| 482 |
// so we get the values from the explicit query of the table
|
| 483 |
// instead.
|
| 484 |
foreach ($revisions as $revision) {
|
| 485 |
$found = TRUE;
|
| 486 |
|
| 487 |
if ($node_types[$revision->type]->has_body) {
|
| 488 |
$node = (object) array(
|
| 489 |
'nid' => $revision->nid,
|
| 490 |
'vid' => $revision->vid,
|
| 491 |
'type' => $revision->type,
|
| 492 |
);
|
| 493 |
$node->title[FIELD_LANGUAGE_NONE][0]['value'] = $revision->title;
|
| 494 |
if (!empty($revision->teaser) && $revision->teaser != text_summary($revision->body)) {
|
| 495 |
$node->body[FIELD_LANGUAGE_NONE][0]['summary'] = $revision->teaser;
|
| 496 |
}
|
| 497 |
// Do this after text_summary() above.
|
| 498 |
$break = '<!--break-->';
|
| 499 |
if (substr($revision->body, 0, strlen($break)) == $break) {
|
| 500 |
$revision->body = substr($revision->body, strlen($break));
|
| 501 |
}
|
| 502 |
$node->body[FIELD_LANGUAGE_NONE][0]['value'] = $revision->body;
|
| 503 |
// Explicitly store the current default text format if the revision
|
| 504 |
// did not have its own text format. Similar conversions for other
|
| 505 |
// core modules are performed in filter_update_7005(), but we do this
|
| 506 |
// one here since we are already migrating the data.
|
| 507 |
$node->body[FIELD_LANGUAGE_NONE][0]['format'] = !empty($revision->format) ? $revision->format : variable_get('filter_default_format', 1);
|
| 508 |
// This is a core update and no contrib modules are enabled yet, so
|
| 509 |
// we can assume default field storage for a faster update.
|
| 510 |
field_sql_storage_field_storage_write('node', $node, FIELD_STORAGE_INSERT, array());
|
| 511 |
}
|
| 512 |
|
| 513 |
// Migrate the status columns to the {node_revision} table.
|
| 514 |
db_update('node_revision')
|
| 515 |
->fields(array(
|
| 516 |
'vid' => $revision->vid,
|
| 517 |
'status' => $revision->status,
|
| 518 |
'comment' => $revision->comment,
|
| 519 |
'promote' => $revision->promote,
|
| 520 |
'sticky' => $revision->sticky,
|
| 521 |
))
|
| 522 |
->condition('vid', $revision->vid)
|
| 523 |
->execute();
|
| 524 |
|
| 525 |
$context['last'] = $revision->vid;
|
| 526 |
$context['count'] += 1;
|
| 527 |
|
| 528 |
if (--$batch_size == 0) {
|
| 529 |
break;
|
| 530 |
}
|
| 531 |
}
|
| 532 |
|
| 533 |
$context['#finished'] = min(0.99, $context['count'] / $context['total']);
|
| 534 |
}
|
| 535 |
|
| 536 |
if (!$found) {
|
| 537 |
// All nodes are processed.
|
| 538 |
|
| 539 |
// Remove the now-obsolete body info from node_revision.
|
| 540 |
db_drop_field('node_revision', 'body');
|
| 541 |
db_drop_field('node_revision', 'teaser');
|
| 542 |
db_drop_field('node_revision', 'format');
|
| 543 |
|
| 544 |
// We're done.
|
| 545 |
$context['#finished'] = 1;
|
| 546 |
return t("!number node body and teaser properties migrated to the 'body' field.", array('!number' => $context['total']));
|
| 547 |
}
|
| 548 |
}
|
| 549 |
}
|
| 550 |
|
| 551 |
/**
|
| 552 |
* Remove column min_word_count.
|
| 553 |
*/
|
| 554 |
function node_update_7007() {
|
| 555 |
db_drop_field('node_type', 'min_word_count');
|
| 556 |
}
|
| 557 |
|
| 558 |
/**
|
| 559 |
* @} End of "defgroup updates-6.x-to-7.x"
|
| 560 |
* The next series of updates should start at 8000.
|
| 561 |
*/
|