diff options
Diffstat (limited to 'includes/filebackend/TempFSFile.php')
-rw-r--r-- | includes/filebackend/TempFSFile.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/includes/filebackend/TempFSFile.php b/includes/filebackend/TempFSFile.php index 5032bf68..8266e420 100644 --- a/includes/filebackend/TempFSFile.php +++ b/includes/filebackend/TempFSFile.php @@ -37,8 +37,8 @@ class TempFSFile extends FSFile { * Make a new temporary file on the file system. * Temporary files may be purged when the file object falls out of scope. * - * @param $prefix string - * @param $extension string + * @param string $prefix + * @param string $extension * @return TempFSFile|null */ public static function factory( $prefix, $extension = '' ) { @@ -81,31 +81,38 @@ class TempFSFile extends FSFile { /** * Clean up the temporary file only after an object goes out of scope * - * @param $object Object - * @return void + * @param Object $object + * @return TempFSFile This object */ public function bind( $object ) { if ( is_object( $object ) ) { + if ( !isset( $object->tempFSFileReferences ) ) { + // Init first since $object might use __get() and return only a copy variable + $object->tempFSFileReferences = array(); + } $object->tempFSFileReferences[] = $this; } + return $this; } /** * Set flag to not clean up after the temporary file * - * @return void + * @return TempFSFile This object */ public function preserve() { $this->canDelete = false; + return $this; } /** * Set flag clean up after the temporary file * - * @return void + * @return TempFSFile This object */ public function autocollect() { $this->canDelete = true; + return $this; } /** |