I have been looking at a way of inputting content into drupal but falsifying the timestamp to show it as content created years ago. Currently I am in the process of migrating a number of static sites to drupal and as such have to manually copy and paste some of the content across. This then gives timestamps and revisions as new, despite the data being old (between 1-5 years).
I wrote this as a simple way of changing timestamps, obviously not for general use, but it does hack the nodes to pretend its old data:
<?php
mysql_connect('localhost', 'user', 'password') or die('Cannot connect to MySql');
mysql_select_db('database') or die('Cannot connect to database');
$sql = 'select * from node';
$query = mysql_query($sql);
$unixTimestamp = 1230800640; // the oldest peice of data as a unix timestamp
$increment = 1012745; //could be replace by a rand() basically worked out by dividing the time by the number of content
while($result = mysql_fetch_assoc($query)){
$updateNode = "UPDATE node SET created = $unixTimestamp, changed = $unixTimestamp WHERE nid =".$result['nid'];
$updateNodeRevisions = "UPDATE node_revisions SET timestamp = $unixTimestamp WHERE nid =".$result['nid'];
echo 'Completed: '.$updateNode.'';
echo 'Completed: '.$updateNodeRevisions.'';
mysql_query($updateNode);
mysql_query($updateNodeRevisions);
$unixTimestamp = $unixTimestamp + $increment;
}
If anyone has done much of this before or has a better way they think I should be doing it then please let me know.
Connect on LinkedIn. Follow me on Twitter. Grab the RSS Feed