User "Tim Starling" posted a comment on MediaWiki.r82778.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82778#c15721

Comment:

In EditPage::showEditForm:fields, you should do what you are doing already. Use 
$parser->mOutput->setProperty() in the parser hook, remove the 
ArticleSaveComplete hook, and then load from page_props in the edit page.

To get the properties in SkinTemplateToolboxEnd, you should do the following:

* Hook OutputPageParserOutput. That hook is passed an OutputPage object and a 
ParserOutput object. 
* Get the central wiki pages with $parserOutput->getProperty(), then store them 
into a custom property in the OutputPage object, say

<pre>
$outputPage->interlanguage_pages = $parserOutput->getProperty( 
'interlanguage_pages' );
</pre>

* In SkinTemplateToolboxEnd, you get a Skin object. In 1.17, the OutputPage 
object is just $wgOut, in 1.18 it is $skin->getContext()->getOutput(). You 
should aim for 1.17 compatibility for now, since we want to deploy this soon. 
So check for your custom property with isset() with code like:

<pre>
global $wgOut;
if ( isset( $wgOut->interlanguage_pages ) ) {
    foreach ( $wgOut->interlanguage_page as $title ) {
        ...
    }
}
</pre>

This will work with the parser cache, giving you up to date properties with no 
extra queries.


_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to