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


PHP View::file_exists方法代码示例

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


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

示例1: rename

 /**
  * rename a file
  *
  * @param string $dir
  * @param string $oldname
  * @param string $newname
  * @return array
  */
 public function rename($dir, $oldname, $newname)
 {
     $result = array('success' => false, 'data' => NULL);
     $normalizedOldPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $oldname);
     $normalizedNewPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname);
     // rename to non-existing folder is denied
     if (!$this->view->file_exists($normalizedOldPath)) {
         $result['data'] = array('message' => $this->l10n->t('%s could not be renamed as it has been deleted', array($oldname)), 'code' => 'sourcenotfound', 'oldname' => $oldname, 'newname' => $newname);
     } else {
         if (!$this->view->file_exists($dir)) {
             $result['data'] = array('message' => (string) $this->l10n->t('The target folder has been moved or deleted.', array($dir)), 'code' => 'targetnotfound');
             // rename to existing file is denied
         } else {
             if ($this->view->file_exists($normalizedNewPath)) {
                 $result['data'] = array('message' => $this->l10n->t("The name %s is already used in the folder %s. Please choose a different name.", array($newname, $dir)));
             } else {
                 if ($newname !== '.' and $this->view->rename($normalizedOldPath, $normalizedNewPath)) {
                     // successful rename
                     $meta = $this->view->getFileInfo($normalizedNewPath);
                     $meta = \OCA\Files\Helper::populateTags(array($meta));
                     $fileInfo = \OCA\Files\Helper::formatFileInfo(current($meta));
                     $fileInfo['path'] = dirname($normalizedNewPath);
                     $result['success'] = true;
                     $result['data'] = $fileInfo;
                 } else {
                     // rename failed
                     $result['data'] = array('message' => $this->l10n->t('%s could not be renamed', array($oldname)));
                 }
             }
         }
     }
     return $result;
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:41,代码来源:app.php

示例2: show

 /**
  * Get the template for a specific activity-event in the activities
  *
  * @param array $activity An array with all the activity data in it
  * @return string
  */
 public function show($activity)
 {
     $tmpl = new Template('activity', 'stream.item');
     $tmpl->assign('formattedDate', $this->dateTimeFormatter->formatDateTime($activity['timestamp']));
     $tmpl->assign('formattedTimestamp', Template::relative_modified_date($activity['timestamp']));
     if (strpos($activity['subjectformatted']['markup']['trimmed'], '<a ') !== false) {
         // We do not link the subject as we create links for the parameters instead
         $activity['link'] = '';
     }
     $tmpl->assign('event', $activity);
     if ($activity['file']) {
         $this->view->chroot('/' . $activity['affecteduser'] . '/files');
         $exist = $this->view->file_exists($activity['file']);
         $is_dir = $this->view->is_dir($activity['file']);
         $tmpl->assign('previewLink', $this->getPreviewLink($activity['file'], $is_dir));
         // show a preview image if the file still exists
         $mimeType = Files::getMimeType($activity['file']);
         if ($mimeType && !$is_dir && $this->preview->isMimeSupported($mimeType) && $exist) {
             $tmpl->assign('previewImageLink', $this->urlGenerator->linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150)));
         } else {
             $mimeTypeIcon = Template::mimetype_icon($is_dir ? 'dir' : $mimeType);
             $mimeTypeIcon = substr($mimeTypeIcon, -4) === '.png' ? substr($mimeTypeIcon, 0, -4) . '.svg' : $mimeTypeIcon;
             $tmpl->assign('previewImageLink', $mimeTypeIcon);
             $tmpl->assign('previewLinkIsDir', true);
         }
     }
     return $tmpl->fetchPage();
 }
开发者ID:AARNet,项目名称:activity,代码行数:34,代码来源:display.php

