Posts

Showing posts from May, 2011

Drupal reset cron

// Delete cron with PHP  $num_deleted = 0; $num_deleted = db_delete('variable')           ->condition('name', 'cron_semaphore')           ->execute(); $num_deleted += db_delete('variable')           ->condition('name', 'cron_last')           ->execute(); if ($num_deleted > 0)         echo "Cron cleared. Clear cache!"; -- // Delete flood with PHP  $num_deleted = 0;         $num_deleted = db_delete('flood')           ->execute();     if ($num_deleted > 0)         echo "Flood cleared."; -- // Delete cron with SQL DELETE FROM `variable` WHERE name = 'cron_semaphore'; DELETE FROM `variable` WHERE name = 'cron_last'; DELETE FROM semaphore WHERE name = 'cron'; // And C...

Mac OSX Cannot empty trash because item is in use

Cannot empty trash because item is in use System Relaunching finder from "force quit applications" (command+option+esc) seems to work just as well.

Programmatically creating missing content profiles with default values bypassing validation

$sql = "select u.uid, u.name from users u where u.uid not in (select n.uid from node n where n.type='profile')"; $result = db_query($sql); while ($data = db_fetch_object($result)) { $node = array(); $node['type'] = 'profile'; $node['name'] = 'Profile'; $node['status'] = 1; $node['format'] = 0; $node['comment'] = 0; $node['promote'] = 0; $node['sticky'] = 0; $node['uid'] = $data->uid; $node['title'] = $data->name; $node = (object)$node; $node->field_cck1[0]['value'] = 1000; $node->field_cck2[0]['value'] = 100; $node->created = time(); $node->validated = TRUE; node_save($node); }