Merge "Rewrite pref cleanup script"
[lhc/web/wiklou.git] / includes / specials / SpecialEditWatchlist.php
index d2940e4..e3c5d8c 100644 (file)
@@ -29,6 +29,7 @@
 use MediaWiki\Linker\LinkRenderer;
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\DBReadOnlyError;
 
 /**
  * Provides the UI through which users can perform editing
@@ -451,6 +452,10 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         * Remove all titles from a user's watchlist
         */
        private function clearWatchlist() {
+               if ( $this->getConfig()->get( 'ReadOnlyWatchedItemStore' ) ) {
+                       throw new DBReadOnlyError( null, 'The watchlist is currently readonly.' );
+               }
+
                $dbw = wfGetDB( DB_MASTER );
                $dbw->delete(
                        'watchlist',
@@ -568,7 +573,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        // checkTitle can filter some options out, avoid empty sections
                        if ( count( $options ) > 0 ) {
                                $fields['TitlesNs' . $namespace] = [
-                                       'class' => 'EditWatchlistCheckboxSeriesField',
+                                       'class' => EditWatchlistCheckboxSeriesField::class,
                                        'options' => $options,
                                        'section' => "ns$namespace",
                                ];