Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
23
vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron.twig
vendored
Normal file
23
vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron.twig
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* Implements hook_cron().
|
||||
*/
|
||||
function {{ machine_name }}_cron() {
|
||||
// Short-running operation example, not using a queue:
|
||||
// Delete all expired records since the last cron run.
|
||||
$expires = variable_get('mymodule_cron_last_run', REQUEST_TIME);
|
||||
db_delete('mymodule_table')
|
||||
->condition('expires', $expires, '>=')
|
||||
->execute();
|
||||
variable_set('mymodule_cron_last_run', REQUEST_TIME);
|
||||
|
||||
// Long-running operation example, leveraging a queue:
|
||||
// Fetch feeds from other sites.
|
||||
$result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < :time AND refresh <> :never', array(
|
||||
':time' => REQUEST_TIME,
|
||||
':never' => AGGREGATOR_CLEAR_NEVER,
|
||||
));
|
||||
$queue = DrupalQueue::get('aggregator_feeds');
|
||||
foreach ($result as $feed) {
|
||||
$queue->createItem($feed);
|
||||
}
|
||||
}
|
||||
Reference in a new issue