You are here

function weight_old_nodes in Weight 5

Same name and namespace in other branches
  1. 6 weight.admin.inc \weight_old_nodes()
  2. 7 weight.admin.inc \weight_old_nodes()

Update "old" nodes where sticky is 1 or 0 And resave them with new values so that they will sort correctly with new and updated nodes

1 call to weight_old_nodes()
weight_enable_page in ./weight.module

File

./weight.module, line 335

Code

function weight_old_nodes() {
  $count = db_num_rows(db_query('SELECT DISTINCT nid FROM {node} WHERE sticky IN (0,1)'));
  db_query('UPDATE {node} SET sticky = 100 WHERE sticky = 1');
  db_query('UPDATE {node} SET sticky = -100 WHERE sticky = 0');
  if ($count > 0) {
    drupal_set_message($count . t(' nodes updated to support weight.module'));
  }
  else {
    drupal_set_message(t('No nodes needed to be updated.'));
  }
}