language where available.
* Special:ActiveUsers will no longer filter out users who became inactive since
the last time the active users query cache was updated.
+* (T215675) RecentChange and ManualLogEntry implement new Taggable interface.
=== New developer features in 1.33 ===
* The AuthManagerLoginAuthenticateAudit hook has a new parameter for
deprecated and will be removed in the future.
* The FileBasedSiteLookup class has been deprecated. For a cacheable SiteLookup
implementation, use CachingSiteStore instead.
+* ManualLogEntry::setTags() is deprecated, use ManualLogEntry::addTags()
+ instead. The setTags() method was overriding the tags, addTags() doesn't
+ override, only adds new tags.
=== Other changes in 1.33 ===
* (T201747) Html::openElement() warns if given an element name with a space
'MediaWikiSite' => __DIR__ . '/includes/site/MediaWikiSite.php',
'MediaWikiTitleCodec' => __DIR__ . '/includes/title/MediaWikiTitleCodec.php',
'MediaWikiVersionFetcher' => __DIR__ . '/includes/MediaWikiVersionFetcher.php',
+ 'MediaWiki\\ChangeTags\\Taggable' => __DIR__ . '/includes/changetags/Taggable.php',
'MediaWiki\\Config\\ConfigRepository' => __DIR__ . '/includes/config/ConfigRepository.php',
'MediaWiki\\DB\\PatchFileLocation' => __DIR__ . '/includes/db/PatchFileLocation.php',
'MediaWiki\\Diff\\ComplexityException' => __DIR__ . '/includes/diff/ComplexityException.php',
*
* @file
*/
+use MediaWiki\ChangeTags\Taggable;
/**
* Utility class for creating new RC entries
* we're having to include both rc_comment and rc_comment_text/rc_comment_data
* so random crap works right.
*/
-class RecentChange {
+class RecentChange implements Taggable {
// Constants for the rc_source field. Extensions may also have
// their own source constants.
const SRC_EDIT = 'mw.edit';
*
* @since 1.28
*
- * @param string|array $tags
+ * @param string|string[] $tags
*/
public function addTags( $tags ) {
if ( is_string( $tags ) ) {
--- /dev/null
+<?php
+/**
+ * Interface that defines how to tag objects
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Change tagging
+ * @author Piotr Miazga
+ * @license GPL-2.0-or-later
+ */
+namespace MediaWiki\ChangeTags;
+
+/**
+ * Interface that defines how to tag objects
+ *
+ * @since 1.33
+ */
+interface Taggable {
+
+ /**
+ * Append tags to the tagged object
+ *
+ * @since 1.33
+ * @param string|string[] $tags Tags to apply
+ */
+ public function addTags( $tags );
+
+}
* @since 1.19
*/
+use MediaWiki\ChangeTags\Taggable;
use MediaWiki\Linker\LinkTarget;
use MediaWiki\User\UserIdentity;
use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Assert\Assert;
/**
* Interface for log entries. Every log entry has these methods.
*
* @since 1.19
*/
-class ManualLogEntry extends LogEntryBase {
+class ManualLogEntry extends LogEntryBase implements Taggable {
/** @var string Type of log entry */
protected $type;
*
* @since 1.27
* @param string|string[]|null $tags
+ * @deprecated since 1.33 Please use addTags() instead
*/
public function setTags( $tags ) {
- if ( $tags === null ) {
- $tags = [];
- } elseif ( is_string( $tags ) ) {
+ if ( $this->tags ) {
+ wfDebug( 'Overwriting existing ManualLogEntry tags' );
+ }
+ $this->tags = [];
+ if ( $tags !== null ) {
+ $this->addTags( $tags );
+ }
+ }
+
+ /**
+ * Add change tags for the log entry
+ *
+ * @since 1.33
+ * @param string|string[] $tags Tags to apply
+ */
+ public function addTags( $tags ) {
+ if ( is_string( $tags ) ) {
$tags = [ $tags ];
}
- $this->tags = $tags;
+ Assert::parameterElementType( 'string', $tags, 'tags' );
+ $this->tags = array_unique( array_merge( $this->tags, $tags ) );
}
/**