示例3: findInfoByPath

 /**
  * @param string $user
  * @param string $path
  * @return array
  */
 protected function findInfoByPath($user, $path)
 {
     $this->view->chroot('/' . $user . '/files');
     $exists = $this->view->file_exists($path);
     $this->cachePath[$user][$path] = ['path' => $path, 'exists' => $exists, 'is_dir' => $exists ? $this->view->is_dir($path) : false, 'view' => ''];
     return $this->cachePath[$user][$path];
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:12,代码来源:ViewInfoCache.php

示例4: rename

 /**
  * rename a file
  *
  * @param string $dir
  * @param string $oldname
  * @param string $newname
  * @return array
  */
 public function rename($dir, $oldname, $newname)
 {
     $result = array('success' => false, 'data' => NULL);
     // rename to "/Shared" is denied
     if ($dir === '/' and $newname === 'Shared') {
         $result['data'] = array('message' => $this->l10n->t("Invalid folder name. Usage of 'Shared' is reserved."));
         // rename to existing file is denied
     } else {
         if ($this->view->file_exists($dir . '/' . $newname)) {
             $result['data'] = array('message' => $this->l10n->t("The name %s is already used in the folder %s. Please choose a different name.", array($newname, $dir)));
         } else {
             if ($newname !== '.' and !($dir === '/' and $oldname === 'Shared') and $this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname)) {
                 // successful rename
                 $meta = $this->view->getFileInfo($dir . '/' . $newname);
                 if ($meta['mimetype'] === 'httpd/unix-directory') {
                     $meta['type'] = 'dir';
                 } else {
                     $meta['type'] = 'file';
                 }
                 $fileinfo = array('id' => $meta['fileid'], 'mime' => $meta['mimetype'], 'size' => $meta['size'], 'etag' => $meta['etag'], 'directory' => $dir, 'name' => $newname, 'isPreviewAvailable' => \OC::$server->getPreviewManager()->isMimeSupported($meta['mimetype']), 'icon' => \OCA\Files\Helper::determineIcon($meta));
                 $result['success'] = true;
                 $result['data'] = $fileinfo;
             } else {
                 // rename failed
                 $result['data'] = array('message' => $this->l10n->t('%s could not be renamed', array($oldname)));
             }
         }
     }
     return $result;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:38,代码来源:app.php

示例5: verifyNewKeyPath

 protected function verifyNewKeyPath($uid)
 {
     // private key
     if ($uid !== '') {
         $this->assertTrue($this->view->file_exists($uid . '/files_encryption/' . $this->moduleId . '/' . $uid . '.privateKey'));
     }
     // file keys
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/folder2/folder3/file3/' . $this->moduleId . '/fileKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/folder2/file2/' . $this->moduleId . '/fileKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/file.1/' . $this->moduleId . '/fileKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder2/file.2.1/' . $this->moduleId . '/fileKey'));
     // share keys
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/folder2/folder3/file3/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/folder2/folder3/file3/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER2 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/folder2/folder3/file3/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER3 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/folder2/file2/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/folder2/file2/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER2 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/folder2/file2/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER3 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/file.1/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/file.1/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER2 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder1/file.1/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER3 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder2/file.2.1/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER1 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder2/file.2.1/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER2 . '.shareKey'));
     $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder2/file.2.1/' . $this->moduleId . '/' . self::TEST_ENCRYPTION_MIGRATION_USER3 . '.shareKey'));
     if ($this->public_share_key_id) {
         $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder2/file.2.1/' . $this->moduleId . '/' . $this->public_share_key_id . '.shareKey'));
     }
     if ($this->recovery_key_id) {
         $this->assertTrue($this->view->file_exists($uid . '/files_encryption/keys/files/folder2/file.2.1/' . $this->moduleId . '/' . $this->recovery_key_id . '.shareKey'));
     }
 }
开发者ID:0x17de,项目名称:core,代码行数:31,代码来源:MigrationTest.php

示例6: testSizePropagationWhenRecipientChangesFile

 public function testSizePropagationWhenRecipientChangesFile()
 {
     $this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
     $recipientView = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
     $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $ownerView = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
     $ownerView->mkdir('/sharedfolder/subfolder');
     $ownerView->file_put_contents('/sharedfolder/subfolder/foo.txt', 'bar');
     $sharedFolderInfo = $ownerView->getFileInfo('/sharedfolder', false);
     $this->assertInstanceOf('\\OC\\Files\\FileInfo', $sharedFolderInfo);
     \OCP\Share::shareItem('folder', $sharedFolderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER1, 31);
     $ownerRootInfo = $ownerView->getFileInfo('', false);
     $this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
     $this->assertTrue($recipientView->file_exists('/sharedfolder/subfolder/foo.txt'));
     $recipientRootInfo = $recipientView->getFileInfo('', false);
     // when file changed as recipient
     $recipientView->file_put_contents('/sharedfolder/subfolder/foo.txt', 'foobar');
     // size of recipient's root stays the same
     $newRecipientRootInfo = $recipientView->getFileInfo('', false);
     $this->assertEquals($recipientRootInfo->getSize(), $newRecipientRootInfo->getSize());
     // size of owner's root increases
     $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $newOwnerRootInfo = $ownerView->getFileInfo('', false);
     $this->assertEquals($ownerRootInfo->getSize() + 3, $newOwnerRootInfo->getSize());
 }
