$logRelationsValues = array();
$logRelationsField = null;
+ $logParamsDetails = array();
if ( $id ) { // Protection of existing page
if ( !Hooks::run( 'ArticleProtect', array( &$this, &$user, $limit, $reason ) ) ) {
__METHOD__
);
if ( $restrictions != '' ) {
+ $cascadeValue = ( $cascade && $action == 'edit' ) ? 1 : 0;
$dbw->insert(
'page_restrictions',
array(
'pr_page' => $id,
'pr_type' => $action,
'pr_level' => $restrictions,
- 'pr_cascade' => ( $cascade && $action == 'edit' ) ? 1 : 0,
+ 'pr_cascade' => $cascadeValue,
'pr_expiry' => $dbw->encodeExpiry( $expiry[$action] )
),
__METHOD__
);
$logRelationsValues[] = $dbw->insertId();
+ $logParamsDetails[] = array(
+ 'type' => $action,
+ 'level' => $restrictions,
+ 'expiry' => $expiry[$action],
+ 'cascade' => (bool)$cascadeValue,
+ );
}
}
'pt_reason' => $reason,
), __METHOD__
);
+ $logParamsDetails[] = array(
+ 'type' => 'create',
+ 'level' => $limit['create'],
+ 'expiry' => $expiry['create'],
+ );
} else {
$dbw->delete( 'protected_titles',
array(
$params = array();
} else {
$protectDescriptionLog = $this->protectDescriptionLog( $limit, $expiry );
- $params = array( $protectDescriptionLog, $cascade ? 'cascade' : '' );
+ $params = array(
+ '4::description' => $protectDescriptionLog, // parameter for IRC
+ '5:bool:cascade' => $cascade,
+ 'details' => $logParamsDetails, // parameter for localize and api
+ );
}
// Update the protection log
- $log = new LogPage( 'protect' );
- $logId = $log->addEntry( $logAction, $this->mTitle, $reason, $params, $user );
+ $logEntry = new ManualLogEntry( 'protect', $logAction );
+ $logEntry->setTarget( $this->mTitle );
+ $logEntry->setComment( $reason );
+ $logEntry->setPerformer( $user );
+ $logEntry->setParameters( $params );
if ( $logRelationsField !== null && count( $logRelationsValues ) ) {
- $log->addRelations( $logRelationsField, $logRelationsValues, $logId );
+ $logEntry->setRelations( array( $logRelationsField => $logRelationsValues ) );
}
+ $logId = $logEntry->insert();
+ $logEntry->publish( $logId );
return Status::newGood();
}
// remove secondary indexes, etc
$updates = $this->getDeletionUpdates( $content );
- DataUpdate::runUpdates( $updates );
+ DataUpdate::runUpdates( $updates, 'enqueue' );
// Reparse any pages transcluding this page
LinksUpdate::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks' );