addDescription( 'Handle inserting DPL\'s necessary template for content inclusion.' ); } /** * Get the unique update key for this logged update. * * @return string */ protected function getUpdateKey() { return 'dynamic-page-list-create-template'; } /** * Message to show that the update was done already and was just skipped * * @return string */ protected function updateSkippedMessage() { return 'Template already created.'; } /** * Handle inserting DPL's necessary template for content inclusion. * * @return bool */ protected function doDBUpdates() { $title = Title::newFromText( 'Extension DPL', NS_TEMPLATE ); // Make sure template does not already exist if ( !$title->exists() ) { $wikipage = WikiPage::factory( $title ); $updater = $wikipage->newPageUpdater( User::newSystemUser( 'MediaWiki default' ) ); $content = $wikipage->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 ); print_r( $content ); $updater->setContent( SlotRecord::MAIN, $content ); $comment = CommentStoreComment::newUnsavedComment( 'Autogenerated DPL\'s necessary template for content inclusion' ); print_r( $comment ); $updater->saveRevision( $comment ); print_r( $updater ); } return true; } } $maintClass = CreateTemplateUpdateMaintenance::class; require_once RUN_MAINTENANCE_IF_MAIN;