jenkins-bot has submitted this change and it was merged.

Change subject: do null check for invalid site, instead of false
......................................................................


do null check for invalid site, instead of false

if an invalid site, then null is returned and check for it here.

Change-Id: I1b32a7f5ee7c6b2fb3128104ce1fb85f361bad81
---
M repo/includes/specials/SpecialSetSiteLink.php
1 file changed, 6 insertions(+), 5 deletions(-)

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



diff --git a/repo/includes/specials/SpecialSetSiteLink.php 
b/repo/includes/specials/SpecialSetSiteLink.php
index 250b61b9..e372969 100644
--- a/repo/includes/specials/SpecialSetSiteLink.php
+++ b/repo/includes/specials/SpecialSetSiteLink.php
@@ -132,7 +132,7 @@
         * @return bool
         */
        private function isValidSiteId( $siteId ) {
-               return $siteId !== null && \Sites::singleton()->getSite( 
$siteId ) !== false;
+               return $siteId !== null && \Sites::singleton()->getSite( 
$siteId ) !== null;
        }
 
        /**
@@ -160,14 +160,14 @@
 
                $site = \Sites::singleton()->getSite( $this->site );
 
-               if ( $this->entityContent !== null && $this->site !== null && 
$site !== false ) {
+               if ( $this->entityContent !== null && $this->site !== null && 
$site !== null ) {
                        return Html::rawElement(
                                'p',
                                array(),
                                $this->msg(
                                        'wikibase-setsitelink-introfull',
                                        
$this->entityContent->getTitle()->getPrefixedText(),
-                                       '[' . \Sites::singleton()->getSite( 
$this->site )->getPageUrl( '' ) . ' ' . $this->site . ']'
+                                       '[' . $site->getPageUrl( '' ) . ' ' . 
$this->site . ']'
                                )->parse()
                        )
                        . Html::input( 'site', $this->site, 'hidden' )
@@ -249,10 +249,11 @@
                $siteObject = \Sites::singleton()->getSite( $site );
                $status = \Status::newGood();
 
-               if ( $siteObject === false ) {
+               if ( $siteObject === null ) {
                        $status->error( 'wikibase-setsitelink-invalid-site', 
$site );
                        return $status;
                }
+
                if ( $siteObject->normalizePageName( $page ) === false && $page 
!== '' ) {
                        $status->error( 'wikibase-error-ui-no-external-page' );
                        return $status;
@@ -270,4 +271,4 @@
                $summary = $this->getSummary( $site, $page, $i18n ); // 
$summary is passed by reference ( &$summary )
                return $status;
        }
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1b32a7f5ee7c6b2fb3128104ce1fb85f361bad81
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to