Re: [Wikitech-l] Extension migration: LinksDeletionUpdate is now a subclass of LinksUpdate

2020-07-16 Thread Mark Clements (HappyDog)
Thanks Gergo - that's very helpful.

- Mark

"Gergo Tisza"  wrote in message 
news:caevcxn08n4vu2ssyeatr7jfprhaiohovajpxgorrpgnqgho...@mail.gmail.com...
> On Tue, Jul 14, 2020 at 5:49 PM Mark Clements (HappyDog) <
> gm...@kennel17.co.uk> wrote:
>
>> I have an extension that uses the LinksUpdate hook to re-parse the 
>> article
>> in order to extract meta-data that it then stores in the DB for use
>> elsewhere in the extension.
>> (...)
>> In the light of the above change to the LinksUpdate hook, what changes do
>> I
>> need to make to my extension?  Shall I simply drop the
>> ArticleDeleteComplete
>> hook and update LinksUpdate to check whether an article is deleted or not
>> (how?) to decide which action is required?  Or is there more to it.
>>
>
> That would work; you can check the type of the LinksUpdate object to
> determine what kind of action you are handling.
>
>
>> On a separate note, I also reparse the page when the ArticleUndelete hook
>> is
>> called.  Is this necessary, or is LinksUpdate also being called for
>> undeletes?
>>
>
> LinksUpdate is called when a page has new content that needs to be
> processed for links (or, more generally, metadata), whether it got 
> created,
> edited or restored.
>
>
>> Finally, I do a similar thing in the TitleMoveComplete hook - I reparse
>> both
>> the old article and the new article.  Is this also redundant due to
>> LinksUpdate calls, or not?
>>
>
> LinksUpdate is called in those cases as well.
> ___
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l 




___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Extension migration: LinksDeletionUpdate is now a subclass of LinksUpdate

2020-07-15 Thread Gergo Tisza
On Tue, Jul 14, 2020 at 5:49 PM Mark Clements (HappyDog) <
gm...@kennel17.co.uk> wrote:

> I have an extension that uses the LinksUpdate hook to re-parse the article
> in order to extract meta-data that it then stores in the DB for use
> elsewhere in the extension.
> (...)
> In the light of the above change to the LinksUpdate hook, what changes do
> I
> need to make to my extension?  Shall I simply drop the
> ArticleDeleteComplete
> hook and update LinksUpdate to check whether an article is deleted or not
> (how?) to decide which action is required?  Or is there more to it.
>

That would work; you can check the type of the LinksUpdate object to
determine what kind of action you are handling.


> On a separate note, I also reparse the page when the ArticleUndelete hook
> is
> called.  Is this necessary, or is LinksUpdate also being called for
> undeletes?
>

LinksUpdate is called when a page has new content that needs to be
processed for links (or, more generally, metadata), whether it got created,
edited or restored.


> Finally, I do a similar thing in the TitleMoveComplete hook - I reparse
> both
> the old article and the new article.  Is this also redundant due to
> LinksUpdate calls, or not?
>

LinksUpdate is called in those cases as well.
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

[Wikitech-l] Extension migration: LinksDeletionUpdate is now a subclass of LinksUpdate

2020-07-14 Thread Mark Clements (HappyDog)
Hi there,

From the Release Note for MW 1.33:
(https://www.mediawiki.org/wiki/Release_notes/1.33)

> LinksDeletionUpdate is now a subclass of LinksUpdate. As a consequence,
> the following hooks will now be triggered upon page deletion in addition 
> to page
> updates: LinksUpdateConstructed, LinksUpdate, LinksUpdateComplete.

I have an extension that uses the LinksUpdate hook to re-parse the article 
in order to extract meta-data that it then stores in the DB for use 
elsewhere in the extension.

I use LinksUpdate, rather than ArticleSaveComplete, as I also need to 
re-parse the article when any of its templates changes.  This hook captures 
all changes that affect the page (by my understanding) except - up until 
1.33 - deletions.

I therefore also use the ArticleDeleteComplete hook to remove the article 
from the extension's meta-data tables when the article is deleted.

In the light of the above change to the LinksUpdate hook, what changes do I 
need to make to my extension?  Shall I simply drop the ArticleDeleteComplete 
hook and update LinksUpdate to check whether an article is deleted or not 
(how?) to decide which action is required?  Or is there more to it.

On a separate note, I also reparse the page when the ArticleUndelete hook is 
called.  Is this necessary, or is LinksUpdate also being called for 
undeletes?

Finally, I do a similar thing in the TitleMoveComplete hook - I reparse both 
the old article and the new article.  Is this also redundant due to 
LinksUpdate calls, or not?

Kind regards,

- Mark Clements (HappyDog)




___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l