Thcipriani has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/336917 )
Change subject: Fix remaining undefined index notices ...................................................................... Fix remaining undefined index notices Since the removal of error supression the notices of undefined indecies in this skin have been many. This should continue the work done previously to squelch remaining undefined index notices. Bug: T157619 Change-Id: I9d098389285d8a8d7927e6bbfb2e0b42844a7dd1 (cherry picked from commit 96b0ddfc5941187cec883c6e6597139ab8bc73dc) --- M SkinCologneBlue.php 1 file changed, 78 insertions(+), 30 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/CologneBlue refs/changes/17/336917/1 diff --git a/SkinCologneBlue.php b/SkinCologneBlue.php index ece6172..9b2ba42 100644 --- a/SkinCologneBlue.php +++ b/SkinCologneBlue.php @@ -168,23 +168,38 @@ $element = array(); $editLinkMessage = $this->getSkin()->getTitle()->exists() ? 'editthispage' : 'create-this-page'; - $element[] = $this->processBottomLink( 'edit', $content_nav['views']['edit'], $editLinkMessage ); - $element[] = $this->processBottomLink( - 'viewsource', - $content_nav['views']['viewsource'], - 'viewsource' - ); - $element[] = $this->processBottomLink( - 'watch', - $content_nav['actions']['watch'], - 'watchthispage' - ); - $element[] = $this->processBottomLink( - 'unwatch', - $content_nav['actions']['unwatch'], - 'unwatchthispage' - ); + if ( isset( $content_nav['views']['edit'] ) ) { + $element[] = $this->processBottomLink( + 'edit', + $content_nav['views']['edit'], + $editLinkMessage + ); + } + + if ( isset( $content_nav['views']['viewsource'] ) ) { + $element[] = $this->processBottomLink( + 'viewsource', + $content_nav['views']['viewsource'], + 'viewsource' + ); + } + + if ( isset( $content_nav['actions']['watch'] ) ) { + $element[] = $this->processBottomLink( + 'watch', + $content_nav['actions']['watch'], + 'watchthispage' + ); + } + + if ( isset( $content_nav['actions']['unwatch'] ) ) { + $element[] = $this->processBottomLink( + 'unwatch', + $content_nav['actions']['unwatch'], + 'unwatchthispage' + ); + } $element[] = $this->talkLink(); @@ -193,7 +208,10 @@ $element[] = $this->processBottomLink( 'whatlinkshere', $toolbox['whatlinkshere'] ); $element[] = $this->processBottomLink( 'recentchangeslinked', $toolbox['recentchangeslinked'] ); - $element[] = $this->processBottomLink( 'contributions', $toolbox['contributions'] ); + if ( isset( $toolbox['contributions'] ) ) { + $element[] = $this->processBottomLink( 'contributions', $toolbox['contributions'] ); + } + if ( isset( $toolbox['emailuser'] ) ) { $element[] = $this->processBottomLink( 'emailuser', $toolbox['emailuser'] ); } @@ -203,11 +221,14 @@ // Second row. Privileged actions. $element = array(); - $element[] = $this->processBottomLink( - 'delete', - $content_nav['actions']['delete'], - 'deletethispage' - ); + if ( isset( $content_nav['actions']['delete'] ) ) { + $element[] = $this->processBottomLink( + 'delete', + $content_nav['actions']['delete'], + 'deletethispage' + ); + } + if ( isset( $content_nav['actions']['undelete'] ) ) { $element[] = $this->processBottomLink( 'undelete', @@ -232,7 +253,13 @@ ); } - $element[] = $this->processBottomLink( 'move', $content_nav['actions']['move'], 'movethispage' ); + if ( isset( $content_nav['actions']['move'] ) ) { + $element[] = $this->processBottomLink( + 'move', + $content_nav['actions']['move'], + 'movethispage' + ); + } $lines[] = $this->getSkin()->getLanguage()->pipeList( array_filter( $element ) ); @@ -485,20 +512,38 @@ // $...['namespaces']['talk'] together serve the same purpose. We also // don't use $...['variants'], these are displayed in the top menu. $content_navigation = $this->data['content_navigation']; + + $content_navigation_overrides = array(); + + foreach ( + array( + array('views', 'history'), + array('actions', 'watch'), + array('actions', 'unwatch'), + ) as $key ) { + if ( isset( $content_navigation[$key[0]][$key[1]] ) ) { + $content_navigation_overrides[$key[1]] = $content_navigation[$key[0]][$key[1]]; + } else { + $content_navigation_overrides[$key[1]] = array(); + } + } + $qbpageoptions = array_merge( $content_navigation['namespaces'], - array( - 'history' => $content_navigation['views']['history'], - 'watch' => $content_navigation['actions']['watch'], - 'unwatch' => $content_navigation['actions']['unwatch'], - ) + $content_navigation_overrides ); + $content_navigation['actions']['watch'] = null; $content_navigation['actions']['unwatch'] = null; - $qbEditLinks = [ 'edit' => $content_navigation['views']['edit'] ]; + + if ( isset( $content_navigation['views']['edit'] ) ) { + $qbEditLinks = [ 'edit' => $content_navigation['views']['edit'] ]; + } + if ( isset( $content_navigation['views']['addsection'] ) ) { $qbEditLinks['addsection'] = $content_navigation['views']['addsection']; } + $qbedit = array_merge( $qbEditLinks, $content_navigation['actions'] @@ -583,7 +628,10 @@ $heading = (string)$heading; $portletId = Sanitizer::escapeId( "p-$heading" ); - $headingMsg = wfMessage( $idToMessage[$heading] ? $idToMessage[$heading] : $heading ); + $headingMsg = $heading; + if ( isset( $idToMessage[$heading] ) ) { + $headingMsg = wfMessage( $idToMessage[$heading] ? $idToMessage[$heading] : $heading ); + } $headingHTML = "<h3>"; $headingHTML .= $headingMsg->exists() ? $headingMsg->escaped() -- To view, visit https://gerrit.wikimedia.org/r/336917 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9d098389285d8a8d7927e6bbfb2e0b42844a7dd1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/CologneBlue Gerrit-Branch: wmf/1.29.0-wmf.11 Gerrit-Owner: Thcipriani <tcipri...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits