# Reads all revision information of the specified
article
function prepareRevisions( $id ) {
global $wgDBprefix;
$this->rev2date = array();
$this->date2rev = array();
$sql = "SELECT * FROM {$wgDBprefix}revision WHERE
rev_page='{$id}'";
$res = wfQuery( $sql, DB_READ );
while( $x = wfFetchObject( $res ) ) {
$this->rev2date[$x->rev_id] = $x;
$this->date2rev[$x->rev_timestamp] = $x;
}
}
I don't think it's been said yet, someone has to say it. The name of the
revision table is not "{$wgDBprefix}revision", it is
$db->tableName('revision'). If those two produce the same text, consider
it conincidence. wfQuery() and wfFetchObject() are deprecated. Instead
use wfGetDB() to get a Database object and call the query() and
fetchObject() member functions.
-- Tim Starling