Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable9] Upstream Sync #174

Merged
merged 12 commits into from
Jun 20, 2016
Merged
5 changes: 5 additions & 0 deletions apps/files_external/lib/dropbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use GuzzleHttp\Exception\RequestException;
use Icewind\Streams\IteratorDirectory;
use Icewind\Streams\RetryWrapper;
use OCP\Files\StorageNotAvailableException;

require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php';

Expand Down Expand Up @@ -94,6 +95,8 @@ private function getDropBoxMetaData($path, $list = false) {
if ($list) {
try {
$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) {
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
return false;
Expand Down Expand Up @@ -127,6 +130,8 @@ private function getDropBoxMetaData($path, $list = false) {
return $response;
}
return null;
} catch (\Dropbox_Exception_Forbidden $e) {
throw new StorageNotAvailableException('Dropbox API rate limit exceeded', StorageNotAvailableException::STATUS_ERROR, $e);
} catch (\Exception $exception) {
if ($exception instanceof \Dropbox_Exception_NotFound) {
// don't log, might be a file_exist check
Expand Down
5 changes: 3 additions & 2 deletions apps/files_sharing/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
\OC::$CLASSPATH['OCA\Files\Share\Maintainer'] = 'files_sharing/lib/maintainer.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::registerPersonal('files_sharing', 'settings-personal');
Expand All @@ -52,6 +50,9 @@
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');

$application = new Application();
$application->registerMountProviders();

$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener(
'OCA\Files::loadAdditionalScripts',
Expand Down
12 changes: 8 additions & 4 deletions apps/files_sharing/lib/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,19 +302,23 @@ public static function isIncomingServer2serverShareEnabled() {
/**
* get default share folder
*
* @param \OC\Files\View
* @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 = Filesystem::normalizePath($shareFolder);

if (!Filesystem::file_exists($shareFolder)) {
if (!$view->file_exists($shareFolder)) {
$dir = '';
$subdirs = explode('/', $shareFolder);
foreach ($subdirs as $subdir) {
$dir = $dir . '/' . $subdir;
if (!Filesystem::is_dir($dir)) {
Filesystem::mkdir($dir);
if (!$view->is_dir($dir)) {
$view->mkdir($dir);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/sharedmount.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private function verifyMountPoint(&$share) {
$parent = dirname($share['file_target']);

if (!$this->recipientView->is_dir($parent)) {
$parent = Helper::getShareFolder();
$parent = Helper::getShareFolder($this->recipientView);
}

$newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget(
Expand Down
2 changes: 1 addition & 1 deletion build/integration/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"behat/behat": "^3.0",
"guzzlehttp/guzzle": "~5.0",
"jarnaiz/behat-junit-formatter": "^1.3",
"sabre/dav": "3.0.x-dev"
"sabre/dav": "3.0.9"
}
}
7 changes: 6 additions & 1 deletion core/command/maintenance/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ protected function validateInput(InputInterface $input, OutputInterface $output,
$dbUser = $input->getOption('database-user');
$dbPass = $input->getOption('database-pass');
$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_';
if ($input->hasParameterOption('--database-table-prefix')) {
$dbTablePrefix = (string) $input->getOption('database-table-prefix');
Expand Down
26 changes: 13 additions & 13 deletions core/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -365,26 +365,26 @@ body {
}
#body-login .grouptop input,
.grouptop input {
margin-bottom: 0;
border-bottom: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
margin-bottom: 0 !important;
border-bottom: 0 !important;
border-bottom-left-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}
#body-login .groupmiddle input,
.groupmiddle input {
margin-top: 0;
margin-bottom: 0;
border-top: 0;
border-bottom: 0;
border-radius: 0;
margin-top: 0 !important;
margin-bottom: 0 !important;
border-top: 0 !important;
border-bottom: 0 !important;
border-radius: 0 !important;
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset !important;
}
#body-login .groupbottom input,
.groupbottom input {
margin-top: 0;
border-top: 0;
border-top-right-radius: 0;
border-top-left-radius: 0;
margin-top: 0 !important;
border-top: 0 !important;
border-top-right-radius: 0 !important;
border-top-left-radius: 0 !important;
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset !important;
}
#body-login .groupbottom input[type=submit] {
Expand Down
6 changes: 4 additions & 2 deletions lib/private/allconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/

namespace OC;
use OC\Cache\CappedMemoryCache;
use OCP\IDBConnection;
use OCP\PreConditionNotMetException;

Expand Down Expand Up @@ -58,14 +59,15 @@ class AllConfig implements \OCP\IConfig {
* - deleteAllUserValues
* - deleteAppFromAllUsers
*
* @var array $userCache
* @var CappedMemoryCache $userCache
*/
private $userCache = array();
private $userCache;

/**
* @param SystemConfig $systemConfig
*/
function __construct(SystemConfig $systemConfig) {
$this->userCache = new CappedMemoryCache();
$this->systemConfig = $systemConfig;
}

Expand Down
3 changes: 3 additions & 0 deletions lib/private/encryption/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

namespace OC\Encryption;

use OC\Cache\CappedMemoryCache;

class File implements \OCP\Encryption\IFile {

/** @var Util */
Expand All @@ -36,6 +38,7 @@ class File implements \OCP\Encryption\IFile {

public function __construct(Util $util) {
$this->util = $util;
$this->cache = new CappedMemoryCache();
}


Expand Down
17 changes: 14 additions & 3 deletions lib/private/files/config/usermountcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use OC\Cache\CappedMemoryCache;

/**
* Cache mounts points per user in the cache so we can easilly look them up
Expand All @@ -50,15 +51,23 @@ class UserMountCache implements IUserMountCache {
*/
private $userManager;

/** @var ICachedMountInfo[][] [$userId => [$cachedMountInfo, ....], ...] */
private $mountsForUsers = [];
/**
* Cached mount info.
* Map of $userId to ICachedMountInfo.
*
* @var ICache
**/
private $mountsForUsers;

/**
* @var ILogger
*/
private $logger;

private $cacheInfoCache = [];
/**
* @var ICache
*/
private $cacheInfoCache;

/**
* UserMountCache constructor.
Expand All @@ -71,6 +80,8 @@ public function __construct(IDBConnection $connection, IUserManager $userManager
$this->connection = $connection;
$this->userManager = $userManager;
$this->logger = $logger;
$this->cacheInfoCache = new CappedMemoryCache();
$this->mountsForUsers = new CappedMemoryCache();
}

public function registerMounts(IUser $user, array $mounts) {
Expand Down
5 changes: 5 additions & 0 deletions lib/private/share20/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,11 @@ public function getSharesBy($userId, $shareType, $path = null, $reshares = false
break;
}

// If there was no limit on the select we are done
if ($limit === -1) {
break;
}

$offset += $added;

// Fetch again $limit shares
Expand Down
2 changes: 2 additions & 0 deletions ocs/v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
use Symfony\Component\Routing\Exception\MethodNotAllowedException;

try {
OC_App::loadApps(['session']);
OC_App::loadApps(['authentication']);
// load all apps to get all api routes properly setup
OC_App::loadApps();

Expand Down
2 changes: 1 addition & 1 deletion settings/js/users/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var UserList = {
availableGroups: [],
offset: 0,
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: '',
filter: '',

Expand Down