• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP OC_Appconfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中OC_Appconfig的典型用法代码示例。如果您正苦于以下问题:PHP OC_Appconfig类的具体用法?PHP OC_Appconfig怎么用?PHP OC_Appconfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: setExecutionType

 /**
  * sets the background jobs execution type
  * @param string $type execution type
  * @return false|null
  *
  * This method sets the execution type of the background jobs. Possible types
  * are "none", "ajax", "webcron", "cron"
  */
 public static function setExecutionType($type)
 {
     if (!in_array($type, array('none', 'ajax', 'webcron', 'cron'))) {
         return false;
     }
     return OC_Appconfig::setValue('core', 'backgroundjobs_mode', $type);
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:15,代码来源:backgroundjob.php


示例2: check

 /**
  * Check if a new version is available
  */
 public static function check()
 {
     OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
     if (OC_Appconfig::getValue('core', 'installedat', '') == '') {
         OC_Appconfig::setValue('core', 'installedat', microtime(true));
     }
     $updaterurl = 'http://apps.owncloud.com/updater.php';
     $version = OC_Util::getVersion();
     $version['installed'] = OC_Appconfig::getValue('core', 'installedat');
     $version['updated'] = OC_Appconfig::getValue('core', 'lastupdatedat');
     $version['updatechannel'] = 'stable';
     $version['edition'] = OC_Util::getEditionString();
     $versionstring = implode('x', $version);
     //fetch xml data from updater
     $url = $updaterurl . '?version=' . $versionstring;
     $xml = @file_get_contents($url);
     if ($xml == FALSE) {
         return array();
     }
     $data = @simplexml_load_string($xml);
     $tmp = array();
     $tmp['version'] = $data->version;
     $tmp['versionstring'] = $data->versionstring;
     $tmp['url'] = $data->url;
     $tmp['web'] = $data->web;
     return $tmp;
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:30,代码来源:updater.php


示例3: check

 /**
  * Check if a new version is available
  */
 public static function check()
 {
     OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
     if (OC_Appconfig::getValue('core', 'installedat', '') == '') {
         OC_Appconfig::setValue('core', 'installedat', microtime(true));
     }
     $updaterurl = 'http://apps.owncloud.com/updater.php';
     $version = OC_Util::getVersion();
     $version['installed'] = OC_Appconfig::getValue('core', 'installedat');
     $version['updated'] = OC_Appconfig::getValue('core', 'lastupdatedat');
     $version['updatechannel'] = 'stable';
     $version['edition'] = OC_Util::getEditionString();
     $versionstring = implode('x', $version);
     //fetch xml data from updater
     $url = $updaterurl . '?version=' . $versionstring;
     // set a sensible timeout of 10 sec to stay responsive even if the update server is down.
     $ctx = stream_context_create(array('http' => array('timeout' => 10)));
     $xml = @file_get_contents($url, 0, $ctx);
     if ($xml == false) {
         return array();
     }
     $data = @simplexml_load_string($xml);
     $tmp = array();
     $tmp['version'] = $data->version;
     $tmp['versionstring'] = $data->versionstring;
     $tmp['url'] = $data->url;
     $tmp['web'] = $data->web;
     return $tmp;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:32,代码来源:updater.php


示例4: check

 /**
  * Check if a new version is available
  * @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php'
  * @return array | bool
  */
 public function check($updaterUrl)
 {
     // Look up the cache - it is invalidated all 30 minutes
     if (\OC_Appconfig::getValue('core', 'lastupdatedat') + 1800 > time()) {
         return json_decode(\OC_Appconfig::getValue('core', 'lastupdateResult'), true);
     }
     \OC_Appconfig::setValue('core', 'lastupdatedat', time());
     if (\OC_Appconfig::getValue('core', 'installedat', '') == '') {
         \OC_Appconfig::setValue('core', 'installedat', microtime(true));
     }
     $version = \OC_Util::getVersion();
     $version['installed'] = \OC_Appconfig::getValue('core', 'installedat');
     $version['updated'] = \OC_Appconfig::getValue('core', 'lastupdatedat');
     $version['updatechannel'] = \OC_Util::getChannel();
     $version['edition'] = \OC_Util::getEditionString();
     $version['build'] = \OC_Util::getBuild();
     $versionString = implode('x', $version);
     //fetch xml data from updater
     $url = $updaterUrl . '?version=' . $versionString;
     // set a sensible timeout of 10 sec to stay responsive even if the update server is down.
     $ctx = stream_context_create(array('http' => array('timeout' => 10)));
     $xml = @file_get_contents($url, 0, $ctx);
     if ($xml == false) {
         return array();
     }
     $data = @simplexml_load_string($xml);
     $tmp = array();
     $tmp['version'] = $data->version;
     $tmp['versionstring'] = $data->versionstring;
     $tmp['url'] = $data->url;
     $tmp['web'] = $data->web;
     // Cache the result
     \OC_Appconfig::setValue('core', 'lastupdateResult', json_encode($data));
     return $tmp;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:40,代码来源:updater.php


示例5: getUser

 /**
  * gets user info
  */
 public static function getUser($parameters)
 {
     $userid = $parameters['userid'];
     $return = array();
     $return['email'] = OC_Preferences::getValue($userid, 'settings', 'email', '');
     $default = OC_Appconfig::getValue('files', 'default_quota', 0);
     $return['quota'] = OC_Preferences::getValue($userid, 'files', 'quota', $default);
     return $return;
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:12,代码来源:users.php


示例6: __construct

 function __construct()
 {
     $this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host', '');
     $this->ldap_port = OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT);
     $this->ldap_dn = OC_Appconfig::getValue('user_ldap', 'ldap_dn', '');
     $this->ldap_password = OC_Appconfig::getValue('user_ldap', 'ldap_password', '');
     $this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base', '');
     $this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter', '');
     if (!empty($this->ldap_host) && !empty($this->ldap_port) && !empty($this->ldap_dn) && !empty($this->ldap_password) && !empty($this->ldap_base) && !empty($this->ldap_filter)) {
         $this->configured = true;
     }
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:12,代码来源:owncloud_apps_user_ldap_user_ldap.php


示例7: checkNext

 public static function checkNext()
 {
     // check both 1 file and 1 folder, this way new files are detected quicker because there are less folders than files usually
     $previousFile = \OC_Appconfig::getValue('files', 'backgroundwatcher_previous_file', 0);
     $previousFolder = \OC_Appconfig::getValue('files', 'backgroundwatcher_previous_folder', 0);
     $nextFile = self::getNextFileId($previousFile, false);
     $nextFolder = self::getNextFileId($previousFolder, true);
     \OC_Appconfig::setValue('files', 'backgroundwatcher_previous_file', $nextFile);
     \OC_Appconfig::setValue('files', 'backgroundwatcher_previous_folder', $nextFolder);
     if ($nextFile > 0) {
         self::checkUpdate($nextFile);
     }
     if ($nextFolder > 0) {
         self::checkUpdate($nextFolder);
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:16,代码来源:backgroundwatcher.php


示例8: __construct

 function __construct()
 {
     $this->db_conn = false;
     $db_host = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_host', '');
     $db_name = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_name', '');
     $db_driver = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_driver', 'mysql');
     $db_user = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_user', '');
     $db_password = OC_Appconfig::getValue('user_django_auth', 'django_auth_db_password', '');
     $dsn = "{$db_driver}:host={$db_host};dbname={$db_name}";
     try {
         $this->db = new PDO($dsn, $db_user, $db_password);
         $this->db_conn = true;
     } catch (PDOException $e) {
         OC_Log::write('OC_User_Django_Auth', 'OC_User_Django_Auth, Failed to connect to django auth database: ' . $e->getMessage(), OC_Log::ERROR);
     }
     return false;
 }
开发者ID:nutztherookie,项目名称:owncloud-user_django_auth,代码行数:17,代码来源:user_django_auth.php


示例9: __construct

 public function __construct()
 {
     $this->pwauth_bin_path = OC_Appconfig::getValue('user_pwauth', 'pwauth_path', OC_USER_BACKEND_PWAUTH_PATH);
     $list = explode(";", OC_Appconfig::getValue('user_pwauth', 'uid_list', OC_USER_BACKEND_PWAUTH_UID_LIST));
     $r = array();
     foreach ($list as $entry) {
         if (strpos($entry, "-") === FALSE) {
             $r[] = $entry;
         } else {
             $range = explode("-", $entry);
             if ($range[0] < 0) {
                 $range[0] = 0;
             }
             if ($range[1] < $range[0]) {
                 $range[1] = $range[0];
             }
             for ($i = $range[0]; $i <= $range[1]; $i++) {
                 $r[] = $i;
             }
         }
     }
     $this->pwauth_uid_list = $r;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:23,代码来源:user_pwauth.php


示例10: __construct

 /**
  * @brief if session is started, check if ownCloud key pair is set up, if not create it
  * @param \OC_FilesystemView $view
  *
  * @note The ownCloud key pair is used to allow public link sharing even if encryption is enabled
  */
 public function __construct($view)
 {
     $this->view = $view;
     if (!$this->view->is_dir('owncloud_private_key')) {
         $this->view->mkdir('owncloud_private_key');
     }
     $publicShareKeyId = \OC_Appconfig::getValue('files_encryption', 'publicShareKeyId');
     if ($publicShareKeyId === null) {
         $publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
         \OC_Appconfig::setValue('files_encryption', 'publicShareKeyId', $publicShareKeyId);
     }
     if (!$this->view->file_exists("/public-keys/" . $publicShareKeyId . ".public.key") || !$this->view->file_exists("/owncloud_private_key/" . $publicShareKeyId . ".private.key")) {
         $keypair = Crypt::createKeypair();
         // Disable encryption proxy to prevent recursive calls
         $proxyStatus = \OC_FileProxy::$enabled;
         \OC_FileProxy::$enabled = false;
         // Save public key
         if (!$view->is_dir('/public-keys')) {
             $view->mkdir('/public-keys');
         }
         $this->view->file_put_contents('/public-keys/' . $publicShareKeyId . '.public.key', $keypair['publicKey']);
         // Encrypt private key empty passphrase
         $encryptedPrivateKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], '');
         // Save private key
         $this->view->file_put_contents('/owncloud_private_key/' . $publicShareKeyId . '.private.key', $encryptedPrivateKey);
         \OC_FileProxy::$enabled = $proxyStatus;
     }
     if (\OCA\Encryption\Helper::isPublicAccess()) {
         // Disable encryption proxy to prevent recursive calls
         $proxyStatus = \OC_FileProxy::$enabled;
         \OC_FileProxy::$enabled = false;
         $encryptedKey = $this->view->file_get_contents('/owncloud_private_key/' . $publicShareKeyId . '.private.key');
         $privateKey = Crypt::decryptPrivateKey($encryptedKey, '');
         $this->setPublicSharePrivateKey($privateKey);
         \OC_FileProxy::$enabled = $proxyStatus;
     }
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:43,代码来源:session.php


示例11: getParams

 public function getParams()
 {
     $array = array();
     foreach ($this->params as $key => $param) {
         $array[$param] = OC_Appconfig::getValue('user_wordpress', $param, '');
     }
     if (empty($array['wordpress_db_host'])) {
         $array['wordpress_db_host'] = OC_Config::getValue("dbhost", "");
     }
     if (empty($array['wordpress_db_name'])) {
         $array['wordpress_db_name'] = OC_Config::getValue("dbname", "owncloud");
     }
     if (empty($array['wordpress_db_user'])) {
         $array['wordpress_db_user'] = OC_Config::getValue("dbuser", "");
     }
     if (empty($array['wordpress_db_password'])) {
         $array['wordpress_db_password'] = OC_Config::getValue("dbpassword", "");
     }
     if (empty($array['wordpress_have_to_be_logged'])) {
         $array['wordpress_have_to_be_logged'] = '0';
         OC_Appconfig::setValue('user_wordpress', 'wordpress_have_to_be_logged', '0');
     }
     return $array;
 }
开发者ID:silvioheinze,项目名称:user_wordpress,代码行数:24,代码来源:wordpress.class.php


示例12: trim

         if ($param === 'rcHost') {
             if ($_POST[$param] == '' || strlen($_POST[$param]) > 3) {
                 OCP\Config::setAppValue('roundcube', $param, $_POST[$param]);
             }
         } else {
             if ($param === 'maildir') {
                 $maildir = $_POST[$param];
                 if (substr($maildir, -1) != '/') {
                     $maildir .= '/';
                 }
                 OCP\Config::setAppValue('roundcube', $param, $maildir);
             } else {
                 if ($param == 'rcRefreshInterval') {
                     $refresh = trim($_POST[$param]);
                     if ($refresh == '') {
                         OC_Appconfig::deleteKey('roundcube', $param);
                     } else {
                         if (!is_numeric($refresh)) {
                             OC_JSON::error(array("data" => array("message" => $l->t("Refresh interval '%s' is not a number.", array($refresh)))));
                             return false;
                         } else {
                             OCP\Config::setAppValue('roundcube', $param, $refresh);
                         }
                     }
                 } else {
                     OCP\Config::setAppValue('roundcube', $param, $_POST[$param]);
                 }
             }
         }
     }
 } else {
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:adminSettings.php


示例13: shareWithGroupMembersOnly

 /**
  * check if user can only share with group members
  * @return bool
  */
 public static function shareWithGroupMembersOnly()
 {
     $value = \OC_Appconfig::getValue('core', 'shareapi_only_share_with_group_members', 'no');
     return $value === 'yes' ? true : false;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:9,代码来源:share.php


示例14: isset

<?php

/**
 * ownCloud - Updater plugin
 *
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk [email protected]
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
namespace OCA\Updater;

\OCP\User::checkAdminUser();
\OCP\Util::addScript(App::APP_ID, '3rdparty/angular');
\OCP\Util::addScript(App::APP_ID, 'app');
\OCP\Util::addScript(App::APP_ID, 'controllers');
\OCP\Util::addStyle(App::APP_ID, 'updater');
if (!@file_exists(App::getBackupBase())) {
    Helper::mkdir(App::getBackupBase());
}
$data = App::getFeed();
$isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array();
$tmpl = new \OCP\Template(App::APP_ID, 'admin');
$lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat');
$tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck));
$tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable ? 'true' : 'false');
$tmpl->assign('channels', Channel::getChannels());
$tmpl->assign('currentChannel', Channel::getCurrentChannel());
$tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : '');
return $tmpl->fetchPage();
开发者ID:samj1912,项目名称:repo,代码行数:31,代码来源:admin.php


示例15:

 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *  
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
namespace OCA\Documents;

\OCP\User::checkLoggedIn();
\OCP\JSON::checkAppEnabled('documents');
\OCP\App::setActiveNavigationEntry('documents_index');
\OCP\Util::addStyle('documents', 'style');
\OCP\Util::addStyle('documents', '3rdparty/webodf/dojo-app');
\OCP\Util::addScript('documents', 'documents');
\OCP\Util::addScript('files', 'file-upload');
\OCP\Util::addScript('files', 'jquery.iframe-transport');
\OCP\Util::addScript('files', 'jquery.fileupload');
$tmpl = new \OCP\Template('documents', 'documents', 'user');
$previewsEnabled = \OC::$server->getConfig()->getSystemValue('enable_previews', true);
$unstable = \OCP\Config::getAppValue('documents', 'unstable', 'false');
$maxUploadFilesize = \OCP\Util::maxUploadFilesize("/");
$savePath = \OCP\Config::getUserValue(\OCP\User::getUser(), 'documents', 'save_path', '/');
$tmpl->assign('enable_previews', $previewsEnabled);
$tmpl->assign('useUnstable', $unstable);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign('uploadMaxHumanFilesize', \OCP\Util::humanFileSize($maxUploadFilesize));
$tmpl->assign('savePath', $savePath);
$tmpl->assign("allowShareWithLink", \OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
$tmpl->printPage();
开发者ID:eottone,项目名称:documents,代码行数:31,代码来源:index.php


示例16: testDefaultExpireDate

 public function testDefaultExpireDate()
 {
     \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
     \OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes');
     \OC_Appconfig::setValue('core', 'shareapi_enforce_expire_date', 'yes');
     \OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2');
     // default expire date is set to 2 days
     // the time when the share was created is set to 3 days in the past
     // user defined expire date is set to +2 days from now on
     // -> link should be already expired by the default expire date but the user
     //    share should still exists.
     $now = time();
     $dateFormat = 'Y-m-d H:i:s';
     $shareCreated = $now - 3 * 24 * 60 * 60;
     $expireDate = date($dateFormat, $now + 2 * 24 * 60 * 60);
     $info = OC\Files\Filesystem::getFileInfo($this->filename);
     $this->assertTrue($info instanceof \OC\Files\FileInfo);
     $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, null, \OCP\PERMISSION_READ);
     $this->assertTrue(is_string($result));
     $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
     $this->assertTrue($result);
     $result = \OCP\Share::setExpirationDate('file', $info->getId(), $expireDate);
     $this->assertTrue($result);
     //manipulate stime so that both shares are older then the default expire date
     $statement = "UPDATE `*PREFIX*share` SET `stime` = ? WHERE `share_type` = ?";
     $query = \OCP\DB::prepare($statement);
     $result = $query->execute(array($shareCreated, \OCP\Share::SHARE_TYPE_LINK));
     $this->assertSame(1, $result);
     $query = \OCP\DB::prepare($statement);
     $result = $query->execute(array($shareCreated, \OCP\Share::SHARE_TYPE_USER));
     $this->assertSame(1, $result);
     // now the link share should expire because of enforced default expire date
     // the user share should still exist
     $result = \OCP\Share::getItemShared('file', $info->getId());
     $this->assertTrue(is_array($result));
     $this->assertSame(1, count($result));
     $share = reset($result);
     $this->assertSame(\OCP\Share::SHARE_TYPE_USER, $share['share_type']);
     //cleanup
     $result = \OCP\Share::unshare('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
     $this->assertTrue($result);
     \OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'no');
     \OC_Appconfig::setValue('core', 'shareapi_enforce_expire_date', 'no');
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:44,代码来源:api.php


示例17:

<?php

$currentVersion = OC_Appconfig::getValue('search_lucene', 'installed_version');
if (version_compare($currentVersion, '0.5.0', '<')) {
    //force reindexing of files
    $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*lucene_status` WHERE 1=1');
    $stmt->execute();
    //clear old background jobs
    $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*queuedtasks` WHERE `app`=?');
    $stmt->execute(array('search_lucene'));
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:11,代码来源:update.php


示例18: array

$linkItem = $data['linkItem'];
// Load the files
$dir = $data['realPath'];
$dir = \OC\Files\Filesystem::normalizePath($dir);
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
    \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
    \OCP\JSON::error(array('success' => false));
    exit;
}
$data = array();
// make filelist
$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
$formattedFiles = array();
foreach ($files as $file) {
    $entry = \OCA\Files\Helper::formatFileInfo($file);
    unset($entry['directory']);
    // for now
    $entry['permissions'] = \OCP\PERMISSION_READ;
    $formattedFiles[] = $entry;
}
$data['directory'] = $relativePath;
$data['files'] = $formattedFiles;
$data['dirToken'] = $linkItem['token'];
$permissions = $linkItem['permissions'];
// if globally disabled
if (OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
    // only allow reading
    $permissions = \OCP\PERMISSION_READ;
}
$data['permissions'] = $permissions;
OCP\JSON::success(array('data' => $data));
开发者ID:olucao,项目名称:owncloud-core,代码行数:31,代码来源:list.php


示例19: expire

 /**
  * @brief Erase a file's versions which exceed the set quota
  */
 private static function expire($filename, $versionsSize = null, $offset = 0)
 {
     if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
         list($uid, $filename) = self::getUidAndFilename($filename);
         $versionsFileview = new \OC\Files\View('/' . $uid . '/files_versions');
         // get available disk space for user
         $softQuota = true;
         $quota = \OC_Preferences::getValue($uid, 'files', 'quota');
         if ($quota === null || $quota === 'default') {
             $quota = \OC_Appconfig::getValue('files', 'default_quota');
         }
         if ($quota === null || $quota === 'none') {
             $quota = \OC\Files\Filesystem::free_space('/');
             $softQuota = false;
         } else {
             $quota = \OCP\Util::computerFileSize($quota);
         }
         // make sure that we have the current size of the version history
         if ($versionsSize === null) {
             $versionsSize = self::getVersionsSize($uid);
             if ($versionsSize === false || $versionsSize < 0) {
                 $versionsSize = self::calculateSize($uid);
             }
         }
         // calculate available space for version history
         // subtract size of files and current versions size from quota
         if ($softQuota) {
             $files_view = new \OC\Files\View('/' . $uid . '/files');
             $rootInfo = $files_view->getFileInfo('/');
             $free = $quota - $rootInfo['size'];
             // remaining free space for user
             if ($free > 0) {
                 $availableSpace = $free * self::DEFAULTMAXSIZE / 100 - ($versionsSize + $offset);
                 // how much space can be used for versions
             } else {
                 $availableSpace = $free - $versionsSize - $offset;
             }
         } else {
             $availableSpace = $quota - $offset;
         }
         // with the  probability of 0.1% we reduce the number of all versions not only for the current file
         $random = rand(0, 1000);
         if ($random == 0) {
             $allFiles = true;
         } else {
             $allFiles = false;
         }
         $allVersions = Storage::getVersions($uid, $filename);
         $versionsByFile[$filename] = $allVersions;
         $sizeOfDeletedVersions = self::delOldVersions($versionsByFile, $allVersions, $versionsFileview);
         $availableSpace = $availableSpace + $sizeOfDeletedVersions;
         $versionsSize = $versionsSize - $sizeOfDeletedVersions;
         // if still not enough free space we rearrange the versions from all files
         if ($availableSpace <= 0 || $allFiles) {
             $result = Storage::getAllVersions($uid);
             $versionsByFile = $result['by_file'];
             $allVersions = $result['all'];
             $sizeOfDeletedVersions = self::delOldVersions($versionsByFile, $allVersions, $versionsFileview);
             $availableSpace = $availableSpace + $sizeOfDeletedVersions;
             $versionsSize = $versionsSize - $sizeOfDeletedVersions;
         }
         // Check if enough space is available after versions are rearranged.
         // If not we delete the oldest versions until we meet the size limit for versions,
         // but always keep the two latest versions
         $numOfVersions = count($allVersions) - 2;
         $i = 0;
         while ($availableSpace < 0 && $i < $numOfVersions) {
             $version = current($allVersions);
             $versionsFileview->unlink($version['path'] . '.v' . $version['version']);
             $versionsSize -= $version['size'];
             $availableSpace += $version['size'];
             next($allVersions);
             $i++;
         }
         return $versionsSize;
         // finally return the new size of the version history
     }
     return false;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:82,代码来源:versions.php


示例20: is_writable

$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size));
if ($_POST && OC_Util::isCallRegistered()) {
    if (isset($_POST['maxUploadSize'])) {
        if (($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) {
            $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize);
        }
    }
}
OCP\App::setActiveNavigationEntry("files_administration");
$htaccessWritable = is_writable(OC::$SERVERROOT . '/.htaccess');
$tmpl = new OCP\Template('files', 'admin');
/* 
* extended version
* + only users with permission can delete files(in the files app only)
* + file type restriction
*/
$filetyprestriction = \OC_Appconfig::getValue('core', 'filetyperes_enabled', 'no');
$allowed_types = \OC_Appconfig::getValue('core', 'allowed_filetypes', '');
$deleteGroupsList = \OC_Appconfig::getValue('core', 'delete', '');
$deleteGroupsList = explode(',', $deleteGroupsList);
$tmpl->assign('deleteGroupsList', implode('|', $deleteGroupsList));
$tmpl->assign('fileTypeRes', $filetyprestriction);
$tmpl->assign('allowed_filetypes', $allowed_types);
$tmpl->assign('uploadChangable', $htaccessWorking and $htaccessWritable);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
// max possible makes only sense on a 32 bit system
$tmpl->assign('displayMaxPossibleUploadSize', PHP_INT_SIZE === 4);
$tmpl->assign('maxPossibleUploadSize', OCP\Util::humanFileSize(PHP_INT_MAX));
return $tmpl->fetchPage();
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:31,代码来源:admin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP OC_Calendar_App类代码示例发布时间:2022-05-23
下一篇:
PHP OC_App类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap