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


PHP OC_Helper::getStorageInfo方法代码示例

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


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

示例1: buildFileStorageStatistics

 public static function buildFileStorageStatistics($dir)
 {
     // information about storage capacities
     $storageInfo = \OC_Helper::getStorageInfo($dir);
     $l = new \OC_L10N('files');
     $maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);
     $maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);
     $maxHumanFileSize = $l->t('Upload (max. %s)', array($maxHumanFileSize));
     return array('uploadMaxFilesize' => $maxUploadFileSize, 'maxHumanFilesize' => $maxHumanFileSize, 'freeSpace' => $storageInfo['free'], 'usedSpacePercent' => (int) $storageInfo['relative']);
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:10,代码来源:helper.php

示例2: getUser

 /**
  * gets user info
  *
  * exposes the quota of an user:
  * <data>
  *   <quota>
  *      <free>1234</free>
  *      <used>4321</used>
  *      <total>5555</total>
  *      <ralative>0.78</ralative>
  *   </quota>
  * </data>
  *
  * @param $parameters object should contain parameter 'userid' which identifies
  *                           the user from whom the information will be returned
  */
 public static function getUser($parameters)
 {
     // Check if they are viewing information on themselves
     if ($parameters['userid'] === OC_User::getUser()) {
         // Self lookup
         $storage = OC_Helper::getStorageInfo('/');
         $quota = array('free' => $storage['free'], 'used' => $storage['used'], 'total' => $storage['total'], 'relative' => $storage['relative']);
         return new OC_OCS_Result(array('quota' => $quota));
     } else {
         // No permission to view this user data
         return new OC_OCS_Result(null, 997);
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:29,代码来源:cloud.php

示例3: getUser

 /**
  * gets user info
  *
  * exposes the quota of an user:
  * <data>
  *   <quota>
  *      <free>1234</free>
  *      <used>4321</used>
  *      <total>5555</total>
  *      <ralative>0.78</ralative>
  *   </quota>
  * </data>
  *
  * @param $parameters object should contain parameter 'userid' which identifies
  *                           the user from whom the information will be returned
  */
 public static function getUser($parameters)
 {
     $return = array();
     // Check if they are viewing information on themselves
     if ($parameters['userid'] === OC_User::getUser()) {
         // Self lookup
         $storage = OC_Helper::getStorageInfo('/');
         $return['quota'] = array('free' => $storage['free'], 'used' => $storage['used'], 'total' => $storage['total'], 'relative' => $storage['relative']);
     }
     if (OC_User::isAdminUser(OC_User::getUser()) || OC_Subadmin::isUserAccessible(OC_User::getUser(), $parameters['userid'])) {
         // Is an admin/subadmin so can see display name
         $return['displayname'] = OC_User::getDisplayName($parameters['userid']);
     }
     if (count($return)) {
         return new OC_OCS_Result($return);
     } else {
         // No permission to view this user data
         return new OC_OCS_Result(null, 997);
     }
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:36,代码来源:cloud.php

示例4: getChartUsage

 /**
  * Return the chart data you want to return based on the ChartConfig
  *
  * @return mixed
  */
 public function getChartUsage()
 {
     $new = array();
     $storageInfo = \OC_Helper::getStorageInfo('/');
     $free = ceil($storageInfo['free'] / 1024 / 1024);
     if ($this->isAdminUser()) {
         $data = $this->repository->findAllWithLimit(1);
         foreach ($data as $username => $items) {
             foreach ($items as $item) {
                 $new[$username] = ceil($item->getUsage() / 1024 / 1024);
             }
         }
         $new['free'] = $free;
         $data = $new;
     } else {
         $free = ceil($storageInfo['free'] / 1024 / 1024);
         $used = ceil($storageInfo['used'] / 1024 / 1024);
         $data = array('used' => $used, 'free' => $free);
     }
     return $data;
 }
开发者ID:heinekentap,项目名称:ocusagecharts,代码行数:26,代码来源:storageusagecurrentprovider.php

示例5: testGetStorageInfoWhenFreeSpaceLessThanQuota

 /**
  * Test getting the storage info when the remaining
  * free storage space is less than the quota
  */
 function testGetStorageInfoWhenFreeSpaceLessThanQuota()
 {
     $homeStorage = $this->getStorageMock(12);
     $homeStorage->file_put_contents('test.txt', '01234');
     $homeStorage = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $homeStorage, 'quota' => 18));
     \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files');
     $storageInfo = \OC_Helper::getStorageInfo('');
     $this->assertEquals(12, $storageInfo['free']);
     $this->assertEquals(5, $storageInfo['used']);
     // total = free + used (because quota > total)
     $this->assertEquals(17, $storageInfo['total']);
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:16,代码来源:HelperStorageTest.php

示例6: isset

if ($isIE8 && (isset($_GET['dir']) || isset($_GET['view']))) {
    $hash = '#?';
    $dir = isset($_GET['dir']) ? $_GET['dir'] : '/';
    $view = isset($_GET['view']) ? $_GET['view'] : 'files';
    $hash = '#?dir=' . \OCP\Util::encodePath($dir);
    if ($view !== 'files') {
        $hash .= '&view=' . urlencode($view);
    }
    header('Location: ' . OCP\Util::linkTo('files', 'index.php') . $hash);
    exit;
}
$user = OC_User::getUser();
$config = \OC::$server->getConfig();
// mostly for the home storage's free space
$dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
$storageInfo = OC_Helper::getStorageInfo('/', $dirInfo);
$nav = new OCP\Template('files', 'appnavigation', '');
function sortNavigationItems($item1, $item2)
{
    return $item1['order'] - $item2['order'];
}
\OCA\Files\App::getNavigationManager()->add(array('id' => 'favorites', 'appname' => 'files', 'script' => 'simplelist.php', 'order' => 5, 'name' => $l->t('Favorites')));
$navItems = \OCA\Files\App::getNavigationManager()->getAll();
usort($navItems, 'sortNavigationItems');
$nav->assign('navigationItems', $navItems);
$contentItems = array();
function renderScript($appName, $scriptName)
{
    $content = '';
    $appPath = OC_App::getAppPath($appName);
    $scriptPath = $appPath . '/' . $scriptName;
开发者ID:rosarion,项目名称:core,代码行数:31,代码来源:index.php

示例7: array

$urlGenerator = \OC::$server->getURLGenerator();
// Highlight navigation entry
OC_Util::addScript('settings', 'personal');
OC_Util::addScript('settings', 'certificates');
OC_Util::addStyle('settings', 'settings');
\OC_Util::addVendorScript('strengthify/jquery.strengthify');
\OC_Util::addVendorStyle('strengthify/strengthify');
\OC_Util::addScript('files', 'jquery.iframe-transport');
\OC_Util::addScript('files', 'jquery.fileupload');
if ($config->getSystemValue('enable_avatars', true) === true) {
    \OC_Util::addVendorScript('jcrop/js/jquery.Jcrop');
    \OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop');
}
// Highlight navigation entry
OC::$server->getNavigationManager()->setActiveEntry('personal');
$storageInfo = OC_Helper::getStorageInfo('/');
$user = OC::$server->getUserManager()->get(OC_User::getUser());
$email = $user->getEMailAddress();
$userLang = $config->getUserValue(OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage());
$languageCodes = OC_L10N::findAvailableLanguages();
// array of common languages
$commonLangCodes = array('en', 'es', 'fr', 'de', 'de_DE', 'ja', 'ar', 'ru', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko');
$languageNames = (include 'languageCodes.php');
$languages = array();
$commonLanguages = array();
foreach ($languageCodes as $lang) {
    $l = \OC::$server->getL10N('settings', $lang);
    // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
    if (substr($l->t('__language_name__'), 0, 1) !== '_') {
        //first check if the language name is in the translation file
        $ln = array('code' => $lang, 'name' => (string) $l->t('__language_name__'));
开发者ID:nseps,项目名称:core,代码行数:31,代码来源:personal.php

示例8: getQuotaInfo

 /**
  * Returns available diskspace information
  *
  * @return array
  */
 public function getQuotaInfo()
 {
     if ($this->quotaInfo) {
         return $this->quotaInfo;
     }
     try {
         $storageInfo = \OC_Helper::getStorageInfo($this->info->getPath(), $this->info);
         $this->quotaInfo = array($storageInfo['used'], $storageInfo['free']);
         return $this->quotaInfo;
     } catch (\OCP\Files\StorageNotAvailableException $e) {
         return array(0, 0);
     }
 }
开发者ID:evanjt,项目名称:core,代码行数:18,代码来源:directory.php

示例9: array

$list = new OCP\Template('files', 'part.list', '');
$list->assign('files', $files);
$list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
$list->assign('isPublic', false);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
$permissions = \OCA\Files\Helper::getDirPermissions($dir);
if ($needUpgrade) {
    OCP\Util::addscript('files', 'upgrade');
    $tmpl = new OCP\Template('files', 'upgrade', 'user');
    $tmpl->printPage();
} else {
    // information about storage capacities
    $storageInfo = OC_Helper::getStorageInfo($dir);
    $maxUploadFilesize = OCP\Util::maxUploadFilesize($dir);
    $publicUploadEnabled = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes');
    // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code)
    $encryptionInitStatus = 2;
    if (OC_App::isEnabled('files_encryption')) {
        $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
        $encryptionInitStatus = $session->getInitialized();
    }
    $trashEnabled = \OCP\App::isEnabled('files_trashbin');
    $trashEmpty = true;
    if ($trashEnabled) {
        $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user);
    }
    $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/');
    $fileHeader = (!isset($files) or count($files) > 0);
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:index.php

示例10: getQuotaInfo

 /**
  * Returns available diskspace information
  *
  * @return array
  */
 public function getQuotaInfo()
 {
     $path = \OC\Files\Filesystem::getView()->getRelativePath($this->info->getPath());
     $storageInfo = OC_Helper::getStorageInfo($path);
     return array($storageInfo['used'], $storageInfo['free']);
 }
开发者ID:Combustible,项目名称:core,代码行数:11,代码来源:directory.php

示例11: getStorageInfo

 /**
  * FIXME: Replace with non static code
  *
  * @return array
  * @throws \OCP\Files\NotFoundException
  */
 protected function getStorageInfo()
 {
     $dirInfo = \OC\Files\Filesystem::getFileInfo('/', false);
     return \OC_Helper::getStorageInfo('/', $dirInfo);
 }
开发者ID:kenwi,项目名称:core,代码行数:11,代码来源:viewcontroller.php

示例12: getQuotaInfo

 /**
  * Returns available diskspace information
  *
  * @return array
  */
 public function getQuotaInfo()
 {
     $storageInfo = OC_Helper::getStorageInfo($this->path);
     return array($storageInfo['used'], $storageInfo['free']);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:10,代码来源:directory.php

示例13: getQuotaInfo

 /**
  * Returns available diskspace information
  *
  * @return array
  */
 public function getQuotaInfo()
 {
     if ($this->quotaInfo) {
         return $this->quotaInfo;
     }
     try {
         $storageInfo = \OC_Helper::getStorageInfo($this->info->getPath(), $this->info);
         if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
             $free = \OCP\Files\FileInfo::SPACE_UNLIMITED;
         } else {
             $free = $storageInfo['free'];
         }
         $this->quotaInfo = array($storageInfo['used'], $free);
         return $this->quotaInfo;
     } catch (\OCP\Files\StorageNotAvailableException $e) {
         return array(0, 0);
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:23,代码来源:Directory.php

示例14: post_deleteHook

 public static function post_deleteHook($arguments)
 {
     $h = new Publisher();
     $path = $arguments['path'];
     $info = null;
     if (isset(self::$deleteFileInfo[$path])) {
         $info = self::$deleteFileInfo[$path];
     }
     $h->pushFileChange('deleted', $path, $info);
     // quota change handling
     $postStorageInfo = \OC_Helper::getStorageInfo('/');
     $h->pushQuotaChange(self::$preStorageInfo, $postStorageInfo);
 }
开发者ID:evaluation-alex,项目名称:web_hooks,代码行数:13,代码来源:hooks.php

示例15: getQuotaInfo

 /**
  * Returns available diskspace information
  *
  * @return array
  */
 public function getQuotaInfo()
 {
     try {
         $path = \OC\Files\Filesystem::getView()->getRelativePath($this->info->getPath());
         $storageInfo = OC_Helper::getStorageInfo($path);
         return array($storageInfo['used'], $storageInfo['free']);
     } catch (\OCP\Files\StorageNotAvailableException $e) {
         return array(0, 0);
     }
 }
开发者ID:Romua1d,项目名称:core,代码行数:15,代码来源:directory.php


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