Last modified: 2011-01-25 00:12:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T23136, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 21136 - Index page not recorded as a dependency when using ProofreadPages
Index page not recorded as a dependency when using ProofreadPages
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ProofreadPage (Other open bugs)
unspecified
All All
: Normal blocker with 1 vote (vote)
: ---
Assigned To: ThomasV
:
Depends on:
Blocks: 21653
  Show dependency treegraph
 
Reported: 2009-10-14 11:07 UTC by Ralf Schmitt
Modified: 2011-01-25 00:12 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Ralf Schmitt 2009-10-14 11:07:34 UTC
I'm trying to get the collection extension working on wikisource. I've found the following problem:


mediawiki's api.php does not return the index pages used for rendering the pages tags.

e.g. the following snippet on  http://de.wikisource.org/

<pages index="Beim Bau der chinesischen Mauer" from="Kafka Beim Bau der Chinesischen Mauer 074.jpg" to="Kafka Beim Bau der Chinesischen Mauer 076.jpg" />

uses the page  http://de.wikisource.org/wiki/Index:Beim_Bau_der_chinesischen_Mauer

which isn't returned by api.php as one of the pages used.
Comment 1 ThomasV 2009-11-18 16:59:48 UTC
that is normal.
this bit of code does not use the index page, but subpages linked from the index.
afaik these subpages should be counted as dependencies.
Comment 2 Ralf Schmitt 2009-11-18 19:18:05 UTC
(In reply to comment #1)
> that is normal.
> this bit of code does not use the index page, but subpages linked from the
> index.

I disagree. If you delete that index page, the above snippet renders as an error message.
Note that when expanding a #ifexist template as in "{{#ifexist:Foo|yes|no}}", the page "Foo" is also returned as a dependency (if it exists).

> afaik these subpages should be counted as dependencies.
> 

I think the subpages are already returned as dependencies (but I might be wrong, don't quite remember it)
Comment 3 ThomasV 2009-11-27 12:55:48 UTC
I assume you are talking about the list of templates returned by ?action=parse (please confirm)

The pages are returned as dependencies, and the index page is not in the list of templates.

Is this the reason why the <pages /> tag is not evaluated in the Collection extension ?
Comment 4 Ralf Schmitt 2009-11-27 13:32:46 UTC
(In reply to comment #3)
> I assume you are talking about the list of templates returned by ?action=parse
> (please confirm)
> 

Here is the exact api.php call we make:
,----
| % curl 'http://de.wikisource.org/w/api.php?redirects=1&tllimit=500&format=json&rvprop=ids&prop=revisions|templates|images&titles=Benutzer:Schmir&action=query&imlimit=500'
| {"query":{"pages":{"194920":{"pageid":194920,"ns":2,"title":"Benutzer:Schmir","revisions":[{"revid":874475,"parentid":874468}],"templates":[{"ns":8,"title":"MediaWiki:Proofreadpage pagenum template"},{"ns":10,"title":"Vorlage:Center"},{"ns":102,"title":"Seite:Kafka Beim Bau der Chinesischen Mauer 074.jpg"},{"ns":102,"title":"Seite:Kafka Beim Bau der Chinesischen Mauer 075.jpg"},{"ns":102,"title":"Seite:Kafka Beim Bau der Chinesischen Mauer 076.jpg"}]}}}}
`----

This is for my user page which contains the following:

,----
| <pages index="Beim Bau der chinesischen Mauer" from="Kafka Beim Bau der Chinesischen Mauer 074.jpg" to="Kafka Beim Bau der Chinesischen Mauer 076.jpg" />
`----

> The pages are returned as dependencies, and the index page is not in the list
> of templates.
> 
> Is this the reason why the <pages /> tag is not evaluated in the Collection
> extension ?
> 

It's the reason why we can't even start to implement it.


Comment 5 ThomasV 2010-06-19 09:06:08 UTC
I understand that I should try to include the index page as a dependency, just as in the #ifexist parser hook. 

So I looked at #ifexist. Here is an example :

http://fr.wikisource.org/wiki/Utilisateur:ThomasV/test2

And here is the corresponding API request : 

http://fr.wikisource.org/w/api.php?redirects=1&tllimit=500&format=jsonfm&rvprop=ids&prop=revisions|templates|images&titles=User:ThomasV/test2&action=query&imlimit=500

As you can see, the API does not return the first part of the #ifexist as a dependency. So for me it is not clear what you want me to do...
Comment 6 ThomasV 2010-06-19 09:12:21 UTC
...although it is returned as a "link" if you add "links" to your API request : 

http://fr.wikisource.org/w/api.php?redirects=1&tllimit=500&format=jsonfm&rvprop=ids&prop=revisions|templates|links&titles=User:ThomasV/test2&action=query&imlimit=500

...but you are not doing that ; you seem to be requesting templates, not links.
Comment 7 Ralf Schmitt 2010-06-21 10:37:04 UTC
yes, you're right about the current #ifexist behaviour. I probably was mistaken about that (or the behaviour changed). I am very sorry about that.

Anyway, the index page is being used to generate the output just like all the other pages, which are returned as a dependency.
Comment 8 ThomasV 2010-06-21 12:38:36 UTC
"As a dependency" is not clear. Do you need the index page to be returned as a link or as a template ? here are two patches : the first one returns it as a link, the second one as a template. Please tell me which one you need.


Index: ProofreadPage.php
===================================================================
--- ProofreadPage.php	(révision 67856)
+++ ProofreadPage.php	(copie de travail)
@@ -745,6 +745,7 @@
 	if( ! $index_title || ! $index_title->exists() ) {
 		return '<strong class="error">' . wfMsgForContent( 'proofreadpage_nosuch_index' ) . '</strong>';
 	}
+	$parser->mOutput->addLink( $index_title, $index_title->getArticleID() );
 
 	$out = '';


Index: ProofreadPage.php
===================================================================
--- ProofreadPage.php	(révision 68350)
+++ ProofreadPage.php	(copie de travail)
@@ -745,6 +745,7 @@
 	if( ! $index_title || ! $index_title->exists() ) {
 		return '<strong class="error">' . wfMsgForContent( 'proofreadpage_nosuch_index' ) . '</strong>';
 	}
+	$parser->mOutput->addTemplate( $index_title, $index_title->getArticleID(), $index_title->getLatestRevID() );
 
 	$out = '';
Comment 9 Ralf Schmitt 2010-06-21 19:01:51 UTC
we would need the second one
Comment 10 ThomasV 2010-06-22 08:58:45 UTC
commited, see r68394
Comment 11 Ralf Schmitt 2010-06-22 09:14:56 UTC
thanks.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links