Aude has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/199617

Change subject: Update Wikidata - Fix recent changes formatting on wikidata
......................................................................

Update Wikidata - Fix recent changes formatting on wikidata

* also fixes edit summary on SpecialSetLabelDescriptionAliases page
* add debug logging to UpdateRepo code
* fix php notice in PhpDateTimeParser

Change-Id: I6d8e0019e11674ffbe1ca62b337c5f41b61b4e6b
---
M composer.json
M composer.lock
M extensions/Wikibase/client/includes/Hooks/UpdateRepoHookHandlers.php
M extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php
M extensions/Wikibase/lib/includes/formatters/EntityIdLinkFormatter.php
M extensions/Wikibase/lib/includes/parsers/PhpDateTimeParser.php
M extensions/Wikibase/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
M extensions/Wikibase/lib/tests/phpunit/parsers/PhpDateTimeParserTest.php
M extensions/Wikibase/repo/i18n/en.json
M extensions/Wikibase/repo/i18n/qqq.json
M extensions/Wikibase/repo/includes/Localizer/MessageParameterFormatter.php
M extensions/Wikibase/repo/includes/WikibaseRepo.php
M 
extensions/Wikibase/repo/includes/specials/SpecialSetLabelDescriptionAliases.php
M 
extensions/Wikibase/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php
M vendor/composer/installed.json
15 files changed, 169 insertions(+), 89 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata 
refs/changes/17/199617/1

diff --git a/composer.json b/composer.json
index 1c414a4..227596d 100644
--- a/composer.json
+++ b/composer.json
@@ -5,6 +5,10 @@
     "repositories": [
         {
             "type": "vcs",
+            "url": 
"https://git.wikimedia.org/git/mediawiki/extensions/Wikibase.git";
+       },
+       {
+            "type": "vcs",
             "url": "https://github.com/wmde/Wikidata.org.git";
         },
         {
@@ -33,4 +37,4 @@
         "preferred-install": "dist",
         "autoloader-suffix": "wikidata_1_25wmf22"
     }
-}
\ No newline at end of file
+}
diff --git a/composer.lock b/composer.lock
index 2ab3e90..a0e9c21 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at 
http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file";,
         "This file is @generated automatically"
     ],
-    "hash": "2c17a6721641ee4dfc829a9a94dc98f5",
+    "hash": "99b3db77c3640ec4fa944bb1517f39d7",
     "packages": [
         {
             "name": "composer/installers",
@@ -1236,14 +1236,8 @@
             "version": "dev-wmf/1.25wmf22",
             "source": {
                 "type": "git",
-                "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-                "reference": "7d3a0b11d0321ff09fde1b5692599860fea6496c"
-            },
-            "dist": {
-                "type": "zip",
-                "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/7d3a0b11d0321ff09fde1b5692599860fea6496c";,
-                "reference": "7d3a0b11d0321ff09fde1b5692599860fea6496c",
-                "shasum": ""
+                "url": 
"https://git.wikimedia.org/git/mediawiki/extensions/Wikibase.git";,
+                "reference": "c42291f422f391dd14388859caf39857e80a4959"
             },
             "require": {
                 "data-values/common": "~0.2.0",
@@ -1291,7 +1285,6 @@
                     "Wikibase\\Repo\\View\\": "repo/includes/View"
                 }
             },
-            "notification-url": "https://packagist.org/downloads/";,
             "license": [
                 "GPL-2.0+"
             ],
@@ -1309,7 +1302,11 @@
                 "wikibaserepo",
                 "wikidata"
             ],
