本文整理汇总了PHP中OC\Files\View::getUpdater方法的典型用法代码示例。如果您正苦于以下问题:PHP View::getUpdater方法的具体用法?PHP View::getUpdater怎么用?PHP View::getUpdater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\View
的用法示例。
在下文中一共展示了View::getUpdater方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->view = new \OC\Files\View();
$this->view->getUpdater()->disable();
$this->public_share_key_id = Helper::getPublicShareKeyId();
$this->recovery_key_id = Helper::getRecoveryKeyId();
}
示例2: __construct
/**
* @param IConfig $config
* @param View $view
* @param Connection $connection
*/
public function __construct(IConfig $config, View $view, Connection $connection)
{
$this->view = $view;
$this->view->getUpdater()->disable();
$this->connection = $connection;
$this->moduleId = \OCA\Encryption\Crypto\Encryption::ID;
$this->config = $config;
}
示例3: __construct
/**
* @param IConfig $config
* @param View $view
* @param Connection $connection
* @param ILogger $logger
*/
public function __construct(IConfig $config, View $view, Connection $connection, ILogger $logger)
{
$this->view = $view;
$this->view->getUpdater()->disable();
$this->connection = $connection;
$this->moduleId = \OCA\Encryption\Crypto\Encryption::ID;
$this->config = $config;
$this->logger = $logger;
$this->installedVersion = $this->config->getAppValue('files_encryption', 'installed_version', '-1');
}
示例4: getChangePropagator
/**
* @param string $user
* @return \OC\Files\Cache\ChangePropagator
*/
public function getChangePropagator($user)
{
$activeUser = $this->userSession->getUser();
// for the local user we want to propagator from the active view, not any cached one
if ($activeUser && $activeUser->getUID() === $user && Filesystem::getView() instanceof View) {
// it's important that we take the existing propagator here to make sure we can listen to external changes
$this->changePropagators[$user] = Filesystem::getView()->getUpdater()->getPropagator();
}
if (isset($this->changePropagators[$user])) {
return $this->changePropagators[$user];
}
$view = new View('/' . $user . '/files');
$this->changePropagators[$user] = $view->getUpdater()->getPropagator();
return $this->changePropagators[$user];
}
示例5: copy
/**
* Copy a file or folder on storage level
*
* @param View $view
* @param string $source
* @param string $target
* @return bool
*/
private static function copy(View $view, $source, $target)
{
/** @var \OC\Files\Storage\Storage $sourceStorage */
list($sourceStorage, $sourceInternalPath) = $view->resolvePath($source);
/** @var \OC\Files\Storage\Storage $targetStorage */
list($targetStorage, $targetInternalPath) = $view->resolvePath($target);
/** @var \OC\Files\Storage\Storage $ownerTrashStorage */
$result = $targetStorage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
if ($result) {
$view->getUpdater()->update($target);
}
return $result;
}
示例6: move2trash
/**
* move file to the trash bin
*
* @param string $file_path path to the deleted file/directory relative to the files root directory
*/
public static function move2trash($file_path)
{
// get the user for which the filesystem is setup
$root = Filesystem::getRoot();
list(, $user) = explode('/', $root);
$size = 0;
list($owner, $ownerPath) = self::getUidAndFilename($file_path);
$view = new \OC\Files\View('/' . $user);
// file has been deleted in between
if (!$view->file_exists('/files/' . $file_path)) {
return true;
}
self::setUpTrash($user);
if ($owner !== $user) {
// also setup for owner
self::setUpTrash($owner);
}
$path_parts = pathinfo($file_path);
$filename = $path_parts['basename'];
$location = $path_parts['dirname'];
$timestamp = time();
$userTrashSize = self::getTrashbinSize($user);
// disable proxy to prevent recursive calls
$trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp;
/** @var \OC\Files\Storage\Storage $trashStorage */
list($trashStorage, $trashInternalPath) = $view->resolvePath($trashPath);
/** @var \OC\Files\Storage\Storage $sourceStorage */
list($sourceStorage, $sourceInternalPath) = $view->resolvePath('/files/' . $file_path);
try {
$sizeOfAddedFiles = $sourceStorage->filesize($sourceInternalPath);
if ($trashStorage->file_exists($trashInternalPath)) {
$trashStorage->unlink($trashInternalPath);
}
$trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
} catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) {
$sizeOfAddedFiles = false;
if ($trashStorage->file_exists($trashInternalPath)) {
$trashStorage->unlink($trashInternalPath);
}
\OCP\Util::writeLog('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OC_log::ERROR);
}
if ($sourceStorage->file_exists($sourceInternalPath)) {
// failed to delete the original file, abort
$sourceStorage->unlink($sourceInternalPath);
return false;
}
$view->getUpdater()->rename('/files/' . $file_path, $trashPath);
if ($sizeOfAddedFiles !== false) {
$size = $sizeOfAddedFiles;
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`user`) VALUES (?,?,?,?)");
$result = $query->execute(array($filename, $timestamp, $location, $user));
if (!$result) {
\OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR);
}
\OCP\Util::emitHook('\\OCA\\Files_Trashbin\\Trashbin', 'post_moveToTrash', array('filePath' => \OC\Files\Filesystem::normalizePath($file_path), 'trashPath' => \OC\Files\Filesystem::normalizePath($filename . '.d' . $timestamp)));
$size += self::retainVersions($file_path, $filename, $owner, $ownerPath, $timestamp);
// if owner !== user we need to also add a copy to the owners trash
if ($user !== $owner) {
self::copyFilesToOwner($file_path, $owner, $ownerPath, $timestamp);
}
}
$userTrashSize += $size;
self::scheduleExpire($userTrashSize, $user);
// if owner !== user we also need to update the owners trash size
if ($owner !== $user) {
$ownerTrashSize = self::getTrashbinSize($owner);
$ownerTrashSize += $size;
self::scheduleExpire($ownerTrashSize, $owner);
}
return $sizeOfAddedFiles === false ? false : true;
}