schema31/php-gcloud-storage-sdk

该包的最新版本(1.1.48)没有可用的许可信息。

1.1.48 2020-11-01 09:40 UTC

This package is auto-updated.

Last update: 2024-08-29 05:24:59 UTC


README

用于与 gCloud Storage 交互的 PHP 类

目前实现了以下方法:sendFile(), sendMultipleFiles(), detailFile(), getFile(), streamFile(), deleteFile() 和 getShortUrl().

使用参考

类: gCloud_Storage

属性

  • repositoryName : 要交互的仓库名称
  • Authentication : 与 gCloud Storage 交互的安全密钥
  • LastError : 如果设置,则包含 gCloud Storage 返回的最后一个错误消息
  • maxAutoRetry : 指定在出现错误时尝试执行请求操作的次数(默认 = 1)
  • autoRetrySleep : 在 'autoRetry' 的情况下,指定尝试之间等待的时间(以微秒为单位)(默认 = 1 秒)
  • ResponseBody : REST 调用的响应
  • ResponseStatus : REST 调用的状态码

方法

  • sendFile($localFile = NULL, $mime = self::DEFAULT_MIME_TYPE, $publicName = NULL, $fileKey = NULL)

    该函数将服务器本地文件系统中名为 $localFile 的文件,类型为(可选)$mime,发送到 gCloud Storage。默认情况下,将文件名 "invia" 作为 gCloud Storage 的文件名,但可以通过设置 $publicName 来阻止这种行为。此外,如果我们在更新一个已存在的文档而不是上传一个新的文档,我们将发送参考文档的 $fileKey。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • sendMultipleFiles($localFiles = array(), $fileKey = NULL) {

    该函数将服务器本地文件系统中存在的 N 个文件发送到,这些文件作为参数在一个数组中接收,每个元素具有以下键

    • 'path'(文件本地路径)
    • 'publicName'(文件名)
    • 'mime'(文件 mime 类型)建议仅使用该函数来允许执行链式调用,在其中第一个执行的插件需要并行处理多个文件。与 'sendFile' 函数一样,可以传递一个有效的 fileKey 作为第二个参数,以更新已存在的文档。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • detailFile($fileKey = NULL, $fileVersion = NULL, $chain = NULL, $subFile = NULL)

    该函数返回有关指定文件的详细信息。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • getFile($fileKey = NULL, $fileVersion = NULL, $chain = NULL, $subFile = NULL, $pluginParameters = array(), $byteRangeStart = NULL, $byteRangeEnd = NULL)

    该函数返回 gCloud Storage 上存在 $fileKey 的文件。函数返回包含文件内容的二进制字符串。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • streamFile($fileKey = NULL, $fileVersion = NULL, $chain = NULL, $subFile = NULL, $pluginParameters = array(), $byteRangeStart = NULL, $byteRangeEnd = NULL, $callBackFunction = NULL)

    该函数执行文件输出,同时设置必要的 HTTP 标头。

     E' possibile indicare un metodo di callbak per gestire in maniera personalizzata lo 
    

    文件内容的流。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • getShortUrl($fileKey = NULL, $fileVersion = NULL, $expiresAt = NULL, $whitelist = NULL)

    该函数返回直接访问存储在私有仓库中的文件的链接。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • deleteFile($fileKey = NULL, $fileVersion = NULL)

    该函数删除 gCloud Storage 上存在 $fileKey 的文件。函数返回包含已删除文件详细信息的对象。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • detailRepository()

     Questa funzione ritorna i dettagli su un dato repository.
    

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • getResourcesList($offset = NULL, $limit = NULL, $sortBy = NULL, $getVersions = NULL, $isDeleted = NULL, $fileName = NULL)

     Questa funzione ritorna l'elenco dei file in un dato repository.
    

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

     Le proprietà:
         - $offset e $limit consentono di indicare l'intervallo di selezione.
         - $sortBy consente di indicare il criterio di ordinamento
         - $getVersions consente di indicare se ritornare anche le versioni 'precedenti' per la stessa fileKey o solamente l'ultima
         - $isDeleted consente di indicare se ritornare i file validi o quelli cancellati
         - $fileName consente di indicare un filtro di ricerca basato sul nome del file
    
  • undeleteFile($fileKey = NULL, $fileVersion = NULL)

    该函数允许恢复先前删除的文件。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。

  • editFile($fileKey = NULL, $fileVersion = NULL, $fileName = NULL, $fileMimeType = NULL)

    此功能允许您修改文件的名称或MIME类型。

    该函数假定已经正确设置了类的 $repositoryName 和 $Authentication 属性。