User:Dantman/GE Extended/Hack List

ViewTitle Hook
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 );

ConProtection
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; }