本文整理汇总了PHP中OC\Files\Storage\Storage::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::getId方法的具体用法?PHP Storage::getId怎么用?PHP Storage::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\Storage\Storage
的用法示例。
在下文中一共展示了Storage::getId方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(\OC\Files\Storage\Storage $storage)
{
$this->storage = $storage;
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
$this->cacheActive = !Config::getSystemValue('filesystem_cache_readonly', false);
}
示例2: __construct
public function __construct(\OC\Files\Storage\Storage $storage)
{
$this->storage = $storage;
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
$this->permissionsCache = $storage->getPermissionsCache();
}
示例3: __construct
/**
* @param \OC\Files\Storage\Storage|string $storage
* @throws \RuntimeException
*/
public function __construct($storage)
{
if ($storage instanceof \OC\Files\Storage\Storage) {
$this->storageId = $storage->getId();
} else {
$this->storageId = $storage;
}
$this->storageId = self::adjustStorageId($this->storageId);
$sql = 'SELECT `numeric_id` FROM `*PREFIX*storages` WHERE `id` = ?';
$result = \OC_DB::executeAudited($sql, array($this->storageId));
if ($row = $result->fetchRow()) {
$this->numericId = $row['numeric_id'];
} else {
$connection = \OC_DB::getConnection();
if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId])) {
$this->numericId = \OC_DB::insertid('*PREFIX*storages');
} else {
$result = \OC_DB::executeAudited($sql, array($this->storageId));
if ($row = $result->fetchRow()) {
$this->numericId = $row['numeric_id'];
} else {
throw new \RuntimeException('Storage could neither be inserted nor be selected from the database');
}
}
}
}
示例4: __construct
/**
* @param \OC\Files\Storage\Storage|string $storage
*/
public function __construct($storage)
{
if ($storage instanceof \OC\Files\Storage\Storage) {
$this->storageId = $storage->getId();
} else {
$this->storageId = $storage;
}
}
示例5: __construct
/**
* @param \OC\Files\Storage\Storage|string $storage
*/
public function __construct($storage)
{
if ($storage instanceof \OC\Files\Storage\Storage) {
$this->storageId = $storage->getId();
} else {
$this->storageId = $storage;
}
if (strlen($this->storageId) > 64) {
$this->storageId = md5($this->storageId);
}
$this->storageCache = new Storage($storage);
}
示例6: __construct
/**
* @param \OC\Files\Storage\Storage|string $storage
*/
public function __construct($storage)
{
if ($storage instanceof \OC\Files\Storage\Storage) {
$this->storageId = $storage->getId();
} else {
$this->storageId = $storage;
}
if (strlen($this->storageId) > 64) {
$this->storageId = md5($this->storageId);
}
$this->storageCache = new Storage($storage);
$this->mimetypeLoader = \OC::$server->getMimeTypeLoader();
}
示例7: getStorageId
/**
* @return string
*/
public function getStorageId() {
if (!$this->storageId) {
if (is_null($this->storage)) {
$storage = $this->createStorage(); //FIXME: start using exceptions
if (is_null($storage)) {
return null;
}
$this->storage = $storage;
}
$this->storageId = $this->storage->getId();
if (strlen($this->storageId) > 64) {
$this->storageId = md5($this->storageId);
}
}
return $this->storageId;
}
示例8: __construct
/**
* @param \OC\Files\Storage\Storage|string $storage
*/
public function __construct($storage)
{
if ($storage instanceof \OC\Files\Storage\Storage) {
$this->storageId = $storage->getId();
} else {
$this->storageId = $storage;
}
$this->storageId = self::adjustStorageId($this->storageId);
$sql = 'SELECT `numeric_id` FROM `*PREFIX*storages` WHERE `id` = ?';
$result = \OC_DB::executeAudited($sql, array($this->storageId));
if ($row = $result->fetchRow()) {
$this->numericId = $row['numeric_id'];
} else {
$sql = 'INSERT INTO `*PREFIX*storages` (`id`) VALUES(?)';
\OC_DB::executeAudited($sql, array($this->storageId));
$this->numericId = \OC_DB::insertid('*PREFIX*storages');
}
}
示例9: __construct
/**
* @param \OC\Files\Storage\Storage|string $storage
*/
public function __construct($storage)
{
if ($storage instanceof \OC\Files\Storage\Storage) {
$this->storageId = $storage->getId();
} else {
$this->storageId = $storage;
}
if (strlen($this->storageId) > 64) {
$this->storageId = md5($this->storageId);
}
$query = \OC_DB::prepare('SELECT `numeric_id` FROM `*PREFIX*storages` WHERE `id` = ?');
$result = $query->execute(array($this->storageId));
if ($row = $result->fetchRow()) {
$this->numericId = $row['numeric_id'];
} else {
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*storages`(`id`) VALUES(?)');
$query->execute(array($this->storageId));
$this->numericId = \OC_DB::insertid('*PREFIX*storages');
}
}
示例10: __construct
/**
* @param \OC\Files\Storage\Storage|string $storage
* @param bool $isAvailable
* @throws \RuntimeException
*/
public function __construct($storage, $isAvailable = true)
{
if ($storage instanceof \OC\Files\Storage\Storage) {
$this->storageId = $storage->getId();
} else {
$this->storageId = $storage;
}
$this->storageId = self::adjustStorageId($this->storageId);
if ($row = self::getStorageById($this->storageId)) {
$this->numericId = $row['numeric_id'];
} else {
$connection = \OC_DB::getConnection();
if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $isAvailable])) {
$this->numericId = \OC_DB::insertid('*PREFIX*storages');
} else {
if ($row = self::getStorageById($this->storageId)) {
$this->numericId = $row['numeric_id'];
} else {
throw new \RuntimeException('Storage could neither be inserted nor be selected from the database');
}
}
}
}
示例11: getId
/**
* Get the identifier for the storage,
* the returned id should be the same for every storage object that is created with the same parameters
* and two storage objects with the same id should refer to two storages that display the same files.
*
* @return string
*/
public function getId()
{
return $this->storage->getId();
}
示例12: getNumericId
/**
* get the numeric storage id
*
* @param \OC\Files\Storage\Storage $storage
* @return int
*/
function getNumericId($storage)
{
$storageId = $storage->getId();
if (!isset($this->numericIds[$storageId])) {
$cache = $storage->getCache();
$this->numericIds[$storageId] = $cache->getNumericStorageId();
}
return $this->numericIds[$storageId];
}