Use namespace MediaWiki\Extension\WikiEditor in PHP

Change-Id: I0be9b88accafce97f7e9b7524ec740fb576fa11c
This commit is contained in:
Fomafix 2021-11-08 18:23:04 +00:00
parent c820a43220
commit 4da6f5b3b5
2 changed files with 34 additions and 10 deletions

View file

@ -22,25 +22,25 @@
},
"Hooks": {
"EditPage::showEditForm:initial": [
"WikiEditorHooks::editPageShowEditFormInitial"
"MediaWiki\\Extension\\WikiEditor\\Hooks::editPageShowEditFormInitial"
],
"GetPreferences": [
"WikiEditorHooks::getPreferences"
"MediaWiki\\Extension\\WikiEditor\\Hooks::getPreferences"
],
"EditPage::showEditForm:fields": [
"WikiEditorHooks::editPageShowEditFormFields"
"MediaWiki\\Extension\\WikiEditor\\Hooks::editPageShowEditFormFields"
],
"EditPage::attemptSave": [
"WikiEditorHooks::editPageAttemptSave"
"MediaWiki\\Extension\\WikiEditor\\Hooks::editPageAttemptSave"
],
"EditPage::attemptSave:after": [
"WikiEditorHooks::editPageAttemptSaveAfter"
"MediaWiki\\Extension\\WikiEditor\\Hooks::editPageAttemptSaveAfter"
],
"EditPageGetPreviewContent": "WikiEditorHooks"
},
"HookHandlers": {
"WikiEditorHooks": {
"class": "WikiEditorHooks"
"class": "MediaWiki\\Extension\\WikiEditor\\Hooks"
}
},
"ResourceModules": {
@ -60,8 +60,8 @@
"jquery.wikiEditor.dialogs.config.js",
{
"name": "data.json",
"callback": "WikiEditorHooks::getModuleData",
"versionCallback": "WikiEditorHooks::getModuleDataSummary"
"callback": "MediaWiki\\Extension\\WikiEditor\\Hooks::getModuleData",
"versionCallback": "MediaWiki\\Extension\\WikiEditor\\Hooks::getModuleDataSummary"
}
],
"styles": [
@ -393,7 +393,8 @@
"wikieditor-toolbar-help-content-indent-result"
],
"AutoloadClasses": {
"WikiEditorHooks": "includes/WikiEditorHooks.php"
"MediaWiki\\Extension\\WikiEditor\\Hooks": "includes/Hooks.php",
"WikiEditorHooks": "includes/Hooks.php"
},
"manifest_version": 2
}

View file

@ -6,12 +6,29 @@
* @ingroup Extensions
*/
namespace MediaWiki\Extension\WikiEditor;
use ApiMessage;
use Article;
use Config;
use Content;
use EditPage;
use EventLogging;
use ExtensionRegistry;
use Html;
use MediaWiki\Cache\CacheKeyHelper;
use MediaWiki\Hook\EditPageGetPreviewContentHook;
use MediaWiki\MediaWikiServices;
use MessageLocalizer;
use MWCryptRand;
use OutputPage;
use ResourceLoaderContext;
use Status;
use User;
use WebRequest;
use WikimediaEvents\WikimediaEventsHooks;
class WikiEditorHooks implements EditPageGetPreviewContentHook {
class Hooks implements EditPageGetPreviewContentHook {
/** @var string|bool ID used for grouping entries all of a session's entries together in EventLogging. */
private static $statsId = false;
@ -439,3 +456,9 @@ class WikiEditorHooks implements EditPageGetPreviewContentHook {
}
}
}
/**
* Retain the old class name for backwards compatibility.
* @deprecated since 1.38
*/
class_alias( Hooks::class, 'WikiEditorHooks' );