By LeMale on
Hi,
I want a way to set a node's creation time to the current date, every day, using the cron.php script, just like this :
the node X was created on 10/10/10, I want to change it's creation date every day when cron.php is executed.
are there a way to do this ?
Regards
Comments
a node_save inside
a node_save inside hook_cron
http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...
http://api.drupal.org/api/drupal/modules--node--node.module/function/nod...
<?phpfunction
worked well, thanks! To do
worked well, thanks!
To do so, I created a custom module where I placed this function, is there a faster way ?
Sort of. Could use SQL Cron
Sort of. Could use SQL Cron and poke db directly like
UPDATE node SET created = UNIX_TIMESTAMP() - 300 WHERE nid = 513 AND created - UNIX_TIMESTAMP() > 86400If you need complex conditions, it's harder to stuff them into a single line of SQL; above would be executed not after 9 a.m. but when at least 24 hours (86400 seconds) have passed since node creation time.
If the node creation time on your site is displayed as date only so that changing it every hour wouldn't seem suspicious, you might omit all conditions and 'minus 300 seconds' part as well.