开发者ID:evanjt,项目名称:core,代码行数:25,代码来源:sizepropagation.php

示例7: doTestRestore

 private function doTestRestore()
 {
     $filePath = self::TEST_VERSIONS_USER . '/files/sub/test.txt';
     $this->rootView->file_put_contents($filePath, 'test file');
     $t0 = $this->rootView->filemtime($filePath);
     // not exactly the same timestamp as the file
     $t1 = time() - 60;
     // second version is two weeks older
     $t2 = $t1 - 60 * 60 * 24 * 14;
     // create some versions
     $v1 = self::USERS_VERSIONS_ROOT . '/sub/test.txt.v' . $t1;
     $v2 = self::USERS_VERSIONS_ROOT . '/sub/test.txt.v' . $t2;
     $this->rootView->mkdir(self::USERS_VERSIONS_ROOT . '/sub');
     $this->rootView->file_put_contents($v1, 'version1');
     $this->rootView->file_put_contents($v2, 'version2');
     $oldVersions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, '/sub/test.txt');
     $this->assertCount(2, $oldVersions);
     $this->assertEquals('test file', $this->rootView->file_get_contents($filePath));
     $info1 = $this->rootView->getFileInfo($filePath);
     \OCA\Files_Versions\Storage::rollback('sub/test.txt', $t2);
     $this->assertEquals('version2', $this->rootView->file_get_contents($filePath));
     $info2 = $this->rootView->getFileInfo($filePath);
     $this->assertNotEquals($info2['etag'], $info1['etag'], 'Etag must change after rolling back version');
     $this->assertEquals($info2['fileid'], $info1['fileid'], 'File id must not change after rolling back version');
     $this->assertEquals($info2['mtime'], $t2, 'Restored file has mtime from version');
     $newVersions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, '/sub/test.txt');
     $this->assertTrue($this->rootView->file_exists(self::USERS_VERSIONS_ROOT . '/sub/test.txt.v' . $t0), 'A version file was created for the file before restoration');
     $this->assertTrue($this->rootView->file_exists($v1), 'Untouched version file is still there');
     $this->assertFalse($this->rootView->file_exists($v2), 'Restored version file gone from files_version folder');
     $this->assertCount(2, $newVersions, 'Additional version created');
     $this->assertTrue(isset($newVersions[$t0 . '#' . 'test.txt']), 'A version was created for the file before restoration');
     $this->assertTrue(isset($newVersions[$t1 . '#' . 'test.txt']), 'Untouched version is still there');
     $this->assertFalse(isset($newVersions[$t2 . '#' . 'test.txt']), 'Restored version is not in the list any more');
 }
开发者ID:samj1912,项目名称:repo,代码行数:34,代码来源:versions.php

示例8: stream_close

 /**
  * @return bool
  */
 public function stream_close()
 {
     $this->flush();
     // if there is no valid private key return false
     if ($this->privateKey === false) {
         // cleanup
         if ($this->meta['mode'] !== 'r' && $this->meta['mode'] !== 'rb' && !$this->isLocalTmpFile) {
             // Disable encryption proxy to prevent recursive calls
             $proxyStatus = \OC_FileProxy::$enabled;
             \OC_FileProxy::$enabled = false;
             if ($this->rootView->file_exists($this->rawPath) && $this->size === 0) {
                 $this->rootView->unlink($this->rawPath);
             }
             // Re-enable proxy - our work is done
             \OC_FileProxy::$enabled = $proxyStatus;
         }
         // if private key is not valid redirect user to a error page
         \OCA\Encryption\Helper::redirectToErrorPage($this->session);
     }
     if ($this->meta['mode'] !== 'r' && $this->meta['mode'] !== 'rb' && $this->isLocalTmpFile === false && $this->size > 0 && $this->unencryptedSize > 0) {
         // only write keyfiles if it was a new file
         if ($this->newFile === true) {
             // Disable encryption proxy to prevent recursive calls
             $proxyStatus = \OC_FileProxy::$enabled;
             \OC_FileProxy::$enabled = false;
             // Fetch user's public key
             $this->publicKey = Keymanager::getPublicKey($this->rootView, $this->keyId);
             // Check if OC sharing api is enabled
             $sharingEnabled = \OCP\Share::isEnabled();
             $util = new Util($this->rootView, $this->userId);
             // Get all users sharing the file includes current user
             $uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath);
             $checkedUserIds = $util->filterShareReadyUsers($uniqueUserIds);
             // Fetch public keys for all sharing users
             $publicKeys = Keymanager::getPublicKeys($this->rootView, $checkedUserIds['ready']);
             // Encrypt enc key for all sharing users
             $this->encKeyfiles = Crypt::multiKeyEncrypt($this->plainKey, $publicKeys);
             // Save the new encrypted file key
             Keymanager::setFileKey($this->rootView, $util, $this->relPath, $this->encKeyfiles['data']);
             // Save the sharekeys
             Keymanager::setShareKeys($this->rootView, $util, $this->relPath, $this->encKeyfiles['keys']);
             // Re-enable proxy - our work is done
             \OC_FileProxy::$enabled = $proxyStatus;
         }
         // we need to update the file info for the real file, not for the
         // part file.
         $path = Helper::stripPartialFileExtension($this->rawPath);
         // get file info
         $fileInfo = $this->rootView->getFileInfo($path);
         if (is_array($fileInfo)) {
             // set encryption data
             $fileInfo['encrypted'] = true;
             $fileInfo['size'] = $this->size;
             $fileInfo['unencrypted_size'] = $this->unencryptedSize;
             // set fileinfo
             $this->rootView->putFileInfo($path, $fileInfo);
         }
     }
     return fclose($this->handle);
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:63,代码来源:stream.php

