diff --git a/PageToGitHub.php b/PageToGitHub.php index d14845b..8264147 100644 --- a/PageToGitHub.php +++ b/PageToGitHub.php @@ -48,20 +48,17 @@ 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 = true; + $P2GIgnoreMinor = $config->get('P2GIgnoreMinor'); -<<<<<<< HEAD - wfDebugLog( 'PageToGitHub', '[PageToGitHub]Entered'); -======= wfDebugLog('PageToGitHub', '[PageToGitHub]Entered'); ->>>>>>> 0202cae82c0f4ab46248acdce50f2e068569c362 $pageNameSpace = $wikiPage->getTitle()->getNsText(); $pageTitle = $wikiPage->getTitle()->getRootText(); $pageContent = $wikiPage->getContent()->getNativeData(); wfDebugLog('PageToGitHub', '[PageToGitHub]Summary: '.$summary); - if ($P2GignoreMinor and $isMinor) { + if ($P2GIgnoreMinor and $isMinor) { wfDebugLog('PageToGitHub', '[PageToGitHub]IGNORING Minor'); } else { wfDebugLog('PageToGitHub', '[PageToGitHub]NOT ignoring Minor'); diff --git a/README.md b/README.md index e52f198..4e5880f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # PageToGitHub + [![StyleCI](https://github.styleci.io/repos/238323866/shield?branch=master)](https://github.styleci.io/repos/238323866) [![Latest Stable Version](https://poser.pugx.org/lucamauri/page-to-github/v/stable)](https://packagist.org/packages/lucamauri/page-to-github) [![Total Downloads](https://poser.pugx.org/lucamauri/page-to-github/downloads)](https://packagist.org/packages/lucamauri/page-to-github) @@ -18,16 +19,19 @@ It was originally conceived and written by [Luca Mauri](https://github.com/lucam ## Requirements ## Install -Download extension from GitHub and place the uncompressed files in a directory called `PageToGitHub -` in the `extensions/` folder of your MediaWiki installation. + +Download extension from GitHub and place the uncompressed files in a directory called `PageToGitHub` in the `extensions/` folder of your MediaWiki installation. Add the following code at the bottom of the site's `LocalSettings.php`: + ```PHP wfLoadExtension('PageToGitHub'); ``` -Below this line, add the configuration parameters as explained below in *Configuration* section. + +Below this line, add the configuration parameters as explained below in _Configuration_ section. In order to install dependencies needed by the extension, add the composer configuration to the `composer.local.json` at the root of your mediawiki installation, or create the file if it does not exist yet: + ```JSON { "extra": { @@ -39,33 +43,52 @@ In order to install dependencies needed by the extension, add the composer confi } } ``` + and run Composer in a console from the root of your mediawiki installation: + ``` composer install --no-dev ``` ## Configuration + In the `LocalSettigs.php` file add: ``` -$wgP2GNameSpace = 'Module'; -$wgP2GRepo = 'Name-Of-Your-Repository'; $wgP2GAuthToken = 'GitHub-Token'; -$wgP2GOwner = 'Project-Or-Person'; +$wgP2GIgnoreMinor = true; $wgP2GKeyword = 'Keyword'; +$wgP2GNameSpace = 'Module'; +$wgP2GOwner = 'Project-Or-Person'; +$wgP2GRepo = 'Name-Of-Your-Repository'; ``` -### $wgP2GNameSpace + +### \$wgP2GAuthToken + +The GitHub token needed to authenticate and made modification the the repository. You can generate one in your GitHub account in _Settings_ > _Developer settings_ > _Personal access tokens_ + +### \$wgP2GIgnoreMinor + +If empty or set as `true` the revision is not pushed to GitHub if is marked as _Minor_ + +### \$wgP2GKeyword + +An optional keyword to check into the page. When present, P2G will _not_ upload pages if the keyword is not written in the page. If the parameter is omitted, P2G will upload all pages in the Namespace specified above. + +### \$wgP2GNameSpace + P2G will upload pages only belonging to the namespace spedified in this variable -### $wgP2GRepo -The name of the repository where the codes must be uploaded -### $wgP2GAuthToken -The GitHub token needed to authenticate and made modification the the repository. You can generate one in your GitHub account in *Settings* > *Developer settings* > *Personal access tokens* -### $wgP2GOwner + +### \$wgP2GOwner + The Person or Organization owner of the repository -### $wgP2GKeyword -An optional keyword to check into the page. When present, P2G will *not* upload pages if the keyword is not written in the page. If the parameter is omitted, P2G will upload all pages in the Namespace specified above. - + +### \$wgP2GRepo + +The name of the repository where the code must be uploaded + ## Troubleshoot + To read detailed logging messages, you can intercept the [log group](https://www.mediawiki.org/wiki/Manual:$wgDebugLogGroups) named `PageToGitHub`: for instace with the following configuration into `LocalSetting.php`: ``` @@ -74,11 +97,15 @@ $wgDebugLogGroups['PageToGitHub'] = "/var/log/mediawiki/PageToGitHub-{$wgDBname} ``` ## Documentation + ## License + [GNU General Public License, version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) ## Maintainers + [Luca Mauri](https://github.com/lucamauri) ## Contributors + [Luca Mauri](https://github.com/lucamauri) diff --git a/extension.json b/extension.json index 2f5e3ed..8cbc359 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "PageToGitHub", - "author": "Luca Mauri", + "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.0", @@ -14,6 +14,10 @@ "PageContentSaveComplete": ["PageToGitHubHooks::onPageContentSaveComplete"] }, "config": { + "P2GIgnoreMinor": { + "description": "Ignore chages if they are Minor", + "value": true + }, "P2GNameSpace": { "description": "Label of the namespace to check", "descriptionmsg": "p2g-config-namespace",