44 $this->fileKey = $key;
48 if ( FileRepo::isVirtualUrl(
$path ) ) {
55 !str_starts_with(
$path, $repoTempPath )
57 wfDebug(
"UploadStash: tried to construct an UploadStashFile "
58 .
"from a file that should already exist at '$path', but path is not valid" );
60 wfMessage(
'uploadstash-bad-path-invalid' )
66 wfDebug(
"UploadStash: tried to construct an UploadStashFile from "
67 .
"a file that should already exist at '$path', but path is not found" );
69 wfMessage(
'uploadstash-file-not-found-not-exists' )
76 $this->name = basename( $this->path );
87 $this->sha1 = parent::getSha1();
115 $path = dirname( $this->path );
116 if ( $thumbName !==
false ) {
117 $path .=
"/$thumbName";
142 private function getSpecialUrl( $subPage ) {
157 wfDebug( __METHOD__ .
" getting for $thumbName" );
159 return $this->getSpecialUrl(
'thumb/' . $this->
getUrlName() .
'/' . $thumbName );
169 if ( !$this->urlName ) {
170 $this->urlName = $this->fileKey;
173 return $this->urlName;
183 if ( $this->url ===
null ) {
184 $this->url = $this->getSpecialUrl(
'file/' . $this->
getUrlName() );
208 return $this->fileKey;
215 public function remove() {
216 if ( !$this->repo->fileExists( $this->path ) ) {
221 return $this->repo->freeTemp( $this->path );
226 return $this->repo->fileExists( $this->path );
231class_alias( UploadStashFile::class,
'UploadStashFile' );
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.
Parent class for all special pages.
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,...