[MediaWiki-commits] [Gerrit] mediawiki...Translate[master]: Remove MediawikiExtensionFFS

2017-12-04 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/394850 )

Change subject: Remove MediawikiExtensionFFS
..


Remove MediawikiExtensionFFS

* All extensions have been converted to JsonFFS
* It is a bad format and I want to discourage its use

Change-Id: I7e5d96d0a6d4081672e15db85358c2aa0573f046
---
M Autoload.php
D ffs/MediaWikiExtensionFFS.php
M ffs/MediaWikiExtensions.php
M tests/phpunit/MediaWikiExtensionTest.php
D tests/phpunit/data/MediaWikiExtensionTest-conf1.yaml
M tests/phpunit/data/MediaWikiExtensionTest-conf2.yaml
M tests/phpunit/data/MediaWikiExtensionTest-conf4.yaml
M tests/phpunit/data/mediawiki-extensions.txt
D tests/phpunit/ffs/MediaWikiExtensionFFSTest.php
9 files changed, 7 insertions(+), 463 deletions(-)

Approvals:
  jenkins-bot: Verified
  Santhosh: Looks good to me, approved



diff --git a/Autoload.php b/Autoload.php
index 2b16979..450ec2c 100644
--- a/Autoload.php
+++ b/Autoload.php
@@ -174,7 +174,6 @@
 $al['JavaFFS'] = "$dir/ffs/JavaFFS.php";
 $al['JavaScriptFFS'] = "$dir/ffs/JavaScriptFFS.php";
 $al['JsonFFS'] = "$dir/ffs/JsonFFS.php";
-$al['MediaWikiExtensionFFS'] = "$dir/ffs/MediaWikiExtensionFFS.php";
 $al['ShapadoJsFFS'] = "$dir/ffs/JavaScriptFFS.php";
 $al['SimpleFFS'] = "$dir/ffs/SimpleFFS.php";
 $al['XliffFFS'] = "$dir/ffs/XliffFFS.php";
