1

We are using a MediaWiki 1.23.3 at work, and most of our pages need to be updated with fresh new data very often.

I'm wondering if there is a way to automatically show a text/template in the header of every page after "n" days from the last update, to alert the user that data in the page can be outdated and should be checked.

Any ideas?

1

An ArticleViewHeader hook maybe?

$wgHooks['ArticleViewHeader'][] = function ( &$article, &$outputDone, &$pcache ) {
    $lastUpdate = new DateTime( $article->getTimestamp() );
    $cutoff = new DateTime( "-$n days" );
    if (  $lastUpdate < $cutoff ) {
        $article->getContext()->getOutput()->addHTML(
            Html::element( 'div', [ 'class' => 'outdated-warning' ],
                "boo I'm old" );
        );
    }
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.