Page MenuHomePhabricator

Moved ArticleSave hook breaks backward compatibility
Closed, DeclinedPublic

Description

Author: jlerner

Description:
The ArticleSave hook has been moved to WikiPage, along with the doEdit() method. Any code that depends upon the first hook argument ($this) will fail, as $this now is a WikiPage object (instead of an Article object).

Not sure what can or should be done about this, apart from updating the release notes as well as http://www.mediawiki.org/wiki/Manual:Hooks/ArticleSave.


Version: 1.18.x
Severity: normal

Details

Reference
bz32318

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:58 PM
bzimport set Reference to bz32318.

Looks like we need to at least get something in the release notes about this one. Josh, which methods of the Article object are you counting on in your extensions?

jlerner wrote:

Just Article::getContent() - updated that bit to $wikipage->mLastRevision->mText.

(In reply to comment #1)

Looks like we need to at least get something in the release notes about this
one. Josh, which methods of the Article object are you counting on in your
extensions?

Notes changed in r102565.

Most function calls are b/c.

(In reply to comment #3)

Most function calls are b/c.

$ grep 'public function ' includes/Article.php | sed 's/(.*g' | sort > 1.txt
$ grep 'public function ' includes/WikiPage.php | sed 's/(.*
g' | sort > 2.txt
$ diff -u 1.txt 2.txt | grep ^- | wc -l
50
$ wc -l 1.txt 2.txt

57 1.txt
64 2.txt

When there are 57 public functions and 50 of them are not in the WikiPage class (as the above shows), how does that reflect "most functions are b/c"?

(In reply to comment #4)

(In reply to comment #3)

Most function calls are b/c.

$ grep 'public function ' includes/Article.php | sed 's/(.*g' | sort > 1.txt
$ grep 'public function ' includes/WikiPage.php | sed 's/(.*
g' | sort > 2.txt
$ diff -u 1.txt 2.txt | grep ^- | wc -l
50
$ wc -l 1.txt 2.txt

57 1.txt
64 2.txt

When there are 57 public functions and 50 of them are not in the WikiPage class
(as the above shows), how does that reflect "most functions are b/c"?

I said "Most function calls are b/c" not "Most function are b/c". Extensions tended to be using the backend functions (which are in WikiPage). getContent()/fetchContent() were the important edge case functions (mixing UI and backend) and were not moved to WikiPage. A few callers had to be updated. Also see http://www.mediawiki.org/wiki/Special:Code/MediaWiki/91123#c22036 .

Also, it makes sense that most (50/57) of the functions in Article now are not in WikiPage, as the vast majority of WikiPage functions were moved there *from* Article.

Aaron, could you update the release notes for 1.18, then either change the target milestone, or mark "WONTFIX"?

More notes added in r103215. Closed.