Elgg  Version 5.1
ElggTempFile.php
Go to the documentation of this file.
1 <?php
2 
4 
18 class ElggTempFile extends ElggFile {
19 
25  protected function initializeAttributes() {
26  parent::initializeAttributes();
27 
28  $this->attributes['subtype'] = 'temp_file';
29  $this->setFilename(uniqid());
30  }
31 
37  protected function getFilestore(): \Elgg\Filesystem\Filestore\TempDiskFilestore {
38  return _elgg_services()->temp_filestore;
39  }
40 
44  public function transfer(int $owner_guid, string $filename = null): bool {
45  return false;
46  }
47 
51  public function canDownload(int $user_guid = 0, bool $default = false): bool {
52  return false;
53  }
54 
58  public function getDownloadURL(bool $use_cookie = true, string $expires = '+2 hours'): ?string {
59  return '';
60  }
61 
65  public function getInlineURL(bool $use_cookie = false, string $expires = ''): ?string {
66  return '';
67  }
68 
74  public function save(): bool {
75  throw new IOException("Temp files can't be saved to the database");
76  }
77 }
$default
Definition: checkbox.php:30
$user_guid
Definition: login_as.php:10
initializeAttributes()
Set subtype to &#39;temp_file&#39;.
This class represents a physical file (by default in the system temp directory).
canDownload(int $user_guid=0, bool $default=false)
{}
An IO Exception, throw when an IO Exception occurs.
Definition: IOException.php:12
setFilename(string $filename)
Set the filename of this file.
Definition: ElggFile.php:85
$owner_guid
transfer(int $owner_guid, string $filename=null)
{}
getFilestore()
Return the system temp filestore based on the system temp directory.
$expires
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
getDownloadURL(bool $use_cookie=true, string $expires= '+2 hours')
{}
getInlineURL(bool $use_cookie=false, string $expires= '')
{}