* @param string $tags Comma-separated list of tags
* @param string $page A label for the type of action which is being displayed,
* for example: 'history', 'contributions' or 'newpages'
* @param string $tags Comma-separated list of tags
* @param string $page A label for the type of action which is being displayed,
* for example: 'history', 'contributions' or 'newpages'
* @return array Array with two items: (html, classes)
* - html: String: HTML for displaying the tags (empty string when param $tags is empty)
* - classes: Array of strings: CSS classes used in the generated html, one class for each tag
*/
* @return array Array with two items: (html, classes)
* - html: String: HTML for displaying the tags (empty string when param $tags is empty)
* - classes: Array of strings: CSS classes used in the generated html, one class for each tag
*/
- array( 'class' => 'mw-tag-marker ' .
- Sanitizer::escapeClass( "mw-tag-marker-$tag" ) ),
+ [ 'class' => 'mw-tag-marker ' .
+ Sanitizer::escapeClass( "mw-tag-marker-$tag" ) ],
* @param int|null $rc_id The rc_id of the change to add the tags to
* @param int|null $rev_id The rev_id of the change to add the tags to
* @param int|null $log_id The log_id of the change to add the tags to
* @param int|null $rc_id The rc_id of the change to add the tags to
* @param int|null $rev_id The rev_id of the change to add the tags to
* @param int|null $log_id The log_id of the change to add the tags to
if ( !self::updateTagSummaryRow( $tagsToAdd, $tagsToRemove, $rc_id, $rev_id,
$log_id, $prevTags ) ) {
// nothing to do
if ( !self::updateTagSummaryRow( $tagsToAdd, $tagsToRemove, $rc_id, $rev_id,
$log_id, $prevTags ) ) {
// nothing to do
foreach ( $tagsToAdd as $tag ) {
// Filter so we don't insert NULLs as zero accidentally.
// Keep in mind that $rc_id === null means "I don't care/know about the
// rc_id, just delete $tag on this revision/log entry". It doesn't
// mean "only delete tags on this revision/log WHERE rc_id IS NULL".
$tagsRows[] = array_filter(
foreach ( $tagsToAdd as $tag ) {
// Filter so we don't insert NULLs as zero accidentally.
// Keep in mind that $rc_id === null means "I don't care/know about the
// rc_id, just delete $tag on this revision/log entry". It doesn't
// mean "only delete tags on this revision/log WHERE rc_id IS NULL".
$tagsRows[] = array_filter(
- $dbw->insert( 'change_tag', $tagsRows, __METHOD__, array( 'IGNORE' ) );
+ $dbw->insert( 'change_tag', $tagsRows, __METHOD__, [ 'IGNORE' ] );
}
// delete from change_tag
if ( count( $tagsToRemove ) ) {
foreach ( $tagsToRemove as $tag ) {
$conds = array_filter(
}
// delete from change_tag
if ( count( $tagsToRemove ) ) {
foreach ( $tagsToRemove as $tag ) {
$conds = array_filter(
);
$dbw->delete( 'change_tag', $conds, __METHOD__ );
}
}
self::purgeTagUsageCache();
);
$dbw->delete( 'change_tag', $conds, __METHOD__ );
}
}
self::purgeTagUsageCache();
- $rc_id, $rev_id, $log_id, &$prevTags = array() ) {
+ $rc_id, $rev_id, $log_id, &$prevTags = [] ) {
// Can't both add and remove a tag at the same time...
$tagsToAdd = array_diff( $tagsToAdd, $tagsToRemove );
// Can't both add and remove a tag at the same time...
$tagsToAdd = array_diff( $tagsToAdd, $tagsToRemove );
$dbw->delete( 'tag_summary', $tsConds, __METHOD__ );
} else {
$dbw->replace( 'tag_summary',
$dbw->delete( 'tag_summary', $tsConds, __METHOD__ );
} else {
$dbw->replace( 'tag_summary',
- array( 'ts_rev_id', 'ts_rc_id', 'ts_log_id' ),
- array_filter( array_merge( $tsConds, array( 'ts_tags' => implode( ',', $newTags ) ) ) ),
+ [ 'ts_rev_id', 'ts_rc_id', 'ts_log_id' ],
+ array_filter( array_merge( $tsConds, [ 'ts_tags' => implode( ',', $newTags ) ] ) ),
$rc_id, $rev_id, $log_id, $params, $reason, User $user ) {
if ( is_null( $tagsToAdd ) ) {
$rc_id, $rev_id, $log_id, $params, $reason, User $user ) {
if ( is_null( $tagsToAdd ) ) {
$tagsToRemove, $rc_id, $rev_id, $log_id, $params );
if ( !$tagsAdded && !$tagsRemoved ) {
// no-op, don't log it
$tagsToRemove, $rc_id, $rev_id, $log_id, $params );
if ( !$tagsAdded && !$tagsRemoved ) {
// no-op, don't log it
// This function is from revision deletion logic and has nothing to do with
// change tags, but it appears to be the only other place in core where we
// perform logged actions on log items.
// This function is from revision deletion logic and has nothing to do with
// change tags, but it appears to be the only other place in core where we
// perform logged actions on log items.
'8:list:tagsRemoved' => $tagsRemoved,
'9:number:tagsRemovedCount' => count( $tagsRemoved ),
'initialTags' => $initialTags,
'8:list:tagsRemoved' => $tagsRemoved,
'9:number:tagsRemovedCount' => count( $tagsRemoved ),
'initialTags' => $initialTags,
$dbw = wfGetDB( DB_MASTER );
$logId = $logEntry->insert( $dbw );
// Only send this to UDP, not RC, similar to patrol events
$logEntry->publish( $logId, 'udp' );
$dbw = wfGetDB( DB_MASTER );
$logId = $logEntry->insert( $dbw );
// Only send this to UDP, not RC, similar to patrol events
$logEntry->publish( $logId, 'udp' );
'logId' => $logId,
'addedTags' => $tagsAdded,
'removedTags' => $tagsRemoved,
'logId' => $logId,
'addedTags' => $tagsAdded,
'removedTags' => $tagsRemoved,
- array( 'action' => $title->getLocalURL(), 'class' => 'mw-tagfilter-form', 'method' => 'get' ),
+ [ 'action' => $title->getLocalURL(), 'class' => 'mw-tagfilter-form', 'method' => 'get' ],
public static function defineTag( $tag ) {
$dbw = wfGetDB( DB_MASTER );
$dbw->replace( 'valid_tag',
public static function defineTag( $tag ) {
$dbw = wfGetDB( DB_MASTER );
$dbw->replace( 'valid_tag',
if ( !is_null( $tagCount ) ) {
$params['5:number:count'] = $tagCount;
}
$logEntry->setParameters( $params );
if ( !is_null( $tagCount ) ) {
$params['5:number:count'] = $tagCount;
}
$logEntry->setParameters( $params );
- Hooks::run( 'ChangeTagCanCreate', array( $tag, $user, &$canCreateResult ) );
+ Hooks::run( 'ChangeTagCanCreate', [ $tag, $user, &$canCreateResult ] );
// find out which revisions use this tag, so we can delete from tag_summary
$result = $dbw->select( 'change_tag',
// find out which revisions use this tag, so we can delete from tag_summary
$result = $dbw->select( 'change_tag',
- array( 'ct_rc_id', 'ct_log_id', 'ct_rev_id', 'ct_tag' ),
- array( 'ct_tag' => $tag ),
+ [ 'ct_rc_id', 'ct_log_id', 'ct_rev_id', 'ct_tag' ],
+ [ 'ct_tag' => $tag ],
self::updateTagSummaryRow( $tagsToAdd, $tagsToRemove, $row->ct_rc_id,
$row->ct_rev_id, $row->ct_log_id );
}
// delete from change_tag
self::updateTagSummaryRow( $tagsToAdd, $tagsToRemove, $row->ct_rc_id,
$row->ct_rev_id, $row->ct_log_id );
}
// delete from change_tag
$dbw->endAtomic( __METHOD__ );
// give extensions a chance
$status = Status::newGood();
$dbw->endAtomic( __METHOD__ );
// give extensions a chance
$status = Status::newGood();
// let's not allow error results, as the actual tag deletion succeeded
if ( !$status->isOK() ) {
wfDebug( 'ChangeTagAfterDelete error condition downgraded to warning' );
// let's not allow error results, as the actual tag deletion succeeded
if ( !$status->isOK() ) {
wfDebug( 'ChangeTagAfterDelete error condition downgraded to warning' );
- Hooks::run( 'ChangeTagCanDelete', array( $tag, $user, &$status ) );
+ Hooks::run( 'ChangeTagCanDelete', [ $tag, $user, &$status ] );
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
// Ask extensions which tags they consider active
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
// Ask extensions which tags they consider active
- $tags = $dbr->selectFieldValues( 'valid_tag', 'vt_tag', array(), $fname );
+ $tags = $dbr->selectFieldValues( 'valid_tag', 'vt_tag', [], $fname );
function ( $oldValue, &$ttl, array &$setOpts ) {
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );
function ( $oldValue, &$ttl, array &$setOpts ) {
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_SLAVE ) );