diff --git a/debian/pve-docs-mediawiki.install b/debian/pve-docs-mediawiki.install
index 680f240..f1abc9f 100644
--- a/debian/pve-docs-mediawiki.install
+++ b/debian/pve-docs-mediawiki.install
@@ -1,3 +1,3 @@
/usr/bin/pve-docs-mediawiki-import
debian/tree/pve-docs-mediawiki/pve-docs.conf /etc/apache2/sites-available/
-debian/tree/pve-docs-mediawiki/pvedocs-include.php /usr/lib/pve-docs/
+debian/tree/pve-docs-mediawiki/PVEDocs /usr/lib/pve-docs/
diff --git a/debian/tree/pve-docs-mediawiki/PVEDocs/LICENSE.txt b/debian/tree/pve-docs-mediawiki/PVEDocs/LICENSE.txt
new file mode 100644
index 0000000..46ee902
--- /dev/null
+++ b/debian/tree/pve-docs-mediawiki/PVEDocs/LICENSE.txt
@@ -0,0 +1,31 @@
+Coryright for all files not covered by a more specific rule below:
+
+ Copyright (C) 2015 - 2021 Proxmox Server Solutions GmbH
+
+ This program is free software: you can redistribute it and/or
+ modify it under the terms of the GNU Affero General Public License
+ as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public
+ License along with this program. If not, see
+ .
+
+
+All documentation files (*.adoc *.png) are release under:
+
+ Copyright (C) 2015 - 2021 Proxmox Server Solutions GmbH
+
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.3
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+ A copy of the license is included in the section entitled "GNU
+ Free Documentation License".
+
+ You can find a copy of the license in /usr/share/common-licenses/GFDL.
diff --git a/debian/tree/pve-docs-mediawiki/PVEDocs/PVEDocs.i18n.magic.php b/debian/tree/pve-docs-mediawiki/PVEDocs/PVEDocs.i18n.magic.php
new file mode 100644
index 0000000..8bd73ef
--- /dev/null
+++ b/debian/tree/pve-docs-mediawiki/PVEDocs/PVEDocs.i18n.magic.php
@@ -0,0 +1,7 @@
+ [ 0, 'pvedocs' ], # case-insensitive, name
+];
diff --git a/debian/tree/pve-docs-mediawiki/PVEDocs/extension.json b/debian/tree/pve-docs-mediawiki/PVEDocs/extension.json
new file mode 100644
index 0000000..dee3cca
--- /dev/null
+++ b/debian/tree/pve-docs-mediawiki/PVEDocs/extension.json
@@ -0,0 +1,25 @@
+{
+ "name": "PVEDocs",
+ "author": "Thomas Lamprecht, Dietmar Maurer",
+ "version": "2021.05.1",
+ "url": "https://git.proxmox.com/?p=pve-docs.git;a=summary",
+ "descriptionmsg": "Display PVE Documentation Pages",
+ "license-name": "GPL-3.0-or-later",
+ "type": "parserhook",
+ "AutoloadClasses": {
+ "PVEDocs": "include/PVEDocs.php"
+ },
+ "MessagesDirs": {
+ "PVEDocs": [
+ "i18n"
+ ]
+ },
+ "ExtensionMessagesFiles": {
+ "PVEDocsMagic": "PVEDocs.i18n.magic.php"
+ },
+ "Hooks": {
+ "ParserFirstCallInit": "PVEDocs::onParserFirstCallInit",
+ "ParserAfterTidy": "PVEDocs::efPvedocsPostProcessFunction"
+ },
+ "manifest_version": 1
+}
diff --git a/debian/tree/pve-docs-mediawiki/PVEDocs/include/PVEDocs.php b/debian/tree/pve-docs-mediawiki/PVEDocs/include/PVEDocs.php
new file mode 100644
index 0000000..b7acb34
--- /dev/null
+++ b/debian/tree/pve-docs-mediawiki/PVEDocs/include/PVEDocs.php
@@ -0,0 +1,43 @@
+setFunctionHook('pvedocs', [ self::class, 'efPvedocsParserFunction_Render' ]);
+ $parser->setHook('pvehide', [ self::class, 'renderTagPveHideContent' ]);
+
+ return true;
+ }
+
+ // similar code as in tag...
+ public static function efPvedocsPostProcessFunction($parser, &$text) {
+ $text = preg_replace_callback(
+ '//sm',
+ function ($m) { return base64_decode("$m[1]"); },
+ $text
+ );
+ return true;
+ }
+
+ // "Render"
+ public static function renderTagPveHideContent($input, array $args, Parser $parser, PPFrame $frame ) {
+ return ''; // simply return nothing
+ }
+
+
+ # Render the output of {{#pvedocs:chapter}}.
+ public static function efPvedocsParserFunction_Render(Parser $parser, $doc = '') {
+ $parser->getOutput()->updateCacheExpiry(0); // disableCache() was dropped in MW 1.34
+
+ // only allow simple names, so that jist files from within "/usr/share/pve-docs/" can be included
+ if (!preg_match("/[a-z0-9.-]+\.html/i", $doc)) {
+ die("no such manual page");
+ }
+
+ $content = file_get_contents("/usr/share/pve-docs/$doc");
+
+ // from https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/HTMLets/+/11e5ef1ea2820319458dc67174ca76d6e00b10cc/HTMLets.php#140
+ $output = '';
+ return array($output, 'noparse' => true, 'isHTML' => true);
+ }
+}
diff --git a/debian/tree/pve-docs-mediawiki/README b/debian/tree/pve-docs-mediawiki/README
index 64df764..bf9faa8 100644
--- a/debian/tree/pve-docs-mediawiki/README
+++ b/debian/tree/pve-docs-mediawiki/README
@@ -25,5 +25,5 @@ In the MediaWiki settings PHP file ('/var/www/mediawiki/LocalSettings.php') add:
# ----8<----
# for docs-inclusion plugin:
-require_once("/usr/lib/pve-docs/pvedocs-include.php");
+wfLoadExtension( 'PVEDocs' );
# ---->8----
diff --git a/debian/tree/pve-docs-mediawiki/pvedocs-include.php b/debian/tree/pve-docs-mediawiki/pvedocs-include.php
deleted file mode 100644
index 78a6829..0000000
--- a/debian/tree/pve-docs-mediawiki/pvedocs-include.php
+++ /dev/null
@@ -1,74 +0,0 @@
- "PVE Documentation Pages",
- 'description' => "Display PVE Documentation Pages",
- 'author' => "Dietmar Maurer",
-);
-
-# Define a setup function
-$wgHooks['ParserFirstCallInit'][] = 'efPvedocsParserFunction_Setup';
-$wgHooks['ParserAfterTidy'][] = 'efPvedocsPostProcessFunction';
-
-# Add a hook to initialise the magic word
-$wgHooks['LanguageGetMagic'][] = 'efPvedocsParserFunction_Magic';
-
-function efPvedocsParserFunction_Setup(&$parser) {
- # Set a function hook associating the "pvedocs" magic
- # word with our function
- $parser->setFunctionHook('pvedocs', 'efPvedocsParserFunction_Render');
-
- $parser->setHook('pvehide', 'renderTagPveHideContent');
-
- return true;
-}
-
-# similar code as in tag...
-function efPvedocsPostProcessFunction($parser, &$text) {
- $text = preg_replace_callback(
- '//sm',
- function ($m) { return base64_decode("$m[1]"); },
- $text);
-
- return true;
-}
-
-// Render
-function renderTagPveHideContent($input, array $args, Parser $parser,
-PPFrame $frame ) {
- // simply return nothing
- return '';
-}
-
-
-function efPvedocsParserFunction_Magic(&$magicWords, $langCode) {
- # Add the magic word
- # The first array element is whether to be case sensitive,
- # in this case (0) it is not case sensitive, 1 would be sensitive
- # All remaining elements are synonyms for our parser function
- $magicWords['pvedocs'] = array( 0, 'pvedocs' );
-
- # unless we return true, other parser functions extensions won't get loaded.
- return true;
-}
-
-function efPvedocsParserFunction_Render($parser, $param1 = '', $param2 = '') {
-
- $parser->disableCache();
-
- # only allow simply names, so that users can only include
- # files from within "/usr/share/pve-docs/"
- if (!preg_match("/[a-z0-9.-]+\.html/i", $param1)) {
- die("no such manual page");
- }
-
- $content = file_get_contents("/usr/share/pve-docs/$param1");
-
- # from https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/HTMLets/+/11e5ef1ea2820319458dc67174ca76d6e00b10cc/HTMLets.php#140
- $output = '';
- return array($output, 'noparse' => true, 'isHTML' => true);
-}
-
-?>