Index: trunk/phase3/includes/Title.php |
— | — | @@ -1426,7 +1426,8 @@ |
1427 | 1427 | |
1428 | 1428 | $expiry_description = ''; |
1429 | 1429 | if ( $encodedExpiry != 'infinity' ) { |
1430 | | - $expiry_description = ' (' . wfMsgForContent( 'protect-expiring', $wgContLang->timeanddate( $expiry ) , $wgContLang->date( $expiry ) , $wgContLang->time( $expiry ) ).')'; |
| 1430 | + $expiry_description = ' (' . wfMsgForContent( 'protect-expiring',$wgContLang->timeanddate( $expiry ), |
| 1431 | + $wgContLang->date( $expiry ) , $wgContLang->time( $expiry ) ).')'; |
1431 | 1432 | } |
1432 | 1433 | else { |
1433 | 1434 | $expiry_description .= ' (' . wfMsgForContent( 'protect-expiry-indefinite' ).')'; |
— | — | @@ -1435,23 +1436,30 @@ |
1436 | 1437 | # Update protection table |
1437 | 1438 | if ($create_perm != '' ) { |
1438 | 1439 | $dbw->replace( 'protected_titles', array(array('pt_namespace', 'pt_title')), |
1439 | | - array( 'pt_namespace' => $namespace, 'pt_title' => $title |
1440 | | - , 'pt_create_perm' => $create_perm |
1441 | | - , 'pt_timestamp' => Block::encodeExpiry(wfTimestampNow(), $dbw) |
1442 | | - , 'pt_expiry' => $encodedExpiry |
1443 | | - , 'pt_user' => $wgUser->getId(), 'pt_reason' => $reason ), __METHOD__ ); |
| 1440 | + array( |
| 1441 | + 'pt_namespace' => $namespace, |
| 1442 | + 'pt_title' => $title, |
| 1443 | + 'pt_create_perm' => $create_perm, |
| 1444 | + 'pt_timestamp' => Block::encodeExpiry(wfTimestampNow(), $dbw), |
| 1445 | + 'pt_expiry' => $encodedExpiry, |
| 1446 | + 'pt_user' => $wgUser->getId(), |
| 1447 | + 'pt_reason' => $reason, |
| 1448 | + ), __METHOD__ |
| 1449 | + ); |
1444 | 1450 | } else { |
1445 | 1451 | $dbw->delete( 'protected_titles', array( 'pt_namespace' => $namespace, |
1446 | 1452 | 'pt_title' => $title ), __METHOD__ ); |
1447 | 1453 | } |
1448 | 1454 | # Update the protection log |
1449 | | - $log = new LogPage( 'protect' ); |
| 1455 | + if( $dbw->affectedRows() ) { |
| 1456 | + $log = new LogPage( 'protect' ); |
1450 | 1457 | |
1451 | | - if( $create_perm ) { |
1452 | | - $params = array("[create=$create_perm] $expiry_description",''); |
1453 | | - $log->addEntry( ( isset( $this->mRestrictions['create'] ) && $this->mRestrictions['create'] ) ? 'modify' : 'protect', $this, trim( $reason ), $params ); |
1454 | | - } else { |
1455 | | - $log->addEntry( 'unprotect', $this, $reason ); |
| 1458 | + if( $create_perm ) { |
| 1459 | + $params = array("[create=$create_perm] $expiry_description",''); |
| 1460 | + $log->addEntry( ( isset( $this->mRestrictions['create'] ) && $this->mRestrictions['create'] ) ? 'modify' : 'protect', $this, trim( $reason ), $params ); |
| 1461 | + } else { |
| 1462 | + $log->addEntry( 'unprotect', $this, $reason ); |
| 1463 | + } |
1456 | 1464 | } |
1457 | 1465 | |
1458 | 1466 | return true; |