当前位置: 首页>>代码示例>>PHP>>正文


PHP StorageConfig::setBackendClass方法代码示例

本文整理汇总了PHP中OCA\Files_External\Lib\StorageConfig::setBackendClass方法的典型用法代码示例。如果您正苦于以下问题:PHP StorageConfig::setBackendClass方法的具体用法?PHP StorageConfig::setBackendClass怎么用?PHP StorageConfig::setBackendClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCA\Files_External\Lib\StorageConfig的用法示例。


在下文中一共展示了StorageConfig::setBackendClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: populateStorageConfigWithLegacyOptions

 /**
  * Copy legacy storage options into the given storage config object.
  *
  * @param StorageConfig $storageConfig storage config to populate
  * @param string $mountType mount type
  * @param string $applicable applicable user or group
  * @param array $storageOptions legacy storage options
  *
  * @return StorageConfig populated storage config
  */
 protected function populateStorageConfigWithLegacyOptions(&$storageConfig, $mountType, $applicable, $storageOptions)
 {
     $storageConfig->setBackendClass($storageOptions['class']);
     $storageConfig->setBackendOptions($storageOptions['options']);
     if (isset($storageOptions['mountOptions'])) {
         $storageConfig->setMountOptions($storageOptions['mountOptions']);
     }
     if (isset($storageOptions['priority'])) {
         $storageConfig->setPriority($storageOptions['priority']);
     }
     if ($mountType === \OC_Mount_Config::MOUNT_TYPE_USER) {
         $applicableUsers = $storageConfig->getApplicableUsers();
         if ($applicable !== 'all') {
             $applicableUsers[] = $applicable;
             $storageConfig->setApplicableUsers($applicableUsers);
         }
     } else {
         if ($mountType === \OC_Mount_Config::MOUNT_TYPE_GROUP) {
             $applicableGroups = $storageConfig->getApplicableGroups();
             $applicableGroups[] = $applicable;
             $storageConfig->setApplicableGroups($applicableGroups);
         }
     }
     return $storageConfig;
 }
开发者ID:brunomilet,项目名称:owncloud-core,代码行数:35,代码来源:storagesservice.php

示例2: testDeleteStorage

 public function testDeleteStorage()
 {
     $storage = new StorageConfig(255);
     $storage->setMountPoint('mountpoint');
     $storage->setBackendClass('\\OC\\Files\\Storage\\SMB');
     $storage->setBackendOptions(['password' => 'testPassword']);
     $newStorage = $this->service->addStorage($storage);
     $this->assertEquals(1, $newStorage->getId());
     $newStorage = $this->service->removeStorage(1);
     $caught = false;
     try {
         $this->service->getStorage(1);
     } catch (NotFoundException $e) {
         $caught = true;
     }
     $this->assertTrue($caught);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:17,代码来源:storagesservicetest.php

示例3: testJsonSerialization

 public function testJsonSerialization()
 {
     $storageConfig = new StorageConfig(1);
     $storageConfig->setMountPoint('test');
     $storageConfig->setBackendClass('\\OC\\Files\\Storage\\SMB');
     $storageConfig->setBackendOptions(['user' => 'test', 'password' => 'password123']);
     $storageConfig->setPriority(128);
     $storageConfig->setApplicableUsers(['user1', 'user2']);
     $storageConfig->setApplicableGroups(['group1', 'group2']);
     $storageConfig->setMountOptions(['preview' => false]);
     $json = $storageConfig->jsonSerialize();
     $this->assertEquals(1, $json['id']);
     $this->assertEquals('/test', $json['mountPoint']);
     $this->assertEquals('\\OC\\Files\\Storage\\SMB', $json['backendClass']);
     $this->assertEquals('test', $json['backendOptions']['user']);
     $this->assertEquals('password123', $json['backendOptions']['password']);
     $this->assertEquals(128, $json['priority']);
     $this->assertEquals(['user1', 'user2'], $json['applicableUsers']);
     $this->assertEquals(['group1', 'group2'], $json['applicableGroups']);
     $this->assertEquals(['preview' => false], $json['mountOptions']);
 }
开发者ID:samj1912,项目名称:repo,代码行数:21,代码来源:storageconfigtest.php

示例4: update

 /**
  * Update an external storage entry.
  *
  * @param int $id storage id
  * @param string $mountPoint storage mount point
  * @param string $backendClass backend class name
  * @param array $backendOptions backend-specific options
  * @param array $mountOptions mount-specific options
  * @param array $applicableUsers users for which to mount the storage
  * @param array $applicableGroups groups for which to mount the storage
  * @param int $priority priority
  *
  * @return DataResponse
  */
 public function update($id, $mountPoint, $backendClass, $backendOptions, $mountOptions, $applicableUsers, $applicableGroups, $priority)
 {
     $storage = new StorageConfig($id);
     $storage->setMountPoint($mountPoint);
     $storage->setBackendClass($backendClass);
     $storage->setBackendOptions($backendOptions);
     $storage->setMountOptions($mountOptions);
     $storage->setApplicableUsers($applicableUsers);
     $storage->setApplicableGroups($applicableGroups);
     $storage->setPriority($priority);
     $response = $this->validate($storage);
     if (!empty($response)) {
         return $response;
     }
     try {
         $storage = $this->service->updateStorage($storage);
     } catch (NotFoundException $e) {
         return new DataResponse(['message' => (string) $this->l10n->t('Storage with id "%i" not found', array($id))], Http::STATUS_NOT_FOUND);
     }
     $this->updateStorageStatus($storage);
     return new DataResponse($storage, Http::STATUS_OK);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:36,代码来源:globalstoragescontroller.php

示例5: testGetStorage

 public function testGetStorage()
 {
     $storageConfig = new StorageConfig(1);
     $storageConfig->setMountPoint('test');
     $storageConfig->setBackendClass('\\OC\\Files\\Storage\\SMB');
     $storageConfig->setBackendOptions(['user' => 'test', 'password', 'password123']);
     $storageConfig->setMountOptions(['priority' => false]);
     $this->service->expects($this->once())->method('getStorage')->with(1)->will($this->returnValue($storageConfig));
     $response = $this->controller->show(1);
     $this->assertEquals(Http::STATUS_OK, $response->getStatus());
     $this->assertEquals($storageConfig, $response->getData());
 }
开发者ID:samj1912,项目名称:repo,代码行数:12,代码来源:storagescontrollertest.php


注:本文中的OCA\Files_External\Lib\StorageConfig::setBackendClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。