* Improve Special:Log performance on big log sets
* (bug 5507) Changed mediawiki:logouttext from plain to wikitext
* (bug 4760) Prevent creation of entries in protection log when protection levels haven't changed
+* (bug 861) Show page protection/unprotection events in histories
== Compatibility ==
* @return bool true on success
*/
function updateRestrictions( $limit = array(), $reason = '' ) {
- global $wgUser, $wgRestrictionTypes;
+ global $wgUser, $wgRestrictionTypes, $wgContLang;
$id = $this->mTitle->getArticleID();
if( !$wgUser->isAllowed( 'protect' ) || wfReadOnly() || $id == 0 ) {
# If nothing's changed, do nothing
if( $changed ) {
if( wfRunHooks( 'ArticleProtect', array( &$this, &$wgUser, $limit, $reason ) ) ) {
- # Update page record
+
$dbw =& wfGetDB( DB_MASTER );
+
+ # Prepare a null revision to be added to the history
+ $comment = $wgContLang->ucfirst( wfMsgForContent( $protect ? 'protectedarticle' : 'unprotectedarticle', $this->mTitle->getPrefixedText() ) );
+ if( $reason )
+ $comment .= ": $reason";
+ if( $protect )
+ $comment .= " [$updated]";
+ $nullRevision = Revision::newNullRevision( $dbw, $id, $comment, true );
+ $nullRevId = $nullRevision->insertOn( $dbw );
+
+ # Update page record
$dbw->update( 'page',
array( /* SET */
'page_touched' => $dbw->timestamp(),
- 'page_restrictions' => $updated
+ 'page_restrictions' => $updated,
+ 'page_latest' => $nullRevId
), array( /* WHERE */
'page_id' => $id
), 'Article::protect'