+ /**
+ * Get rev_timestamp from rev_id, without loading the rest of the row
+ * @param integer $id
+ */
+ static function getTimestampFromID( $id ) {
+ $dbr = wfGetDB( DB_SLAVE );
+ $timestamp = $dbr->selectField( 'revision', 'rev_timestamp',
+ array( 'rev_id' => $id ), __METHOD__ );
+ if ( $timestamp === false ) {
+ # Not in slave, try master
+ $dbw = wfGetDB( DB_MASTER );
+ $timestamp = $dbw->selectField( 'revision', 'rev_timestamp',
+ array( 'rev_id' => $id ), __METHOD__ );
+ }
+ return $timestamp;
+ }
+
+ static function countByPageId( $db, $id ) {
+ $row = $db->selectRow( 'revision', 'COUNT(*) AS revCount',
+ array( 'rev_page' => $id ), __METHOD__ );
+ if( $row ) {
+ return $row->revCount;
+ }
+ return 0;
+ }
+
+ static function countByTitle( $db, $title ) {
+ $id = $title->getArticleId();
+ if( $id ) {
+ return Revision::countByPageId( $db, $id );
+ }
+ return 0;
+ }