getAutoDeletereason did not gracefully deal with revisions that would
return null as their content (e.g. for deleted revisions).
Change-Id: I4976f2d09b8666ca1bccebea346af37ee77b09f7
$content = $rev->getContent();
$blank = false;
$content = $rev->getContent();
$blank = false;
- $this->checkModelID( $content->getModel() );
-
// If the page is blank, use the text from the previous revision,
// which can only be blank if there's a move/import/protect dummy
// revision involved
// If the page is blank, use the text from the previous revision,
// which can only be blank if there's a move/import/protect dummy
// revision involved
- if ( $content->getSize() == 0 ) {
+ if ( !$content || $content->isEmpty() ) {
$prev = $rev->getPrevious();
$prev = $rev->getPrevious();
- if ( $prev ) {
- $content = $prev->getContent();
+ if ( $prev ) {
+ $rev = $prev;
+ $content = $rev->getContent();
+ $this->checkModelID( $rev->getContentModel() );
+
// Find out if there was only one contributor
// Only scan the last 20 revisions
$res = $dbw->select( 'revision', 'rev_user_text',
// Find out if there was only one contributor
// Only scan the last 20 revisions
$res = $dbw->select( 'revision', 'rev_user_text',
}
// Max content length = max comment length - length of the comment (excl. $1)
}
// Max content length = max comment length - length of the comment (excl. $1)
- $text = $content->getTextForSummary( 255 - ( strlen( $reason ) - 2 ) );
+ $text = $content ? $content->getTextForSummary( 255 - ( strlen( $reason ) - 2 ) ) : '';
// Now replace the '$1' placeholder
$reason = str_replace( '$1', $text, $reason );
// Now replace the '$1' placeholder
$reason = str_replace( '$1', $text, $reason );