Extension migration: LinksDeletionUpdate is now a subclass of LinksUpdate

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

Extension migration: LinksDeletionUpdate is now a subclass of LinksUpdate

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
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Extension migration: LinksDeletionUpdate is now a subclass of LinksUpdate

Gergo Tisza
On Tue, Jul 14, 2020 at 5:49 PM Mark Clements (HappyDog) <
[hidden email]> 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
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Extension migration: LinksDeletionUpdate is now a subclass of LinksUpdate

Mark Clements (HappyDog)
Thanks Gergo - that's very helpful.

- Mark

"Gergo Tisza" <[hidden email]> wrote in message
news:[hidden email]...

> On Tue, Jul 14, 2020 at 5:49 PM Mark Clements (HappyDog) <
> [hidden email]> 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
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l 




_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l