-            "time": "2015-03-25 00:03:14"
+            "support": {
+                "issues": "https://bugzilla.wikimedia.org/";,
+                "irc": "irc://irc.freenode.net/wikidata"
+            },
+            "time": "2015-03-25 14:50:27"
         },
         {
             "name": "wikibase/wikimedia-badges",
diff --git 
a/extensions/Wikibase/client/includes/Hooks/UpdateRepoHookHandlers.php 
b/extensions/Wikibase/client/includes/Hooks/UpdateRepoHookHandlers.php
index ec41526..53dcc5c 100644
--- a/extensions/Wikibase/client/includes/Hooks/UpdateRepoHookHandlers.php
+++ b/extensions/Wikibase/client/includes/Hooks/UpdateRepoHookHandlers.php
@@ -230,6 +230,7 @@
                        // show a message to the user that the Wikibase item 
needs to be
                        // manually updated.
                        wfLogWarning( $e->getMessage() );
+                       wfDebugLog( 'UpdateRepo', "OnDelete: Failed to inject 
job: " . $e->getMessage() );
                }
 
                return true;
@@ -274,6 +275,7 @@
                        // show a message to the user that the Wikibase item 
needs to be
                        // manually updated.
                        wfLogWarning( $e->getMessage() );
+                       wfDebugLog( 'UpdateRepo', "OnMove: Failed to inject 
job: " . $e->getMessage() );
                }
 
                return true;
diff --git a/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php 
b/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php
index 89f158b..ea21694 100644
--- a/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php
+++ b/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php
@@ -91,6 +91,13 @@
                                        $this->title->getFullText()
                                )
                        );
+
+                       if ( $this->entityId === null ) {
+                               wfDebugLog(
+                                       'UpdateRepo',
+                                       "Couldn't find an item for 
{$this->title->getFullText()}"
+                               );
+                       }
                }
 
                return $this->entityId;
@@ -106,18 +113,33 @@
                if ( !class_exists( 'CentralAuthUser' ) ) {
                        // We can't do anything without CentralAuth as there's 
no way to verify that
                        // the local user equals the repo one with the same name
+                       wfDebugLog(
+                               'UpdateRepo',
+                               "Can't validate user " . $this->user->getName() 
. ": class CentralAuthUser doesn't exist"
+                       );
+
                        return false;
                }
 
                $caUser = CentralAuthUser::getInstance( $this->user );
                if ( !$caUser || !$caUser->exists() ) {
                        // The current user doesn't have a central account
+                       wfDebugLog(
+                               'UpdateRepo',
+                               "Can't validate user " . $this->user->getName() 
. ": User doesn't have a global account"
+                       );
+
                        return false;
                }
 
                if ( !$caUser->isAttached() || !$caUser->attachedOn( 
$this->repoDB ) ) {
                        // Either the user account on this wiki or the one on 
the repo do not exist
                        // or they aren't connected
+                       wfDebugLog(
+                               'UpdateRepo',
+                               "Can't validate user " . $this->user->getName() 
. ": User is not attached locally or on {$this->repoDB}"
+                       );
+
                        return false;
                }
 
diff --git 
a/extensions/Wikibase/lib/includes/formatters/EntityIdLinkFormatter.php 
b/extensions/Wikibase/lib/includes/formatters/EntityIdLinkFormatter.php
index 9a520aa..60567f4 100644
--- a/extensions/Wikibase/lib/includes/formatters/EntityIdLinkFormatter.php
+++ b/extensions/Wikibase/lib/includes/formatters/EntityIdLinkFormatter.php
@@ -24,7 +24,7 @@
        public function formatEntityId( EntityId $entityId ) {
                $title = parent::formatEntityId( $entityId );
 
-               return "[[$title|" . wfEscapeWikiText( 
$entityId->getSerialization() ) . "]]";
+               return "[[$title]]";
        }
 
 }
diff --git a/extensions/Wikibase/lib/includes/parsers/PhpDateTimeParser.php 
b/extensions/Wikibase/lib/includes/parsers/PhpDateTimeParser.php
index 986da80..3c02785 100644
--- a/extensions/Wikibase/lib/includes/parsers/PhpDateTimeParser.php
+++ b/extensions/Wikibase/lib/includes/parsers/PhpDateTimeParser.php
@@ -172,7 +172,7 @@
                        }
                }
 
