Use namespace MediaWiki\Extension\CodeEditor in PHP

An alias with the old class name CodeEditorHooks is not added because
there are no external findings on
https://codesearch.wmcloud.org/search/?q=CodeEditorHooks

Change-Id: I88cb3a506d196d918ce852e46433dad808ae2a6c
This commit is contained in:
Fomafix 2021-11-25 19:40:49 +00:00
parent b10b8862a8
commit d7117949b1
2 changed files with 15 additions and 6 deletions

View file

@ -16,9 +16,9 @@
} }
}, },
"Hooks": { "Hooks": {
"EditPage::showEditForm:initial": "CodeEditorHooks::editPageShowEditFormInitial", "EditPage::showEditForm:initial": "MediaWiki\\Extension\\CodeEditor\\Hooks::editPageShowEditFormInitial",
"EditPage::showReadOnlyForm:initial": "CodeEditorHooks::editPageShowEditFormInitial", "EditPage::showReadOnlyForm:initial": "MediaWiki\\Extension\\CodeEditor\\Hooks::editPageShowEditFormInitial",
"GetPreferences": "CodeEditorHooks::getPreferences" "GetPreferences": "MediaWiki\\Extension\\CodeEditor\\Hooks::getPreferences"
}, },
"MessagesDirs": { "MessagesDirs": {
"CodeEditor": [ "CodeEditor": [
@ -133,7 +133,7 @@
"remoteExtPath": "CodeEditor/modules" "remoteExtPath": "CodeEditor/modules"
}, },
"AutoloadClasses": { "AutoloadClasses": {
"CodeEditorHooks": "includes/CodeEditorHooks.php" "MediaWiki\\Extension\\CodeEditor\\Hooks": "includes/Hooks.php"
}, },
"manifest_version": 2 "manifest_version": 2
} }

View file

@ -1,6 +1,15 @@
<?php <?php
class CodeEditorHooks { namespace MediaWiki\Extension\CodeEditor;
use EditPage;
use ErrorPageError;
use ExtensionRegistry;
use OutputPage;
use Title;
use User;
class Hooks {
/** /**
* @param Title $title * @param Title $title
* @param string $model * @param string $model
@ -19,7 +28,7 @@ class CodeEditorHooks {
// Give extensions a chance // Give extensions a chance
// Note: $model and $format were added around the time of MediaWiki 1.28. // Note: $model and $format were added around the time of MediaWiki 1.28.
$lang = null; $lang = null;
Hooks::run( 'CodeEditorGetPageLanguage', [ $title, &$lang, $model, $format ] ); \Hooks::run( 'CodeEditorGetPageLanguage', [ $title, &$lang, $model, $format ] );
return $lang; return $lang;
} }