當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Filesystem::getLoader方法代碼示例

本文整理匯總了PHP中OC\Files\Filesystem::getLoader方法的典型用法代碼示例。如果您正苦於以下問題:PHP Filesystem::getLoader方法的具體用法?PHP Filesystem::getLoader怎麽用?PHP Filesystem::getLoader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC\Files\Filesystem的用法示例。


在下文中一共展示了Filesystem::getLoader方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('files_sharing', $urlParams);
     $container = $this->getContainer();
     $server = $container->getServer();
     /**
      * Controllers
      */
     $container->registerService('ShareController', function (SimpleContainer $c) use($server) {
         return new ShareController($c->query('AppName'), $c->query('Request'), $c->query('UserSession'), $server->getAppConfig(), $server->getConfig(), $c->query('URLGenerator'), $c->query('UserManager'), $server->getLogger(), $server->getActivityManager());
     });
     $container->registerService('ExternalSharesController', function (SimpleContainer $c) {
         return new ExternalSharesController($c->query('AppName'), $c->query('Request'), $c->query('IsIncomingShareEnabled'), $c->query('ExternalManager'), $c->query('HttpClientService'));
     });
     /**
      * Core class wrappers
      */
     $container->registerService('UserSession', function (SimpleContainer $c) use($server) {
         return $server->getUserSession();
     });
     $container->registerService('URLGenerator', function (SimpleContainer $c) use($server) {
         return $server->getUrlGenerator();
     });
     $container->registerService('UserManager', function (SimpleContainer $c) use($server) {
         return $server->getUserManager();
     });
     $container->registerService('HttpClientService', function (SimpleContainer $c) use($server) {
         return $server->getHTTPClientService();
     });
     $container->registerService('IsIncomingShareEnabled', function (SimpleContainer $c) {
         return Helper::isIncomingServer2serverShareEnabled();
     });
     $container->registerService('ExternalManager', function (SimpleContainer $c) use($server) {
         $user = $server->getUserSession()->getUser();
         $uid = $user ? $user->getUID() : null;
         return new \OCA\Files_Sharing\External\Manager($server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), $server->getHTTPHelper(), $server->getNotificationManager(), $uid);
     });
     /**
      * Middleware
      */
     $container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use($server) {
         return new SharingCheckMiddleware($c->query('AppName'), $server->getConfig(), $server->getAppManager());
     });
     // Execute middlewares
     $container->registerMiddleware('SharingCheckMiddleware');
     $container->registerService('MountProvider', function (IContainer $c) {
         /** @var \OCP\IServerContainer $server */
         $server = $c->query('ServerContainer');
         return new MountProvider($server->getConfig(), $c->query('PropagationManager'));
     });
     $container->registerService('PropagationManager', function (IContainer $c) {
         /** @var \OCP\IServerContainer $server */
         $server = $c->query('ServerContainer');
         return new PropagationManager($server->getUserSession(), $server->getConfig());
     });
     /*
      * Register capabilities
      */
     $container->registerCapability('OCA\\Files_Sharing\\Capabilities');
 }
開發者ID:hyb148,項目名稱:core,代碼行數:60,代碼來源:application.php

示例2: createShare

 /**
  * create a new share
  *
  * @param array $params
  * @return \OC_OCS_Result
  */
 public function createShare($params)
 {
     if (!$this->isS2SEnabled(true)) {
         return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing');
     }
     $remote = isset($_POST['remote']) ? $_POST['remote'] : null;
     $token = isset($_POST['token']) ? $_POST['token'] : null;
     $name = isset($_POST['name']) ? $_POST['name'] : null;
     $owner = isset($_POST['owner']) ? $_POST['owner'] : null;
     $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null;
     $remoteId = isset($_POST['remoteId']) ? (int) $_POST['remoteId'] : null;
     if ($remote && $token && $name && $owner && $remoteId && $shareWith) {
         if (!\OCP\Util::isValidFileName($name)) {
             return new \OC_OCS_Result(null, 400, 'The mountpoint name contains invalid characters.');
         }
         // FIXME this should be a method in the user management instead
         \OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG);
         \OCP\Util::emitHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', array('uid' => &$shareWith));
         \OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG);
         if (!\OCP\User::userExists($shareWith)) {
             return new \OC_OCS_Result(null, 400, 'User does not exists');
         }
         \OC_Util::setupFS($shareWith);
         $externalManager = new \OCA\Files_Sharing\External\Manager(\OC::$server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), \OC::$server->getHTTPHelper(), \OC::$server->getNotificationManager(), $shareWith);
         try {
             $externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId);
             $user = $owner . '@' . $this->cleanupRemote($remote);
             \OC::$server->getActivityManager()->publishActivity(Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($user, trim($name, '/')), '', array(), '', '', $shareWith, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_LOW);
             /**
             * FIXME
             				$urlGenerator = \OC::$server->getURLGenerator();
             
             				$notificationManager = \OC::$server->getNotificationManager();
             				$notification = $notificationManager->createNotification();
             				$notification->setApp('files_sharing')
             					->setUser($shareWith)
             					->setTimestamp(time())
             					->setObject('remote_share', $remoteId)
             					->setSubject('remote_share', [$user, trim($name, '/')]);
             
             				$declineAction = $notification->createAction();
             				$declineAction->setLabel('decline')
             					->setLink($urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/remote_shares/' . $remoteId), 'DELETE');
             				$notification->addAction($declineAction);
             
             				$acceptAction = $notification->createAction();
             				$acceptAction->setLabel('accept')
             					->setLink($urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/remote_shares/' . $remoteId), 'POST');
             				$notification->addAction($acceptAction);
             
             				$notificationManager->notify($notification);
             */
             return new \OC_OCS_Result();
         } catch (\Exception $e) {
             \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR);
             return new \OC_OCS_Result(null, 500, 'internal server error, was not able to add share from ' . $remote);
         }
     }
     return new \OC_OCS_Result(null, 400, 'server can not add remote share, missing parameter');
 }
