* Merge arrays in the style of getUserPermissionsErrors, with duplicate removal
* e.g.
* wfMergeErrorArrays(
- * array( array( 'x' ) ),
- * array( array( 'x', '2' ) ),
- * array( array( 'x' ) ),
- * array( array( 'y' ) )
+ * [ [ 'x' ] ],
+ * [ [ 'x', '2' ] ],
+ * [ [ 'x' ] ],
+ * [ [ 'y' ] ]
* );
* returns:
- * array(
- * array( 'x', '2' ),
- * array( 'x' ),
- * array( 'y' )
- * )
+ * [
+ * [ 'x', '2' ],
+ * [ 'x' ],
+ * [ 'y' ]
+ * ]
*
* @param array $array1,...
* @return array
$bits = parse_url( $url );
MediaWiki\restoreWarnings();
// parse_url() returns an array without scheme for some invalid URLs, e.g.
- // parse_url("%0Ahttp://example.com") == array( 'host' => '%0Ahttp', 'path' => 'example.com' )
+ // parse_url("%0Ahttp://example.com") == [ 'host' => '%0Ahttp', 'path' => 'example.com' ]
if ( !$bits || !isset( $bits['scheme'] ) ) {
return false;
}
}
/**
- * Replace all invalid characters with -
- * Additional characters can be defined in $wgIllegalFileChars (see bug 20489)
- * By default, $wgIllegalFileChars = ':'
+ * Replace all invalid characters with '-'.
+ * Additional characters can be defined in $wgIllegalFileChars (see T22489).
+ * By default, $wgIllegalFileChars includes ':', '/', '\'.
*
* @param string $name Filename to process
* @return string
function wfStripIllegalFilenameChars( $name ) {
global $wgIllegalFileChars;
$illegalFileChars = $wgIllegalFileChars ? "|[" . $wgIllegalFileChars . "]" : '';
- $name = wfBaseName( $name );
$name = preg_replace(
"/[^" . Title::legalChars() . "]" . $illegalFileChars . "/",
'-',
$name
);
+ // $wgIllegalFileChars may not include '/' and '\', so we still need to do this
+ $name = wfBaseName( $name );
return $name;
}
*
* @code
* $conf = new SiteConfiguration;
- * $conf->wikis = array( 'de', 'en', 'beta' );
+ * $conf->wikis = [ 'de', 'en', 'beta' ];
* @endcode
*
* When configuring the MediaWiki global settings (the $wg variables),
* the identifiers will be available to specify settings on a per wiki basis.
*
* @code
- * $conf->settings = array(
- * 'wgSomeSetting' => array(
+ * $conf->settings = [
+ * 'wgSomeSetting' => [
*
* # production:
* 'de' => false,
*
* # test:
* 'beta => true,
- * ),
- * );
+ * ],
+ * ];
* @endcode
*
* With three wikis, that is easy to manage. But what about a farm with
* the above code could be written:
*
* @code
- * $conf->settings = array(
- * 'wgSomeSetting' => array(
+ * $conf->settings = [
+ * 'wgSomeSetting' => [
*
* 'default' => false,
*
* # Enable feature on test
* 'beta' => true,
- * ),
- * );
+ * ],
+ * ];
* @endcode
*
*
* on a per wiki basis.
*
* @code
- * $conf->settings = array(
- * 'wgMergeSetting' = array(
+ * $conf->settings = [
+ * 'wgMergeSetting' = [
* # Value that will be shared among all wikis:
- * 'default' => array( NS_USER => true ),
+ * 'default' => [ NS_USER => true ],
*
* # Leading '+' means merging the array of value with the defaults
- * '+beta' => array( NS_HELP => true ),
- * ),
- * );
+ * '+beta' => [ NS_HELP => true ],
+ * ],
+ * ];
*
* # Get configuration for the German site:
* $conf->get( 'wgMergeSetting', 'de' );
- * // --> array( NS_USER => true );
+ * // --> [ NS_USER => true ];
*
* # Get configuration for the testing site:
* $conf->get( 'wgMergeSetting', 'beta' );
- * // --> array( NS_USER => true, NS_HELP => true );
+ * // --> [ NS_USER => true, NS_HELP => true ];
* @endcode
*
* Finally, to load all configuration settings, extract them in global context:
* extract( $globals );
* @endcode
*
+ * @note For WikiMap to function, the configuration must define string values for
+ * $wgServer (or $wgCanonicalServer) and $wgArticlePath, even if these are the
+ * same for all wikis or can be correctly determined by the logic in
+ * Setup.php.
+ *
* @todo Give examples for,
* suffixes:
- * $conf->suffixes = array( 'wiki' );
+ * $conf->suffixes = [ 'wiki' ];
* localVHosts
* callbacks!
*/