Efficient page exists script

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Efficient page exists script

Mike McGrath-2
I'd like to write a script that checks a few pages on my mediawiki
install remotely.  Probably using urlgrabber.  Whats the most efficient
way to determine if a page exists besides just grabbing the page?

    -Mike

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Efficient page exists script

Platonides
Mike McGrath wrote:
> I'd like to write a script that checks a few pages on my mediawiki
> install remotely.  Probably using urlgrabber.  Whats the most efficient
> way to determine if a page exists besides just grabbing the page?
>
>     -Mike

You could ask Special:Export for all pages at once which avoids querying
each one.
If you want to avoid querying page you already have, you can check its
properties before on api.php


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Efficient page exists script

Rob Church
On 16/10/2007, Platonides <[hidden email]> wrote:

> Mike McGrath wrote:
> > I'd like to write a script that checks a few pages on my mediawiki
> > install remotely.  Probably using urlgrabber.  Whats the most efficient
> > way to determine if a page exists besides just grabbing the page?
> >
> >     -Mike
>
> You could ask Special:Export for all pages at once which avoids querying
> each one.
> If you want to avoid querying page you already have, you can check its
> properties before on api.php

Of course, if you're querying multiple pages, then a far more
efficient method is to do a batch check; this would be a very handy
API module to have in core for multiple uses, not least of all
interwiki existence checking[*], and would essentially be a simple
wrapper around a LinkBatch operation.

* = though for Wikimedia sites, we'd probably want the option to query
the database directly


Rob Church

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Efficient page exists script

Mike McGrath-2
Rob Church wrote:

> On 16/10/2007, Platonides <[hidden email]> wrote:
>  
>> Mike McGrath wrote:
>>    
>>> I'd like to write a script that checks a few pages on my mediawiki
>>> install remotely.  Probably using urlgrabber.  Whats the most efficient
>>> way to determine if a page exists besides just grabbing the page?
>>>
>>>     -Mike
>>>      
>> You could ask Special:Export for all pages at once which avoids querying
>> each one.
>> If you want to avoid querying page you already have, you can check its
>> properties before on api.php
>>    
>
> Of course, if you're querying multiple pages, then a far more
> efficient method is to do a batch check; this would be a very handy
> API module to have in core for multiple uses, not least of all
> interwiki existence checking[*], and would essentially be a simple
> wrapper around a LinkBatch operation.
>
> * = though for Wikimedia sites, we'd probably want the option to query
> the database directly
>  

In my case the pages are more codes, there will be thousands of codes,
only a few being checked at a time so an api would be handy.

    -Mike

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Efficient page exists script

Platonides
Mike McGrath wrote:

> Rob Church wrote:
>> Of course, if you're querying multiple pages, then a far more
>> efficient method is to do a batch check; this would be a very handy
>> API module to have in core for multiple uses, not least of all
>> interwiki existence checking[*], and would essentially be a simple
>> wrapper around a LinkBatch operation.
>>
>> * = though for Wikimedia sites, we'd probably want the option to query
>> the database directly
>>  
>
> In my case the pages are more codes, there will be thousands of codes,
> only a few being checked at a time so an api would be handy.
>
>     -Mike

I think you missed that Rob and I were talking about an *existing* api
with which you can do batch queries.
http://www.mediawiki.org/wiki/API


_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l