&$skin: Skin object
'BeforeParserFetchFileAndTitle': before an image is rendered by Parser
-&$parser: Parser object
-&$nt: the image title
+$parser: Parser object
+$nt: the image title
&$time: the image timestamp (use '0' to force a broken thumbnail)
&$sha1: image base 36 sha1 (used to specify the file, $nt will be ignored if this is set)
&$descQuery: query string to add to thumbnail URL
'BeforeParserFetchTemplateAndtitle': before a template is fetched by Parser
-&$parser: Parser object
-&$title: title of the template
+$parser: Parser object
+$title: title of the template
&$skip: skip this template and link it?
&$id: the id of the revision being parsed
# Give extensions a chance to select the file revision for us
$time = $sha1 = false;
wfRunHooks( 'BeforeParserFetchFileAndTitle',
- array( $this->mParser, &$nt, &$time, &$sha1, &$descQuery ) );
+ array( $this->mParser, $nt, &$time, &$sha1, &$descQuery ) );
# Fetch and register the file (file title may be different via hooks)
list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $time, $sha1 );
} else {
* Get the templates used on this page
*
* @return Array (namespace => dbKey => revId)
+ * @since 1.18
*/
public function getTemplateIds() {
return $this->mTemplateIds;
* Get the files used on this page
*
* @return Array (dbKey => array('time' => MW timestamp or null, 'sha1' => sha1 or ''))
+ * @since 1.18
*/
public function getImageTimeKeys() {
return $this->mImageTimeKeys;
# Give extensions a chance to select the file revision for us
$time = $sha1 = $descQuery = false;
wfRunHooks( 'BeforeParserFetchFileAndTitle',
- array( $this, &$nt, &$time, &$sha1, &$descQuery ) );
+ array( $this, $nt, &$time, &$sha1, &$descQuery ) );
# Fetch and register the file (file title may be different via hooks)
list( $file, $nt ) = $this->fetchFileAndTitle( $nt, $time, $sha1 );
# Cloak with NOPARSE to avoid replacement in replaceExternalLinks
# Give extensions a chance to select the revision instead
$id = false; # Assume current
wfRunHooks( 'BeforeParserFetchTemplateAndtitle',
- array( $parser, &$title, &$skip, &$id ) );
+ array( $parser, $title, &$skip, &$id ) );
if ( $skip ) {
$text = false;
} else { // get by (name,timestamp)
$file = wfFindFile( $title, array( 'time' => $time ) );
}
- $time = $file ? $file->getTimestamp() : null;
- $sha1 = $file ? $file->getSha1() : null;
+ $time = $file ? $file->getTimestamp() : false;
+ $sha1 = $file ? $file->getSha1() : false;
# Register the file as a dependency...
$this->mOutput->addImage( $title->getDBkey(), $time, $sha1 );
if ( $file && !$title->equals( $file->getTitle() ) ) {
# Give extensions a chance to select the file revision for us
$time = $sha1 = $descQuery = false;
wfRunHooks( 'BeforeParserFetchFileAndTitle',
- array( $this, &$title, &$time, &$sha1, &$descQuery ) );
+ array( $this, $title, &$time, &$sha1, &$descQuery ) );
# Fetch and register the file (file title may be different via hooks)
list( $file, $title ) = $this->fetchFileAndTitle( $title, $time, $sha1 );
}
/**
+ * Register a file dependency for this output
* @param $name string Title dbKey
- * @param $timestamp string MW timestamp of file creation
- * @param $sha string base 36 SHA-1 of file
+ * @param $timestamp string MW timestamp of file creation (or false if non-existing)
+ * @param $sha string base 36 SHA-1 of file (or false if non-existing)
* @return void
*/
function addImage( $name, $timestamp = null, $sha1 = null ) {
$this->mImages[$name] = 1;
- $this->mImageTimeKeys[$name] = array( 'time' => $timestamp, 'sha1' => $sha1 );
+ if ( $timestamp !== null && $sha1 !== null ) {
+ $this->mImageTimeKeys[$name] = array( 'time' => $timestamp, 'sha1' => $sha1 );
+ }
}
/**
+ * Register a template dependency for this output
* @param $title Title
* @param $page_id
* @param $rev_id