/**
* The following member variables are not lazy-initialised
*/
- var $repo, $title, $lastError;
+ var $repo, $title, $lastError, $redirected;
/**
* Call this constructor from child classes
/**
* Return the associated title object
- * @public
*/
- function getTitle() { return $this->title; }
+ public function getTitle() { return $this->title; }
/**
* Return the URL of the file
- * @public
*/
- function getUrl() {
+ public function getUrl() {
if ( !isset( $this->url ) ) {
$this->url = $this->repo->getZoneUrl( 'public' ) . '/' . $this->getUrlRel();
}
* @return string
*/
public function getFullUrl() {
- $url = $this->getUrl();
- if( substr( $url, 0, 1 ) == '/' ) {
- global $wgServer;
- return $wgServer . $url;
- }
- return $url;
+ return wfExpandUrl( $this->getUrl() );
}
function getViewURL() {
* or in hashed paths like /images/3/3c.
*
* May return false if the file is not locally accessible.
- *
- * @public
*/
- function getPath() {
+ public function getPath() {
if ( !isset( $this->path ) ) {
$this->path = $this->repo->getZonePath('public') . '/' . $this->getRel();
}
/**
* Alias for getPath()
- * @public
*/
- function getFullPath() {
+ public function getFullPath() {
return $this->getPath();
}
*/
public function getHeight( $page = 1 ) { return false; }
+ /**
+ * Returns ID or name of user who uploaded the file
+ * STUB
+ *
+ * @param $type string 'text' or 'id'
+ */
+ public function getUser( $type='text' ) { return null; }
+
/**
* Get the duration of a media file in seconds
*/
$script = $this->getTransformScript();
if ( $script && !($flags & self::RENDER_NOW) ) {
- // Use a script to transform on client request
+ // Use a script to transform on client request, if possible
$thumb = $this->handler->getScriptedTransform( $this, $script, $params );
- break;
+ if( $thumb ) {
+ break;
+ }
}
$normalisedParams = $params;
$thumbName = $this->thumbName( $normalisedParams );
$thumbPath = $this->getThumbPath( $thumbName );
$thumbUrl = $this->getThumbUrl( $thumbName );
-
+
if ( $this->repo->canTransformVia404() && !($flags & self::RENDER_NOW ) ) {
$thumb = $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
break;
* STUB
* Overridden by LocalFile
*/
- function purgeCache( $archiveFiles = array() ) {}
+ function purgeCache() {}
/**
* Purge the file description page, but don't go after
}
}
+ /**
+ * Return a fragment of the history of file.
+ *
+ * STUB
+ * @param $limit integer Limit of rows to return
+ * @param $start timestamp Only revisions older than $start will be returned
+ * @param $end timestamp Only revisions newer than $end will be returned
+ */
+ function getHistory($limit = null, $start = null, $end = null) {
+ return false;
+ }
+
/**
* Return the history of this file, line by line. Starts with current version,
* then old versions. Should return an object similar to an image/oldimage
* STUB
* Overridden by LocalFile
*/
- function delete( $reason, $suppress=false ) {
+ function delete( $reason ) {
$this->readOnlyError();
}
}
}
+ /**
+ * Get discription of file revision
+ * STUB
+ */
+ function getDescription() {
+ return null;
+ }
+
/**
* Get the 14-character timestamp of the file upload, or false if
* it doesn't exist
}
/**
- * Get an associative array containing information about a file in the local filesystem\
+ * Get an associative array containing information about a file in the local filesystem.
*
* @param string $path Absolute local filesystem path
* @param mixed $ext The file extension, or true to extract it from the filename.
return '';
}
}
+
+ function getRedirected() {
+ return $this->redirected;
+ }
+
+ function redirectedFrom( $from ) {
+ $this->redirected = $from;
+ }
}
/**
* Aliases for backwards compatibility with 1.6