-               if ( !isset( $matches ) ) {
+               if ( !isset( $matches[1] ) ) {
                        return null;
                }
 
diff --git 
a/extensions/Wikibase/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
 
b/extensions/Wikibase/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
index d7084b9..035a916 100644
--- 
a/extensions/Wikibase/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
+++ 
b/extensions/Wikibase/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
@@ -5,6 +5,7 @@
 use LogicException;
 use PHPUnit_Framework_TestCase;
 use Title;
+use ValueFormatters\FormatterOptions;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
@@ -16,6 +17,8 @@
  * @covers Wikibase\Lib\EntityIdLinkFormatter
  *
  * @group Wikibase
+ * @group ValueFormatters
+ * @group DataValueExtensions
  * @group WikibaseLib
  * @group EntityIdFormatterTest
  *
@@ -28,11 +31,11 @@
                return array(
                        'ItemId' => array(
                                new ItemId( 'Q23' ),
-                               '[[ITEM-TEST--Q23|Q23]]'
+                               '[[ITEM-TEST--Q23]]'
                        ),
                        'PropertyId' => array(
                                new PropertyId( 'P23' ),
-                               '[[PROPERTY-TEST--P23|P23]]'
+                               '[[PROPERTY-TEST--P23]]'
                        ),
                );
        }
@@ -58,7 +61,8 @@
                }
        }
 
-       private function newEntityIdLinkFormatter() {
+       protected function newEntityIdLinkFormatter() {
+               $options = new FormatterOptions();
                $titleLookup = $this->getMock( 
'Wikibase\Lib\Store\EntityTitleLookup' );
                $titleLookup->expects( $this->any() )->method( 'getTitleForId' )
                        ->will( $this->returnCallback( array( $this, 
'getTitleForId' ) ) );
diff --git 
a/extensions/Wikibase/lib/tests/phpunit/parsers/PhpDateTimeParserTest.php 
b/extensions/Wikibase/lib/tests/phpunit/parsers/PhpDateTimeParserTest.php
index ad63be6..0f9f825 100644
--- a/extensions/Wikibase/lib/tests/phpunit/parsers/PhpDateTimeParserTest.php
+++ b/extensions/Wikibase/lib/tests/phpunit/parsers/PhpDateTimeParserTest.php
@@ -137,6 +137,8 @@
                                array( '+0000000000000111-07-04T00:00:00Z' ),
                        '4th July 1' =>
                                array( '+0000000000000001-07-04T00:00:00Z' ),
+                       '12.Jun.10x' =>
+                               array( '+0000000000000010-06-12T00:00:00Z' ),
 
                        // More than 4 digit years
                        '4th July 10000' =>
@@ -265,6 +267,7 @@
                        '1980+3',
                        '1980+x',
                        'x',
+                       'x x x',
                        'zz',
                        'America/New_York'
                );
diff --git a/extensions/Wikibase/repo/i18n/en.json 
b/extensions/Wikibase/repo/i18n/en.json
index 416d3d3..2ef6536 100644
--- a/extensions/Wikibase/repo/i18n/en.json
+++ b/extensions/Wikibase/repo/i18n/en.json
@@ -341,6 +341,7 @@
        "wikibase-item-summary-wbsetaliases-add-remove": "Added and removed 
[$2] {{PLURAL:$1|alias|aliases}}",
        "wikibase-item-summary-wbsetaliases-add": "Added [$2] 
{{PLURAL:$1|alias|aliases}}",
        "wikibase-item-summary-wbsetaliases-remove": "Removed [$2] 
{{PLURAL:$1|alias|aliases}}",
+       "wikibase-item-summary-wbsetlabeldescriptionaliases": "Changed [$2] 
label, description and aliases",
        "wikibase-item-summary-wbsetsitelink-add": "Added link to [$2]",
        "wikibase-item-summary-wbsetsitelink-add-both": "Added link with badges 
to [$2]",
        "wikibase-item-summary-wbsetsitelink-set": "Changed link to [$2]",
@@ -393,6 +394,7 @@
        "wikibase-property-summary-wbsetaliases-add-remove": "Added and removed 
[$2] {{PLURAL:$1|alias|aliases}}",
        "wikibase-property-summary-wbsetaliases-add": "Added [$2] 
{{PLURAL:$1|alias|aliases}}",
        "wikibase-property-summary-wbsetaliases-remove": "Removed [$2] 
{{PLURAL:$1|alias|aliases}}",
+       "wikibase-property-summary-wbsetlabeldescriptionaliases": "Changed [$2] 
label, description and aliases",
        "wikibase-property-summary-wbsetclaim-update": "Changed 
{{PLURAL:$3|claim|claims}}",
        "wikibase-property-summary-wbsetclaim-create": "Created 
{{PLURAL:$3|claim|claims}}",
        "wikibase-property-summary-wbsetclaim-update-qualifiers": "Changed 
{{PLURAL:$4|one qualifier|$4 qualifiers}} of {{PLURAL:$3|claim|claims}}",
diff --git a/extensions/Wikibase/repo/i18n/qqq.json 
b/extensions/Wikibase/repo/i18n/qqq.json
index 8f1178e..248f76d 100644
--- a/extensions/Wikibase/repo/i18n/qqq.json
+++ b/extensions/Wikibase/repo/i18n/qqq.json
@@ -363,6 +363,7 @@
        "wikibase-item-summary-wbsetaliases-add-remove": "{{wikibase summary 
messages|item|Automatic edit summary when adding and removing item aliases. A 
user can be in edit mode for aliases and can remove one or more aliases, while 
adding others in the same edit.}}",
        "wikibase-item-summary-wbsetaliases-add": "{{wikibase summary 
