/**
* Get revision ID
*
- * @return Integer
+ * @return Integer|null
*/
public function getId() {
return $this->mId;
/**
* Get text row ID
*
- * @return Integer
+ * @return Integer|null
*/
public function getTextId() {
return $this->mTextId;
/**
* Returns the length of the text in this revision, or null if unknown.
*
- * @return Integer
+ * @return Integer|null
*/
public function getSize() {
return $this->mSize;
/**
* Returns the base36 sha1 of the text in this revision, or null if unknown.
*
- * @return String
+ * @return String|null
*/
public function getSha1() {
return $this->mSha1;
}
/**
- * Returns the title of the page associated with this entry.
+ * Returns the title of the page associated with this entry or null.
*
- * @return Title
+ * Will do a query, when title is not set and id is given.
+ *
+ * @return Title|null
*/
public function getTitle() {
if( isset( $this->mTitle ) ) {
return $this->mTitle;
}
- $dbr = wfGetDB( DB_SLAVE );
- $row = $dbr->selectRow(
- array( 'page', 'revision' ),
- self::selectPageFields(),
- array( 'page_id=rev_page',
- 'rev_id' => $this->mId ),
- __METHOD__ );
- if ( $row ) {
- $this->mTitle = Title::newFromRow( $row );
+ if( !is_null( $this->mId ) ) { //rev_id is defined as NOT NULL
+ $dbr = wfGetDB( DB_SLAVE );
+ $row = $dbr->selectRow(
+ array( 'page', 'revision' ),
+ self::selectPageFields(),
+ array( 'page_id=rev_page',
+ 'rev_id' => $this->mId ),
+ __METHOD__ );
+ if ( $row ) {
+ $this->mTitle = Title::newFromRow( $row );
+ }
}
return $this->mTitle;
}
/**
* Get the page ID
*
- * @return Integer
+ * @return Integer|null
*/
public function getPage() {
return $this->mPage;