diff --git a/ffs/MediaWikiExtensionFFS.php b/ffs/MediaWikiExtensionFFS.php
deleted file mode 100644
index a1aef9d..000
--- a/ffs/MediaWikiExtensionFFS.php
+++ /dev/null
@@ -1,288 +0,0 @@
-group->getSourceFilePath( $code );
-   if ( !file_exists( $filename ) ) {
-   return false;
-   }
-
-   if ( isset( self::$cache[$filename]['parsed'][$code] ) ) {
-   return self::$cache[$filename]['parsed'][$code];
-   }
-
-   if ( !isset( self::$cache[$filename] ) ) {
-   // Clear the cache if the filename changes to reduce 
memory use
-   self::$cache = [];
-
-   $contents = file_get_contents( $filename );
-   self::$cache[$filename]['sections'] =
-   $this->splitSections( $contents, $filename );
-   }
-
-   // Shorten
-   $cache = ::$cache[$filename];
-
-   $value = false;
-   if ( isset( $cache['sections'][$code] ) ) {
-   $value = $this->readFromVariable( 
$cache['sections'][$code] );
-   }
-
-   $cache['parsed'][$code] = $value;
-
-   return $value;
-   }
-
-   /**
-* @param string $data
-* @return array Parsed data.
-* @throws MWException
-*/
-   public function readFromVariable( $data ) {
-   $messages = [];
-   eval( $data );
-
-   $c = count( $messages );
-   if ( $c !== 1 ) {
-   throw new MWException( "MWEFFS3: Expected 1, got $c: 
$data" );
-   }
-
-   $messages = array_shift( $messages );
-   $mangler = $this->group->getMangler();
-   $messages = $mangler->mangle( $messages );
-
-   return [
-   'MESSAGES' => $messages,
-   ];
-   }
-
-   // Handled in writeReal
-   protected function tryReadSource( $filename, MessageCollection 
$collection ) {
-   }
-
-   /**
-* @param MessageCollection $collection
-* @return string
-*/
-   protected function writeReal( MessageCollection $collection ) {
-   $mangler = $this->group->getMangler();
-   $code = $collection->getLanguage();
-
-   $block = $this->generateMessageBlock( $collection, $mangler );
-   if ( $block === false ) {
-   return '';
-   }
-
-   // Ugly code, relies on side effects
-   // Avoid parsing stuff with fake language code
-   // Premature optimization
-   $this->read( 'mul' );
-   $filename = $this->group->getSourceFilePath( $code );
-   $cache = ::$cache[$filename];
-
-   // Generating authors
-   if ( isset( $cache['sections'][$code] ) ) {
-   // More premature optimization
-   $fromFile = self::parseAuthorsFromString( 
$cache['sections'][$code] );
-   $collection->addCollectionAuthors( $fromFile );
-   }
-
-   $authors = $collection->getAuthors();
-   $authors = $this->filterAuthors( $authors, $code );
-
-   $authorList = '';
-   foreach ( $authors as $author ) {
-   $authorList .= "\n * @author $author";
-   }
-
-   // And putting all together
-   $name = 

[MediaWiki-commits] [Gerrit] mediawiki...Translate[master]: Remove MediawikiExtensionFFS

2017-12-03 Thread Nikerabbit (Code Review)
Nikerabbit has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394850 )

Change subject: Remove MediawikiExtensionFFS
..

Remove MediawikiExtensionFFS

* All extensions have been converted to JsonFFS
* It is a bad format and I want to discourage its use

Change-Id: I7e5d96d0a6d4081672e15db85358c2aa0573f046
---
D ffs/MediaWikiExtensionFFS.php
M ffs/MediaWikiExtensions.php
M tests/phpunit/MediaWikiExtensionTest.php
D tests/phpunit/data/MediaWikiExtensionTest-conf1.yaml
M tests/phpunit/data/MediaWikiExtensionTest-conf2.yaml
M tests/phpunit/data/MediaWikiExtensionTest-conf4.yaml
M tests/phpunit/data/mediawiki-extensions.txt
D tests/phpunit/ffs/MediaWikiExtensionFFSTest.php
8 files changed, 7 insertions(+), 462 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/50/394850/1

diff --git a/ffs/MediaWikiExtensionFFS.php b/ffs/MediaWikiExtensionFFS.php
deleted file mode 100644
index a1aef9d..000
--- a/ffs/MediaWikiExtensionFFS.php
+++ /dev/null
@@ -1,288 +0,0 @@
-group->getSourceFilePath( $code );
-   if ( !file_exists( $filename ) ) {
-   return false;
-   }
-
-   if ( isset( self::$cache[$filename]['parsed'][$code] ) ) {
-   return self::$cache[$filename]['parsed'][$code];
-   }
-
-   if ( !isset( self::$cache[$filename] ) ) {
-   // Clear the cache if the filename changes to reduce 
memory use
-   self::$cache = [];
-
-   $contents = file_get_contents( $filename );
-   self::$cache[$filename]['sections'] =
-   $this->splitSections( $contents, $filename );
-   }
-
-   // Shorten
-   $cache = ::$cache[$filename];
-
-   $value = false;
-   if ( isset( $cache['sections'][$code] ) ) {
-   $value = $this->readFromVariable( 
$cache['sections'][$code] );
-   }
-
-   $cache['parsed'][$code] = $value;
-
-   return $value;
-   }
-
-   /**
-* @param string $data
-* @return array Parsed data.
-* @throws MWException
-*/
-   public function readFromVariable( $data ) {
-   $messages = [];
-   eval( $data );
-
-   $c = count( $messages );
-   if ( $c !== 1 ) {
-   throw new MWException( "MWEFFS3: Expected 1, got $c: 
$data" );
-   }
-
-   $messages = array_shift( $messages );
-   $mangler = $this->group->getMangler();
-   $messages = $mangler->mangle( $messages );
-
-   return [
-   'MESSAGES' => $messages,
-   ];
-   }
-
-   // Handled in writeReal
-   protected function tryReadSource( $filename, MessageCollection 
$collection ) {
-   }
-
-   /**
-* @param MessageCollection $collection
-* @return string
-*/
-   protected function writeReal( MessageCollection $collection ) {
-   $mangler = $this->group->getMangler();
-   $code = $collection->getLanguage();
-
-   $block = $this->generateMessageBlock( $collection, $mangler );
-   if ( $block === false ) {
-   return '';
-   }
-
-   // Ugly code, relies on side effects
-   // Avoid parsing stuff with fake language code
-   // Premature optimization
-   $this->read( 'mul' );
-   $filename = $this->group->getSourceFilePath( $code );
-   $cache = ::$cache[$filename];
-
-   // Generating authors
-   if ( isset( $cache['sections'][$code] ) ) {
-   // More premature optimization
-   $fromFile = self::parseAuthorsFromString( 
$cache['sections'][$code] );
-   $collection->addCollectionAuthors( $fromFile );
-   }
-
-   $authors = $collection->getAuthors();
-   $authors = $this->filterAuthors( $authors, $code );
-
-   $authorList = '';
-   foreach ( $authors as $author ) {
-   $authorList .= "\n * @author $author";
-   }
-
-   // And putting all together
-   $name = TranslateUtils::getLanguageName( $code );
-   $native = TranslateUtils::getLanguageName( $code, $code );
-
-   $section = <getSourceLanguage(),
-   $wgTranslateDocumentationLanguageCode,
-   ];
-   foreach ( $codes as $pcode ) {
-   if ( isset( $sections[$pcode] ) ) {
-   $priority[] = $sections[$pcode];
-   unset(