messages|item|Automatic edit summary when adding one or more aliases.}}",
        "wikibase-item-summary-wbsetaliases-remove": "{{wikibase summary 
messages|item|Automatic edit summary when a user removes one or more 
aliases.}}",
+       "wikibase-item-summary-wbsetlabeldescriptionaliases": "{{wikibase 
summary messages|item|Automatic edit summary generated when editing an item 
label, description and aliases. Example of a full edit summary is \"Changed 
[en] label, description and aliases: Label, Description, Alias 1, Alias 2\".}}",
        "wikibase-item-summary-wbsetsitelink-add": "{{wikibase summary 
messages|sitelinks|Automatic edit summary (autocomment) when adding a language 
link. Such a summary could appear in English as \"Added link to [itwiki]:  
Italia\".}}",
        "wikibase-item-summary-wbsetsitelink-add-both": "{{wikibase summary 
messages|sitelinks|Automatic edit summary (autocomment) when adding a language 
link with badges. Such a summary could appear in English as \"Added link to 
[itwiki]:  Italia, Q2, Q3\".}}",
        "wikibase-item-summary-wbsetsitelink-set": "{{doc-important|Translate 
this as \"Changed link which points to <nowiki>[$2]</nowiki>\".}}\n{{wikibase 
summary messages|sitelinks|Automatic edit summary (autocomment) when editing a 
language link. Such a summary could appear in English as \"Changed link to 
[itwiki]:  Italia\".}}",
@@ -415,6 +416,7 @@
        "wikibase-property-summary-wbsetaliases-add-remove": "Automatic edit 
summary when adding and removing property aliases. A user can be in edit mode 
for aliases and can remove one or more aliases, while adding others in the same 
edit.\n\nParameters:\n* $1 - the number of aliases added/removed\n* $2 - the 
language code of the item page",
        "wikibase-property-summary-wbsetaliases-add": "Automatic edit summary 
when adding an alias(es) for a property. Parameters:\n* $1 - the number of 
aliases that were added\n* $2 - the language code for the item page",
        "wikibase-property-summary-wbsetaliases-remove": "Automatic edit 
