From 0fa3413576751247586fe291c837fcedbba3c1f0 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 9 Jan 2017 21:56:41 +1100 Subject: [PATCH] Remove cols and rows preferences In https://gerrit.wikimedia.org/r/80061/, Chad was convinced this preference is barely used and mostly set to weird values by people who don't understand what they're doing. He made some quick stats: http://p.defau.lt/?fgGU0StB4J9l0LC5GZq8AA Used defaults of 80 columns and 25 rows in places that still were asking for it. The old default values are left in $wgDefaultUserOptions for now, since various extensions are using them. The 'rows' and 'columns' messages don't appear to be in use in any extensions in Git, so I killed those as well. (This is the same as I642188c74d929a586b1882a1cf8656056c4fcf5a.) Bug: T26430 Change-Id: I6c9802bc4f9cf32fb75c3dd7b9e2dc18f271eedf --- includes/DefaultSettings.php | 4 ++-- includes/EditPage.php | 4 ++-- includes/Preferences.php | 18 ++---------------- includes/specials/SpecialUndelete.php | 4 ++-- includes/specials/SpecialUpload.php | 2 +- languages/i18n/en.json | 2 -- languages/i18n/qqq.json | 2 -- tests/phpunit/includes/user/UserTest.php | 8 ++++---- 8 files changed, 13 insertions(+), 31 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ffa5c2128e..856a3f9d71 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4788,7 +4788,7 @@ $wgReservedUsernames = [ */ $wgDefaultUserOptions = [ 'ccmeonemails' => 0, - 'cols' => 80, + 'cols' => 80, // @deprecated since 1.29 No longer used in core 'date' => 'default', 'diffonly' => 0, 'disablemail' => 0, @@ -4818,7 +4818,7 @@ $wgDefaultUserOptions = [ 'rcdays' => 7, 'rcenhancedfilters' => 0, 'rclimit' => 50, - 'rows' => 25, + 'rows' => 25, // @deprecated since 1.29 No longer used in core 'showhiddencats' => 0, 'shownumberswatching' => 1, 'showtoolbar' => 1, diff --git a/includes/EditPage.php b/includes/EditPage.php index acbd13051e..05fa366eba 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -4441,8 +4441,8 @@ HTML $attribs = $customAttribs + [ 'accesskey' => ',', 'id' => $name, - 'cols' => $user->getIntOption( 'cols' ), - 'rows' => $user->getIntOption( 'rows' ), + 'cols' => 80, + 'rows' => 25, // Avoid PHP notices when appending preferences // (appending allows customAttribs['style'] to still work). 'style' => '' diff --git a/includes/Preferences.php b/includes/Preferences.php index 263ff5b128..89982a61e8 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -55,8 +55,6 @@ class Preferences { /** @var array */ protected static $saveFilters = [ 'timecorrection' => [ 'Preferences', 'filterTimezoneInput' ], - 'cols' => [ 'Preferences', 'filterIntval' ], - 'rows' => [ 'Preferences', 'filterIntval' ], 'rclimit' => [ 'Preferences', 'filterIntval' ], 'wllimit' => [ 'Preferences', 'filterIntval' ], 'searchlimit' => [ 'Preferences', 'filterIntval' ], @@ -817,20 +815,7 @@ class Preferences { ] ]; } - $defaultPreferences['cols'] = [ - 'type' => 'int', - 'label-message' => 'columns', - 'section' => 'editing/editor', - 'min' => 4, - 'max' => 1000, - ]; - $defaultPreferences['rows'] = [ - 'type' => 'int', - 'label-message' => 'rows', - 'section' => 'editing/editor', - 'min' => 4, - 'max' => 1000, - ]; + if ( $user->isAllowed( 'minoredit' ) ) { $defaultPreferences['minordefault'] = [ 'type' => 'toggle', @@ -838,6 +823,7 @@ class Preferences { 'label-message' => 'tog-minordefault', ]; } + $defaultPreferences['forceeditsummary'] = [ 'type' => 'toggle', 'section' => 'editing/editor', diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 3d5184208b..4c6a593838 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -1141,8 +1141,8 @@ class SpecialUndelete extends SpecialPage { 'textarea', [ 'readonly' => 'readonly', - 'cols' => $user->getIntOption( 'cols' ), - 'rows' => $user->getIntOption( 'rows' ) + 'cols' => 80, + 'rows' => 25 ], $content->getNativeData() . "\n" ); diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index aabd450894..8b8e514ac0 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -1118,7 +1118,7 @@ class UploadForm extends HTMLForm { ? 'filereuploadsummary' : 'fileuploadsummary', 'default' => $this->mComment, - 'cols' => $this->getUser()->getIntOption( 'cols' ), + 'cols' => 80, 'rows' => 8, ] ]; diff --git a/languages/i18n/en.json b/languages/i18n/en.json index a621f1c5b2..ea07d7892d 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1053,8 +1053,6 @@ "saveprefs": "Save", "restoreprefs": "Restore all default settings (in all sections)", "prefs-editing": "Editing", - "rows": "Rows:", - "columns": "Columns:", "searchresultshead": "Search", "stub-threshold": "Threshold for stub link formatting ($1):", "stub-threshold-sample-link": "sample", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 372a12795e..a795484da1 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1238,8 +1238,6 @@ "saveprefs": "Button for saving changes in the preferences page.\n\nSee also:\n* {{msg-mw|Saveprefs}}\n* {{msg-mw|Accesskey-preferences-save}}\n* {{msg-mw|Tooltip-preferences-save}}\n{{Identical|Save}}", "restoreprefs": "Used as link text in [[Special:Preferences]]. The link points to [[Special:Preferences/reset]] which shows the \"Restore all default settings\" form.\n\nAlso used as label for the Submit button in [[Special:Preferences/reset]].", "prefs-editing": "Title of a tab in [[Special:Preferences]].\nWhen changing this message, please also update {{msg-mw|vector-editwarning-warning}} which references to this message.\n{{Identical|Editing}}", - "rows": "Used on [[Special:Preferences]], \"Editing\" section in the \"Size of editing window\" fieldset.\n{{Identical|Row}}", - "columns": "Used on [[Special:Preferences]], \"Editing\" section in the \"Size of editing window\" fieldset.\n{{Identical|Column}}", "searchresultshead": "Replaced by {{msg-mw|prefs-searchoptions}}, though may still be used in some extensions. DEPRECATED.\n\n{{Identical|Search}}", "stub-threshold": "Used in [[Special:Preferences]], \"Advanced options\" section. The setting allows the user to select a threshold value, in bytes, from a predefined list of options. Any links that lead to pages smaller than the threshold (\"stub links\") will be styled differently.\n\nParameters:\n* $1: the text of {{msg-mw|stub-threshold-sample-link}}, styled as a stub link", "stub-threshold-sample-link": "Passed as a parameter to the {{msg-mw|stub-threshold}} message.\n{{Identical|Sample}}", diff --git a/tests/phpunit/includes/user/UserTest.php b/tests/phpunit/includes/user/UserTest.php index 94c6b4f4c5..fe56d27c93 100644 --- a/tests/phpunit/includes/user/UserTest.php +++ b/tests/phpunit/includes/user/UserTest.php @@ -345,18 +345,18 @@ class UserTest extends MediaWikiTestCase { $user = $this->getMutableTestUser()->getUser(); $user->setOption( 'userjs-someoption', 'test' ); - $user->setOption( 'cols', 200 ); + $user->setOption( 'rclimit', 200 ); $user->saveSettings(); $user = User::newFromName( $user->getName() ); $user->load( User::READ_LATEST ); $this->assertEquals( 'test', $user->getOption( 'userjs-someoption' ) ); - $this->assertEquals( 200, $user->getOption( 'cols' ) ); + $this->assertEquals( 200, $user->getOption( 'rclimit' ) ); $user = User::newFromName( $user->getName() ); MediaWikiServices::getInstance()->getMainWANObjectCache()->clearProcessCache(); $this->assertEquals( 'test', $user->getOption( 'userjs-someoption' ) ); - $this->assertEquals( 200, $user->getOption( 'cols' ) ); + $this->assertEquals( 200, $user->getOption( 'rclimit' ) ); } /** @@ -367,7 +367,7 @@ class UserTest extends MediaWikiTestCase { public function testAnonOptions() { global $wgDefaultUserOptions; $this->user->setOption( 'userjs-someoption', 'test' ); - $this->assertEquals( $wgDefaultUserOptions['cols'], $this->user->getOption( 'cols' ) ); + $this->assertEquals( $wgDefaultUserOptions['rclimit'], $this->user->getOption( 'rclimit' ) ); $this->assertEquals( 'test', $this->user->getOption( 'userjs-someoption' ) ); } -- 2.20.1