Skip to content

Logic regarding settings of $wgMonacoAllowUseTheme and $wgMonacoTheme #39

@WikiMANNia

Description

@WikiMANNia

I suggest replacing lines 73-94 in file SkinMonaco.php with:

	$request = $this->getRequest();
	$theme_key = 'theme_monaco';
	$themes = self::getSkinMonacoThemeList();
	$user = RequestContext::getMain()->getUser();
	// Check the following things in this order:
	// 1) value of $wgMonacoTheme (set in site configuration)
	// 2) user's personal preference/override
	// 3) per-page usetheme URL parameter
	$theme_fallback = self::getSkinMonacoFallbackTheme();
	$theme_default = $this->config->get( 'MonacoTheme', $theme_fallback );
	if ( !in_array( $theme_default, $themes ) ) {
		// May be $wgMonacoTheme is not in the list (i.e. because a misspelling)
		$theme_default = $theme_fallback;
	}
	$theme = $theme_default;
	if ( $this->config->get( 'MonacoAllowUseTheme' ) ) {
		$theme_user = $this->mUserOptionsLookup->getOption( $user, $theme_key, $theme_default );
		if ( !in_array( $theme_user, $themes ) ) {
			$theme_user = $theme_default;
		}
		$theme = $request->getText( 'usetheme', $theme_user );
		if ( !in_array( $theme, $themes ) ) {
			$theme = $theme_user;
		}
	}

The line 45
public static function getSkinMonacoDefaultTheme()
is also to be replaced by
private static function getSkinMonacoFallbackTheme()

Argument:
The selection of themes can be deactivated by setting the variable $wgMonacoAllowUseTheme to false. In this case, the default theme ($wgMonacoTheme) is set as the theme.

The default theme itself can be set using the variable $wgMonacoTheme. If this variable is set incorrectly (e.g. due to a typing error), the theme ‘sapphire’ should be used as a fallback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions