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