Wikia

Community Central

WatchlistRandom pageRecent changes

Dantman/GE Extended/Hack List

Talk0
63,610pages on
this wiki

< Dantman | Dantman/GE Extended

ViewTitle HookEdit

A new hook needs to be added to the code, this hook lets extensions alter the displayed title of the page. This title modification only changes the viewed title, when editing, and in other areas of reference the title stays as the normal one. I did attempt at creating a parserhook that would allow for modification to the title. But like the MW devs did I had trouble with that. But the purpose of this title modification is not to allow a user to change it, but an extension. In this case the extension which works with the Network will use this hook to strip out the World Name such as striping Nanoha/ from Nanoha/Nanoha Takamichi.

Two parts of includes/Article.php need to be modified:

00821		/* title may have been set from the cache */
00822		$t = $wgOut->getPageTitle();
00823		if( empty( $t ) ) {
00824			$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
00825		}

Needs to be replaced with:

00821		/* title may have been set from the cache */
00822		$t = $wgOut->getPageTitle();
00823		if( empty( $t ) ) {
+++++			$articleTitle = $this->mTitle;
+++++			$displayTitle = $articleTitle->getPrefixedText();
+++++			wfRunHooks( 'ViewTitle', array( &$articleTitle, &$displayTitle ) );
00824			$wgOut->setPageTitle( $displayTitle );
00825		}

And similarly:

00934			
00935			$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );

Needs to be replaced with:

00934			
+++++			$articleTitle = $this->mTitle;
+++++			$displayTitle = $articleTitle->getPrefixedText();
+++++			wfRunHooks( 'ViewTitle', array( &$articleTitle, &$displayTitle ) );
00935			$wgOut->setPageTitle( $displayTitle );

ConProtectionEdit

The UserCan hook now allows us to do this without hacking the source...

Alright, I admit this is just blatantly adding an outsourced function into MediaWiki code instead of doing a hook. But I outsourced it to cut down on the hacked code. This code basically extends the code used to force protection on MediaWiki namespace messages. The extension of this similarly forces pages which are a subpage of World/Tech/Admin. Where World is the name of a valid Anime world in the world's table (This means that removing a world from the table will automatically unprotect these). The reason these pages are autoprotected is because pages such as World/Tech/Admin/Common.css, and World/Tech/Admin/Monobook.css are located in these places. Simply put those pages are included into all articles in that world. Basically All subpages of Nanoha would include Nanoha/Tech/Admin/Monobook.css and this page would be used to add per-anime CSS styling giving each Anime world it's own MiniWiki styling capabilities. Obviously pages like this need auto-protection because they are globally viewable and change the interface.

Due to the fact that this section of code has changed between MW-1.9.3 and MW-1.10 I cannot accurately add this function to the code without some Staff assistance.

To do this one part of includes/Title.php needs to be modifed:

Needs to be replaced with:

		// XXX: This is the code that prevents unprotecting a page in NS_MEDIAWIKI or a Con Protected page
		// from taking effect -ævar
		if( ( NS_MEDIAWIKI == $this->mNamespace && !$wgUser->isAllowed('editinterface') ) ||
			( wfIsConProtected( $this ) && !$wgUser->isAllowed('editconprotected') ) ) {
			wfProfileOut( $fname );
			return false;
		}

ExpandSkinCSS HookEdit

This will be done in a similar fashion either to Wikia's GlobalJSCSS hooks, or SyntaxHighlight GeSHi's stylesheet hook, so no hacking is needed.

To allow for extensions to properly expand the css, a new hook is needed inside of [ includes/SkinTemplate.php]. It is true that the SkinTemplateSetupPageCss hook already exists and allows for CSS to be extended. But there is an issue with that hook. The problem is that the hook is sent before the skins have been initialized. This means that you cannot grab the skin name such as Monobook to insert a skin specific style such as how MediaWiki:Monobook.css and User:Username/monobook.css are included.

To do this setupUserCss() in includes/SkinTemplate.php needs to be altered so that this:

		# If we use the site's dynamic CSS, throw that in, too
		if ( $wgUseSiteCss ) {
			$query = "usemsgcache=yes&action=raw&ctype=text/css&smaxage=$wgSquidMaxage";
			$sitecss .= '@import "' . self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI) . '";' . "\n";
			$sitecss .= '@import "' . self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ) . '";' . "\n";
			$sitecss .= '@import "' . self::makeUrl( '-', 'action=raw&gen=css' . $siteargs ) . '";' . "\n";
		}

Becomes this:

		# If we use the site's dynamic CSS, throw that in, too
		if ( $wgUseSiteCss ) {
			$query = "usemsgcache=yes&action=raw&ctype=text/css&smaxage=$wgSquidMaxage";
			$sitecss .= '@import "' . self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI) . '";' . "\n";
			$sitecss .= '@import "' . self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ) . '";' . "\n";
			$sitecss .= '@import "' . self::makeUrl( '-', 'action=raw&gen=css' . $siteargs ) . '";' . "\n";
			$extracss = '';
			wfRunHooks( 'ExpandSkinCSS', array( &$extracss, $this->skinname ) );
			$sitecss .= $extracss . "\n";
		}

Latest Photos

Add a Photo
7,509photos on this wiki
See more >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki