logo       

[MediaWiki-CVS] SVN: [54128] trunk/phase3/includes/Title.php: msg#01506

mediawiki-cvs

Subject: [MediaWiki-CVS] SVN: [54128] trunk/phase3/includes/Title.php

http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54128

Revision: 54128
Author: aaron
Date: 2009-07-31 22:57:29 +0000 (Fri, 31 Jul 2009)

Log Message:
-----------
* Don't add title protect log if nothing was done (bug 20026)
* Spacing cleanup

Modified Paths:
--------------
trunk/phase3/includes/Title.php

Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php 2009-07-31 21:56:34 UTC (rev 54127)
+++ trunk/phase3/includes/Title.php 2009-07-31 22:57:29 UTC (rev 54128)
@@ -1426,7 +1426,8 @@

$expiry_description = '';
if ( $encodedExpiry != 'infinity' ) {
- $expiry_description = ' (' . wfMsgForContent(
'protect-expiring', $wgContLang->timeanddate( $expiry ) , $wgContLang->date(
$expiry ) , $wgContLang->time( $expiry ) ).')';
+ $expiry_description = ' (' . wfMsgForContent(
'protect-expiring',$wgContLang->timeanddate( $expiry ),
+ $wgContLang->date( $expiry ) ,
$wgContLang->time( $expiry ) ).')';
}
else {
$expiry_description .= ' (' . wfMsgForContent(
'protect-expiry-indefinite' ).')';
@@ -1435,23 +1436,30 @@
# Update protection table
if ($create_perm != '' ) {
$dbw->replace( 'protected_titles',
array(array('pt_namespace', 'pt_title')),
- array( 'pt_namespace' => $namespace, 'pt_title'
=> $title
- , 'pt_create_perm' => $create_perm
- , 'pt_timestamp' =>
Block::encodeExpiry(wfTimestampNow(), $dbw)
- , 'pt_expiry' => $encodedExpiry
- , 'pt_user' => $wgUser->getId(),
'pt_reason' => $reason ), __METHOD__ );
+ array(
+ 'pt_namespace' => $namespace,
+ 'pt_title' => $title,
+ 'pt_create_perm' => $create_perm,
+ 'pt_timestamp' =>
Block::encodeExpiry(wfTimestampNow(), $dbw),
+ 'pt_expiry' => $encodedExpiry,
+ 'pt_user' => $wgUser->getId(),
+ 'pt_reason' => $reason,
+ ), __METHOD__
+ );
} else {
$dbw->delete( 'protected_titles', array( 'pt_namespace'
=> $namespace,
'pt_title' => $title ), __METHOD__ );
}
# Update the protection log
- $log = new LogPage( 'protect' );
+ if( $dbw->affectedRows() ) {
+ $log = new LogPage( 'protect' );

- if( $create_perm ) {
- $params = array("[create=$create_perm]
$expiry_description",'');
- $log->addEntry( ( isset( $this->mRestrictions['create']
) && $this->mRestrictions['create'] ) ? 'modify' : 'protect', $this, trim(
$reason ), $params );
- } else {
- $log->addEntry( 'unprotect', $this, $reason );
+ if( $create_perm ) {
+ $params = array("[create=$create_perm]
$expiry_description",'');
+ $log->addEntry( ( isset(
$this->mRestrictions['create'] ) && $this->mRestrictions['create'] ) ? 'modify'
: 'protect', $this, trim( $reason ), $params );
+ } else {
+ $log->addEntry( 'unprotect', $this, $reason );
+ }
}

return true;



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@xxxxxxxxxxxxxxxxxxx
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise