Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/396458 )
Change subject: Empty moved extension ...................................................................... Empty moved extension Bug: T182231 Change-Id: I2f8ad3d00f3815eadcecf774d099dcebab2a3ff1 --- D .travis.yml D CODE_OF_CONDUCT.md D COPYING D GitHub.i18n.magic.php D GitHub.php D Gruntfile.js A MOVED D README.md D build/travis/before_script.sh D build/travis/script.sh D composer.json D config/DefaultConfig.php D i18n/ast.json D i18n/bn.json D i18n/ca.json D i18n/cs.json D i18n/de.json D i18n/en.json D i18n/es.json D i18n/eu.json D i18n/fa.json D i18n/fr.json D i18n/fy.json D i18n/gl.json D i18n/id.json D i18n/it.json D i18n/ja.json D i18n/ko.json D i18n/ksh.json D i18n/lb.json D i18n/lv.json D i18n/mk.json D i18n/nl.json D i18n/oc.json D i18n/pl.json D i18n/pt.json D i18n/qqq.json D i18n/ro.json D i18n/roa-tara.json D i18n/ru.json D i18n/sv.json D i18n/te.json D i18n/uk.json D i18n/vi.json D i18n/zh-hans.json D i18n/zh-hant.json D package.json D phpunit.xml.dist D src/GitHubParserHook.php D src/MediaWikiFileFetcher.php D src/Setup.php D tests/system/GitHubParserHookTest.php D tests/unit/SetupTest.php 53 files changed, 1 insertion(+), 1,453 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GitHub refs/changes/58/396458/1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9d74837..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: php - -env: - - THENEEDFORTHIS=FAIL - -matrix: - include: - - env: DBTYPE=mysql; MW=master - php: 5.3 - - env: DBTYPE=mysql; MW=1.24.0 - php: 5.6 - - env: DBTYPE=sqlite; MW=1.24.0 - php: 5.5 - - env: DBTYPE=mysql; MW=master - php: hhvm - exclude: - - env: THENEEDFORTHIS=FAIL - -before_script: bash ./build/travis/before_script.sh - -script: bash ./build/travis/script.sh - -notifications: - email: - recipients: - - [email protected] - on_success: change - on_failure: always diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index d8e5d08..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1 +0,0 @@ -The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Code_of_Conduct). diff --git a/COPYING b/COPYING deleted file mode 100644 index ebba08a..0000000 --- a/COPYING +++ /dev/null @@ -1,347 +0,0 @@ -The license text below "----" applies to all files within this distribution, other -than those that are in a directory which contains files named "LICENSE" or -"COPYING", or a subdirectory thereof. For those files, the license text contained in -said file overrides any license information contained in directories of smaller depth. -Alternative licenses are typically used for software that is provided by external -parties, and merely packaged with this software for convenience. ----- - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 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 General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/GitHub.i18n.magic.php b/GitHub.i18n.magic.php deleted file mode 100644 index c0bb0da..0000000 --- a/GitHub.i18n.magic.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -/** - * Internationalization file for the GitHub extension. - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < [email protected] > - */ - -$magicWords = array(); - -/** English - * @author Jeroen De Dauw - */ -$magicWords['en'] = array( - 'github' => array( 0, 'github' ), -); diff --git a/GitHub.php b/GitHub.php deleted file mode 100644 index b8f52ea..0000000 --- a/GitHub.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -/** - * Entry point of the GitHub extension. - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < [email protected] > - */ - -if ( defined( 'GitHub_VERSION' ) ) { - // Do not initialize more than once. - return 1; -} - -define( 'GitHub_VERSION', '1.0' ); - -if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { - include_once( __DIR__ . '/vendor/autoload.php' ); -} - -if ( defined( 'MEDIAWIKI' ) ) { - $GLOBALS['wgExtensionFunctions'][] = function() { - $setup = new \GitHub\Setup( $GLOBALS, __DIR__ ); - $setup->run(); - }; -} diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index a45071e..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,21 +0,0 @@ -/*jshint node:true */ -module.exports = function ( grunt ) { - grunt.loadNpmTasks( 'grunt-jsonlint' ); - grunt.loadNpmTasks( 'grunt-banana-checker' ); - - grunt.initConfig( { - banana: { - all: 'i18n/' - }, - jsonlint: { - all: [ - '**/*.json', - '!node_modules/**', - '!vendor/**' - ] - } - } ); - - grunt.registerTask( 'test', [ 'jsonlint', 'banana' ] ); - grunt.registerTask( 'default', 'test' ); -}; diff --git a/MOVED b/MOVED new file mode 100644 index 0000000..c8005f3 --- /dev/null +++ b/MOVED @@ -0,0 +1 @@ +Extension was moved to https://github.com/JeroenDeDauw/GitHub diff --git a/README.md b/README.md deleted file mode 100644 index b04cb13..0000000 --- a/README.md +++ /dev/null @@ -1,126 +0,0 @@ -## GitHub extension for MediaWiki - -Simple MediaWiki extension for embedding content of files hosted in GitHub git repositories. - -Build status: -[](http://travis-ci.org/JeroenDeDauw/GitHub) -[](https://scrutinizer-ci.com/g/JeroenDeDauw/GitHub/) - -On Packagist: -[](https://packagist.org/packages/jeroen/mediawiki-github) -[](https://packagist.org/packages/jeroen/mediawiki-github) - -## Requirements - -* [PHP](http://www.php.net) 5.3 or later (HHVM is supported) -* [MediaWiki](https://www.mediawiki.org) 1.24 or later (earlier versions likely work when using [ExtensionInstaller](https://github.com/JeroenDeDauw/ExtensionInstaller)) -* Installation via [Composer](http://getcomposer.org/) - -## Installation - -The recommended way to install the GitHub extension is with [Composer](http://getcomposer.org) using -[MediaWiki 1.22 built-in support for Composer](https://www.mediawiki.org/wiki/Composer). - -##### Step 1 - -Go to the root directory of your MediaWiki installation. - -##### Step 2 - -If you have previously installed Composer skip to step 3. - -To install Composer: - - wget http://getcomposer.org/composer.phar - -##### Step 3 - -Now using Composer, install the GitHub extension. - -If you do not have a composer.json file yet, copy the composer-example.json file to composer.json. If you -are using the ExtensionInstaller, the file to copy will be named example.json, rather than composer-example.json. When this is done, run: - - php composer.phar require jeroen/mediawiki-github "@dev" - -##### Verify installation success - -Go to Special:Version and see if GitHub is listed there. If it is, you successfully installed it! - -## Configuration - -The default GitHub repo can be set using the `$egGitHubDefaultRepo` setting. Assign to this setting -the name of the default repo in your LocalSettings file, after the inclusion of this extension e.g. -for Semantic MediaWiki as follows: - - $egGitHubDefaultRepo = 'SemanticMediaWiki/SemanticMediaWiki'; - -The file contents gets cached in memory during the PHP request. The main MediaWiki cache -is used as secondary cache, with a default TTL of 600 seconds. You can use the -`$egGitHubCacheTime` setting to change the TTL: - - $egGitHubCacheTime = 900; - -You can modify the GitHub raw content URL used to fetch the files. The default is -`https://cdn.rawgit.com`, due to `https://raw.githubusercontent.com` not working on all systems. -You can change this setting as follows: - - $egGitHubUrl = 'https://raw.githubusercontent.com'; - -You can modify which method is used to fetch the file. The supported methods are - -* `'simple'` - use PHPs file_get_contents -* `'mediawiki'` - use MediaWikis HTTP class - -The default is `'simple'`. You can change this setting as follows: - - $egGitHubFetcher = 'mediawiki'; - -## Usage - -Add `{{#github:FileName}}` to your wiki page, where FileName is the name of the file you want to embed. -This can include a path, for instance `{{#github:docs/INSTALL.md}}`. - -You can also specify the repo name and the branch name: `{{#github:FileName|user/repo|branchName}}` - -## Release notes - -### 1.0.2 (2015-01-20) - -* Added `$egGitHubFetcher` setting -* The files are now by default fetched using `file_get_contents` rather than MediaWikis `HTTP` class - -### 1.0.1 (2015-01-19) - -* Added `$egGitHubUrl` setting -* Changed default GitHub raw content url from `https://raw.githubusercontent.com` to `https://cdn.rawgit.com` (tanks to Mike Cariaso) - -### 1.0.0 (2015-01-19) - -#### New features - -* Added support for markdown. Files ending on .md or .markdown are now rendered appropriately -* Added `$egGitHubCacheTime` setting - -#### Compatibility changes - -* The extension now needs to be installed via Composer -* The package name has changed from `jeroen-de-dauw/mediawiki-github` to `jeroen/mediawiki-github` - -#### Enhancements - -* Compatibility with the latest version of the GitHub API has been added -* PSR-4 based autoloading is now used -* The ParserHooks library is now used for the github parser hook -* Additional tests have been added - -### 0.1.0 (2013-07-15) - -* Initial release - -## Links - -* [GitHub on Packagist](https://packagist.org/packages/jeroen/mediawiki-github) -* [GitHub on Ohloh](https://www.ohloh.net/p/mediawiki-github) -* [GitHub on MediaWiki.org](https://www.mediawiki.org/wiki/Extension:GitHub) -* [TravisCI build status](https://travis-ci.org/JeroenDeDauw/GitHub) -* [Latest version of the readme file](https://github.com/JeroenDeDauw/GitHub/blob/master/README.md) diff --git a/build/travis/before_script.sh b/build/travis/before_script.sh deleted file mode 100644 index 2489f1f..0000000 --- a/build/travis/before_script.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/bash - -set -x - -originalDirectory=$(pwd) - -cd .. - -wget https://github.com/wikimedia/mediawiki/archive/$MW.tar.gz -tar -zxf $MW.tar.gz -mv mediawiki-$MW phase3 - -cd phase3 - -git checkout $MW - -composer install --prefer-source - -mysql -e 'create database its_a_mw;' -php maintenance/install.php --dbtype $DBTYPE --dbuser root --dbname its_a_mw --dbpath $(pwd) --pass nyan TravisWiki admin - -cd extensions - -cp -r $originalDirectory GitHub - -cd GitHub -composer install --prefer-source - -cd ../.. - -echo 'require_once( __DIR__ . "/extensions/GitHub/GitHub.php" );' >> LocalSettings.php - -echo 'error_reporting(E_ALL| E_STRICT);' >> LocalSettings.php -echo 'ini_set("display_errors", 1);' >> LocalSettings.php -echo '$wgShowExceptionDetails = true;' >> LocalSettings.php -echo '$wgDevelopmentWarnings = true;' >> LocalSettings.php -echo "putenv( 'MW_INSTALL_PATH=$(pwd)' );" >> LocalSettings.php - -php maintenance/update.php --quick diff --git a/build/travis/script.sh b/build/travis/script.sh deleted file mode 100644 index 8c2c4f1..0000000 --- a/build/travis/script.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/bash - -set -x - -cd ../phase3/tests/phpunit - -php phpunit.php -c ../../extensions/GitHub/ \ No newline at end of file diff --git a/composer.json b/composer.json deleted file mode 100644 index 40f7912..0000000 --- a/composer.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "jeroen/mediawiki-github", - "type": "library", - "description": "Simple MediaWiki extension that allows embedding the content of files hosted in GitHub git repositories", - "keywords": [ - "github", - "mediawiki", - "markdown" - ], - "homepage": "https://github.com/JeroenDeDauw/GitHub", - "license": "GPL-2.0+", - "authors": [ - { - "name": "Jeroen De Dauw", - "email": "[email protected]", - "homepage": "http://jeroendedauw.com", - "role": "Developer" - } - ], - "require": { - "php": ">=5.3.0", - "jeroen/simple-cache": "~2.0", - "jeroen/file-fetcher": "~2.0", - "mediawiki/parser-hooks": "~1.4", - "michelf/php-markdown": "~1.4" - }, - "autoload": { - "psr-4": { - "GitHub\\": "src/" - }, - "files": [ - "GitHub.php" - ], - "classmap": [ - "tests/" - ] - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "replace": { - "jeroen-de-dauw/mediawiki-github": "*" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9.2", - "jakub-onderka/php-console-highlighter": "0.3.2", - "mediawiki/minus-x": "0.2.0" - }, - "scripts": { - "test": [ - "parallel-lint . --exclude vendor --exclude node_modules", - "minus-x check ." - ], - "fix": [ - "minus-x fix ." - ] - } -} diff --git a/config/DefaultConfig.php b/config/DefaultConfig.php deleted file mode 100644 index a4abe2d..0000000 --- a/config/DefaultConfig.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php - diff --git a/i18n/ast.json b/i18n/ast.json deleted file mode 100644 index 66a3697..0000000 --- a/i18n/ast.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Xuacu" - ] - }, - "github-desc": "Permite incrustar el conteníu de ficheros de [https://www.github.com/ GitHub]", - "github-par-filename": "Nome del ficheru", - "github-par-branchname": "Nome de la rama", - "github-par-reponame": "Nome del repositoriu" -} diff --git a/i18n/bn.json b/i18n/bn.json deleted file mode 100644 index 8b43793..0000000 --- a/i18n/bn.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Bodhisattwa" - ] - }, - "github-par-filename": "ফাইলের নাম", - "github-par-branchname": "শাখার নাম", - "github-par-reponame": "রিপোজিটরির নাম" -} diff --git a/i18n/ca.json b/i18n/ca.json deleted file mode 100644 index 24debcb..0000000 --- a/i18n/ca.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Fitoschido" - ] - }, - "github-desc": "Permet incrustar el contingut dels fitxers de [https://www.github.com/ GitHub]", - "github-par-filename": "Nom del fitxer", - "github-par-branchname": "Nom de la branca", - "github-par-reponame": "Nom del repositori" -} diff --git a/i18n/cs.json b/i18n/cs.json deleted file mode 100644 index 8167577..0000000 --- a/i18n/cs.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Littledogboy", - "Aktron", - "Clon" - ] - }, - "github-desc": "Umožňuje vkládání obsahu souborů z [https://www.github.com/ GitHubu]", - "github-par-filename": "Jméno souboru", - "github-par-branchname": "Název větve", - "github-par-reponame": "Název repozitáře" -} diff --git a/i18n/de.json b/i18n/de.json deleted file mode 100644 index 4892564..0000000 --- a/i18n/de.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Kghbln" - ] - }, - "github-desc": "Ermöglicht das Einbetten des Inhalts von Dateien, die sich bei [https://www.github.com/ GitHub] befinden", - "github-par-filename": "Name der Datei", - "github-par-branchname": "Name des Versionszweigs", - "github-par-reponame": "Name des Repositoriums" -} diff --git a/i18n/en.json b/i18n/en.json deleted file mode 100644 index 5d7589b..0000000 --- a/i18n/en.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Jeroen De Dauw", - "Kghbln" - ] - }, - "github-desc": "Allows embedding the contents of files from [https://www.github.com/ GitHub]", - "github-par-filename": "File name", - "github-par-branchname": "Branch name", - "github-par-reponame": "Repository name" -} diff --git a/i18n/es.json b/i18n/es.json deleted file mode 100644 index 33228e0..0000000 --- a/i18n/es.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Macofe", - "Fitoschido" - ] - }, - "github-desc": "Permite incrustar el contenido de archivos alojados en [https://www.github.com/ GitHub]", - "github-par-filename": "Nombre del archivo", - "github-par-branchname": "Nombre de la rama", - "github-par-reponame": "Nombre del repositorio" -} diff --git a/i18n/eu.json b/i18n/eu.json deleted file mode 100644 index b20a232..0000000 --- a/i18n/eu.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Sator" - ] - }, - "github-par-filename": "Fitxategiaren izena" -} diff --git a/i18n/fa.json b/i18n/fa.json deleted file mode 100644 index 6db6214..0000000 --- a/i18n/fa.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Ebraminio" - ] - }, - "github-desc": "اجازهٔ تعبیه محتویات از [https://www.github.com/ گیتهاب] را میدهد", - "github-par-filename": "نام پرونده", - "github-par-branchname": "نام درخت", - "github-par-reponame": "نام مخزن" -} diff --git a/i18n/fr.json b/i18n/fr.json deleted file mode 100644 index 941c579..0000000 --- a/i18n/fr.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Benjozork", - "Orikrin1998" - ] - }, - "github-desc": "Permet d'intégrer le contenu des fichiers à partir de [https://www.github.com/ GitHub]", - "github-par-filename": "Nom du fichier", - "github-par-branchname": "Nom de la branche", - "github-par-reponame": "Nom du dépôt" -} diff --git a/i18n/fy.json b/i18n/fy.json deleted file mode 100644 index b986bff..0000000 --- a/i18n/fy.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Robin0van0der0vliet" - ] - }, - "github-par-filename": "Triemnamme" -} diff --git a/i18n/gl.json b/i18n/gl.json deleted file mode 100644 index 3dc2c32..0000000 --- a/i18n/gl.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Banjo" - ] - }, - "github-desc": "Permite a incorporación de contidos de ficheiros presentes en [https://www.github.com/ GitHub]", - "github-par-filename": "Nome de ficheiro", - "github-par-branchname": "Nome da rama", - "github-par-reponame": "Nome do repositorio" -} diff --git a/i18n/id.json b/i18n/id.json deleted file mode 100644 index 71780eb..0000000 --- a/i18n/id.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "BaconSenpai" - ] - }, - "github-par-filename": "Nama berkas" -} diff --git a/i18n/it.json b/i18n/it.json deleted file mode 100644 index f0d34fc..0000000 --- a/i18n/it.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Nivit" - ] - }, - "github-desc": "Consente di incorporare contenuti di file da [https://www.github.com/ GitHub]", - "github-par-filename": "Nome del file", - "github-par-branchname": "Nome del ramo", - "github-par-reponame": "Nome del repository" -} diff --git a/i18n/ja.json b/i18n/ja.json deleted file mode 100644 index b33b5ee..0000000 --- a/i18n/ja.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Otokoume" - ] - }, - "github-desc": "[https://www.github.com/ GitHub]からファイルの内容を埋め込むことができます", - "github-par-filename": "ファイル名", - "github-par-reponame": "リポジトリ名" -} diff --git a/i18n/ko.json b/i18n/ko.json deleted file mode 100644 index c5e1a02..0000000 --- a/i18n/ko.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Revi" - ] - }, - "github-desc": "[https://www.github.com GitHub]에서 파일을 임베드", - "github-par-filename": "파일 이름", - "github-par-branchname": "브랜치 이름", - "github-par-reponame": "저장소 이름" -} diff --git a/i18n/ksh.json b/i18n/ksh.json deleted file mode 100644 index 4a5f4a9..0000000 --- a/i18n/ksh.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Purodha" - ] - }, - "github-desc": "Määd_et müjjelesch, Dahte uß Datteije vun [https://www.github.com/ JittHapp (<i lang=\"en\" xml:lang=\"en\">GitHub</i>)] enzebenge.", - "github-par-filename": "Dä Dattei iehre Nahme", - "github-par-branchname": "Däm Zweisch singe Nahme:", - "github-par-reponame": "Däm Kattalooch singe Nahme:" -} diff --git a/i18n/lb.json b/i18n/lb.json deleted file mode 100644 index 4a4dfed..0000000 --- a/i18n/lb.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Robby" - ] - }, - "github-par-filename": "Numm vum Fichier" -} diff --git a/i18n/lv.json b/i18n/lv.json deleted file mode 100644 index 4c4b1fd..0000000 --- a/i18n/lv.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Papuass" - ] - }, - "github-par-filename": "Faila nosaukums", - "github-par-reponame": "Repozitorija nosaukums" -} diff --git a/i18n/mk.json b/i18n/mk.json deleted file mode 100644 index f5b7853..0000000 --- a/i18n/mk.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Bjankuloski06" - ] - }, - "github-desc": "Овозможува вметнување на содржини на податотеки од [https://www.github.com/ GitHub]", - "github-par-filename": "Име на податотека", - "github-par-branchname": "Име на гранката", - "github-par-reponame": "Име на складиштето" -} diff --git a/i18n/nl.json b/i18n/nl.json deleted file mode 100644 index d02bbb4..0000000 --- a/i18n/nl.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Robin0van0der0vliet", - "Esketti", - "Robin van der Vliet", - "Sjoerddebruin" - ] - }, - "github-desc": "Laat de inbedding van de inhoud van de bestanden van [https://www.github.com/ GitHub]", - "github-par-filename": "Bestandsnaam", - "github-par-branchname": "Branchnaam", - "github-par-reponame": "Repositorynaam" -} diff --git a/i18n/oc.json b/i18n/oc.json deleted file mode 100644 index 6e78751..0000000 --- a/i18n/oc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Cedric31" - ] - }, - "github-par-filename": "Nom del fichièr" -} diff --git a/i18n/pl.json b/i18n/pl.json deleted file mode 100644 index d514971..0000000 --- a/i18n/pl.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Chrumps" - ] - }, - "github-par-filename": "Nazwa pliku", - "github-par-reponame": "Nazwa repozytorium" -} diff --git a/i18n/pt.json b/i18n/pt.json deleted file mode 100644 index b27876f..0000000 --- a/i18n/pt.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Vitorvicentevalente" - ] - }, - "github-desc": "Permite incorporar o conteúdo dos ficheiros do [https://www.github.com/ GitHub]", - "github-par-filename": "Nome do ficheiro", - "github-par-reponame": "Nome do repositório" -} diff --git a/i18n/qqq.json b/i18n/qqq.json deleted file mode 100644 index f9d60c7..0000000 --- a/i18n/qqq.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Kghbln", - "Robby" - ] - }, - "github-desc": "{{desc|name=GitHub|url=https://www.mediawiki.org/wiki/Extension:GitHub}}", - "github-par-filename": "Label for the contents of the \"file name\" parameter\n{{Identical|Filename}}", - "github-par-branchname": "Label for the contents of the \"branch name\" parameter", - "github-par-reponame": "Label for the contents of the \"repository name\" parameter" -} diff --git a/i18n/ro.json b/i18n/ro.json deleted file mode 100644 index 6a9d7e5..0000000 --- a/i18n/ro.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Hugbear" - ] - }, - "github-par-branchname": "Numele filialei" -} diff --git a/i18n/roa-tara.json b/i18n/roa-tara.json deleted file mode 100644 index 02002af..0000000 --- a/i18n/roa-tara.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Joetaras" - ] - }, - "github-desc": "Permette de 'ngapsulà le condenute de le file da [https://www.github.com/ GitHub]", - "github-par-filename": "Nome d'u file", - "github-par-branchname": "Nome d'u rame", - "github-par-reponame": "Nome de l'archivije" -} diff --git a/i18n/ru.json b/i18n/ru.json deleted file mode 100644 index c0d1272..0000000 --- a/i18n/ru.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Okras" - ] - }, - "github-desc": "Позволяет встраивать содержимое файлов с [https://www.github.com/ на GitHub]", - "github-par-filename": "Имя файла", - "github-par-branchname": "Название ветки (branch)", - "github-par-reponame": "Название репозитория" -} diff --git a/i18n/sv.json b/i18n/sv.json deleted file mode 100644 index 3c5494f..0000000 --- a/i18n/sv.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "WikiPhoenix", - "Lokal Profil" - ] - }, - "github-desc": "Tillåter inbäddning av innehållet i filer från [https://www.github.com/ GitHub]", - "github-par-filename": "Filnamn", - "github-par-branchname": "Grennamn", - "github-par-reponame": "Centralförvarsnamn" -} diff --git a/i18n/te.json b/i18n/te.json deleted file mode 100644 index c3e754a..0000000 --- a/i18n/te.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "@metadata": { - "authors": [ - "M phani" - ] - }, - "github-par-filename": "దస్త్రపు పేరు", - "github-par-branchname": "శాఖ పేరు" -} diff --git a/i18n/uk.json b/i18n/uk.json deleted file mode 100644 index 478b61b..0000000 --- a/i18n/uk.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Ата" - ] - }, - "github-desc": "Дозволяє вбудовувати вміст файлів з [https://www.github.com/ GitHub]", - "github-par-filename": "Назва файлу", - "github-par-branchname": "Назва гілки", - "github-par-reponame": "Назва репозиторію" -} diff --git a/i18n/vi.json b/i18n/vi.json deleted file mode 100644 index 8ebee36..0000000 --- a/i18n/vi.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Dinhxuanduyet" - ] - }, - "github-desc": "Cho phép nhúng nội dung của tập tin từ [https://www.github.com/ GitHub]", - "github-par-filename": "Tên tập tin", - "github-par-branchname": "Tên chi nhánh", - "github-par-reponame": "Tên kho lưu trữ" -} diff --git a/i18n/zh-hans.json b/i18n/zh-hans.json deleted file mode 100644 index 0e2c8e5..0000000 --- a/i18n/zh-hans.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Liuxinyu970226" - ] - }, - "github-desc": "允许嵌入来自[https://www.github.com/ GitHub]的文件内容", - "github-par-filename": "文件名", - "github-par-branchname": "分支名称", - "github-par-reponame": "版本库名称" -} diff --git a/i18n/zh-hant.json b/i18n/zh-hant.json deleted file mode 100644 index 20876a2..0000000 --- a/i18n/zh-hant.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "@metadata": { - "authors": [ - "Citizen01", - "Cwlin0416" - ] - }, - "github-desc": "允許內嵌來自 [https://www.github.com/ GitHub] 的檔案內容", - "github-par-filename": "檔案名稱", - "github-par-branchname": "分支名稱", - "github-par-reponame": "儲存庫名稱" -} diff --git a/package.json b/package.json deleted file mode 100644 index 3b4b5f0..0000000 --- a/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "private": true, - "scripts": { - "test": "grunt test" - }, - "devDependencies": { - "grunt": "1.0.1", - "grunt-banana-checker": "0.4.0", - "grunt-jsonlint": "1.0.7" - } -} diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 5f56c8b..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,21 +0,0 @@ -<phpunit backupGlobals="false" - backupStaticAttributes="false" - cacheTokens="false" - colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - stopOnError="false" - stopOnFailure="false" - stopOnIncomplete="false" - stopOnSkipped="false" - verbose="true"> - <testsuites> - <testsuite name="GitHubStandalone"> - <directory>tests/unit</directory> - </testsuite> - <testsuite name="GitHubSystem"> - <directory>tests/system</directory> - </testsuite> - </testsuites> -</phpunit> diff --git a/src/GitHubParserHook.php b/src/GitHubParserHook.php deleted file mode 100644 index 227a9fa..0000000 --- a/src/GitHubParserHook.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php - -namespace GitHub; - -use FileFetcher\FileFetcher; -use Michelf\Markdown; -use ParamProcessor\ProcessingResult; -use Parser; -use ParserHooks\HookHandler; - -/** - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < [email protected] > - */ -class GitHubParserHook implements HookHandler { - - private $fileFetcher; - private $gitHubUrl; - - private $fileName; - private $repoName; - private $branchName; - - /** - * @param FileFetcher $fileFetcher - * @param string $gitHubUrl - */ - public function __construct( FileFetcher $fileFetcher, $gitHubUrl ) { - $this->fileFetcher = $fileFetcher; - $this->gitHubUrl = $gitHubUrl; - } - - public function handle( Parser $parser, ProcessingResult $result ) { - $this->setFields( $result ); - - return $this->getRenderedContent(); - } - - private function setFields( ProcessingResult $result ) { - $params = $result->getParameters(); - - $this->fileName = $params['file']->getValue(); - $this->repoName = $params['repo']->getValue(); - $this->branchName = $params['branch']->getValue(); - } - - private function getRenderedContent() { - $content = $this->getFileContent(); - - if ( $this->isMarkdownFile() ) { - $content = $this->renderAsMarkdown( $content ); - } - - return $content; - } - - private function getFileContent() { - return $this->fileFetcher->fetchFile( $this->getFileUrl() ); - } - - private function getFileUrl() { - return sprintf( - '%s/%s/%s/%s', - $this->gitHubUrl, - $this->repoName, - $this->branchName, - $this->fileName - ); - } - - private function isMarkdownFile() { - return $this->fileHasExtension( 'md' ) || $this->fileHasExtension( 'markdown' ); - } - - private function fileHasExtension( $extension ) { - $fullExtension = '.' . $extension; - return substr( $this->fileName, -strlen( $fullExtension ) ) === $fullExtension; - } - - private function renderAsMarkdown( $content ) { - return Markdown::defaultTransform( $content ); - } - -} diff --git a/src/MediaWikiFileFetcher.php b/src/MediaWikiFileFetcher.php deleted file mode 100644 index 348464a..0000000 --- a/src/MediaWikiFileFetcher.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -namespace GitHub; - -use FileFetcher\FileFetcher; - -/** - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < [email protected] > - */ -class MediaWikiFileFetcher implements FileFetcher { - - public function fetchFile( $fileUrl ) { - return \Http::get( $fileUrl ); - } - -} diff --git a/src/Setup.php b/src/Setup.php deleted file mode 100644 index e7d0413..0000000 --- a/src/Setup.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php - -namespace GitHub; - -use FileFetcher\CachingFileFetcher; -use FileFetcher\SimpleFileFetcher; -use ParserHooks\FunctionRunner; -use ParserHooks\HookDefinition; -use ParserHooks\HookRegistrant; -use SimpleCache\Cache\CombinatoryCache; -use SimpleCache\Cache\MediaWikiCache; -use SimpleCache\Cache\SimpleInMemoryCache; - -/** - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < [email protected] > - */ -class Setup { - - private $globals; - private $rootDirectory; - private $defaultGitHubRepo = 'JeroenDeDauw/GitHub'; - private $cacheTime = 600; - private $gitHubUrl = 'https://cdn.rawgit.com'; - private $gitHubFetcher = 'simple'; - - public function __construct( &$globals, $rootDirectory ) { - $this->globals =& $globals; - $this->rootDirectory = $rootDirectory; - } - - public function run() { - $this->loadSettings(); - - $this->registerExtensionCredits(); - $this->registerMessageFiles(); - $this->registerParserHookHandler(); - } - - private function registerExtensionCredits() { - $this->globals['wgExtensionCredits']['other'][] = array( - 'path' => $this->rootDirectory . '/GitHub.php', - 'name' => 'GitHub', - 'version' => GitHub_VERSION, - 'author' => array( - '[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]', - ), - 'url' => 'https://github.com/JeroenDeDauw/GitHub', - 'descriptionmsg' => 'github-desc' - ); - } - - private function registerMessageFiles() { - $this->globals['wgExtensionMessagesFiles']['GitHubMagic'] = $this->rootDirectory . '/GitHub.i18n.magic.php'; - $this->globals['wgMessagesDirs']['GitHub'] = $this->rootDirectory . '/i18n'; - } - - private function loadSettings() { - if ( array_key_exists( 'egGitHubDefaultRepo', $this->globals ) ) { - $this->defaultGitHubRepo = $this->globals['egGitHubDefaultRepo']; - } - - if ( array_key_exists( 'egGitHubCacheTime', $this->globals ) ) { - $this->cacheTime = $this->globals['egGitHubCacheTime']; - } - - if ( array_key_exists( 'egGitHubUrl', $this->globals ) ) { - $this->gitHubUrl = $this->globals['egGitHubUrl']; - } - - if ( array_key_exists( 'egGitHubFetcher', $this->globals ) ) { - $this->gitHubFetcher = $this->globals['egGitHubFetcher']; - } - } - - private function registerParserHookHandler() { - $self = $this; - - $this->globals['wgHooks']['ParserFirstCallInit'][] = function( \Parser &$parser ) use ( $self ) { - $hookRegistrant = new HookRegistrant( $parser ); - - $hookRegistrant->registerFunction( - new FunctionRunner( - $self->getGitHubHookDefinition(), - $self->getGitHubHookHandler(), - array( - FunctionRunner::OPT_DO_PARSE => false - ) - ) - ); - - return true; - }; - } - - public function newFileFetcher() { - return new CachingFileFetcher( - $this->gitHubFetcher === 'mediawiki' ? new MediaWikiFileFetcher() : new SimpleFileFetcher(), - new CombinatoryCache( array( - new SimpleInMemoryCache(), - new MediaWikiCache( wfGetMainCache(), $this->cacheTime ) - ) ) - ); - } - - /** - * @since 1.0 - * - * @return HookDefinition - */ - public function getGitHubHookDefinition() { - return new HookDefinition( - 'github', - array( - 'file' => array( - 'default' => 'README.md', - 'aliases' => 'filename', - 'message' => 'github-par-filename', - ), - 'repo' => array( - 'default' => $this->defaultGitHubRepo, - 'aliases' => 'reponame', - 'message' => 'github-par-reponame', - ), - 'branch' => array( - 'default' => 'master', - 'aliases' => 'branchname', - 'message' => 'github-par-branchname', - ), - ), - array( 'file', 'repo', 'branch' ) - ); - } - - public function getGitHubHookHandler() { - return new GitHubParserHook( - $this->newFileFetcher(), - $this->gitHubUrl - ); - } - -} \ No newline at end of file diff --git a/tests/system/GitHubParserHookTest.php b/tests/system/GitHubParserHookTest.php deleted file mode 100644 index 5f2ef96..0000000 --- a/tests/system/GitHubParserHookTest.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php - -namespace GitHub\Tests\System; - -use FileFetcher\FileFetcher; -use GitHub\GitHubParserHook; -use ParamProcessor\ProcessedParam; -use ParamProcessor\ProcessingResult; - -/** - * @covers GitHub\GitHubParserHook - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < [email protected] > - */ -class GitHubParserHookTest extends \PHPUnit_Framework_TestCase { - - private $file; - private $repo; - private $branch; - - public function setUp() { - $this->file = 'README.md'; - $this->repo = 'JeroenDeDauw/GitHub'; - $this->branch = 'master'; - } - - public function testUrlGetsBuildCorrectly() { - $fileFetcher = $this->getMock( 'FileFetcher\FileFetcher' ); - - $fileFetcher->expects( $this->once() ) - ->method( 'fetchFile' ) - ->with( 'https://cdn.rawgit.com/JeroenDeDauw/GitHub/master/README.md' ); - - $this->runHookWithFileFetcher( $fileFetcher ); - } - - private function runHookWithFileFetcher( FileFetcher $fileFetcher ) { - $parserHook = new GitHubParserHook( $fileFetcher, 'https://cdn.rawgit.com' ); - - $parser = $this->getMock( 'Parser' ); - $params = $this->newParams(); - - return $renderResult = $parserHook->handle( $parser, $params ); - } - - private function newParams() { - return $params = new ProcessingResult( array( - 'file' => new ProcessedParam( 'file', $this->file, false ), - 'repo' => new ProcessedParam( 'repo', $this->repo, false ), - 'branch' => new ProcessedParam( 'branch', $this->branch, true ), - ) ); - } - - public function makrdownProvider() { - return array( - array( - '# Ohai there!', - "<h1>Ohai there!</h1>\n" - ), - array( - 'foo bar baz', - "<p>foo bar baz</p>\n" - ) - ); - } - - /** - * @dataProvider makrdownProvider - */ - public function testRenderWithMakrkdownFile( $markdown, $html ) { - $this->assertFileContentRendersAs( $markdown, $html ); - } - - private function assertFileContentRendersAs( $fileContent, $expectedRenderedResult ) { - $fileFetcher = $this->getMock( 'FileFetcher\FileFetcher' ); - - $fileFetcher->expects( $this->once() ) - ->method( 'fetchFile' ) - ->will( $this->returnValue( $fileContent ) ); - - $renderResult = $this->runHookWithFileFetcher( $fileFetcher ); - - $this->assertEquals( $expectedRenderedResult, $renderResult ); - } - - public function nonMdProvider() { - return array( - array( - 'foo bar baz', - 'Foo.php', - ), - array( - '# Ohai there!', - 'README.wikitext', - ), - array( - '{ "you": { "can": "haz", "a": "json!" } }', - 'composer.json', - ), - array( - '{ "you": { "can": "haz", "a": "json!" } }', - 'someFileWithoutExtension', - ), - ); - } - - /** - * @dataProvider nonMdProvider - */ - public function testRenderingWithNonMdFileAsIs( $notMd, $fileName ) { - $this->file = $fileName; - $this->assertFileContentRendersAs( $notMd, $notMd ); - } - -} diff --git a/tests/unit/SetupTest.php b/tests/unit/SetupTest.php deleted file mode 100644 index 61f281e..0000000 --- a/tests/unit/SetupTest.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -namespace GitHub\Tests\Phpunit; - -use GitHub\Setup; - -/** - * @covers GitHub\Setup - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < [email protected] > - */ -class SetupTest extends \PHPUnit_Framework_TestCase { - - public function testCanConstruct() { - $inputGlobals = array( - 'wgExtensionCredits' => array( 'other' => array() ), - 'wgExtensionMessagesFiles' => array(), - 'wgHooks' => array( 'ParserFirstCallInit' => array() ), - ); - - $setup = new Setup( $inputGlobals, __DIR__ . '/..' ); - $setup->run(); - - $this->assertCount( 1, $inputGlobals['wgExtensionCredits']['other'], 'credits where set' ); - $this->assertCount( 2, $inputGlobals['wgExtensionMessagesFiles'], 'message files where registered' ); - $this->assertCount( 1, $inputGlobals['wgHooks']['ParserFirstCallInit'], 'parser hook was registered' ); - } - -} -- To view, visit https://gerrit.wikimedia.org/r/396458 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2f8ad3d00f3815eadcecf774d099dcebab2a3ff1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GitHub Gerrit-Branch: master Gerrit-Owner: Umherirrender <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
