function _publication_date_update_existing in Publication Date 7
Same name and namespace in other branches
- 8.2 publication_date.install \_publication_date_update_existing()
- 8 publication_date.install \_publication_date_update_existing()
- 6 publication_date.install \_publication_date_update_existing()
- 7.2 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 58 - Installation functions for the Publication Date module.
Code
function _publication_date_update_existing() {
$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();
}