From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/resourceloader/ResourceLoader.php | 93 +++++++++++++++--------------- 1 file changed, 47 insertions(+), 46 deletions(-) (limited to 'includes/resourceloader/ResourceLoader.php') diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 7b87f9d4..27f682c2 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -39,7 +39,7 @@ class ResourceLoader { /** Associative array mapping module name to info associative array */ protected $moduleInfos = array(); - + /** Associative array mapping framework ids to a list of names of test suite modules */ /** like array( 'qunit' => array( 'mediawiki.tests.qunit.suites', 'ext.foo.tests', .. ), .. ) */ protected $testModuleNames = array(); @@ -60,7 +60,7 @@ class ResourceLoader { * requests its own information. This sacrifice of modularity yields a substantial * performance improvement. * - * @param $modules Array: List of module names to preload information for + * @param array $modules List of module names to preload information for * @param $context ResourceLoaderContext: Context to load the information within */ public function preloadModuleInfo( array $modules, ResourceLoaderContext $context ) { @@ -127,8 +127,8 @@ class ResourceLoader { * If $data is empty, only contains whitespace or the filter was unknown, * $data is returned unmodified. * - * @param $filter String: Name of filter to run - * @param $data String: Text to filter, such as JavaScript or CSS text + * @param string $filter Name of filter to run + * @param string $data Text to filter, such as JavaScript or CSS text * @return String: Filtered data, or a comment containing an error message */ protected function filter( $filter, $data ) { @@ -210,7 +210,6 @@ class ResourceLoader { $this->registerTestModules(); } - wfProfileOut( __METHOD__ ); } @@ -218,7 +217,7 @@ class ResourceLoader { * Registers a module with the ResourceLoader system. * * @param $name Mixed: Name of module as a string or List of name/object pairs as an array - * @param $info array Module info array. For backwards compatibility with 1.17alpha, + * @param array $info Module info array. For backwards compatibility with 1.17alpha, * this may also be a ResourceLoaderModule object. Optional when using * multiple-registration calling style. * @throws MWException: If a duplicate module registration is attempted @@ -309,7 +308,8 @@ class ResourceLoader { * 'loadScript': URL (either fully-qualified or protocol-relative) of load.php for this source * * @param $id Mixed: source ID (string), or array( id1 => props1, id2 => props2, ... ) - * @param $properties Array: source properties + * @param array $properties source properties + * @throws MWException */ public function addSource( $id, $properties = null) { // Allow multiple sources to be registered in one call @@ -346,13 +346,13 @@ class ResourceLoader { public function getModuleNames() { return array_keys( $this->moduleInfos ); } - - /** + + /** * Get a list of test module names for one (or all) frameworks. * If the given framework id is unknkown, or if the in-object variable is not an array, * then it will return an empty array. * - * @param $framework String: Optional. Get only the test module names for one + * @param string $framework Optional. Get only the test module names for one * particular framework. * @return Array */ @@ -370,7 +370,7 @@ class ResourceLoader { /** * Get the ResourceLoaderModule object for a given module name. * - * @param $name String: Module name + * @param string $name Module name * @return ResourceLoaderModule if module has been registered, null otherwise */ public function getModule( $name ) { @@ -450,7 +450,7 @@ class ResourceLoader { $this->hasErrors = true; continue; } - $modules[$name] = $this->getModule( $name ); + $modules[$name] = $module; } else { $missing[] = $name; } @@ -530,8 +530,8 @@ class ResourceLoader { /** * Send content type and last modified headers to the client. * @param $context ResourceLoaderContext - * @param $mtime string TS_MW timestamp to use for last-modified - * @param $error bool Whether there are commented-out errors in the response + * @param string $mtime TS_MW timestamp to use for last-modified + * @param bool $error Whether there are commented-out errors in the response * @return void */ protected function sendResponseHeaders( ResourceLoaderContext $context, $mtime, $errors ) { @@ -540,12 +540,12 @@ class ResourceLoader { // to propagate to clients quickly // If there were errors, we also need a shorter expiry time so we can recover quickly if ( is_null( $context->getVersion() ) || $errors ) { - $maxage = $wgResourceLoaderMaxage['unversioned']['client']; + $maxage = $wgResourceLoaderMaxage['unversioned']['client']; $smaxage = $wgResourceLoaderMaxage['unversioned']['server']; // If a version was specified we can use a longer expiry time since changing // version numbers causes cache misses } else { - $maxage = $wgResourceLoaderMaxage['versioned']['client']; + $maxage = $wgResourceLoaderMaxage['versioned']['client']; $smaxage = $wgResourceLoaderMaxage['versioned']['server']; } if ( $context->getOnly() === 'styles' ) { @@ -569,7 +569,7 @@ class ResourceLoader { * If there's an If-Modified-Since header, respond with a 304 appropriately * and clear out the output buffer. If the client cache is too old then do nothing. * @param $context ResourceLoaderContext - * @param $mtime string The TS_MW timestamp to check the header against + * @param string $mtime The TS_MW timestamp to check the header against * @return bool True iff 304 header sent and output handled */ protected function tryRespondLastModified( ResourceLoaderContext $context, $mtime ) { @@ -666,8 +666,8 @@ class ResourceLoader { * Generates code for a response * * @param $context ResourceLoaderContext: Context in which to generate a response - * @param $modules Array: List of module objects keyed by module name - * @param $missing Array: List of unavailable modules (optional) + * @param array $modules List of module objects keyed by module name + * @param array $missing List of unavailable modules (optional) * @return String: Response data */ public function makeModuleResponse( ResourceLoaderContext $context, @@ -834,7 +834,7 @@ class ResourceLoader { * Returns JS code to call to mw.loader.implement for a module with * given properties. * - * @param $name string Module name + * @param string $name Module name * @param $scripts Mixed: List of URLs to JavaScript files or String of JavaScript code * @param $styles Mixed: Array of CSS strings keyed by media type, or an array of lists of URLs to * CSS files keyed by media type @@ -842,6 +842,7 @@ class ResourceLoader { * associative array mapping message key to value, or a JSON-encoded message blob containing * the same data, wrapped in an XmlJsCode object. * + * @throws MWException * @return string */ public static function makeLoaderImplementScript( $name, $scripts, $styles, $messages ) { @@ -881,7 +882,7 @@ class ResourceLoader { * Combines an associative array mapping media type to CSS into a * single stylesheet with "@media" blocks. * - * @param $styles Array: Array keyed by media type containing (arrays of) CSS strings. + * @param array $stylePairs Array keyed by media type containing (arrays of) CSS strings. * * @return Array */ @@ -941,12 +942,12 @@ class ResourceLoader { * which will have values corresponding to $name, $version, $dependencies * and $group as supplied. * - * @param $name String: Module name + * @param string $name Module name * @param $version Integer: Module version number as a timestamp - * @param $dependencies Array: List of module names on which this module depends - * @param $group String: Group which the module is in. - * @param $source String: Source of the module, or 'local' if not foreign. - * @param $script String: JavaScript code + * @param array $dependencies List of module names on which this module depends + * @param string $group Group which the module is in. + * @param string $source Source of the module, or 'local' if not foreign. + * @param string $script JavaScript code * * @return string */ @@ -974,11 +975,11 @@ class ResourceLoader { * ) ): * Registers modules with the given names and parameters. * - * @param $name String: Module name + * @param string $name Module name * @param $version Integer: Module version number as a timestamp - * @param $dependencies Array: List of module names on which this module depends - * @param $group String: group which the module is in. - * @param $source String: source of the module, or 'local' if not foreign + * @param array $dependencies List of module names on which this module depends + * @param string $group group which the module is in. + * @param string $source source of the module, or 'local' if not foreign * * @return string */ @@ -1004,8 +1005,8 @@ class ResourceLoader { * - ResourceLoader::makeLoaderSourcesScript( array( $id1 => $props1, $id2 => $props2, ... ) ); * Register sources with the given IDs and properties. * - * @param $id String: source ID - * @param $properties Array: source properties (see addSource()) + * @param string $id source ID + * @param array $properties source properties (see addSource()) * * @return string */ @@ -1021,7 +1022,7 @@ class ResourceLoader { * Returns JS code which runs given JS code if the client-side framework is * present. * - * @param $script String: JavaScript code + * @param string $script JavaScript code * * @return string */ @@ -1033,7 +1034,7 @@ class ResourceLoader { * Returns JS code which will set the MediaWiki configuration array to * the given value. * - * @param $configuration Array: List of configuration values keyed by variable name + * @param array $configuration List of configuration values keyed by variable name * * @return string */ @@ -1046,7 +1047,7 @@ class ResourceLoader { * * For example, array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' ) * becomes 'foo.bar,baz|bar.baz,quux' - * @param $modules array of module names (strings) + * @param array $modules of module names (strings) * @return string Packed query string */ public static function makePackedModulesString( $modules ) { @@ -1084,16 +1085,16 @@ class ResourceLoader { /** * Build a load.php URL - * @param $modules array of module names (strings) - * @param $lang string Language code - * @param $skin string Skin name - * @param $user string|null User name. If null, the &user= parameter is omitted - * @param $version string|null Versioning timestamp - * @param $debug bool Whether the request should be in debug mode - * @param $only string|null &only= parameter - * @param $printable bool Printable mode - * @param $handheld bool Handheld mode - * @param $extraQuery array Extra query parameters to add + * @param array $modules of module names (strings) + * @param string $lang Language code + * @param string $skin Skin name + * @param string|null $user User name. If null, the &user= parameter is omitted + * @param string|null $version Versioning timestamp + * @param bool $debug Whether the request should be in debug mode + * @param string|null $only &only= parameter + * @param bool $printable Printable mode + * @param bool $handheld Handheld mode + * @param array $extraQuery Extra query parameters to add * @return string URL to load.php. May be protocol-relative (if $wgLoadScript is procol-relative) */ public static function makeLoaderURL( $modules, $lang, $skin, $user = null, $version = null, $debug = false, $only = null, @@ -1149,7 +1150,7 @@ class ResourceLoader { * Module names may not contain pipes (|), commas (,) or exclamation marks (!) and can be * at most 255 bytes. * - * @param $moduleName string Module name to check + * @param string $moduleName Module name to check * @return bool Whether $moduleName is a valid module name */ public static function isValidModuleName( $moduleName ) { -- cgit v1.2.2