if ( isset( $row->ar_text ) && !$row->ar_text_id ) {
// Pre-1.5 ar_text row
$attribs['text'] = self::getRevisionText( $row, 'ar_' );
+ if ( $attribs['text'] === false ) {
+ throw new MWException( 'Unable to load text from archive row (possibly bug 22624)' );
+ }
}
return new self( $attribs );
}
* WARNING: Timestamps may in some circumstances not be unique,
* so this isn't the best key to use.
*
- * @param $db Database
+ * @param $db DatabaseBase
* @param $title Title
* @param $timestamp String
* @return Revision or null
* Given a set of conditions, fetch a revision from
* the given database connection.
*
- * @param $db Database
+ * @param $db DatabaseBase
* @param $conditions Array
* @return Revision or null
*/
* which will return matching database rows with the
* fields necessary to build Revision objects.
*
- * @param $db Database
+ * @param $db DatabaseBase
* @param $conditions Array
* @return ResultWrapper
*/
* Return the list of revision fields that should be selected to create
* a new revision.
*/
- static function selectFields() {
+ public static function selectFields() {
return array(
'rev_id',
'rev_page',
if( isset( $row->page_latest ) ) {
$this->mCurrent = ( $row->rev_id == $row->page_latest );
- $row->page_id = $this->mPage;
$this->mTitle = Title::newFromRow( $row );
} else {
$this->mCurrent = false;
* Revision::FOR_THIS_USER to be displayed to $wgUser
* Revision::RAW get the text regardless of permissions
*
- *
* @return String
*/
public function getText( $audience = self::FOR_PUBLIC ) {
/**
* Alias for getText(Revision::FOR_THIS_USER)
*
- * @deprecated
+ * @deprecated since 1.17
* @return String
*/
public function revText() {
+ wfDeprecated( __METHOD__ );
return $this->getText( self::FOR_THIS_USER );
}
# Upconvert on demand.
# ("utf8" checked for compatibility with some broken
# conversion scripts 2008-12-30)
- global $wgInputEncoding, $wgContLang;
- $text = $wgContLang->iconv( $wgLegacyEncoding, $wgInputEncoding, $text );
+ global $wgContLang;
+ $text = $wgContLang->iconv( $wgLegacyEncoding, 'UTF-8', $text );
}
}
wfProfileOut( __METHOD__ );
* Insert a new revision into the database, returning the new revision ID
* number on success and dies horribly on failure.
*
- * @param $dbw DatabaseBase (master connection)
+ * @param $dbw DatabaseBase: (master connection)
* @return Integer
*/
public function insertOn( $dbw ) {
* @param $pageId Integer: ID number of the page to read from
* @param $summary String: revision's summary
* @param $minor Boolean: whether the revision should be considered as minor
- * @return Mixed: Revision, or null on error
+ * @return Revision|null on error
*/
public static function newNullRevision( $dbw, $pageId, $summary, $minor ) {
wfProfileIn( __METHOD__ );
public static function userCanBitfield( $bitfield, $field ) {
if( $bitfield & $field ) { // aspect is deleted
global $wgUser;
- $permission = '';
if ( $bitfield & self::DELETED_RESTRICTED ) {
$permission = 'suppressrevision';
} elseif ( $field & self::DELETED_TEXT ) {