開發者ID:evanjt,項目名稱:core,代碼行數:66,代碼來源:server2server.php

示例3: tearDown

 protected function tearDown()
 {
     $this->view->unlink($this->folder);
     $this->view->unlink($this->filename);
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
     parent::tearDown();
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:7,代碼來源:sharedstorage.php

示例4: createShare

 /**
  * create a new share
  *
  * @param array $params
  * @return \OC_OCS_Result
  */
 public function createShare($params)
 {
     if (!$this->isS2SEnabled(true)) {
         return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing');
     }
     $remote = isset($_POST['remote']) ? $_POST['remote'] : null;
     $token = isset($_POST['token']) ? $_POST['token'] : null;
     $name = isset($_POST['name']) ? $_POST['name'] : null;
     $owner = isset($_POST['owner']) ? $_POST['owner'] : null;
     $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null;
     $remoteId = isset($_POST['remoteId']) ? (int) $_POST['remoteId'] : null;
     if ($remote && $token && $name && $owner && $remoteId && $shareWith) {
         if (!\OCP\Util::isValidFileName($name)) {
             return new \OC_OCS_Result(null, 400, 'The mountpoint name contains invalid characters.');
         }
         if (!\OCP\User::userExists($shareWith)) {
             return new \OC_OCS_Result(null, 400, 'User does not exists');
         }
         \OC_Util::setupFS($shareWith);
         $externalManager = new \OCA\Files_Sharing\External\Manager(\OC::$server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), \OC::$server->getHTTPHelper(), $shareWith);
         try {
             $externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId);
             $user = $owner . '@' . $this->cleanupRemote($remote);
             \OC::$server->getActivityManager()->publishActivity('files_sharing', \OCA\Files_Sharing\Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($user), '', array(), '', '', $shareWith, \OCA\Files_Sharing\Activity::TYPE_REMOTE_SHARE, \OCA\Files_Sharing\Activity::PRIORITY_LOW);
             return new \OC_OCS_Result();
         } catch (\Exception $e) {
             \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR);
             return new \OC_OCS_Result(null, 500, 'internal server error, was not able to add share from ' . $remote);
         }
     }
     return new \OC_OCS_Result(null, 400, 'server can not add remote share, missing parameter');
 }
開發者ID:nougad,項目名稱:core,代碼行數:38,代碼來源:server2server.php

示例5: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     // cleanup test user
     \OC_User::deleteUser(self::TEST_ENCRYPTION_TRASHBIN_USER1);
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
     parent::tearDownAfterClass();
 }
開發者ID:samj1912,項目名稱:repo,代碼行數:7,代碼來源:trashbin.php

示例6: declineShare

 /**
  * Decline a remote share
  *
  * @param array $params contains the shareID 'id' which should be declined
  * @return \OC_OCS_Result
  */
 public static function declineShare($params)
 {
     $externalManager = new Manager(\OC::$server->getDatabaseConnection(), Filesystem::getMountManager(), Filesystem::getLoader(), \OC::$server->getHTTPHelper(), \OC_User::getUser());
     if ($externalManager->declineShare($params['id'])) {
         return new \OC_OCS_Result();
     }
     return new \OC_OCS_Result(null, 404, "wrong share ID, share doesn't exist.");
 }
開發者ID:ninjasilicon,項目名稱:core,代碼行數:14,代碼來源:remote.php

示例7: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $appManager = \OC::$server->getAppManager();
     self::$trashBinStatus = $appManager->isEnabledForUser('files_trashbin');
     $appManager->disableApp('files_trashbin');
     // just in case...
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:8,代碼來源:DeleteOrphanedSharesJobTest.php

示例8: tearDown

 protected function tearDown()
 {
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
     $this->logout();
     \OC_User::deleteUser($this->user);
     \OC_Hook::clear();
     parent::tearDown();
 }
開發者ID:ninjasilicon,項目名稱:core,代碼行數:8,代碼來源:storage.php

示例9: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     // cleanup test user
     \OC_User::deleteUser(self::TEST_TRASHBIN_USER1);
     \OC_Config::setValue('trashbin_retention_obligation', self::$rememberRetentionObligation);
     \OC_Config::setValue('trashbin_auto_expire', self::$rememberAutoExpire);
     \OC_Hook::clear();
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
     parent::tearDownAfterClass();
 }
開發者ID:adolfo2103,項目名稱:hcloudfilem,代碼行數:10,代碼來源:trashbin.php

示例10: tearDown

 protected function tearDown()
 {
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
     $this->logout();
     $user = \OC::$server->getUserManager()->get($this->user);
     if ($user !== null) {
         $user->delete();
     }
     \OC_Hook::clear();
     parent::tearDown();
 }
開發者ID:TechArea,項目名稱:core,代碼行數:11,代碼來源:storage.php

示例11: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     // cleanup test user
     \OC_User::deleteUser(self::TEST_TRASHBIN_USER1);
     \OC::$server->getConfig()->setSystemValue('trashbin_retention_obligation', self::$rememberRetentionObligation);
     \OC_Hook::clear();
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
     if (self::$trashBinStatus) {
         \OC::$server->getAppManager()->enableApp('files_trashbin');
     }
     parent::tearDownAfterClass();
 }
開發者ID:loulancn,項目名稱:core,代碼行數:12,代碼來源:trashbin.php

示例12: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('files_sharing', $urlParams);
     $container = $this->getContainer();
     $server = $container->getServer();
     /**
      * Controllers
      */
     $container->registerService('ShareController', function (SimpleContainer $c) use($server) {
         $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing');
         return new ShareController($c->query('AppName'), $c->query('Request'), $server->getConfig(), $server->getURLGenerator(), $server->getUserManager(), $server->getLogger(), $server->getActivityManager(), $server->getShareManager(), $server->getSession(), $server->getPreviewManager(), $server->getRootFolder(), $federatedSharingApp->getFederatedShareProvider());
     });
     $container->registerService('ExternalSharesController', function (SimpleContainer $c) {
         return new ExternalSharesController($c->query('AppName'), $c->query('Request'), $c->query('ExternalManager'), $c->query('HttpClientService'));
     });
     /**
      * Core class wrappers
      */
     $container->registerService('HttpClientService', function (SimpleContainer $c) use($server) {
         return $server->getHTTPClientService();
     });
     $container->registerService('ExternalManager', function (SimpleContainer $c) use($server) {
         $user = $server->getUserSession()->getUser();
         $uid = $user ? $user->getUID() : null;
         $discoveryManager = new DiscoveryManager(\OC::$server->getMemCacheFactory(), \OC::$server->getHTTPClientService());
         return new \OCA\Files_Sharing\External\Manager($server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), $server->getHTTPHelper(), $server->getNotificationManager(), $discoveryManager, $uid);
     });
     /**
      * Middleware
      */
     $container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) use($server) {
         return new SharingCheckMiddleware($c->query('AppName'), $server->getConfig(), $server->getAppManager(), $c['ControllerMethodReflector']);
     });
     // Execute middlewares
     $container->registerMiddleware('SharingCheckMiddleware');
     $container->registerService('MountProvider', function (IContainer $c) {
         /** @var \OCP\IServerContainer $server */
         $server = $c->query('ServerContainer');
         return new MountProvider($server->getConfig(), $server->getShareManager(), $server->getLogger());
     });
     $container->registerService('ExternalMountProvider', function (IContainer $c) {
         /** @var \OCP\IServerContainer $server */
         $server = $c->query('ServerContainer');
         return new \OCA\Files_Sharing\External\MountProvider($server->getDatabaseConnection(), function () use($c) {
             return $c->query('ExternalManager');
         });
     });
     /*
      * Register capabilities
      */
     $container->registerCapability('OCA\\Files_Sharing\\Capabilities');
 }
開發者ID:GitHubUser4234,項目名稱:core,代碼行數:52,代碼來源:Application.php

示例13: testDeleteParentFolder

 /**
  * test deletion of a folder which contains share mount points. Share mount
  * points should be unshared before the folder gets deleted so
  * that the mount point doesn't end up at the trash bin
  */
 function testDeleteParentFolder()
 {
     $status = \OC_App::isEnabled('files_trashbin');
     \OC_App::enable('files_trashbin');
     \OCA\Files_Trashbin\Trashbin::registerHooks();
     $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
     $this->assertTrue($fileinfo instanceof \OC\Files\FileInfo);
     \OCP\Share::shareItem('folder', $fileinfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
     // check if user2 can see the shared folder
     $this->assertTrue($view->file_exists($this->folder));
     $foldersShared = \OCP\Share::getItemsSharedWith('folder');
     $this->assertSame(1, count($foldersShared));
     $view->mkdir("localFolder");
     $view->file_put_contents("localFolder/localFile.txt", "local file");
     $view->rename($this->folder, 'localFolder/' . $this->folder);
     // share mount point should now be moved to the subfolder
     $this->assertFalse($view->file_exists($this->folder));
     $this->assertTrue($view->file_exists('localFolder/' . $this->folder));
     $view->unlink('localFolder');
     $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // shared folder should be unshared
     $foldersShared = \OCP\Share::getItemsSharedWith('folder');
     $this->assertTrue(empty($foldersShared));
     // trashbin should contain the local file but not the mount point
     $rootView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
     $trashContent = \OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_FILES_SHARING_API_USER2);
     $this->assertSame(1, count($trashContent));
     $firstElement = reset($trashContent);
     $timestamp = $firstElement['mtime'];
     $this->assertTrue($rootView->file_exists('files_trashbin/files/localFolder.d' . $timestamp . '/localFile.txt'));
     $this->assertFalse($rootView->file_exists('files_trashbin/files/localFolder.d' . $timestamp . '/' . $this->folder));
     //cleanup
     $rootView->deleteAll('files_trashin');
     if ($status === false) {
         \OC_App::disable('files_trashbin');
     }
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
 }
開發者ID:Kevin-ZK,項目名稱:vaneDisk,代碼行數:45,代碼來源:updater.php

示例14: __construct

 /**
  * @param array $urlParams
  */
 public function __construct(array $urlParams = array())
 {
     parent::__construct('files_sharing', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('ShareController', function (SimpleContainer $c) {
         return new ShareController($c->query('AppName'), $c->query('Request'), $c->query('UserSession'), $c->query('ServerContainer')->getAppConfig(), $c->query('ServerContainer')->getConfig(), $c->query('URLGenerator'), $c->query('ServerContainer')->getUserManager(), $c->query('ServerContainer')->getLogger(), $c->query('ServerContainer')->getActivityManager());
     });
     $container->registerService('ExternalSharesController', function (SimpleContainer $c) {
         return new ExternalSharesController($c->query('AppName'), $c->query('Request'), $c->query('IsIncomingShareEnabled'), $c->query('ExternalManager'));
     });
     /**
      * Core class wrappers
      */
     $container->registerService('UserSession', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getUserSession();
     });
     $container->registerService('URLGenerator', function (SimpleContainer $c) {
         return $c->query('ServerContainer')->getUrlGenerator();
     });
     $container->registerService('IsIncomingShareEnabled', function (SimpleContainer $c) {
         return Helper::isIncomingServer2serverShareEnabled();
     });
     $container->registerService('ExternalManager', function (SimpleContainer $c) {
         return new \OCA\Files_Sharing\External\Manager(\OC::$server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), \OC\Files\Filesystem::getLoader(), \OC::$server->getUserSession(), \OC::$server->getHTTPHelper());
     });
     /**
      * Middleware
      */
     $container->registerService('SharingCheckMiddleware', function (SimpleContainer $c) {
         return new SharingCheckMiddleware($c->query('AppName'), $c->query('ServerContainer')->getAppConfig(), $c->getCoreApi());
     });
     // Execute middlewares
     $container->registerMiddleware('SharingCheckMiddleware');
 }
開發者ID:riso,項目名稱:owncloud-core,代碼行數:40,代碼來源:application.php

示例15: setup

 public static function setup($options)
 {
     $shares = \OCP\Share::getItemsSharedWith('file');
     $manager = Filesystem::getMountManager();
     $loader = Filesystem::getLoader();
     if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] || $shares) {
         foreach ($shares as $share) {
             // don't mount shares where we have no permissions
             if ($share['permissions'] > 0) {
                 $mount = new SharedMount('\\OC\\Files\\Storage\\Shared', $options['user_dir'] . '/' . $share['file_target'], array('share' => $share), $loader);
                 $manager->addMount($mount);
             }
         }
     }
 }
開發者ID:ArcherSys,項目名稱:ArcherSysOSCloud7,代碼行數:15,代碼來源:sharedstorage.php


注:本文中的OC\Files\Filesystem::getLoader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。