Skip to content

Instantly share code, notes, and snippets.

@arturo-c
Created August 29, 2014 21:12
Show Gist options
  • Save arturo-c/6414cab5755512979547 to your computer and use it in GitHub Desktop.
Save arturo-c/6414cab5755512979547 to your computer and use it in GitHub Desktop.
<?php
/**
* Implements hook_cron_queue_info().
*
* Define callback functions for queue items.
*/
function pc_rel_cron_queue_info() {
return array(
'cleanup_old_guardian_relationships' => array(
'worker callback' => 'pc_rel_cleanup_old_guardian_relationships',
),
);
}
/**
*
*/
function pc_rel_cleanup_old_guardian_relationships($data) {
foreach ($guardian as $guardian) {
//Get all the children
//Get all the parents for each kid
//Verify that the guardian to guardina relationship exists.
}
}
/**
*
*/
function pc_rel_update_6005() {
// Tell drupal that you want resque to process.
variable_set('queue_class_cleanup_old_guardian_relationships', 'Resque');
// Get all the guardinas on the site
while ($guardian_subset = array_slice($all_the_guardians, 500)) {
DrupalQueue::get(array('guardians' => $guardian_subset));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment