Check if content was modified before committing.

This commit is contained in:
Daniel Kraus
2014-06-10 11:55:55 +02:00
parent e5008b9997
commit 5842430021

View File

@ -102,6 +102,7 @@
// To prevent adding self-references, we now
// extract the current page's title.
$myTitle = $article->getTitle();
$myTitleText = $myTitle->GetText();
( $wgLinkTitlesPreferShortTitles ) ? $sort_order = 'ASC' : $sort_order = 'DESC';
( $wgLinkTitlesFirstOnly ) ? $limit = 1 : $limit = -1;
@ -145,11 +146,9 @@
// Build an SQL query and fetch all page titles ordered by length from
// shortest to longest.
// Only titles from 'normal' pages (namespace uid = 0)
// are returned.
// Since the db may be sqlite, we need a try..catch structure
// because sqlite does not support the CHAR_LENGTH function.
// shortest to longest. Only titles from 'normal' pages (namespace uid
// = 0) are returned. Since the db may be sqlite, we need a try..catch
// structure because sqlite does not support the CHAR_LENGTH function.
$dbr = wfGetDB( DB_SLAVE );
try {
$res = $dbr->select(
@ -288,9 +287,10 @@
break;
};
};
$text = implode( '', $arr );
// @todo check if text was changed
$content = $content->getContentHandler()->unserializeContent( $text );
$newText = implode( '', $arr );
if ( $newText != $text ) {
$content = $content->getContentHandler()->unserializeContent( $newText );
}
} // $wgLinkTitlesSmartMode
}
}; // foreach $res as $row