public function renameFile(StorageFacilityParams $params, StorageFacilityFile &$file, $newfileid)
    {
        $this->validateFileID($newfileid);

        if ($file->getId() == null)
            throw new StorageFacilityException("Invalid fileid '".$file->getId()."'");

        if ($this->fileExists($params, $newfileid))
            throw new StorageFacilityException("New file already exists '".$newfileid."'");

        if (!$this->fileExists($params, $file->getId()))
            throw new StorageFacilityException("File does not exist '".$file->getId()."'");

        if (!@rename($this->generateStoragePath($params, $file->getId()),
                $this->generateStoragePath($params, $newfileid)))
            throw new StorageFacilityException("Could not rename file '".$file->getId()."'");

        $file->setId($newfileid);
        $file->setUrl($this->generateUrl($params, $newfileid));
    }
public function renameFile(StorageFacilityParams $params, StorageFacilityFile &$file, $newfileid)
    {
        $this->validateFileID($newfileid);

        if ($file->getId() == null)
            throw new StorageFacilityException("Invalid fileid '".$file->getId()."'");

        if ($this->fileExists($params, $newfileid))
            throw new StorageFacilityException("New file already exists '".$newfileid."'");

        if (!$this->fileExists($params, $file->getId()))
            throw new StorageFacilityException("File does not exist '".$file->getId()."'");

        if (!@rename($this->generateStoragePath($params, $file->getId()),
                $this->generateStoragePath($params, $newfileid)))
            throw new StorageFacilityException("Could not rename file '".$file->getId()."'");

        $file->setId($newfileid);
        $file->setUrl($this->generateUrl($params, $newfileid));
    }
public function renameFile ( StorageFacilityParams $ params , StorageFacilityFile & $ file , $ newfileid ) { $ this -> validateFileID ( $ newfileid ) ; if ( $ file -> getId ( ) == null ) throw new StorageFacilityException ( "Invalid fileid '" . $ file -> getId ( ) . "'" ) ; if ( $ this -> fileExists ( $ params , $ newfileid ) ) throw new StorageFacilityException ( "New file already exists '" . $ newfileid . "'" ) ; if ( ! $ this -> fileExists ( $ params , $ file -> getId ( ) ) ) throw new StorageFacilityException ( "File does not exist '" . $ file -> getId ( ) . "'" ) ; if ( ! @ rename ( $ this -> generateStoragePath ( $ params , $ file -> getId ( ) ) , $ this -> generateStoragePath ( $ params , $ newfileid ) ) ) throw new StorageFacilityException ( "Could not rename file '" . $ file -> getId ( ) . "'" ) ; $ file -> setId ( $ newfileid ) ; $ file -> setUrl ( $ this -> generateUrl ( $ params , $ newfileid ) ) ; }
Renames a StorageFacilityFile in the storage facility.

@param Site   $site      Site used to determine storage location
@param string &$file     File identifier of stored file, ex. /path/to/file.ext
@param string $newfileid File identifier to rename to

@return StorageFacilityFile Fully-resolved and stored file, has URL and id
set appropriately to reference the stored file later
@throws StorageFacilityException if operation fails
Renames a StorageFacilityFile in the storage facility .