0

I need to use an older Mediawiki extension on our site, that isn't maintained anymore. When I activate the extension I get the following Error: 'Call to undefined method SpecialPage::addPage()' As far as I found out, this is due to the fact, that in Mediawiki since version 1.25 they changed the way how new Special pages are created and registered. I could not find examples that showed how to fix the code from an older extension so that it could work in the actual version of MW.

Here is the relevant code of the extension where the SpecialPage is created and registered.

  require_once( './includes/specialpage/SpecialPage.php' );
  $wgSpecialPages['Events'] = new SpecialPage ( 'Events' );

  $wgExtensionFunctions[] = 'efEventsExtn';
  $wgExtensionCredits['specialpage'][] = array( 
  'name' => 'Events', 
  'author' => 'Barrylb',
  'description' => 'Adds [[Special:Events|a special page]] for viewing events',
  'url' => 'http://www.mediawiki.org/wiki/Extension:Calendar_%28Barrylb%29'
  );


  function efEventsExtn() {
    $wgamMessages = array();
    SpecialPage::addPage( new EventsExtn() );
    $wgamMessages = array( 'events' => 'Events' , 'events-header' => '');
  }

  class EventsExtn extends IncludableSpecialPage {

    function EventsExtn() {
      SpecialPage::SpecialPage( 'Events', '', true, false, 'default', true );
    }

... (The rest of the code seems to work properly)

Maybe someone known how to fix this?

1 Answer 1

0

Just $wgSpecialPages should be enough:

$wgSpecialPages['Events'] = 'EventsExtn';

I would mistrust an extension that uses a function that was deprecated in MediaWiki 1.7, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.