Topic on Project:Support desk

Extension ArticlePageDataBefore

3
130.226.249.238 (talkcontribs)

I have a PHP scripts which displays lists of employees on my MediaWiki. I also have a special page, where you can administrate which users are employees, that works very well. However when you make a backend change on the special page, the change isn't displayed on the wikipage, where it's inserted with a tag, until after you edit that page, and change nothing, and save it.

It can only be because I'm using the wrong hook. I'm trying to use this hook instead, but it doesn't seem to be working: Manual:Hooks/ArticlePageDataBefore

Right now I'm using this hook. Just changing the variable name doesn't work:

$wgHooks['ParserFirstCallInit'][] = 'wfEmployeesParserInit';

// Hook our callback function into the parser
function wfEmployeesParserInit( Parser $parser ) {
  // When the parser sees the <sample> tag, it executes 
  // the wfEmployeesRender function (see below)
  $parser->setHook( 'employees', 'wfEmployeesRender' );
        // Always return true from this function. The return value does not denote
        // success or otherwise have meaning - it just must always be true.
  return true;
}

// Execute 
function wfEmployeesRender( $input, array $args, Parser $parser, PPFrame $frame ) {
    ...
Florianschmidtwelzow (talkcontribs)

That's because, not every time you request a page, it will be parsed :) Parsing takes much recources, so a page normally will be parsed one time and will be cached. If the content doesn't change (or you don't do a fake edit), the users will get the cached version of the page, which is ok, because the content haven't changed :)

As an idea, you could try to change the content of a page (Internal/Employees) with your Extension and include this page into the page where you use the the hook atm ({{Internal/Employees}}.

Ciencia Al Poder (talkcontribs)

I think the page can be reparsed without actually *editing* it, by inserting a Job to do deferred updates for each page using that data, although getting the list of pages using it may not be trivial if your extension doesn't keep track of them in the page props table.

Another simplest way is to disable the parser cache on pages using that extension.

Reply to "Extension ArticlePageDataBefore"