mirror of
https://github.com/Universal-Omega/DynamicPageList3
synced 2024-11-14 19:30:15 +00:00
Restore MediaWiki 1.35 compatibility (#79)
Co-authored-by: rvogel <vogel@hallowelt.biz>
This commit is contained in:
parent
db51e49ba5
commit
f20ad2e16f
|
@ -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": {
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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( '<noinclude>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].</noinclude>', $title );
|
||||
$updater->setContent( SlotRecord::MAIN, $content );
|
||||
|
|
Loading…
Reference in a new issue