/** * Constructor * @param ILDAPWrapper $ldap * @param string $configPrefix a string with the prefix for the configkey column (appconfig table) * @param string|null $configID a string with the value for the appid column (appconfig table) or null for on-the-fly connections */ public function __construct(ILDAPWrapper $ldap, $configPrefix = '', $configID = 'user_ldap') { parent::__construct($ldap); $this->configPrefix = $configPrefix; $this->configID = $configID; $this->configuration = new Configuration($configPrefix, !is_null($configID)); $memcache = \OC::$server->getMemCacheFactory(); if ($memcache->isAvailable()) { $this->cache = $memcache->create(); } else { $this->cache = \OC\Cache::getGlobalCache(); } $this->hasPagedResultSupport = $this->ldap->hasPagedResultSupport(); $this->doNotValidate = !in_array($this->configPrefix, Helper::getServerConfigurationPrefixes()); }
/** * @return string */ public function getCacheKey() { if (!isset($this->cacheKey)) { $files = $this->getRoutingFiles(); $files[] = 'settings/routes.php'; $files[] = 'core/routes.php'; $files[] = 'ocs/routes.php'; $this->cacheKey = \OC\Cache::generateCacheKeyFromFiles($files); } return $this->cacheKey; }
/** * @param ILDAPWrapper $ldap */ public function __construct(ILDAPWrapper $ldap) { $this->ldap = $ldap; $this->cache = \OC\Cache::getGlobalCache(); }
private function updateProgress($percentage) { $this->progress = $percentage; if ($this->cacheprogress) { \OC\Cache::set($this->progresskey, $this->progress, 300); } return true; }
public function clear($prefix = '') { $this->fast_cache->clear($prefix); $this->slow_cache->clear($prefix); }
<?php /** * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\JSON::checkLoggedIn(); OCP\App::checkAppEnabled('calendar'); OCP\JSON::callCheck(); session_write_close(); if (isset($_POST['progresskey']) && isset($_POST['getprogress'])) { echo OCP\JSON::success(array('percent' => \OC\Cache::get($_POST['progresskey']))); exit; } $file = \OC\Files\Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']); if (!$file) { OCP\JSON::error(array('error' => '404')); } $file = Sabre\VObject\StringUtil::convertToUTF8($file); $import = new OC_Calendar_Import($file); $import->setUserID(OCP\User::getUser()); $import->setTimeZone(OC_Calendar_App::$tz); $import->enableProgressCache(); $import->setProgresskey($_POST['progresskey']); if (!$import->isValid()) { OCP\JSON::error(array('error' => 'notvalid')); exit; } $newcal = false;
public static function postCroppedAvatar($args) { \OC_JSON::checkLoggedIn(); \OC_JSON::callCheck(); $user = \OC_User::getUser(); if (isset($_POST['crop'])) { $crop = $_POST['crop']; } else { $l = new \OC_L10n('core'); \OC_JSON::error(array("data" => array("message" => $l->t("No crop data provided")))); return; } $tmpavatar = \OC\Cache::get('tmpavatar'); if (is_null($tmpavatar)) { $l = new \OC_L10n('core'); \OC_JSON::error(array("data" => array("message" => $l->t("No temporary profile picture available, try again")))); return; } $image = new \OC_Image($tmpavatar); $image->crop($crop['x'], $crop['y'], $crop['w'], $crop['h']); try { $avatar = new \OC_Avatar($user); $avatar->set($image->data()); // Clean up \OC\Cache::remove('tmpavatar'); \OC_JSON::success(); } catch (\Exception $e) { \OC_JSON::error(array("data" => array("message" => $e->getMessage()))); } }