Extension talk:DisableSpecialPages/Archive

From mediawiki.org

"Allpages" don't work:

$wgDisabledSpecialPages = array( 'Allpages' );

You need to specify page name like:

$wgDisabledSpecialPages = array( 'Recentchanges' );


Broken in 1.15.2 ?


Working[edit]

Working great for me as of 1.15.3. Not 'Allpages', but fine with a defined array.

Interferes with some extensions?[edit]

I can't seem to run this and Extension:ArticleComments simultaneously. ArticleComments creates a special page (for processing comments) at time of installation, and while the new page shows up in the Special Page menu, opening it (or submitting a comment) results in the "No such special page" error. I suspect that any other extensions that create a Special Page might end up having the same problem, so if anyone is having a problem with a new extension, disable this in LocalSettings.php.

Perhaps this issue could be addressed in a code update?

Incompatible with 1.18.1[edit]

See this submited bug for more details: https://bugzilla.wikimedia.org/show_bug.cgi?id=35388

Update: 22-03-2012

I found out what's causing the infinite loop: SpecialPage::resolveAlias has been deprecated since 1.18 Instead you should use SpecialPageFactory::resolveAlias. Problem is this has the following stack:

SpecialPageFactory::resolveAlias --> SpecialPageFactory::getAliasList --> SpecialPageFactory::getList --> wfRunHooks( 'SpecialPage_initList', array( &self::$mList ) );

So it's pretty obvious what the problem is. I don't see why we need the canonical name, because if you look here it's pretty clear how to disable built-in special pages. I made the following changes in order to make it work with 1.18.2:

  • removed this function, not needed: efDspMakeTitle()
  • new version of efDspHook():
function efDspHook( &$aSpecialPages ) {
	global $wgDisabledSpecialPages;
  if ( !empty ( $wgDisabledSpecialPages ) ) {
    foreach( $wgDisabledSpecialPages as $page ) {
      if( !efDspWhitelisted( $page ) && isset( $aSpecialPages[$page] ) )
        unset( $aSpecialPages[$page] );
    }
  }
	return true;
}

Limitations with new code[edit]

I amended DisableSpecialPages.php in line with the above code changes and it works but for the following:

Only certain pages are recognised in the array, e.g. Version will work but AllMessages will not.

Also, and I may have misunderstood the purpose of this extension, pages which are disabled are done so for all users, including bureaucrats.
Surely the idea is to disable visibility of certain special pages to certain groups only?

Can this be achieved? If so, can someone explain in simple terms as I am not proficient in programming (in fact very limited knowledge).