Felipe Schenone has submitted this change and it was merged. Change subject: Add composer support and php code sniffer ......................................................................
Add composer support and php code sniffer Update .gitignore for composer Remove global $wgMSL_FileTypes Whitespaces fixes Follows-up: https://gerrit.wikimedia.org/r/#/c/225231/ Change-Id: Iff5e7ea001f7d507d3f8e2e09d68e3480bbb6f68 --- M MsUpload.body.php M composer.json A phpcs.xml 3 files changed, 22 insertions(+), 12 deletions(-) Approvals: Felipe Schenone: Looks good to me, approved jenkins-bot: Verified diff --git a/MsUpload.body.php b/MsUpload.body.php index 9903ec9..7643257 100644 --- a/MsUpload.body.php +++ b/MsUpload.body.php @@ -3,13 +3,12 @@ class MsUpload { static function start() { - global $wgOut, $wgScriptPath, $wgMSL_FileTypes, $wgMSU_useMsLinks, $wgMSU_showAutoCat, - $wgMSU_autoIndex, $wgMSU_checkAutoCat, $wgMSU_confirmReplace, $wgMSU_useDragDrop, - $wgMSU_imgParams, $wgFileExtensions; + global $wgOut, $wgScriptPath, $wgMSU_useMsLinks, $wgMSU_showAutoCat, $wgMSU_checkAutoCat, + $wgMSU_confirmReplace, $wgMSU_useDragDrop, $wgMSU_imgParams, $wgFileExtensions; $wgOut->addJsConfigVars( array( 'wgFileExtensions' => array_values( array_unique( $wgFileExtensions ) ), - )); + ) ); if ( $wgMSU_imgParams ) { $wgMSU_imgParams = '|' . $wgMSU_imgParams; @@ -32,17 +31,17 @@ } static function saveCat( $filename, $category ) { - global $wgContLang, $wgUser; + global $wgContLang, $wgUser; $mediaString = strtolower( $wgContLang->getNsText( NS_FILE ) ); $title = $mediaString . ':' . $filename; $text = "\n[[" . $category . "]]"; - $wgEnableWriteAPI = true; - $params = new FauxRequest(array ( + $wgEnableWriteAPI = true; + $params = new FauxRequest( array( 'action' => 'edit', 'section'=> 'new', 'title' => $title, 'text' => $text, - 'token' => $wgUser->editToken(),//$token."%2B%5C", + 'token' => $wgUser->editToken(), // $token."%2B%5C", ), true, $_SESSION ); $enableWrite = true; $api = new ApiMain( $params, $enableWrite ); @@ -54,7 +53,8 @@ } return $mediaString; -/* The code below does the same and is better, but for some reason it doesn't update the categorylinks table, so it's no good + /* The code below does the same and is better, + but for some reason it doesn't update the categorylinks table, so it's no good global $wgContLang, $wgUser; $title = Title::newFromText( $filename, NS_FILE ); $page = new WikiPage( $title ); @@ -66,6 +66,6 @@ $revision = $value['revision']; $page->doEditUpdates( $revision, $wgUser ); return true; -*/ + */ } } diff --git a/composer.json b/composer.json index 1c63f9e..083767b 100644 --- a/composer.json +++ b/composer.json @@ -1,10 +1,12 @@ { "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9.2" + "jakub-onderka/php-parallel-lint": "0.9.2", + "mediawiki/mediawiki-codesniffer": "0.5.1" }, "scripts": { "test": [ - "parallel-lint . --exclude vendor" + "parallel-lint . --exclude vendor", + "phpcs -p -s" ] } } diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..d81a292 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<ruleset> + <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/> + <file>.</file> + <arg name="extensions" value="php,php5,inc"/> + <arg name="encoding" value="utf8"/> + <exclude-pattern>vendor</exclude-pattern> +</ruleset> -- To view, visit https://gerrit.wikimedia.org/r/225340 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iff5e7ea001f7d507d3f8e2e09d68e3480bbb6f68 Gerrit-PatchSet: 29 Gerrit-Project: mediawiki/extensions/MsUpload Gerrit-Branch: master Gerrit-Owner: Paladox <[email protected]> Gerrit-Reviewer: Addshore <[email protected]> Gerrit-Reviewer: Felipe Schenone <[email protected]> Gerrit-Reviewer: Hashar <[email protected]> Gerrit-Reviewer: Legoktm <[email protected]> Gerrit-Reviewer: Paladox <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