示例9: testCopy

 public function testCopy()
 {
     \OC\Files\Filesystem::file_put_contents("test.txt", "test file");
     $t1 = time();
     // second version is two weeks older, this way we make sure that no
     // version will be expired
     $t2 = $t1 - 60 * 60 * 24 * 14;
     // create some versions
     $v1 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t1;
     $v2 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t2;
     $v1Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t1;
     $v2Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t2;
     $this->rootView->file_put_contents($v1, 'version1');
     $this->rootView->file_put_contents($v2, 'version2');
     // execute copy hook of versions app
     \OC\Files\Filesystem::copy("test.txt", "test2.txt");
     $this->runCommands();
     $this->assertTrue($this->rootView->file_exists($v1));
     $this->assertTrue($this->rootView->file_exists($v2));
     $this->assertTrue($this->rootView->file_exists($v1Copied));
     $this->assertTrue($this->rootView->file_exists($v2Copied));
     //cleanup
     \OC\Files\Filesystem::unlink('test.txt');
     \OC\Files\Filesystem::unlink('test2.txt');
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:25,代码来源:versions.php

示例10: testDeleteSharedFile

 function testDeleteSharedFile()
 {
     // generate filename
     $filename = 'tmp-' . $this->getUniqueID() . '.txt';
     // save file with content
     $cryptedFile = file_put_contents('crypt:///' . self::TEST_ENCRYPTION_TRASHBIN_USER1 . '/files/' . $filename, $this->dataShort);
     // test that data was successfully written
     $this->assertTrue(is_int($cryptedFile));
     // get the file info from previous created file
     $fileInfo = $this->view->getFileInfo('/' . self::TEST_ENCRYPTION_TRASHBIN_USER1 . '/files/' . $filename);
     // check if we have a valid file info
     $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo);
     // share the file
     $this->assertTrue(\OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_TRASHBIN_USER2, OCP\PERMISSION_ALL));
     self::loginHelper(self::TEST_ENCRYPTION_TRASHBIN_USER2);
     $this->assertTrue(\OC\Files\Filesystem::file_exists($filename));
     \OCA\Files_Trashbin\Trashbin::move2trash($filename);
     $query = \OC_DB::prepare('SELECT `timestamp` FROM `*PREFIX*files_trash`' . ' WHERE `id`=?');
     $result = $query->execute(array($filename))->fetchRow();
     $this->assertNotEmpty($result);
     $timestamp = $result['timestamp'];
     // check if key for both users exists
     $this->assertTrue($this->view->file_exists('/' . self::TEST_ENCRYPTION_TRASHBIN_USER1 . '/files_trashbin/keyfiles/' . $filename . '.key.d' . $timestamp));
     // check if key for admin exists
     $this->assertTrue($this->view->file_exists('/' . self::TEST_ENCRYPTION_TRASHBIN_USER2 . '/files_trashbin/keyfiles/' . $filename . '.key.d' . $timestamp));
     // check if share key for both users exists
     $this->assertTrue($this->view->file_exists('/' . self::TEST_ENCRYPTION_TRASHBIN_USER1 . '/files_trashbin/share-keys/' . $filename . '.' . self::TEST_ENCRYPTION_TRASHBIN_USER1 . '.shareKey.d' . $timestamp));
     $this->assertTrue($this->view->file_exists('/' . self::TEST_ENCRYPTION_TRASHBIN_USER2 . '/files_trashbin/share-keys/' . $filename . '.' . self::TEST_ENCRYPTION_TRASHBIN_USER2 . '.shareKey.d' . $timestamp));
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:29,代码来源:trashbin.php

