Merge pull request #174 from nextcloud/stable9-upstream-sync

[stable9] Upstream Sync
This commit is contained in:
Morris Jobke 2016-06-20 18:02:18 +02:00 committed by GitHub
commit bbe16db5a6
13 changed files with 66 additions and 28 deletions

View File

@ -32,6 +32,7 @@ namespace OC\Files\Storage;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Icewind\Streams\IteratorDirectory; use Icewind\Streams\IteratorDirectory;
use Icewind\Streams\RetryWrapper; use Icewind\Streams\RetryWrapper;
use OCP\Files\StorageNotAvailableException;
require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php'; require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php';
@ -94,6 +95,8 @@ class Dropbox extends \OC\Files\Storage\Common {
if ($list) { if ($list) {
try { try {
$response = $this->dropbox->getMetaData($path); $response = $this->dropbox->getMetaData($path);
} catch (\Dropbox_Exception_Forbidden $e) {
throw new StorageNotAvailableException('Dropbox API rate limit exceeded', StorageNotAvailableException::STATUS_ERROR, $e);
} catch (\Exception $exception) { } catch (\Exception $exception) {
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false; return false;
@ -127,6 +130,8 @@ class Dropbox extends \OC\Files\Storage\Common {
return $response; return $response;
} }
return null; return null;
} catch (\Dropbox_Exception_Forbidden $e) {
throw new StorageNotAvailableException('Dropbox API rate limit exceeded', StorageNotAvailableException::STATUS_ERROR, $e);
} catch (\Exception $exception) { } catch (\Exception $exception) {
if ($exception instanceof \Dropbox_Exception_NotFound) { if ($exception instanceof \Dropbox_Exception_NotFound) {
// don't log, might be a file_exist check // don't log, might be a file_exist check

View File

@ -41,8 +41,6 @@ $l = \OC::$server->getL10N('files_sharing');
\OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php'; \OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.php';
\OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php'; \OC::$CLASSPATH['OCA\Files\Share\Proxy'] = 'files_sharing/lib/proxy.php';
$application = new Application();
$application->registerMountProviders();
\OCP\App::registerAdmin('files_sharing', 'settings-admin'); \OCP\App::registerAdmin('files_sharing', 'settings-admin');
\OCP\App::registerPersonal('files_sharing', 'settings-personal'); \OCP\App::registerPersonal('files_sharing', 'settings-personal');
@ -52,6 +50,9 @@ $application->registerMountProviders();
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
$application = new Application();
$application->registerMountProviders();
$eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener( $eventDispatcher->addListener(
'OCA\Files::loadAdditionalScripts', 'OCA\Files::loadAdditionalScripts',

View File

@ -302,19 +302,23 @@ class Helper {
/** /**
* get default share folder * get default share folder
* *
* @param \OC\Files\View
* @return string * @return string
*/ */
public static function getShareFolder() { public static function getShareFolder($view = null) {
if ($view === null) {
$view = Filesystem::getView();
}
$shareFolder = \OC::$server->getConfig()->getSystemValue('share_folder', '/'); $shareFolder = \OC::$server->getConfig()->getSystemValue('share_folder', '/');
$shareFolder = Filesystem::normalizePath($shareFolder); $shareFolder = Filesystem::normalizePath($shareFolder);
if (!Filesystem::file_exists($shareFolder)) { if (!$view->file_exists($shareFolder)) {
$dir = ''; $dir = '';
$subdirs = explode('/', $shareFolder); $subdirs = explode('/', $shareFolder);
foreach ($subdirs as $subdir) { foreach ($subdirs as $subdir) {
$dir = $dir . '/' . $subdir; $dir = $dir . '/' . $subdir;
if (!Filesystem::is_dir($dir)) { if (!$view->is_dir($dir)) {
Filesystem::mkdir($dir); $view->mkdir($dir);
} }
} }
} }

View File

@ -75,7 +75,7 @@ class SharedMount extends MountPoint implements MoveableMount {
$parent = dirname($share['file_target']); $parent = dirname($share['file_target']);
if (!$this->recipientView->is_dir($parent)) { if (!$this->recipientView->is_dir($parent)) {
$parent = Helper::getShareFolder(); $parent = Helper::getShareFolder($this->recipientView);
} }
$newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget( $newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget(

View File

@ -4,6 +4,6 @@
"behat/behat": "^3.0", "behat/behat": "^3.0",
"guzzlehttp/guzzle": "~5.0", "guzzlehttp/guzzle": "~5.0",
"jarnaiz/behat-junit-formatter": "^1.3", "jarnaiz/behat-junit-formatter": "^1.3",
"sabre/dav": "3.0.x-dev" "sabre/dav": "3.0.9"
} }
} }

View File

@ -106,7 +106,12 @@ class Install extends Command {
$dbUser = $input->getOption('database-user'); $dbUser = $input->getOption('database-user');
$dbPass = $input->getOption('database-pass'); $dbPass = $input->getOption('database-pass');
$dbName = $input->getOption('database-name'); $dbName = $input->getOption('database-name');
$dbHost = $input->getOption('database-host'); if ($db === 'oci') {
// an empty hostname needs to be read from the raw parameters
$dbHost = $input->getParameterOption('--database-host', '');
} else {
$dbHost = $input->getOption('database-host');
}
$dbTablePrefix = 'oc_'; $dbTablePrefix = 'oc_';
if ($input->hasParameterOption('--database-table-prefix')) { if ($input->hasParameterOption('--database-table-prefix')) {
$dbTablePrefix = (string) $input->getOption('database-table-prefix'); $dbTablePrefix = (string) $input->getOption('database-table-prefix');

View File

@ -365,26 +365,26 @@ body {
} }
#body-login .grouptop input, #body-login .grouptop input,
.grouptop input { .grouptop input {
margin-bottom: 0; margin-bottom: 0 !important;
border-bottom: 0; border-bottom: 0 !important;
border-bottom-left-radius: 0; border-bottom-left-radius: 0 !important;
border-bottom-right-radius: 0; border-bottom-right-radius: 0 !important;
} }
#body-login .groupmiddle input, #body-login .groupmiddle input,
.groupmiddle input { .groupmiddle input {
margin-top: 0; margin-top: 0 !important;
margin-bottom: 0; margin-bottom: 0 !important;
border-top: 0; border-top: 0 !important;
border-bottom: 0; border-bottom: 0 !important;
border-radius: 0; border-radius: 0 !important;
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset !important; box-shadow: 0 1px 0 rgba(0,0,0,.1) inset !important;
} }
#body-login .groupbottom input, #body-login .groupbottom input,
.groupbottom input { .groupbottom input {
margin-top: 0; margin-top: 0 !important;
border-top: 0; border-top: 0 !important;
border-top-right-radius: 0; border-top-right-radius: 0 !important;
border-top-left-radius: 0; border-top-left-radius: 0 !important;
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset !important; box-shadow: 0 1px 0 rgba(0,0,0,.1) inset !important;
} }
#body-login .groupbottom input[type=submit] { #body-login .groupbottom input[type=submit] {

View File

@ -27,6 +27,7 @@
*/ */
namespace OC; namespace OC;
use OC\Cache\CappedMemoryCache;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\PreConditionNotMetException; use OCP\PreConditionNotMetException;
@ -58,14 +59,15 @@ class AllConfig implements \OCP\IConfig {
* - deleteAllUserValues * - deleteAllUserValues
* - deleteAppFromAllUsers * - deleteAppFromAllUsers
* *
* @var array $userCache * @var CappedMemoryCache $userCache
*/ */
private $userCache = array(); private $userCache;
/** /**
* @param SystemConfig $systemConfig * @param SystemConfig $systemConfig
*/ */
function __construct(SystemConfig $systemConfig) { function __construct(SystemConfig $systemConfig) {
$this->userCache = new CappedMemoryCache();
$this->systemConfig = $systemConfig; $this->systemConfig = $systemConfig;
} }

View File

@ -22,6 +22,8 @@
namespace OC\Encryption; namespace OC\Encryption;
use OC\Cache\CappedMemoryCache;
class File implements \OCP\Encryption\IFile { class File implements \OCP\Encryption\IFile {
/** @var Util */ /** @var Util */
@ -36,6 +38,7 @@ class File implements \OCP\Encryption\IFile {
public function __construct(Util $util) { public function __construct(Util $util) {
$this->util = $util; $this->util = $util;
$this->cache = new CappedMemoryCache();
} }

View File

@ -35,6 +35,7 @@ use OCP\IDBConnection;
use OCP\ILogger; use OCP\ILogger;
use OCP\IUser; use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use OC\Cache\CappedMemoryCache;
/** /**
* Cache mounts points per user in the cache so we can easilly look them up * Cache mounts points per user in the cache so we can easilly look them up
@ -50,15 +51,23 @@ class UserMountCache implements IUserMountCache {
*/ */
private $userManager; private $userManager;
/** @var ICachedMountInfo[][] [$userId => [$cachedMountInfo, ....], ...] */ /**
private $mountsForUsers = []; * Cached mount info.
* Map of $userId to ICachedMountInfo.
*
* @var ICache
**/
private $mountsForUsers;
/** /**
* @var ILogger * @var ILogger
*/ */
private $logger; private $logger;
private $cacheInfoCache = []; /**
* @var ICache
*/
private $cacheInfoCache;
/** /**
* UserMountCache constructor. * UserMountCache constructor.
@ -71,6 +80,8 @@ class UserMountCache implements IUserMountCache {
$this->connection = $connection; $this->connection = $connection;
$this->userManager = $userManager; $this->userManager = $userManager;
$this->logger = $logger; $this->logger = $logger;
$this->cacheInfoCache = new CappedMemoryCache();
$this->mountsForUsers = new CappedMemoryCache();
} }
public function registerMounts(IUser $user, array $mounts) { public function registerMounts(IUser $user, array $mounts) {

View File

@ -907,6 +907,11 @@ class Manager implements IManager {
break; break;
} }
// If there was no limit on the select we are done
if ($limit === -1) {
break;
}
$offset += $added; $offset += $added;
// Fetch again $limit shares // Fetch again $limit shares

View File

@ -43,6 +43,8 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\MethodNotAllowedException;
try { try {
OC_App::loadApps(['session']);
OC_App::loadApps(['authentication']);
// load all apps to get all api routes properly setup // load all apps to get all api routes properly setup
OC_App::loadApps(); OC_App::loadApps();

View File

@ -14,7 +14,7 @@ var UserList = {
availableGroups: [], availableGroups: [],
offset: 0, offset: 0,
usersToLoad: 10, //So many users will be loaded when user scrolls down usersToLoad: 10, //So many users will be loaded when user scrolls down
initialUsersToLoad: 250, //initial number of users to load initialUsersToLoad: 50, //initial number of users to load
currentGid: '', currentGid: '',
filter: '', filter: '',