Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucamauri committed Apr 13, 2020
1 parent 98ba502 commit fd199f3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 22 deletions.
9 changes: 3 additions & 6 deletions PageToGitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
57 changes: 42 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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": {
Expand All @@ -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`:

```
Expand All @@ -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)
6 changes: 5 additions & 1 deletion extension.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit fd199f3

Please sign in to comment.