Index: scheduler.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/scheduler.module,v retrieving revision 1.46.4.6 diff -u -p -r1.46.4.6 scheduler.module --- scheduler.module 3 May 2007 20:26:41 -0000 1.46.4.6 +++ scheduler.module 8 Jul 2007 20:39:52 -0000 @@ -47,6 +47,12 @@ function scheduler_form_alter($form_id, '#default_value' => variable_get('scheduler_'. $form['#node_type']->type, 0), '#description' => t('Check this box to enable scheduled (un)publishing for this node type.') ); + $form['workflow']['scheduler_touch'] = array( + '#type' => 'checkbox', + '#title' => t('Alter published on time'), + '#default_value' => variable_get('scheduler_touch_'. $form['#node_type']->type, 0), + '#description' => t('Check this box to alter the published on time to match the scheduled time ("touch feature").') + ); } // is this a node form? @@ -202,24 +208,27 @@ function scheduler_cron() { $nodes = db_query('SELECT *, (publish_on - timezone) AS utc_publish_on FROM {scheduler} s LEFT JOIN {node} n ON s.nid = n.nid WHERE n.status = 0 AND s.publish_on > 0 AND s.publish_on < %d + s.timezone', time()); while ($node = db_fetch_object($nodes)) { - $node = node_load($node->nid); - $node->changed = $node->utc_publish_on; - $node->status = 1; - node_save($node); + $n = node_load($node->nid); + $n->changed = $node->utc_publish_on; + $n->status = 1; + if (variable_get('scheduler_touch_'. $n->type, 0) == 1) { + $n->created = $node->utc_publish_on; + } + node_save($n); //if this node is not to be unpublished, then we can delete the record - if ($node->unpublish_on == 0) { - db_query('DELETE FROM {scheduler} WHERE nid = %d', $node->nid); + if ($n->unpublish_on == 0) { + db_query('DELETE FROM {scheduler} WHERE nid = %d', $n->nid); } //we need to unpublish this node at some time so clear the publish on since it's been published else { - db_query('UPDATE {scheduler} SET publish_on = 0 WHERE nid = %d', $node->nid); + db_query('UPDATE {scheduler} SET publish_on = 0 WHERE nid = %d', $n->nid); } //invoke scheduler API - _scheduler_scheduler_api($node, 'publish'); + _scheduler_scheduler_api($n, 'publish'); - watchdog('content', t('@type: scheduled publishing of %title.', array('@type' => $node->type, '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); + watchdog('content', t('@type: scheduled publishing of %title.', array('@type' => $n->type, '%title' => $n->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $n->nid)); $clear_cache = TRUE; } @@ -228,17 +237,17 @@ function scheduler_cron() { while ($node = db_fetch_object($nodes)) { //if this node is to be unpublished, we can update the node and remove the record since it can't be republished - $node = node_load($node->nid); - $node->changed = $node->utc_publish_on; - $node->status = 0; - node_save($node); + $n = node_load($node->nid); + $n->changed = $node->utc_publish_on; + $n->status = 0; + node_save($n); - db_query('DELETE FROM {scheduler} WHERE nid = %d', $node->nid); + db_query('DELETE FROM {scheduler} WHERE nid = %d', $n->nid); //invoke scheduler API - _scheduler_scheduler_api($node, 'unpublish'); + _scheduler_scheduler_api($n, 'unpublish'); - watchdog('content', t('@type: scheduled unpublishing of %title.', array('@type' => $node->type, '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); + watchdog('content', t('@type: scheduled unpublishing of %title.', array('@type' => $n->type, '%title' => $n->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $n->nid)); $clear_cache = TRUE; }