summary when a user removes one or more aliases from a property. Parameters:\n* 
$1 - the number of aliases that were removed\n* $2 - the language code for the 
item page",
+       "wikibase-property-summary-wbsetlabeldescriptionaliases": "{{wikibase 
summary messages|item|Automatic edit summary generated when editing an property 
label, description and aliases. Example of a full edit summary is \"Changed 
[en] label, description and aliases: Label, Description, Alias 1, Alias 2\".}}",
        "wikibase-property-summary-wbsetclaim-update": "Automatic edit summary 
generated when modifying a claim using setclaim. Parameters:\n* $3 - number of 
claims changed.\n{{related|Wikibase-property-summary-wbsetclaim}}",
        "wikibase-property-summary-wbsetclaim-create": "Automatic edit summary 
generated when creating a new claim using setclaim. Parameters:\n* $3 - number 
of claims changed.\n{{related|Wikibase-property-summary-wbsetclaim}}",
        "wikibase-property-summary-wbsetclaim-update-qualifiers": "Automatic 
edit summary generated when modifying the qualifiers of a claim using setclaim. 
Parameters:\n* $3 - number of claims changed\n* $4 - number of qualifiers 
changed.\n{{related|Wikibase-property-summary-wbsetclaim}}",
diff --git 
a/extensions/Wikibase/repo/includes/Localizer/MessageParameterFormatter.php 
b/extensions/Wikibase/repo/includes/Localizer/MessageParameterFormatter.php
index 6cd3c75..7d54deb 100644
--- a/extensions/Wikibase/repo/includes/Localizer/MessageParameterFormatter.php
+++ b/extensions/Wikibase/repo/includes/Localizer/MessageParameterFormatter.php
@@ -10,8 +10,8 @@
 use ValueFormatters\ValueFormatter;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\SiteLink;
-use Wikibase\Lib\EntityIdFormatter;
 use Wikibase\Lib\MediaWikiNumberLocalizer;
+use Wikibase\Lib\Store\EntityTitleLookup;
 
 /**
  * ValueFormatter for formatting objects that may be encountered in
@@ -28,9 +28,9 @@
        private $dataValueFormatter;
 
        /**
-        * @var EntityIdFormatter
+        * @var EntityTitleLookup
         */
