diff --git a/PageToGitHub.php b/PageToGitHub.php index 180b607..5cabe94 100644 --- a/PageToGitHub.php +++ b/PageToGitHub.php @@ -47,8 +47,6 @@ public static function onPageContentSaveComplete($wikiPage, $user, $content, $su $P2GNameSpace = $config->get('P2GNameSpace'); $P2GKeyword = $config->get('P2GKeyword'); - //wfDebugLog('PageToGitHub', '[PageToGitHub]Keyword type: '.gettype($P2GKeyword[0])); - //$P2GignoreMinor = true; $P2GIgnoreMinor = $config->get('P2GIgnoreMinor'); wfDebugLog('PageToGitHub', '[PageToGitHub]Entered'); @@ -64,7 +62,6 @@ public static function onPageContentSaveComplete($wikiPage, $user, $content, $su wfDebugLog('PageToGitHub', '[PageToGitHub]NOT ignoring Minor'); if ($pageNameSpace == $P2GNameSpace) { wfDebugLog('PageToGitHub', '[PageToGitHub]Namespace OK'); - // || $P2GKeyword == '' || strpos($pageContent, $P2GKeyword) > -1 wfDebugLog('PageToGitHub', '[PageToGitHub]Keyword count: '.count($P2GKeyword)); wfDebugLog('PageToGitHub', '[PageToGitHub]Keyword: '.$P2GKeyword[0]); if ($P2GKeyword[0] == null or $P2GKeyword == '' or (strpos($pageContent, $P2GKeyword) > -1)) { diff --git a/extension.json b/extension.json index 2fbc55c..eb578fe 100644 --- a/extension.json +++ b/extension.json @@ -3,12 +3,14 @@ "author": "[https://www.lucamauri.com/ Luca Mauri]", "url": "https://github.com/lucamauri/PageToGitHub", "description": "Allow the transport of page content to GitHub on page save", - "version": "1.1", + "version": "1.2", "license-name": "GPL-2.0-or-later", "type": "parserhook", "manifest_version": 1, "AutoloadClasses": { - "PageToGitHubHooks": "PageToGitHub.php" + "PageToGitHubCommon": "includes/P2GCommon.php", + "PageToGitHubHooks": "PageToGitHub.php", + "PageToGitHubSpecial": "includes/P2GSpecial.php" }, "Hooks": { "PageContentSaveComplete": ["PageToGitHubHooks::onPageContentSaveComplete"] @@ -47,6 +49,9 @@ "ConfigRegistry": { "PageToGitHub": "GlobalVarConfig::newInstance" }, + "SpecialPages": { + "PageToGitHub": "PageToGitHubSpecial" + }, "MessagesDirs": { "PageToGitHub": ["i18n"] } diff --git a/i18n/en.json b/i18n/en.json index 4d853e0..11716c6 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -5,5 +5,9 @@ "auto-upload": "Auto upload by PageToGitHub on", "auto-commit": "Auto commit by PageToGitHub", "code-from-page": "This code from page", - "p2g-config-namespace": "Label of the namespace to check" + "p2g-config-namespace": "Label of the namespace to check", + "pagetogithub": "Page To GitHub", + "p2g-specialpage-text": "This page shows details on ''PageToGitHub'' configuration", + "p2g-specialpage-variables-text": "This section shows the values of ''PageToGitHub'' configuration variables", + "p2g-specialpage-config-title": "==Configuration==" } diff --git a/i18n/it.json b/i18n/it.json index 5fea579..32fe815 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -5,5 +5,9 @@ "auto-upload": "Upload automatica di PageToGitHub il", "auto-commit": "Commit automatico di PageToGitHub", "code-from-page": "Questo codice proviene da", - "p2g-config-namespace": "Nome del namespace da controllare" + "p2g-config-namespace": "Nome del namespace da controllare", + "pagetogithub": "Page To GitHub", + "p2g-specialpage-text": "Questa pagina mostra dettagli sulla configurazione di ''PageToGitHub''", + "p2g-specialpage-variables-text": "Questa sezione mostra i valori delle varibili di configurazione di ''PageToGitHub''", + "p2g-specialpage-config-title": "==Configurazione==" } diff --git a/i18n/qqq.json b/i18n/qqq.json new file mode 100644 index 0000000..f646cde --- /dev/null +++ b/i18n/qqq.json @@ -0,0 +1,13 @@ +{ + "@metadata": { + "authors": ["Luca Mauri"] + }, + "auto-upload": "''Auto upload'' message on GitHub", + "auto-commit": "''Auto commit'' message on GitHub", + "code-from-page": "Prefix to the page name", + "p2g-config-namespace": "Description of the namespace", + "pagetogithub": "Placeholder for product name", + "p2g-specialpage-text": "Intro of the ''Special'' page", + "p2g-specialpage-variables-text": "Intro of the ''Configuration'' section", + "p2g-specialpage-config-title": "Title of the ''config'' section" +} diff --git a/includes/P2GCommon.php b/includes/P2GCommon.php new file mode 100644 index 0000000..32a5de0 --- /dev/null +++ b/includes/P2GCommon.php @@ -0,0 +1,14 @@ +getConfigFactory()->makeConfig('PageToGitHub'); + foreach ($variablesNames as $variableName) { + ${$variableName} = $config->get($variableName); + } + } +} \ No newline at end of file diff --git a/includes/P2GSpecial.php b/includes/P2GSpecial.php new file mode 100644 index 0000000..fb6a448 --- /dev/null +++ b/includes/P2GSpecial.php @@ -0,0 +1,52 @@ +getRequest(); + $output = $this->getOutput(); + $this->setHeaders(); + + # Get request data from, e.g. + $param = $request->getText( 'param' ); + + # Do stuff + $config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig('PageToGitHub'); + + // https://doc.wikimedia.org/mediawiki-core/master/php/classOutputPage.html + $output->addWikiMsg('p2g-specialpage-text'); + $output->addWikiMsg('p2g-specialpage-config-title'); + $output->addWikiMsg('p2g-specialpage-variables-text'); + + $output->addHTML('
Variabile | +Valore | +
---|---|
' . $variableName . ' | '); + if ($variableName == 'P2GAuthToken') { + $variableContent = "''hidden''"; + } else { + $variableContent = "'); + $output->addWikiTextAsContent($variableContent); + $output->addHTML(' | '); + $output->addHTML('