42 $this->fileKey = $key;
52 !str_starts_with(
$path, $repoTempPath )
54 wfDebug(
"UploadStash: tried to construct an UploadStashFile "
55 .
"from a file that should already exist at '$path', but path is not valid" );
57 wfMessage(
'uploadstash-bad-path-invalid' )
63 wfDebug(
"UploadStash: tried to construct an UploadStashFile from "
64 .
"a file that should already exist at '$path', but path is not found" );
66 wfMessage(
'uploadstash-file-not-found-not-exists' )
71 parent::__construct(
false,
$repo,
$path,
false );
73 $this->name = basename( $this->path );
99 $path = dirname( $this->path );
100 if ( $thumbName !==
false ) {
101 $path .=
"/$thumbName";
126 private function getSpecialUrl( $subPage ) {
141 wfDebug( __METHOD__ .
" getting for $thumbName" );
143 return $this->getSpecialUrl(
'thumb/' . $this->
getUrlName() .
'/' . $thumbName );
153 if ( !$this->urlName ) {
154 $this->urlName = $this->fileKey;
157 return $this->urlName;
167 if ( !isset( $this->url ) ) {
168 $this->url = $this->getSpecialUrl(
'file/' . $this->
getUrlName() );
192 return $this->fileKey;
199 public function remove() {
200 if ( !$this->repo->fileExists( $this->path ) ) {
205 return $this->repo->freeTemp( $this->path );
209 return $this->repo->fileExists( $this->path );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
resolveVirtualUrl( $url)
Get the backend storage path corresponding to a virtual URL.
fileExists( $file)
Checks existence of a file.
getZonePath( $zone)
Get the storage path corresponding to one of the zones.
static isVirtualUrl( $url)
Determine if a string is an mwrepo:// URL.
validateFilename( $filename)
Determine if a relative path is valid, i.e.
FileRepo LocalRepo ForeignAPIRepo false $repo
Some member variables can be lazy-initialised using __get().
generateThumbName( $name, $params)
Generate a thumbnail file name from a name and specified parameters.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
File without associated database record.
exists()
Returns true if file exists in the repository.
__construct( $repo, $path, $key)
A LocalFile wrapper around a file that has been temporarily stashed, so we can do things like create ...
getThumbPath( $thumbName=false)
Get the path for the thumbnail (actually any transformation of this file) The actual argument is the ...
getDescriptionUrl()
A method needed by the file transforming and scaling routines in File.php We do not necessarily care ...
getUrl()
Return the URL of the file, if for some reason we wanted to download it We tend not to do this for th...
getThumbUrl( $thumbName=false)
Get a URL to access the thumbnail This is required because the model of how files work requires that ...
getFullUrl()
Parent classes use this method, for no obvious reason, to return the path (relative to wiki root,...
getUrlName()
The basename for the URL, which we want to not be related to the filename.
getFileKey()
Getter for file key (the unique id by which this file's location & metadata is stored in the db)
thumbName( $params, $flags=0)
Return the file/url base name of a thumbnail with the specified parameters.