Nikerabbit has uploaded a new change for review.
https://gerrit.wikimedia.org/r/267881
Change subject: Add phpcs
......................................................................
Add phpcs
Moved things to namespace because LU_ prefix does not pass sniffs.
Change-Id: I6997424d531a9bb4cd767747c1b67dc9cc3138c8
---
M LocalisationUpdate.php
M QuickArrayReader.php
M Updater.php
M composer.json
M extension.json
M fetcher/Fetcher.php
M fetcher/FetcherFactory.php
M fetcher/FileSystemFetcher.php
M fetcher/GitHubFetcher.php
M fetcher/HttpFetcher.php
M finder/Finder.php
M reader/JSONReader.php
M reader/PHPReader.php
M reader/Reader.php
M reader/ReaderFactory.php
M tests/phpunit/UpdaterTest.php
M tests/phpunit/finder/FinderTest.php
M tests/phpunit/reader/JSONReaderTest.php
M tests/phpunit/reader/ReaderFactoryTest.php
M update.php
20 files changed, 134 insertions(+), 86 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LocalisationUpdate
refs/changes/81/267881/1
diff --git a/LocalisationUpdate.php b/LocalisationUpdate.php
index 2b83c3f..03114bf 100644
--- a/LocalisationUpdate.php
+++ b/LocalisationUpdate.php
@@ -5,7 +5,8 @@
// Keep i18n globals so mergeMessageFileList.php doesn't break
$GLOBALS['wgMessagesDirs']['LocalisationUpdate'] = __DIR__ . '/i18n';
/* wfWarn(
- 'Deprecated PHP entry point used for LocalisationUpdate
extension. Please use wfLoadExtension instead, ' .
+ 'Deprecated PHP entry point used for LocalisationUpdate
extension. ' .
+ 'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for
more details.'
); */
return;
diff --git a/QuickArrayReader.php b/QuickArrayReader.php
index 691f4a6..65b6227 100644
--- a/QuickArrayReader.php
+++ b/QuickArrayReader.php
@@ -39,39 +39,46 @@
$varname = trim( substr(
$tokens[$i][1], 1 ) );
$varindex = null;
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( $tokens[$i] === '[' ) {
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( isset(
$scalarTypes[$tokens[$i][0]] ) ) {
$varindex =
$this->parseScalar( $tokens[$i] );
} else {
throw $this->except(
$tokens[$i], 'scalar index' );
}
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( $tokens[$i] !== ']' ) {
throw $this->except(
$tokens[$i], ']' );
}
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
}
if ( $tokens[$i] !== '=' ) {
throw $this->except(
$tokens[$i], '=' );
}
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( isset(
$scalarTypes[$tokens[$i][0]] ) ) {
$buildval = $this->parseScalar(
$tokens[$i] );
} elseif ( $tokens[$i][0] === T_ARRAY )
{
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( $tokens[$i] !== '(' ) {
throw $this->except(
$tokens[$i], '(' );
}
$buildval = array();
do {
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( $tokens[$i] ===
')' ) {
break;
@@ -79,12 +86,14 @@
if ( isset(
$scalarTypes[$tokens[$i][0]] ) ) {
$key =
$this->parseScalar( $tokens[$i] );
}
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( $tokens[$i][0] !==
T_DOUBLE_ARROW ) {
throw
$this->except( $tokens[$i], '=>' );
}
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( isset(
$scalarTypes[$tokens[$i][0]] ) ) {
$val =
$this->parseScalar( $tokens[$i] );
@@ -92,7 +101,8 @@
wfSuppressWarnings();
$buildval[$key] = $val;
wfRestoreWarnings();
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( $tokens[$i] ===
',' ) {
continue;
@@ -112,7 +122,8 @@
$this->vars[$varname][$varindex] = $buildval;
wfRestoreWarnings();
}
- while ( isset(
$skipTypes[$tokens[++$i][0]] ) );
+ while ( isset(
$skipTypes[$tokens[++$i][0]] ) ) {
+ }
if ( $tokens[$i] !== ';' ) {
throw $this->except(
$tokens[$i], ';' );
}
diff --git a/Updater.php b/Updater.php
index bae492d..6055f5d 100644
--- a/Updater.php
+++ b/Updater.php
@@ -5,10 +5,12 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Executes the localisation update.
*/
-class LU_Updater {
+class Updater {
/**
* Whether the path is a pattern and thus we need to use appropriate
* code for fetching directories.
@@ -48,18 +50,18 @@
/**
* Parses translations from given list of files.
*
- * @param LU_ReaderFactory $readerFactory Factory to construct parsers.
+ * @param ReaderFactory $readerFactory Factory to construct parsers.
* @param array $files List of files with their contents as array
values.
* @return array List of translations indexed by language code.
*/
- public function readMessages( LU_ReaderFactory $readerFactory, array
$files ) {
+ public function readMessages( ReaderFactory $readerFactory, array
$files ) {
$messages = array();
foreach ( $files as $filename => $contents ) {
$reader = $readerFactory->getReader( $filename );
try {
$parsed = $reader->parse( $contents );
- } catch ( Exception $e ) {
+ } catch ( \Exception $e ) {
trigger_error( __METHOD__ . ": Unable to parse
messages from $filename", E_USER_WARNING );
continue;
}
@@ -73,7 +75,7 @@
$c = array_sum( array_map( 'count', $parsed ) );
// Useful for debugging, maybe create interface to pass
this to the script?
- #echo "$filename with " . get_class( $reader ) . " and
$c\n";
+ # echo "$filename with " . get_class( $reader ) . " and
$c\n";
}
return $messages;
@@ -104,11 +106,11 @@
/**
* Fetches files from given Url pattern.
*
- * @param LU_FetcherFactory $factory Factory to construct fetchers.
+ * @param FetcherFactory $factory Factory to construct fetchers.
* @param string $path Url to the file or pattern of files.
* @return array List of Urls with file contents as path.
*/
- public function fetchFiles( LU_FetcherFactory $factory, $path ) {
+ public function fetchFiles( FetcherFactory $factory, $path ) {
$fetcher = $factory->getFetcher( $path );
if ( $this->isDirectory( $path ) ) {
@@ -122,9 +124,9 @@
}
public function execute(
- LU_Finder $finder,
- LU_ReaderFactory $readerFactory,
- LU_FetcherFactory $fetcherFactory,
+ Finder $finder,
+ ReaderFactory $readerFactory,
+ FetcherFactory $fetcherFactory,
array $repos
) {
diff --git a/composer.json b/composer.json
index b207b1f..c0eab54 100644
--- a/composer.json
+++ b/composer.json
@@ -37,11 +37,13 @@
]
},
"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 node_modules --exclude
vendor"
+ "parallel-lint . --exclude vendor --exclude extensions",
+ "phpcs -p -s"
]
}
}
diff --git a/extension.json b/extension.json
index 1b6c61e..69e8178 100644
--- a/extension.json
+++ b/extension.json
@@ -19,18 +19,18 @@
},
"AutoloadClasses": {
"LocalisationUpdate": "LocalisationUpdate.class.php",
- "LU_Updater": "Updater.php",
+ "LocalisationUpdate\\Updater": "Updater.php",
"QuickArrayReader": "QuickArrayReader.php",
- "LU_Fetcher": "fetcher/Fetcher.php",
- "LU_FetcherFactory": "fetcher/FetcherFactory.php",
- "LU_FileSystemFetcher": "fetcher/FileSystemFetcher.php",
- "LU_GitHubFetcher": "fetcher/GitHubFetcher.php",
- "LU_HttpFetcher": "fetcher/HttpFetcher.php",
- "LU_Finder": "finder/Finder.php",
- "LU_JSONReader": "reader/JSONReader.php",
- "LU_PHPReader": "reader/PHPReader.php",
- "LU_Reader": "reader/Reader.php",
- "LU_ReaderFactory": "reader/ReaderFactory.php"
+ "LocalisationUpdate\\Fetcher": "fetcher/Fetcher.php",
+ "LocalisationUpdate\\FetcherFactory":
"fetcher/FetcherFactory.php",
+ "LocalisationUpdate\\FileSystemFetcher":
"fetcher/FileSystemFetcher.php",
+ "LocalisationUpdate\\GitHubFetcher":
"fetcher/GitHubFetcher.php",
+ "LocalisationUpdate\\HttpFetcher": "fetcher/HttpFetcher.php",
+ "LocalisationUpdate\\Finder": "finder/Finder.php",
+ "LocalisationUpdate\\JSONReader": "reader/JSONReader.php",
+ "LocalisationUpdate\\PHPReader": "reader/PHPReader.php",
+ "LocalisationUpdate\\Reader": "reader/Reader.php",
+ "LocalisationUpdate\\ReaderFactory": "reader/ReaderFactory.php"
},
"Hooks": {
"LocalisationCacheRecache": [
diff --git a/fetcher/Fetcher.php b/fetcher/Fetcher.php
index 9c06c10..9ff7958 100644
--- a/fetcher/Fetcher.php
+++ b/fetcher/Fetcher.php
@@ -5,10 +5,12 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Interface for classes which fetch files over different protocols and ways.
*/
-interface LU_Fetcher {
+interface Fetcher {
/**
* Fetches a single resource.
*
diff --git a/fetcher/FetcherFactory.php b/fetcher/FetcherFactory.php
index 4e26dc1..e772a4e 100644
--- a/fetcher/FetcherFactory.php
+++ b/fetcher/FetcherFactory.php
@@ -5,20 +5,22 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Constructs fetchers based on the repository urls.
*/
-class LU_FetcherFactory {
+class FetcherFactory {
public function getFetcher( $path ) {
if ( strpos( $path, 'https://raw.github.com/' ) === 0 ) {
- return new LU_GitHubFetcher();
+ return new GitHubFetcher();
} elseif ( strpos( $path, 'http://' ) === 0 ) {
- return new LU_HttpFetcher();
+ return new HttpFetcher();
} elseif ( strpos( $path, 'https://' ) === 0 ) {
- return new LU_HttpFetcher();
+ return new HttpFetcher();
} else {
- return new LU_FileSystemFetcher();
+ return new FileSystemFetcher();
}
}
}
diff --git a/fetcher/FileSystemFetcher.php b/fetcher/FileSystemFetcher.php
index a463d6c..9ed84b5 100644
--- a/fetcher/FileSystemFetcher.php
+++ b/fetcher/FileSystemFetcher.php
@@ -5,10 +5,12 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Accesses file system directly.
*/
-class LU_FileSystemFetcher implements LU_Fetcher {
+class FileSystemFetcher implements Fetcher {
public function fetchFile( $url ) {
// Remove the protocol prefix
$url = preg_replace( '~^file://~', '', $url );
diff --git a/fetcher/GitHubFetcher.php b/fetcher/GitHubFetcher.php
index 5d25257..03ef531 100644
--- a/fetcher/GitHubFetcher.php
+++ b/fetcher/GitHubFetcher.php
@@ -5,6 +5,8 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* This class uses GitHub api to obtain a list of files present in a directory
* to avoid fetching files that don't exist.
@@ -13,19 +15,20 @@
* the source. 2) avoid fetching files which haven't changed since last check
* if we store them.
*/
-class LU_GitHubFetcher extends LU_HttpFetcher {
-
+class GitHubFetcher extends HttpFetcher {
public function fetchDirectory( $pattern ) {
- $p =
'~^https://raw.github\.com/(?P<org>[^/]+)/(?P<repo>[^/]+)/(?P<branch>[^/]+)/(?P<path>.+)/.+$~';
+ $domain = preg_quote( 'https://raw.github.com/', '~' );
+ $p =
"~^$domain(?P<org>[^/]+)/(?P<repo>[^/]+)/(?P<branch>[^/]+)/(?P<path>.+)/.+$~";
preg_match( $p, $pattern, $m );
- $json = Http::get(
"https://api.github.com/repos/{$m['org']}/{$m['repo']}/contents/{$m['path']}" );
+ $apiURL =
"https://api.github.com/repos/{$m['org']}/{$m['repo']}/contents/{$m['path']}";
+ $json = \Http::get( $apiURL );
if ( !$json ) {
- throw new Exception( "Unable to get directory listing
for {$m['org']}/{$m['repo']}" );
+ throw new \Exception( "Unable to get directory listing
for {$m['org']}/{$m['repo']}" );
}
$files = array();
- $json = FormatJson::decode( $json, true );
+ $json = \FormatJson::decode( $json, true );
foreach ( $json as $fileinfo ) {
$fileurl = dirname( $pattern ) . '/' .
$fileinfo['name'];
$file = $this->fetchFile( $fileurl );
diff --git a/fetcher/HttpFetcher.php b/fetcher/HttpFetcher.php
index 9dfed8d..27e6512 100644
--- a/fetcher/HttpFetcher.php
+++ b/fetcher/HttpFetcher.php
@@ -5,12 +5,14 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Fetches files over HTTP(s).
*/
-class LU_HttpFetcher implements LU_Fetcher {
+class HttpFetcher implements Fetcher {
public function fetchFile( $url ) {
- return Http::get( $url );
+ return \Http::get( $url );
}
/**
@@ -20,9 +22,9 @@
public function fetchDirectory( $pattern ) {
$files = array();
- $languages = Language::fetchLanguageNames( null, 'mwfile' );
+ $languages = \Language::fetchLanguageNames( null, 'mwfile' );
- foreach( array_keys( $languages ) as $code ) {
+ foreach ( array_keys( $languages ) as $code ) {
// Hack for core
if ( strpos( $pattern, 'Messages*.php' ) !== false ) {
$code = ucfirst( strtr( $code, '-', '_' ) );
diff --git a/finder/Finder.php b/finder/Finder.php
index dc3a7f6..f59ec2c 100644
--- a/finder/Finder.php
+++ b/finder/Finder.php
@@ -5,11 +5,13 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Interface for classes which provide list of components, which should be
* included for l10n updates.
*/
-class LU_Finder {
+class Finder {
/**
* @param array $php See $wgExtensionMessagesFiles
* @param array $json See $wgMessagesDirs
diff --git a/reader/JSONReader.php b/reader/JSONReader.php
index 636168c..7df4070 100644
--- a/reader/JSONReader.php
+++ b/reader/JSONReader.php
@@ -5,10 +5,12 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Reads MediaWiki JSON i18n files.
*/
-class LU_JSONReader implements LU_Reader {
+class JSONReader implements Reader {
/// @var string Language tag
protected $code;
@@ -17,7 +19,7 @@
}
public function parse( $contents ) {
- $messages = FormatJson::decode( $contents, true );
+ $messages = \FormatJson::decode( $contents, true );
unset( $messages['@metadata'] );
if ( $this->code ) {
diff --git a/reader/PHPReader.php b/reader/PHPReader.php
index 986d7b5..649f4a0 100644
--- a/reader/PHPReader.php
+++ b/reader/PHPReader.php
@@ -5,10 +5,12 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Reads MediaWiki PHP i18n files.
*/
-class LU_PHPReader implements LU_Reader {
+class PHPReader implements Reader {
/// @var string Language tag
protected $code;
@@ -23,7 +25,7 @@
}
$php = $this->cleanupFile( $contents );
- $reader = new QuickArrayReader( "<?php $php" );
+ $reader = new \QuickArrayReader( "<?php $php" );
$messages = $reader->getVar( 'messages' );
if ( $this->code ) {
diff --git a/reader/Reader.php b/reader/Reader.php
index f55a937..8c263ff 100644
--- a/reader/Reader.php
+++ b/reader/Reader.php
@@ -5,10 +5,12 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Interface for file readers.
*/
-interface LU_Reader {
+interface Reader {
/**
* Returns a list of messages indexed by language code. Example
* array( 'en' => array( 'key' => 'value' ) );
diff --git a/reader/ReaderFactory.php b/reader/ReaderFactory.php
index 983ec31..ab5cdf1 100644
--- a/reader/ReaderFactory.php
+++ b/reader/ReaderFactory.php
@@ -5,32 +5,34 @@
* @license GPL-2.0+
*/
+namespace LocalisationUpdate;
+
/**
* Constructs readers for files based on the names.
*/
-class LU_ReaderFactory {
+class ReaderFactory {
/**
* Constructs a suitable reader for a given path.
* @param string $filename Usually a relative path to the file name.
- * @return LU_Reader
+ * @return Reader
* @throw Exception
*/
public function getReader( $filename ) {
if ( preg_match( '/i18n\.php$/', $filename ) ) {
- return new LU_PHPReader();
+ return new PHPReader();
}
// Ugly hack for core i18n files
if ( preg_match( '/Messages(.*)\.php$/', $filename ) ) {
- $code = Language::getCodeFromFileName( basename(
$filename ), 'Messages' );
- return new LU_PHPReader( $code );
+ $code = \Language::getCodeFromFileName( basename(
$filename ), 'Messages' );
+ return new PHPReader( $code );
}
if ( preg_match( '/\.json/', $filename ) ) {
$code = basename( $filename, '.json' );
- return new LU_JSONReader( $code );
+ return new JSONReader( $code );
}
- throw new Exception( "Unknown file format: " . $filename );
+ throw new \Exception( "Unknown file format: " . $filename );
}
}
diff --git a/tests/phpunit/UpdaterTest.php b/tests/phpunit/UpdaterTest.php
index ce742cb..d4afc52 100644
--- a/tests/phpunit/UpdaterTest.php
+++ b/tests/phpunit/UpdaterTest.php
@@ -5,9 +5,11 @@
* @license GPL-2.0+
*/
-class LU_UpdaterTest extends MediaWikiTestCase {
+namespace LocalisationUpdate;
+
+class UpdaterTest extends \PHPUnit_Framework_TestCase {
public function testIsDirectory() {
- $updater = new LU_Updater();
+ $updater = new Updater();
$this->assertTrue(
$updater->isDirectory(
'/IP/extensions/Translate/i18n/*.json' ),
@@ -21,7 +23,7 @@
}
public function testExpandRemotePath() {
- $updater = new LU_Updater();
+ $updater = new Updater();
$repos = array( 'main' => 'file:///repos/%NAME%/%SOME-VAR%' );
$info = array(
@@ -37,18 +39,18 @@
}
public function testReadMessages() {
- $updater = $updater = new LU_Updater();
+ $updater = $updater = new Updater();
$input = array( 'file' => 'Hello World!' );
$output = array( 'en' => array( 'key' => $input['file'] ) );
- $reader = $this->getMock( 'LU_Reader' );
+ $reader = $this->getMock( 'LocalisationUpdate\Reader' );
$reader
->expects( $this->once() )
->method( 'parse' )
->will( $this->returnValue( $output ) );
- $factory = $this->getMock( 'LU_ReaderFactory' );
+ $factory = $this->getMock( 'LocalisationUpdate\ReaderFactory' );
$factory
->expects( $this->once() )
->method( 'getReader' )
@@ -59,7 +61,7 @@
}
public function testFindChangedTranslations() {
- $updater = $updater = new LU_Updater();
+ $updater = $updater = new Updater();
$origin = array(
'A' => '1',
diff --git a/tests/phpunit/finder/FinderTest.php
b/tests/phpunit/finder/FinderTest.php
index b8213ba..b767bf6 100644
--- a/tests/phpunit/finder/FinderTest.php
+++ b/tests/phpunit/finder/FinderTest.php
@@ -5,9 +5,11 @@
* @license GPL-2.0+
*/
-class LU_FinderTest extends MediaWikiTestCase {
+namespace LocalisationUpdate;
+
+class FinderTest extends \PHPUnit_Framework_TestCase {
public function testGetComponents() {
- $finder = new LU_Finder(
+ $finder = new Finder(
array(
'TranslateSearch' =>
'/IP/extensions/Translate/TranslateSearch.i18n.php',
'Babel' =>
'/IP/extensions/Babel/Babel.i18n.php',
diff --git a/tests/phpunit/reader/JSONReaderTest.php
b/tests/phpunit/reader/JSONReaderTest.php
index 4bb53af..06d4cd6 100644
--- a/tests/phpunit/reader/JSONReaderTest.php
+++ b/tests/phpunit/reader/JSONReaderTest.php
@@ -5,12 +5,14 @@
* @license GPL-2.0+
*/
-class LU_JSONReaderTest extends MediaWikiTestCase {
+namespace LocalisationUpdate;
+
+class JSONReaderTest extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider parseProvider
*/
public function testParse( $input, $expected, $comment ) {
- $reader = new LU_JSONReader( 'xx' );
+ $reader = new JSONReader( 'xx' );
$observed = $reader->parse( $input );
$this->assertEquals( $expected, $observed['xx'], $comment );
}
diff --git a/tests/phpunit/reader/ReaderFactoryTest.php
b/tests/phpunit/reader/ReaderFactoryTest.php
index ee155b3..9cb1a8f 100644
--- a/tests/phpunit/reader/ReaderFactoryTest.php
+++ b/tests/phpunit/reader/ReaderFactoryTest.php
@@ -5,12 +5,14 @@
* @license GPL-2.0+
*/
-class LU_ReaderFactoryTest extends MediaWikiTestCase {
+namespace LocalisationUpdate;
+
+class ReaderFactoryTest extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider getReaderProvider
*/
public function testGetReader( $input, $expected, $comment ) {
- $factory = new LU_ReaderFactory();
+ $factory = new ReaderFactory();
$reader = $factory->getReader( $input );
$observed = get_class( $reader );
$this->assertEquals( $expected, $observed, $comment );
@@ -20,17 +22,17 @@
return array(
array(
'languages/messages/MessagesFi.php',
- 'LU_PHPReader',
+ 'LocalisationUpdate\PHPReader',
'core php file',
),
array(
'extensions/Translate/Translate.i18n.php',
- 'LU_PHPReader',
+ 'LocalisationUpdate\PHPReader',
'extension php file',
),
array(
'extension/Translate/i18n/core/de.json',
- 'LU_JSONReader',
+ 'LocalisationUpdate\JSONReader',
'extension json file',
),
);
diff --git a/update.php b/update.php
index e374d59..593a525 100644
--- a/update.php
+++ b/update.php
@@ -24,7 +24,10 @@
ini_set( "max_execution_time", 0 );
ini_set( 'memory_limit', -1 );
- global $wgExtensionMessagesFiles, $IP;
+ // @codingStandardsIgnoreStart Ignore
MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
+ global $IP;
+ // @codingStandardsIgnoreEnd
+ global $wgExtensionMessagesFiles;
global $wgLocalisationUpdateRepositories;
global $wgLocalisationUpdateRepository;
@@ -37,9 +40,9 @@
$lc = Language::getLocalisationCache();
$messagesDirs = $lc->getMessagesDirs();
- $finder = new LU_Finder( $wgExtensionMessagesFiles,
$messagesDirs, $IP );
- $readerFactory = new LU_ReaderFactory();
- $fetcherFactory = new LU_FetcherFactory();
+ $finder = new LocalisationUpdate\Finder(
$wgExtensionMessagesFiles, $messagesDirs, $IP );
+ $readerFactory = new LocalisationUpdate\ReaderFactory();
+ $fetcherFactory = new LocalisationUpdate\FetcherFactory();
$repoid = $this->getOption( 'repoid',
$wgLocalisationUpdateRepository );
if ( !isset( $wgLocalisationUpdateRepositories[$repoid] ) ) {
@@ -50,7 +53,7 @@
$repos = $wgLocalisationUpdateRepositories[$repoid];
// Do it ;)
- $updater = new LU_Updater();
+ $updater = new LocalisationUpdate\Updater();
$updatedMessages = $updater->execute(
$finder,
$readerFactory,
--
To view, visit https://gerrit.wikimedia.org/r/267881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6997424d531a9bb4cd767747c1b67dc9cc3138c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LocalisationUpdate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits