diff --git a/extension.json b/extension.json index 3de32c5..fa97395 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "DynamicPageList3", - "version": "3.3.7", + "version": "3.3.8", "author": [ "Alexia E. Smith", "[https://meta.miraheze.org/wiki/User:Universal_Omega Universal Omega]", @@ -11,7 +11,7 @@ "license-name": "GPL-3.0-or-later", "type": "parserhook", "requires": { - "MediaWiki": ">= 1.36.0" + "MediaWiki": ">= 1.35.0" }, "GroupPermissions": { "sysop": { diff --git a/includes/UpdateArticle.php b/includes/UpdateArticle.php index 812402f..f0d679f 100644 --- a/includes/UpdateArticle.php +++ b/includes/UpdateArticle.php @@ -394,9 +394,16 @@ class UpdateArticle { $permission_errors = MediaWikiServices::getInstance()->getPermissionManager()->getPermissionErrors( 'edit', $user, $titleX ); if ( count( $permission_errors ) == 0 ) { - $wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory(); + $services = MediaWikiServices::getInstance(); + // MW 1.36+ + if ( method_exists( $services, 'getWikiPageFactory' ) ) { + $wikiPageFactory = $services->getWikiPageFactory(); + $page = $wikiPageFactory->newFromTitle( $titleX ); + } + else { + $page = \WikiPage::factory( $titleX ); + } - $page = $wikiPageFactory->newFromTitle( $titleX ); $updater = $page->newPageUpdater( $user ); $content = $page->getContentHandler()->makeContent( $text, $titleX ); $updater->setContent( SlotRecord::MAIN, $content ); diff --git a/maintenance/createTemplate.php b/maintenance/createTemplate.php index edde9cb..7a84f79 100644 --- a/maintenance/createTemplate.php +++ b/maintenance/createTemplate.php @@ -55,9 +55,15 @@ class CreateTemplate extends LoggedUpdateMaintenance { // Make sure template does not already exist if ( !$title->exists() ) { - $wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory(); - - $page = $wikiPageFactory->newFromTitle( $title ); + $services = MediaWikiServices::getInstance(); + // MW 1.36+ + if ( method_exists( $services, 'getWikiPageFactory' ) ) { + $wikiPageFactory = $services->getWikiPageFactory(); + $page = $wikiPageFactory->newFromTitle( $title ); + } + else { + $page = \WikiPage::factory( $title ); + } $updater = $page->newPageUpdater( User::newSystemUser( 'DynamicPageList3 extension' ) ); $content = $page->getContentHandler()->makeContent( 'This page was automatically created. It serves as an anchor page for all \'\'\'[[Special:WhatLinksHere/Template:Extension_DPL|invocations]]\'\'\' of [https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:DynamicPageList3 Extension:DynamicPageList3].', $title ); $updater->setContent( SlotRecord::MAIN, $content );