-       private $entityIdFormatter;
+       private $entityTitleLookup;
 
        /**
         * @var SiteStore
@@ -49,18 +49,18 @@
 
        /**
         * @param ValueFormatter $dataValueFormatter A formatter for turning 
DataValues into wikitext.
-        * @param EntityIdFormatter $entityIdFormatter An entity id formatter 
returning wikitext.
+        * @param EntityTitleLookup $entityTitleLookup
         * @param SiteStore $sites
         * @param Language $language
         */
        public function __construct(
                ValueFormatter $dataValueFormatter,
-               EntityIdFormatter $entityIdFormatter,
+               EntityTitleLookup $entityTitleLookup,
                SiteStore $sites,
                Language $language
        ) {
                $this->dataValueFormatter = $dataValueFormatter;
-               $this->entityIdFormatter = $entityIdFormatter;
+               $this->entityTitleLookup = $entityTitleLookup;
                $this->sites = $sites;
                $this->language = $language;
 
@@ -129,7 +129,13 @@
         * @return string The formatted ID (as a wikitext link).
         */
        private function formatEntityId( EntityId $entityId ) {
-               return $this->entityIdFormatter->formatEntityId( $entityId );
+               // @todo: this should use TitleValue + 
MediaWikiPageLinkRenderer!
+               $title = $this->entityTitleLookup->getTitleForId( $entityId );
+
+               $target = $title->getFullText();
+               $text = wfEscapeWikiText( $entityId->getSerialization() );
+
+               return "[[$target|$text]]";
        }
 
        /**
diff --git a/extensions/Wikibase/repo/includes/WikibaseRepo.php 
b/extensions/Wikibase/repo/includes/WikibaseRepo.php
index 683db98..9f4bacd 100644
--- a/extensions/Wikibase/repo/includes/WikibaseRepo.php
+++ b/extensions/Wikibase/repo/includes/WikibaseRepo.php
@@ -761,7 +761,7 @@
 
                return new MessageParameterFormatter(
                        new DispatchingValueFormatter( $valueFormatters ),
-                       new EntityIdLinkFormatter( 
$this->getEntityTitleLookup() ),
+                       $this->getEntityTitleLookup(),
                        $this->getSiteStore(),
                        $wgLang
                );
diff --git 
a/extensions/Wikibase/repo/includes/specials/SpecialSetLabelDescriptionAliases.php
 
b/extensions/Wikibase/repo/includes/specials/SpecialSetLabelDescriptionAliases.php
index 95ecfe6..d7d2d51 100644
--- 
a/extensions/Wikibase/repo/includes/specials/SpecialSetLabelDescriptionAliases.php
+++ 
b/extensions/Wikibase/repo/includes/specials/SpecialSetLabelDescriptionAliases.php
@@ -4,9 +4,11 @@
 
 use Html;
 use Language;
+use Wikibase\ChangeOp\ChangeOp;
 use Wikibase\ChangeOp\ChangeOpException;
 use Wikibase\ChangeOp\FingerprintChangeOpFactory;
 use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Term\Fingerprint;
 use Wikibase\DataModel\Term\FingerprintProvider;
 use Wikibase\Lib\ContentLanguages;
 use Wikibase\Repo\WikibaseRepo;
@@ -239,7 +241,7 @@
        }
 
        /**
-        * @param string $languageCode
+        * @param string|null $languageCode
         *
         * @return bool
         */
@@ -252,52 +254,19 @@
         *
         * @param Entity $entity
         *
-        * @return Summary[]|bool
+        * @return Summary|bool
         */
        protected function modifyEntity( Entity $entity ) {
-               $fingerprint = $entity->getFingerprint();
-               $changeOpFactory = $this->changeOpFactory;
-               $changeOps = array();
+               $changeOps = $this->getChangeOps( $entity->getFingerprint() );
 
-               if ( $this->label !== '' ) {
-                       $changeOps[] = $changeOpFactory->newSetLabelOp(
-                               $this->languageCode,
-                               $this->label
-                       );
-               } elseif ( $fingerprint->hasLabel( $this->languageCode ) ) {
-                       $changeOps[] = $changeOpFactory->newRemoveLabelOp(
-                               $this->languageCode
-                       );
-               }
-
-               if ( $this->description !== '' ) {
-                       $changeOps[] = $changeOpFactory->newSetDescriptionOp(
-                               $this->languageCode,
-                               $this->description
-                       );
-               } elseif ( $fingerprint->hasDescription( $this->languageCode ) 
) {
-                       $changeOps[] = $changeOpFactory->newRemoveDescriptionOp(
-                               $this->languageCode
-                       );
-               }
-
-               if ( !empty( $this->aliases ) ) {
-                       $changeOps[] = $changeOpFactory->newSetAliasesOp(
-                               $this->languageCode,
-                               $this->aliases
-                       );
-               } elseif ( $fingerprint->hasAliasGroup( $this->languageCode ) ) 
{
-                       $changeOps[] = $changeOpFactory->newRemoveAliasesOp(
-                               $this->languageCode,
-                               $fingerprint->getAliasGroup( 
$this->languageCode )->getAliases()
-                       );
-               }
-
+               $summary = false;
                $success = true;
 
-               foreach ( $changeOps as $changeOp ) {
+               foreach ( $changeOps as $module => $changeOp ) {
+                       $summary = new Summary( $module );
+
                        try {
-                               $this->applyChangeOp( $changeOp, $entity );
+                               $this->applyChangeOp( $changeOp, $entity, 
$summary );
                        } catch ( ChangeOpException $ex ) {
                                $this->showErrorHTML( $ex->getMessage() );
                                $success = false;
@@ -306,9 +275,81 @@
 
                if ( !$success ) {
                        return false;
+               } elseif ( count( $changeOps ) === 1 ) {
+                       return $summary;
                }
 
-               return new Summary( 'wbeditentity' );
+               return $this->getSummaryForLabelDescriptionAliases();
+       }
+
+       /**
+        * @param Fingerprint $fingerprint
+        *
+        * @return ChangeOp[]
+        */
+       private function getChangeOps( Fingerprint $fingerprint ) {
+               $changeOpFactory = $this->changeOpFactory;
+               $changeOps = array();
+
+               if ( $this->label !== '' ) {
+                       if ( !$fingerprint->hasLabel( $this->languageCode )
+                               || $fingerprint->getLabel( $this->languageCode 
)->getText() !== $this->label
+                       ) {
+                               $changeOps['wbsetlabel'] = 
$changeOpFactory->newSetLabelOp(
+                                       $this->languageCode,
+                                       $this->label
+                               );
+                       }
+               } elseif ( $fingerprint->hasLabel( $this->languageCode ) ) {
+                       $changeOps['wbsetlabel'] = 
$changeOpFactory->newRemoveLabelOp(
+                               $this->languageCode
+                       );
+               }
+
+               if ( $this->description !== '' ) {
+                       if ( !$fingerprint->hasDescription( $this->languageCode 
)
+                               || $fingerprint->getDescription( 
$this->languageCode )->getText() !== $this->description
+                       ) {
+                               $changeOps['wbsetdescription'] = 
$changeOpFactory->newSetDescriptionOp(
+                                       $this->languageCode,
+                                       $this->description
+                               );
+                       }
+               } elseif ( $fingerprint->hasDescription( $this->languageCode ) 
) {
+                       $changeOps['wbsetdescription'] = 
$changeOpFactory->newRemoveDescriptionOp(
+                               $this->languageCode
+                       );
+               }
+
+               if ( !empty( $this->aliases ) ) {
+                       if ( !$fingerprint->hasAliasGroup( $this->languageCode )
+                               || $fingerprint->getAliasGroup( 
$this->languageCode )->getAliases() !== $this->aliases
+                       ) {
+                               $changeOps['wbsetaliases'] = 
$changeOpFactory->newSetAliasesOp(
+                                       $this->languageCode,
+                                       $this->aliases
+                               );
+                       }
+               } elseif ( $fingerprint->hasAliasGroup( $this->languageCode ) ) 
{
+                       $changeOps['wbsetaliases'] = 
$changeOpFactory->newRemoveAliasesOp(
+                               $this->languageCode,
+                               $fingerprint->getAliasGroup( 
$this->languageCode )->getAliases()
+                       );
+               }
+
+               return $changeOps;
+       }
+
+       /**
+        * @return Summary
+        */
+       private function getSummaryForLabelDescriptionAliases() {
+               // FIXME: Introduce more specific messages if only 2 of the 3 
fields changed.
+               $summary = new Summary( 'wbsetlabeldescriptionaliases' );
+               $summary->addAutoSummaryArgs( $this->label, $this->description, 
$this->aliases );
+
+               $summary->setLanguage( $this->languageCode );
+               return $summary;
        }
 
 }
diff --git 
a/extensions/Wikibase/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php
 
b/extensions/Wikibase/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php
index a3bb80a..08e4ada 100644
--- 
a/extensions/Wikibase/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php
+++ 
b/extensions/Wikibase/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php
@@ -5,14 +5,14 @@
 use DataValues\DataValue;
 use DataValues\DecimalValue;
 use Language;
-use PHPUnit_Framework_TestCase;
 use Site;
 use SiteStore;
+use Title;
 use ValueFormatters\ValueFormatter;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\SiteLink;
-use Wikibase\Lib\EntityIdFormatter;
+use Wikibase\Lib\Store\EntityTitleLookup;
 use Wikibase\Repo\Localizer\MessageParameterFormatter;
 
 /**
@@ -25,7 +25,7 @@
  * @licence GNU GPL v2+
  * @author Daniel Kinzler
  */
-class MessageParameterFormatterTest extends PHPUnit_Framework_TestCase {
+class MessageParameterFormatterTest extends \PHPUnit_Framework_TestCase {
 
        public function formatProvider() {
                $decimal = new DecimalValue( '+123.456' );
@@ -38,7 +38,7 @@
                        'float en' => array( 123.456, 'en', '123.456' ),
                        'float de' => array( 123.456, 'de', '123,456' ),
                        'DecimalValue en' => array( $decimal, 'en', 
'DataValues\DecimalValue:+123.456' ),
-                       'EntityId' => array( $entityId, 'en', '[[ENTITYID]]' ),
+                       'EntityId' => array( $entityId, 'en', '[[Q123|Q123]]' ),
                        'SiteLink' => array( $siteLink, 'en', 
'[http://acme.com/Foo acme:Foo]' ),
                        'list of floats' => array( array( 1.2, 0.5 ), 'en', 
'1.2, 0.5' ),
                );
@@ -50,7 +50,7 @@
        public function testFormat( $param, $lang, $expected ) {
                $formatter = new MessageParameterFormatter(
                        $this->getMockValueFormatter(),
-                       $this->getMockIdFormatter(),
+                       $this->getMockTitleLookup(),
                        $this->getMockSitesTable(),
                        Language::factory( $lang )
                );
@@ -79,15 +79,15 @@
        }
 
        /**
-        * @return EntityIdFormatter
+        * @return EntityTitleLookup
         */
-       private function getMockIdFormatter() {
-               $mock = $this->getMock( 'Wikibase\Lib\EntityIdFormatter' );
+       private function getMockTitleLookup() {
+               $mock = $this->getMock( 'Wikibase\Lib\Store\EntityTitleLookup' 
);
                $mock->expects( $this->any() )
-                       ->method( 'formatEntityId' )
+                       ->method( 'getTitleForId' )
                        ->will( $this->returnCallback(
                                function ( EntityId $id ) {
-                                       return '[[ENTITYID]]';
+                                       return Title::makeTitle( NS_MAIN, 
$id->getSerialization() );
                                }
                        ) );
 
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 86c90e8..ff25f42 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1328,14 +1328,8 @@
         "version_normalized": "dev-wmf/1.25wmf22",
         "source": {
             "type": "git",
-            "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-            "reference": "7d3a0b11d0321ff09fde1b5692599860fea6496c"
-        },
-        "dist": {
-            "type": "zip",
-            "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/7d3a0b11d0321ff09fde1b5692599860fea6496c";,
-            "reference": "7d3a0b11d0321ff09fde1b5692599860fea6496c",
-            "shasum": ""
+            "url": 
"https://git.wikimedia.org/git/mediawiki/extensions/Wikibase.git";,
+            "reference": "c42291f422f391dd14388859caf39857e80a4959"
         },
         "require": {
             "data-values/common": "~0.2.0",
@@ -1362,9 +1356,9 @@
         "conflict": {
             "mediawiki/mediawiki": "<1.23"
         },
-        "time": "2015-03-25 00:03:14",
+        "time": "2015-03-25 14:50:27",
         "type": "mediawiki-extension",
-        "installation-source": "dist",
+        "installation-source": "source",
         "autoload": {
             "files": [
                 "Wikibase.composer.php"
@@ -1385,7 +1379,6 @@
                 "Wikibase\\Repo\\View\\": "repo/includes/View"
             }
         },
-        "notification-url": "https://packagist.org/downloads/";,
         "license": [
             "GPL-2.0+"
         ],
@@ -1402,6 +1395,10 @@
             "wikibaselib",
             "wikibaserepo",
             "wikidata"
-        ]
+        ],
+        "support": {
+            "issues": "https://bugzilla.wikimedia.org/";,
+            "irc": "irc://irc.freenode.net/wikidata"
+        }
     }
 ]

-- 
To view, visit https://gerrit.wikimedia.org/r/199617
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d8e0019e11674ffbe1ca62b337c5f41b61b4e6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: wmf/1.25wmf22
Gerrit-Owner: Aude <aude.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to