public function getInfo($refresh = false, $history = null)
	{
		if ($refresh) { // We want to query the API
			// Specify relevant file properties to retrieve
			$data = array(
				'titles' => 'File:' . $this->filename,
				'prop' => 'info|imageinfo',
				'iiprop' => 'bitdepth|canonicaltitle|comment|parsedcomment|'
				          . 'commonmetadata|metadata|extmetadata|mediatype|'
				          . 'mime|thumbmime|sha1|size|timestamp|url|user|userid',
				'intoken' => 'edit',
			);
			// Add optional history parameters
			if (is_array($history)) {
				foreach ($history as $key => $val) {
					$data[$key] = $val;
				}
				// Retrieve archive name property as well
				$data['iiprop'] .= '|archivename';
			}

			$r = $this->wikimate->query($data); // Run the query

			// Check for errors
			if (isset($r['error'])) {
				$this->error = $r['error']; // Set the error if there was one
				return null;
			} else {
				$this->error = null; // Reset the error status
			}

			// Get the page (there should only be one)
			$page = array_pop($r['query']['pages']);
			unset($r, $data);

			// Abort if invalid file title
			if (isset($page['invalid'])) {
				$this->invalid = true;
				return null;
			}

			$this->edittoken = $page['edittoken'];

			// Check that file is present and has info
			if (!isset($page['missing']) && isset($page['imageinfo'])) {
				// Update the existence if the file is there
				$this->exists = true;
				// Put the content into info & history
				$this->info    = $page['imageinfo'][0];
				$this->history = $page['imageinfo'];
			}
			unset($page);
		}

		return $this->info; // Return the info in any case
	}
public function getInfo($refresh = false, $history = null)
	{
		if ($refresh) { // We want to query the API
			// Specify relevant file properties to retrieve
			$data = array(
				'titles' => 'File:' . $this->filename,
				'prop' => 'info|imageinfo',
				'iiprop' => 'bitdepth|canonicaltitle|comment|parsedcomment|'
				          . 'commonmetadata|metadata|extmetadata|mediatype|'
				          . 'mime|thumbmime|sha1|size|timestamp|url|user|userid',
				'intoken' => 'edit',
			);
			// Add optional history parameters
			if (is_array($history)) {
				foreach ($history as $key => $val) {
					$data[$key] = $val;
				}
				// Retrieve archive name property as well
				$data['iiprop'] .= '|archivename';
			}

			$r = $this->wikimate->query($data); // Run the query

			// Check for errors
			if (isset($r['error'])) {
				$this->error = $r['error']; // Set the error if there was one
				return null;
			} else {
				$this->error = null; // Reset the error status
			}

			// Get the page (there should only be one)
			$page = array_pop($r['query']['pages']);
			unset($r, $data);

			// Abort if invalid file title
			if (isset($page['invalid'])) {
				$this->invalid = true;
				return null;
			}

			$this->edittoken = $page['edittoken'];

			// Check that file is present and has info
			if (!isset($page['missing']) && isset($page['imageinfo'])) {
				// Update the existence if the file is there
				$this->exists = true;
				// Put the content into info & history
				$this->info    = $page['imageinfo'][0];
				$this->history = $page['imageinfo'];
			}
			unset($page);
		}

		return $this->info; // Return the info in any case
	}
public function getInfo ( $ refresh = false , $ history = null ) { if ( $ refresh ) { // We want to query the API // Specify relevant file properties to retrieve $ data = array ( 'titles' => 'File:' . $ this -> filename , 'prop' => 'info|imageinfo' , 'iiprop' => 'bitdepth|canonicaltitle|comment|parsedcomment|' . 'commonmetadata|metadata|extmetadata|mediatype|' . 'mime|thumbmime|sha1|size|timestamp|url|user|userid' , 'intoken' => 'edit' , ) ; // Add optional history parameters if ( is_array ( $ history ) ) { foreach ( $ history as $ key => $ val ) { $ data [ $ key ] = $ val ; } // Retrieve archive name property as well $ data [ 'iiprop' ] .= '|archivename' ; } $ r = $ this -> wikimate -> query ( $ data ) ; // Run the query // Check for errors if ( isset ( $ r [ 'error' ] ) ) { $ this -> error = $ r [ 'error' ] ; // Set the error if there was one return null ; } else { $ this -> error = null ; // Reset the error status } // Get the page (there should only be one) $ page = array_pop ( $ r [ 'query' ] [ 'pages' ] ) ; unset ( $ r , $ data ) ; // Abort if invalid file title if ( isset ( $ page [ 'invalid' ] ) ) { $ this -> invalid = true ; return null ; } $ this -> edittoken = $ page [ 'edittoken' ] ; // Check that file is present and has info if ( ! isset ( $ page [ 'missing' ] ) && isset ( $ page [ 'imageinfo' ] ) ) { // Update the existence if the file is there $ this -> exists = true ; // Put the content into info & history $ this -> info = $ page [ 'imageinfo' ] [ 0 ] ; $ this -> history = $ page [ 'imageinfo' ] ; } unset ( $ page ) ; } return $ this -> info ; // Return the info in any case }
Gets the information of the file. If refresh is true,
then this method will query the wiki API again for the file details.

@param   boolean  $refresh  True to query the wiki API again
@param   array    $history  An optional array of revision history parameters
@return  mixed              The info of the file (array), or null if error
Gets the information of the file . If refresh is true then this method will query the wiki API again for the file details .