示例11: show

 /**
  * Get the template for a specific activity-event in the activities
  *
  * @param array $activity An array with all the activity data in it
  * @return string
  */
 public static function show($activity)
 {
     $tmpl = new Template('activity', 'activity.box');
     $tmpl->assign('formattedDate', Util::formatDate($activity['timestamp']));
     $tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp']));
     $tmpl->assign('user', $activity['user']);
     $tmpl->assign('displayName', User::getDisplayName($activity['user']));
     if ($activity['app'] === 'files') {
         // We do not link the subject as we create links for the parameters instead
         $activity['link'] = '';
     }
     $tmpl->assign('event', $activity);
     if ($activity['file']) {
         $rootView = new View('/' . $activity['affecteduser'] . '/files');
         $exist = $rootView->file_exists($activity['file']);
         $is_dir = $rootView->is_dir($activity['file']);
         unset($rootView);
         // show a preview image if the file still exists
         $mimetype = \OC_Helper::getFileNameMimeType($activity['file']);
         if (!$is_dir && \OC::$server->getPreviewManager()->isMimeSupported($mimetype) && $exist) {
             $tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file']))));
             $tmpl->assign('previewImageLink', Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150)));
         } else {
             $tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => $activity['file'])));
             $tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon($is_dir ? 'dir' : $mimetype));
             $tmpl->assign('previewLinkIsDir', true);
         }
     }
     return $tmpl->fetchPage();
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:36,代码来源:display.php

示例12: testKeepFileAndVersionsWhenMovingFolderBetweenStorages

 /**
  * Test that versions are not auto-trashed when moving a file between
  * storages. This is because rename() between storages would call
  * unlink() which should NOT trigger the version deletion logic.
  */
 public function testKeepFileAndVersionsWhenMovingFolderBetweenStorages()
 {
     \OCA\Files_Versions\Hooks::connectHooks();
     $storage2 = new Temporary(array());
     \OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage');
     // trigger a version (multiple would not work because of the expire logic)
     $this->userView->file_put_contents('folder/inside.txt', 'v1');
     $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files');
     $this->assertEquals(0, count($results));
     $results = $this->rootView->getDirectoryContent($this->user . '/files_versions/folder/');
     $this->assertEquals(1, count($results));
     // move to another storage
     $this->userView->rename('folder', 'substorage/folder');
     $this->assertTrue($this->userView->file_exists('substorage/folder/inside.txt'));
     // rescan trash storage
     list($rootStorage, ) = $this->rootView->resolvePath($this->user . '/files_trashbin');
     $rootStorage->getScanner()->scan('');
     // versions were moved too
     $results = $this->rootView->getDirectoryContent($this->user . '/files_versions/substorage/folder/');
     $this->assertEquals(1, count($results));
     // check that nothing got trashed by the rename's unlink() call
     $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files');
     $this->assertEquals(0, count($results));
     // check that versions were moved and not trashed
     $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions/');
     $this->assertEquals(0, count($results));
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:32,代码来源:storage.php

示例13: targetExists

 /**
  * check if target already exists
  *
  * @param $path
  * @return bool
  * @throws \Exception
  */
 protected function targetExists($path)
 {
     if ($this->rootView->file_exists($path)) {
         throw new \Exception("new folder '{$path}' already exists");
     }
     return false;
 }
开发者ID:evanjt,项目名称:core,代码行数:14,代码来源:changekeystorageroot.php

示例14: testSingleStorageDeleteFileLoggedOut

 /**
  * Test that deleting a file doesn't error when nobody is logged in
  */
 public function testSingleStorageDeleteFileLoggedOut()
 {
     $this->logout();
     if (!$this->userView->file_exists('test.txt')) {
         $this->markTestSkipped('Skipping since the current home storage backend requires the user to logged in');
     } else {
         $this->userView->unlink('test.txt');
     }
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:12,代码来源:storage.php

示例15: url_stat

 public function url_stat($path)
 {
     $this->setup();
     $path = substr($path, strlen('oc://'));
     if (self::$rootView->file_exists($path)) {
         return self::$rootView->stat($path);
     } else {
         return false;
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:10,代码来源:oc.php


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