Cscott has uploaded a new change for review.

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

Change subject: Remove $wgCollectionHierarchyDelimiter workaround.
......................................................................

Remove $wgCollectionHierarchyDelimiter workaround.

This was introduced in r73454 as a hacky workaround for lack of
subpage support in mwlib (see also T31648).  This lack has been
remedied in OCG (see T93008), so this workaround is no longer
required.

This is a breaking change for wikis using non-standard delimiters or
relying on pseudo-subpages without actually setting them as subpages,
but no such wiki is known (for instance Wikibooks uses the delimiter,
but also uses subpages).

This patch was forked from Federico Leva's work in
https://gerrit.wikimedia.org/r/163139, including some of his
improvements to code comments and type safety.

Change-Id: I924743f6afa45430ea6f77ffd96014aa63370a66
---
M Collection.body.php
M Collection.php
M README.rst
3 files changed, 15 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection 
refs/changes/43/197943/1

diff --git a/Collection.body.php b/Collection.body.php
index 5a0b3ae..eaf8771 100644
--- a/Collection.body.php
+++ b/Collection.body.php
@@ -617,7 +617,6 @@
         * @return bool
         */
        static function addArticle( $title, $oldid = 0 ) {
-               global $wgCollectionHierarchyDelimiter;
 
                $latest = $title->getLatestRevID();
 
@@ -653,13 +652,6 @@
                        'url' => $title->getCanonicalURL(),
                        'currentVersion' => $currentVersion,
                );
-
-               if ( $wgCollectionHierarchyDelimiter != null ) {
-                       $parts = explode( $wgCollectionHierarchyDelimiter, 
$prefixedText );
-                       if ( count( $parts ) > 1 && end( $parts ) != '' ) {
-                               $item['displaytitle'] = end( $parts );
-                       }
-               }
 
                $collection['items'][] = $item;
                CollectionSession::setCollection( $collection );
@@ -1004,11 +996,15 @@
        }
 
        /**
-        * @param $collection
-        * @param $referrer Title
-        * @param $writer
+        * Take an array of arrays, each containing information about one item 
to be
+        * assembled and exported, and appropriately feed the backend chosen 
($writer).
+        * @param $collection array following the collection/Metabook 
dictionary formats
+        * 
https://www.mediawiki.org/wiki/Offline_content_generator/metabook.json
+        * https://mwlib.readthedocs.org/en/latest/internals.html#article
+        * @param $referrer Title object, used only to provide a returnto 
parameter.
+        * @param $writer A writer registered in the appropriate configuration.
         */
-       function renderCollection( $collection, $referrer, $writer ) {
+       function renderCollection( $collection, Title $referrer, $writer ) {
                if ( !$writer ) {
                        $writer = 'rl';
                }
@@ -1198,8 +1194,11 @@
        }
 
        /**
-        * @param $title Title
+        * Render a single page: fetch page name and revision information, then
+        * assemble and feed to renderCollection() a single-item $collection.
+        * @param $title Title needs to be full page name aka prefixed title.
         * @param $oldid int
+        * @param $writer A writer registered in the appropriate configuration.
         * @return array|null
         */
        function makeCollection( $title, $oldid ) {
diff --git a/Collection.php b/Collection.php
index 1c683ff..ff659a5 100644
--- a/Collection.php
+++ b/Collection.php
@@ -58,10 +58,6 @@
 /** PEM-encoded SSL certificate for the mw-serve render server to pass to CURL 
*/
 $wgCollectionMWServeCert = null;
 
-/** if not null, treat this string as hierarchy delimiter in page titles,
- * i.e. support subpages */
-$wgCollectionHierarchyDelimiter = null;
-
 /** Array of namespaces that can be added to a collection */
 $wgCollectionArticleNamespaces = array(
        NS_MAIN,
diff --git a/README.rst b/README.rst
index bd5df0a..2e7066d 100644
--- a/README.rst
+++ b/README.rst
@@ -209,18 +209,9 @@
    i.e. there's one link "Download as PDF".
 
 ``$wgCollectionHierarchyDelimiter`` (string or null)
-   If not null, treat wiki pages whose title contains the configured delimiter
-   as subpages.
-
-   For example, to treat article [[Foo/Bar]] as subpage of article [[Foo]]
-   set this variable to "/". This makes sense e.g. on wikibooks.org, but it's
-   questionable on wikipedia.org (cf. [[AC/DC]]).
-
-   The (only) effect is that the display title for subpages in collections
-   is set to the title of the (deepest) subpage. For example, the title of
-   article [[Foo/Bar]] will be displayed/rendered as "Bar".
-
-   The defaul value is null, which means that no hierarchy is assumed.
+   FEATURE REMOVED 2015-03.
+   Use $wgNamespacesWithSubpages instead. The only accepted delimiter is now
+   the standard slash, "/".
 
 ``$wgCollectionArticleNamespaces`` (array)
    List of namespace numbers for pages which can be added to a collection.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I924743f6afa45430ea6f77ffd96014aa63370a66
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

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

Reply via email to