Mollywhite has uploaded a new change for review.

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


Change subject: Change the default value of $wgBookManagerv2NavigationNamespaces
......................................................................

Change the default value of $wgBookManagerv2NavigationNamespaces

The default value of $wgBookManagerv2NavigationNamespaces was "null",
which meant that it would default to $wgContentNamespaces. I've now
changed the default value of this variable to $wgContentNamespaces,
which I feel is clearer.

Change-Id: I7bde1ed08d11c55368ecd654e555d0f88633c4d2
---
M BookManagerv2.hooks.php
M BookManagerv2.php
2 files changed, 7 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BookManagerv2 
refs/changes/15/79015/1

diff --git a/BookManagerv2.hooks.php b/BookManagerv2.hooks.php
index d38c12d..3c3a5d2 100644
--- a/BookManagerv2.hooks.php
+++ b/BookManagerv2.hooks.php
@@ -232,13 +232,13 @@
                } else if ( $year && $month && !$day ) {
                        $ts = $yearStr . $monthStr . "01000000";
                        $format = $wgLang->getDateFormatString( 'monthonly',
-                               $wgUser->getDatePreference() ?: 'default' );
+                               $wgUser->getDatePreference() ? : 'default' );
                        $date = $wgLang->sprintfDate( $format, $ts );
                        $datetime = $yearStr . "-" . $monthStr;
                } else {
                        $ts = $yearStr . $monthStr . $dayStr . "000000";
                        $format = $wgLang->getDateFormatString( 'date',
-                               $wgUser->getDatePreference() ?: 'default' );
+                               $wgUser->getDatePreference() ? : 'default' );
                        $date = $wgLang->sprintfDate( $format, $ts );
                        $datetime = $yearStr . "-" . $monthStr . "-" . $dayStr;
                }
@@ -369,22 +369,15 @@
         * block.
         */
        public static function onBeforePageDisplay( OutputPage &$out, Skin 
&$skin ) {
-               global $wgContentNamespaces, 
$wgBookManagerv2NavigationNamespaces,
+               global $wgBookManagerv2NavigationNamespaces,
                        $wgBookManagerv2Metadata, $wgBookManagerv2ChapterList,
                        $wgBookManagerv2PrevNext, $wgBookManagerv2JsonFrontend;
 
-               // Navbars will be added to namespaces in the
-               // $wgBookManagerv2NavigationNamespaces array if it's set, 
otherwise
-               // the $wgContentNamespaces
-               if ( is_array( $wgBookManagerv2NavigationNamespaces ) ) {
-                       $navigationNamespaces = 
$wgBookManagerv2NavigationNamespaces;
-               } else {
-                       $navigationNamespaces = $wgContentNamespaces;
-               }
+               $navigationNamespaces = $wgBookManagerv2NavigationNamespaces;
 
                if ( $out->getTitle()->inNamespaces( $navigationNamespaces ) ) {
                        if ( $out->getRevisionId() !== null ) {
-                               global $wgContLang, 
$wgBookManagerv2ExampleNavigation, $wgMemc; 
+                               global $wgContLang, 
$wgBookManagerv2ExampleNavigation, $wgMemc;
                                $categories = $out->getCategories();
                                $namespace = $wgContLang->convertNamespace( 
NS_BOOK ) . ":";
                                $out->addModuleStyles( "ext.BookManagerv2" );
@@ -425,7 +418,7 @@
                                if ( $wgBookManagerv2PrevNext ) {
                                        $currentPageNumber = null;
                                        foreach ( $jsonBook->sections as $key 
=> $val ) {
-                                               // Find the entry that 
corresponds to this page                                         
+                                               // Find the entry that 
corresponds to this page
                                                if ( $val->link === 
$currentPageTitle ) {
                                                        $currentPageNumber = 
$key;
                                                        // If this isn't the 
first section, set previous link
diff --git a/BookManagerv2.php b/BookManagerv2.php
index 57a1b90..c7a3f15 100644
--- a/BookManagerv2.php
+++ b/BookManagerv2.php
@@ -161,7 +161,7 @@
  * namespaces. Otherwise, the navigation bars are added to the
  * namespaces in this array.
  */
-$wgBookManagerv2NavigationNamespaces = null;
+$wgBookManagerv2NavigationNamespaces = $wgContentNamespaces;
 
 /**
  * @var bool

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bde1ed08d11c55368ecd654e555d0f88633c4d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BookManagerv2
Gerrit-Branch: master
Gerrit-Owner: Mollywhite <[email protected]>

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

Reply via email to