Index: trunk/extensions/LastModified/LastModified.php |
— | — | @@ -69,14 +69,22 @@ |
70 | 70 | |
71 | 71 | $wgLastModifiedRange = isset( $wgLastModifiedRange ) ? (integer) $wgLastModifiedRange : 0; |
72 | 72 | |
73 | | -function fnLastModified() { |
74 | | - global $wgOut, $wgArticle, $wgLastModifiedRange; |
| 73 | +/** |
| 74 | + * @param $out OutputPage |
| 75 | + * @param $sk Skin |
| 76 | + * @return bool |
| 77 | + */ |
| 78 | +function fnLastModified( &$out, &$sk ) { |
| 79 | + global $wgLastModifiedRange; |
75 | 80 | |
76 | | - if ( isset( $wgArticle ) && !empty( $wgArticle ) ){ |
77 | | - $timestamp = $wgArticle->getTimestamp(); |
78 | | - $wgOut->addMeta( 'last-edited', wfTimestamp ( TS_UNIX, $timestamp ) ); |
79 | | - $wgOut->addMeta( 'last-modified-range', $wgLastModifiedRange ); |
80 | | - $wgOut->addModules( 'last.modified' ); |
| 81 | + $context = $out->getContext(); |
| 82 | + $title = $context->getTitle(); |
| 83 | + $article = Article::newFromTitle( $title, $context ); |
| 84 | + if ( $article ){ |
| 85 | + $timestamp = $article->getTimestamp(); |
| 86 | + $out->addMeta( 'last-edited', wfTimestamp ( TS_UNIX, $timestamp ) ); |
| 87 | + $out->addMeta( 'last-modified-range', $wgLastModifiedRange ); |
| 88 | + $out->addModules( 'last.modified' ); |
81 | 89 | } |
82 | 90 | |
83 | 91 | return true; |