> On Feb 16, 2017, at 8:10 PM, Brion Vibber <[email protected]> wrote:
> 
> On Wed, Feb 15, 2017 at 11:37 AM Tom Bishop, Wenlin Institute <
> [email protected]> wrote:
> 
>> Hello,
>> 
>> When ImportDump.php is run, PageContentSaveComplete hooks are not called,
>> unless I'm mistaken.
>> 
>> Is this true, and if so, is it by design, or an oversight?
> 
> 
> My recollection is that this was deliberate; an import is like a restore of
> a deleted page in that saving is something that happened in the past,
> somewhere else.
> 
> 
>> How could one make sure that a task gets done whenever a page is created or
>> modified through the browser, the api, or ImportDump.php? Would some other
>> hook be more suitable for that?
> 
> 
> 
> There is the RevisionInsertComplete hook if you're looking to perform an
> action on every revision insertion, which may do the job depending on what
> you need, but doesn't distinguish between filling in old versions and
> updating the current version of a page; if that doesn't look like it'll do
> what you need can you describe the use case for the extension a bit?

The extension hooks PageContentSaveComplete to update custom database tables 
that enable indexing and listing pages in special ways. (For example, some 
pages are dictionary entries describing Chinese characters, and the tables 
support listing all the characters containing a given component, ordered by 
frequency of usage.) Only the current revision of a page should be indexed in 
this way.

The page contents sometimes originate in non-wiki contexts, and they can be 
conveniently added to the wiki in batches of various sizes (hundreds of pages, 
or hundreds of thousands) by wrapping them in xml and then using 
ImportDump.php. However, every time we import a batch, currently we have to run 
another script to re-index the entire namespace, since ImportDump.php doesn't 
call PageContentSaveComplete.

Maybe RevisionInsertComplete would serve our purpose. When we import a page 
with ImportDump.php, we're always making it the current revision. Our hook 
might need to know whether it's being called by ImportDump.php then, to avoid 
indexing non-current revisions. I'll study it.

Thank you very much for your help!

Best wishes,

Tom

Wenlin Institute, Inc. SPC (a Social Purpose Corporation)
文林研究所社会目的公司
Software for Learning Chinese
E-mail: [email protected]     Web: http://www.wenlin.com
Telephone: 1-877-4-WENLIN (1-877-493-6546)
☯



_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to