diff options
-rw-r--r-- | apps/files/command/scan.php | 36 | ||||
-rw-r--r-- | apps/files/css/mobile.css | 4 | ||||
-rw-r--r-- | core/css/share.css | 2 | ||||
-rw-r--r-- | core/js/share.js | 6 | ||||
-rw-r--r-- | lib/private/app.php | 4 | ||||
-rw-r--r-- | lib/private/files/utils/scanner.php | 11 | ||||
-rw-r--r-- | lib/private/repair.php | 11 | ||||
-rw-r--r-- | remote.php | 9 |
8 files changed, 63 insertions, 20 deletions
diff --git a/apps/files/command/scan.php b/apps/files/command/scan.php index 25ab70af362..3412cf80dea 100644 --- a/apps/files/command/scan.php +++ b/apps/files/command/scan.php @@ -9,6 +9,7 @@ namespace OCA\Files\Command; +use OC\ForbiddenException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -32,28 +33,32 @@ class Scan extends Command { ->setName('files:scan') ->setDescription('rescan filesystem') ->addArgument( - 'user_id', - InputArgument::OPTIONAL | InputArgument::IS_ARRAY, - 'will rescan all files of the given user(s)' - ) + 'user_id', + InputArgument::OPTIONAL | InputArgument::IS_ARRAY, + 'will rescan all files of the given user(s)' + ) ->addOption( - 'all', - null, - InputOption::VALUE_NONE, - 'will rescan all files of all known users' - ) - ; + 'all', + null, + InputOption::VALUE_NONE, + 'will rescan all files of all known users' + ); } protected function scanFiles($user, OutputInterface $output) { $scanner = new \OC\Files\Utils\Scanner($user); - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) { + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { $output->writeln("Scanning <info>$path</info>"); }); - $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) { + $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { $output->writeln("Scanning <info>$path</info>"); }); - $scanner->scan(''); + try { + $scanner->scan(''); + } catch (ForbiddenException $e) { + $output->writeln("<error>Home storage for user $user not writable</error>"); + $output->writeln("Make sure you're running the scan command only as the user the web server runs as"); + } } protected function execute(InputInterface $input, OutputInterface $output) { @@ -63,6 +68,11 @@ class Scan extends Command { $users = $input->getArgument('user_id'); } + if (count($users) === 0) { + $output->writeln("<error>Please specify the user id to scan or \"--all\" to scan for all users</error>"); + return; + } + foreach ($users as $user) { if (is_object($user)) { $user = $user->getUID(); diff --git a/apps/files/css/mobile.css b/apps/files/css/mobile.css index a0b92ca6949..a2c63724b06 100644 --- a/apps/files/css/mobile.css +++ b/apps/files/css/mobile.css @@ -25,7 +25,7 @@ table.multiselect thead { /* restrict length of displayed filename to prevent overflow */ table td.filename .nametext { - max-width: 75% !important; + width: 100%; } /* always show actions on mobile, not only on hover */ @@ -51,7 +51,7 @@ table td.filename .nametext { /* ellipsis on file names */ table td.filename .nametext .innernametext { - max-width: 75%; + max-width: 50%; } /* proper notification area for multi line messages */ diff --git a/core/css/share.css b/core/css/share.css index 0859c195858..314c6140d78 100644 --- a/core/css/share.css +++ b/core/css/share.css @@ -35,6 +35,8 @@ #shareWithList label input[type=checkbox]{ margin-left: 0; + top: 3px; + position: relative; } #shareWithList .username{ padding-right: 8px; diff --git a/core/js/share.js b/core/js/share.js index e164602d0ab..1c59524939c 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -569,6 +569,9 @@ OC.Share={ } html += '<label><input type="checkbox" name="mailNotification" class="mailNotification" ' + checked + ' />'+t('core', 'notify by email')+'</label> '; } + if (possiblePermissions & OC.PERMISSION_SHARE) { + html += '<label><input type="checkbox" name="share" class="permissions" '+shareChecked+' data-permissions="'+OC.PERMISSION_SHARE+'" />'+t('core', 'can share')+'</label>'; + } if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) { html += '<label><input type="checkbox" name="edit" class="permissions" '+editChecked+' />'+t('core', 'can edit')+'</label> '; } @@ -583,9 +586,6 @@ OC.Share={ if (possiblePermissions & OC.PERMISSION_DELETE) { html += '<label><input type="checkbox" name="delete" class="permissions" '+deleteChecked+' data-permissions="'+OC.PERMISSION_DELETE+'" />'+t('core', 'delete')+'</label>'; } - if (possiblePermissions & OC.PERMISSION_SHARE) { - html += '<label><input type="checkbox" name="share" class="permissions" '+shareChecked+' data-permissions="'+OC.PERMISSION_SHARE+'" />'+t('core', 'share')+'</label>'; - } html += '</div>'; html += '</li>'; html = $(html).appendTo('#shareWithList'); diff --git a/lib/private/app.php b/lib/private/app.php index 01597b37e77..9fb0ec2e34f 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -509,6 +509,10 @@ class OC_App { * @return string|false */ public static function getAppPath($appid) { + if ($appid === null || trim($appid) === '') { + return false; + } + if (($dir = self::findAppInDirectories($appid)) != false) { return $dir['path'] . '/' . $appid; } diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php index 1bb3e694c96..c2fabf51946 100644 --- a/lib/private/files/utils/scanner.php +++ b/lib/private/files/utils/scanner.php @@ -11,6 +11,7 @@ namespace OC\Files\Utils; use OC\Files\View; use OC\Files\Cache\ChangePropagator; use OC\Files\Filesystem; +use OC\ForbiddenException; use OC\Hooks\PublicEmitter; /** @@ -104,6 +105,7 @@ class Scanner extends PublicEmitter { /** * @param string $dir + * @throws \OC\ForbiddenException */ public function scan($dir) { $mounts = $this->getMounts($dir); @@ -111,7 +113,14 @@ class Scanner extends PublicEmitter { if (is_null($mount->getStorage())) { continue; } - $scanner = $mount->getStorage()->getScanner(); + $storage = $mount->getStorage(); + // if the home storage isn't writable then the scanner is run as the wrong user + if ($storage->instanceOfStorage('\OC\Files\Storage\Home') and + (!$storage->isCreatable('') or !$storage->isCreatable('files')) + ) { + throw new ForbiddenException(); + } + $scanner = $storage->getScanner(); $this->attachListener($mount); $scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); } diff --git a/lib/private/repair.php b/lib/private/repair.php index 23d1c2b831e..db2a04433b0 100644 --- a/lib/private/repair.php +++ b/lib/private/repair.php @@ -13,7 +13,7 @@ use OC\Hooks\Emitter; class Repair extends BasicEmitter { /** - * @var array + * @var RepairStep[] **/ private $repairSteps; @@ -80,4 +80,13 @@ class Repair extends BasicEmitter { public static function getBeforeUpgradeRepairSteps() { return array(); } + + /** + * {@inheritDoc} + * + * Redeclared as public to allow invocation from within the closure above in php 5.3 + */ + public function emit($scope, $method, $arguments = array()) { + parent::emit($scope, $method, $arguments); + } } diff --git a/remote.php b/remote.php index 232e47ee402..a91742b0475 100644 --- a/remote.php +++ b/remote.php @@ -2,6 +2,15 @@ try { require_once 'lib/base.php'; + + if (\OCP\Util::needUpgrade()) { + // since the behavior of apps or remotes are unpredictable during + // an upgrade, return a 503 directly + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); + OC_Template::printErrorPage('Service unavailable'); + exit; + } + $path_info = OC_Request::getPathInfo(); if ($path_info === false || $path_info === '') { OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND); |