Bartosz Dziewoński has uploaded a new change for review.
https://gerrit.wikimedia.org/r/87028
Change subject: Remove dead code
......................................................................
Remove dead code
* Remove .jshintrc
Unused, there are no JavaScript files here anymore.
* Remove unused $vectorResourceTemplate toplevel variable
* Remove 'vector-collapsiblenav-preference' message
Unused as of I47950b53.
* Remove 'vector-simplesearch-search', 'vector-simplesearch-containing' messages
Previously removed in Ib8ebba17, apparently erreneously restored by
Translation updater bot in I89923f52
* Remove BeforePageDisplay, ResourceLoaderGetConfigVars, GetPreferences hooks
No longer do anything, as all of the features have been removed.
* Remove MakeGlobalVariablesScript hook, VectorHooks::isEnabled method
No longer do anything per above, global $wgVectorFeatures which they
refer to no longer exists (removed in I47950b53).
* Remove default true value for 'vector-simplesearch' preference
The preference (with the default value) was added in Vector in r68177,
moved to core in r68224. Default moved to core in Id5e96f5e.
Bug: 45051
Change-Id: If24b0055a94ae254f8f5c639c3f02507d17402a8
---
D .jshintrc
D Vector.hooks.php
M Vector.i18n.php
M Vector.php
4 files changed, 0 insertions(+), 185 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Vector
refs/changes/28/87028/1
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 20c6068..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- /* Common */
-
- // Enforcing
- "camelcase": true,
- "curly": true,
- "eqeqeq": true,
- "immed": true,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "noempty": true,
- "nonew": true,
- "quotmark": "single",
- "trailing": true,
- "undef": true,
- "unused": true,
- // Legacy
- "onevar": true,
-
- /* Local */
-
- // Relaxing
- //"laxbreak": true,
- //"smarttabs": true,
- //"multistr": true,
- // Environment
- "browser": true,
- // Legacy
- //"nomen": true,
-
- "predef": [
- "mediaWiki",
- "jQuery"
- ]
-}
diff --git a/Vector.hooks.php b/Vector.hooks.php
deleted file mode 100644
index 6a924d1..0000000
--- a/Vector.hooks.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-/**
- * Hooks for Vector extension
- *
- * @file
- * @ingroup Extensions
- */
-
-class VectorHooks {
-
- /* Protected Static Members */
-
- protected static $features = array(
- );
-
- /* Protected Static Methods */
-
- protected static function isEnabled( $name ) {
- global $wgVectorFeatures, $wgUser;
-
- // Features with global set to true are always enabled
- if ( !isset( $wgVectorFeatures[$name] ) ||
$wgVectorFeatures[$name]['global'] ) {
- return true;
- }
- // Features with user preference control can have any number of
preferences to be specific values to be enabled
- if ( $wgVectorFeatures[$name]['user'] ) {
- if ( isset( self::$features[$name]['requirements'] ) ) {
- foreach (
self::$features[$name]['requirements'] as $requirement => $value ) {
- // Important! We really do want fuzzy
evaluation here
- if ( $wgUser->getOption( $requirement )
!= $value ) {
- return false;
- }
- }
- }
- return true;
- }
- // Features controlled by $wgVectorFeatures with both global
and user set to false are awlways disabled
- return false;
- }
-
- /* Static Methods */
-
- /**
- * BeforePageDisplay hook
- *
- * Adds the modules to the page
- *
- * @param $out OutputPage output page
- * @param $skin Skin current skin
- */
- public static function beforePageDisplay( $out, $skin ) {
- if ( $skin instanceof SkinVector ) {
- // Add modules for enabled features
- foreach ( self::$features as $name => $feature ) {
- if ( isset( $feature['modules'] ) &&
self::isEnabled( $name ) ) {
- $out->addModules( $feature['modules'] );
- }
- }
- }
- return true;
- }
-
- /**
- * GetPreferences hook
- *
- * Adds Vector-releated items to the preferences
- *
- * @param $user User current user
- * @param $defaultPreferences array list of default user preference
controls
- */
- public static function getPreferences( $user, &$defaultPreferences ) {
- global $wgVectorFeatures;
-
- foreach ( self::$features as $name => $feature ) {
- if (
- isset( $feature['preferences'] ) &&
- ( !isset( $wgVectorFeatures[$name] ) ||
$wgVectorFeatures[$name]['user'] )
- ) {
- foreach ( $feature['preferences'] as $key =>
$options ) {
- $defaultPreferences[$key] = $options;
- }
- }
- }
- return true;
- }
-
- /**
- * ResourceLoaderGetConfigVars hook
- *
- * Adds enabled/disabled switches for Vector modules
- */
- public static function resourceLoaderGetConfigVars( &$vars ) {
- global $wgVectorFeatures;
-
- $configurations = array();
- foreach ( self::$features as $name => $feature ) {
- if (
- isset( $feature['configurations'] ) &&
- ( !isset( $wgVectorFeatures[$name] ) ||
self::isEnabled( $name ) )
- ) {
- foreach ( $feature['configurations'] as
$configuration ) {
- global $$configuration;
- $configurations[$configuration] =
$$configuration;
- }
- }
- }
- if ( count( $configurations ) ) {
- $vars = array_merge( $vars, $configurations );
- }
- return true;
- }
-
- /**
- * @param $vars array
- * @return bool
- */
- public static function makeGlobalVariablesScript( &$vars ) {
- // Build and export old-style wgVectorEnabledModules object for
back compat
- $enabledModules = array();
- foreach ( self::$features as $name => $feature ) {
- $enabledModules[$name] = self::isEnabled( $name );
- }
-
- $vars['wgVectorEnabledModules'] = $enabledModules;
- return true;
- }
-}
diff --git a/Vector.i18n.php b/Vector.i18n.php
index 650d3f6..7063f28 100644
--- a/Vector.i18n.php
+++ b/Vector.i18n.php
@@ -14,9 +14,6 @@
$messages['en'] = array(
'vector' => 'UI improvements for Vector',
'vector-desc' => 'Enhances the user interface when using the Vector
skin',
- 'vector-collapsiblenav-preference' => 'Enable collapsing of items in
the sidebar in Vector skin',
- 'vector-simplesearch-search' => 'Search',
- 'vector-simplesearch-containing' => 'containing...',
);
/** Message documentation (Message documentation)
@@ -30,11 +27,6 @@
$messages['qqq'] = array(
'vector' => 'UI means User Interface. Vector is the name of an
interface skin.',
'vector-desc' =>
'{{desc|name=Vector|url=http://www.mediawiki.org/wiki/Extension:Vector}}',
- 'vector-collapsiblenav-preference' => 'The message refers to the
sidebar, whose sections are collapsible in Vector skin (some of them collapsed
by default and some no); the preference disables collapsing entirely and is
among "Advanced options" in the "Appearence" section.',
- 'vector-simplesearch-search' => 'Greyed out default text in the simple
search box in the Vector skin. (It disappears and lets the user enter the
requested search terms when the search box receives focus.)
-
-{{Identical|Search}}',
- 'vector-simplesearch-containing' => 'Label used in the special item of
the search suggestions list which gives the user an option to perform a full
text search for the term.',
);
/** Achinese (Acèh)
diff --git a/Vector.php b/Vector.php
index bd9859e..a2d2803 100644
--- a/Vector.php
+++ b/Vector.php
@@ -13,10 +13,6 @@
* @version 0.3.0
*/
-/* Configuration */
-// The Vector skin has a basic version of simple search, which is a
prerequisite for the enhanced one
-$wgDefaultUserOptions['vector-simplesearch'] = 1;
-
/* Setup */
$wgExtensionCredits['other'][] = array(
@@ -27,14 +23,4 @@
'url' => 'https://www.mediawiki.org/wiki/Extension:Vector',
'descriptionmsg' => 'vector-desc',
);
-$wgAutoloadClasses['VectorHooks'] = dirname( __FILE__ ) . '/Vector.hooks.php';
$wgExtensionMessagesFiles['Vector'] = dirname( __FILE__ ) . '/Vector.i18n.php';
-$wgHooks['BeforePageDisplay'][] = 'VectorHooks::beforePageDisplay';
-$wgHooks['GetPreferences'][] = 'VectorHooks::getPreferences';
-$wgHooks['ResourceLoaderGetConfigVars'][] =
'VectorHooks::resourceLoaderGetConfigVars';
-$wgHooks['MakeGlobalVariablesScript'][] =
'VectorHooks::makeGlobalVariablesScript';
-
-$vectorResourceTemplate = array(
- 'localBasePath' => dirname( __FILE__ ) . '/modules',
- 'remoteExtPath' => 'Vector/modules',
-);
--
To view, visit https://gerrit.wikimedia.org/r/87028
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If24b0055a94ae254f8f5c639c3f02507d17402a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Vector
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits