You are here

function _publication_date_update_existing in Publication Date 8

Same name and namespace in other branches
  1. 8.2 publication_date.install \_publication_date_update_existing()
  2. 6 publication_date.install \_publication_date_update_existing()
  3. 7.2 publication_date.install \_publication_date_update_existing()
  4. 7 publication_date.install \_publication_date_update_existing()

Helper function to update the existing nodes on install.

We can not know the exact date of publication, so $node->published_at will initially contain the creation date for already publisned nodes.

1 call to _publication_date_update_existing()
publication_date_install in ./publication_date.install
Implements hook_install().

File

./publication_date.install, line 25
Installation functions for the Publication Date module.

Code

function _publication_date_update_existing() {

  // @todo: Convert to entity query.
  return;
  $query = db_select('node');
  $query
    ->addField('node', 'nid');
  $query
    ->addField('node', 'created', 'published_at');
  $nids = $query
    ->condition('status', 1);
  db_insert('publication_date')
    ->from($nids)
    ->execute();
}