Merge pull request #317 from nextcloud/scrutinizer-fixed

Scrutinizer fixes
This commit is contained in:
Roeland Douma 2016-07-08 13:49:42 +02:00 committed by GitHub
commit 48f9e4ed03
19 changed files with 55 additions and 30 deletions

View file

@ -35,6 +35,12 @@ class BirthdayService {
/** @var GroupPrincipalBackend */
private $principalBackend;
/** @var CalDavBackend */
private $calDavBackEnd;
/** @var CardDavBackend */
private $cardDavBackEnd;
/**
* BirthdayService constructor.
*

View file

@ -25,6 +25,8 @@ use OCP\Contacts\IManager;
use OCP\IURLGenerator;
class ContactsManager {
/** @var CardDavBackend */
private $backend;
/**
* ContactsManager constructor.

View file

@ -50,7 +50,7 @@ class Invite implements XmlSerializable {
* The organizer contains information about the person who shared the
* object.
*
* @var array
* @var array|null
*/
protected $organizer;

View file

@ -58,7 +58,7 @@ class CustomPropertiesBackend implements BackendInterface {
private $connection;
/**
* @var IUser
* @var string
*/
private $user;

View file

@ -43,6 +43,12 @@ class Server {
/** @var IRequest */
private $request;
/** @var string */
private $baseUri;
/** @var Connector\Sabre\Server */
private $server;
public function __construct(IRequest $request, $baseUri) {
$this->request = $request;
$this->baseUri = $baseUri;

View file

@ -39,6 +39,6 @@ class ServerTest extends \Test\TestCase {
$r = $this->getMockBuilder('\OCP\IRequest')
->disableOriginalConstructor()->getMock();
$s = new Server($r, '/');
$this->assertNotNull($s->server);
$this->assertInstanceOf('OCA\DAV\Server', $s);
}
}

View file

@ -130,7 +130,7 @@ class GetSharedSecret extends Job{
* @param JobList $jobList
* @param ILogger $logger
*/
protected function parentExecute($jobList, $logger) {
protected function parentExecute($jobList, $logger = null) {
parent::execute($jobList, $logger);
}

View file

@ -43,7 +43,7 @@ class DbHandler {
private $connection;
/** @var IL10N */
private $l;
private $IL10N;
/** @var string */
private $dbTable = 'trusted_servers';
@ -87,7 +87,7 @@ class DbHandler {
return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable);
} else {
$message = 'Internal failure, Could not add ownCloud as trusted server: ' . $url;
$message_t = $this->l->t('Could not add server');
$message_t = $this->IL10N->t('Could not add server');
throw new HintException($message, $message_t);
}
}

View file

@ -70,7 +70,7 @@ var RollingQueue = function (functionList, queueWindow, callback) {
throw "functionList must be an array";
}
for (i = 0; i < this.queueWindow; i++) {
for (var i = 0; i < this.queueWindow; i++) {
this.launchNext();
}
};
@ -134,4 +134,4 @@ if (!OCA.External.StatusManager) {
OCA.External.StatusManager.RollingQueue = RollingQueue;
})();
})();

View file

@ -12,6 +12,8 @@
*
*/
/** @global Handlebars */
if (!OCA.External) {
OCA.External = {};
}
@ -502,7 +504,7 @@ OCA.External.StatusManager.Utils = {
trFolder = $('#fileList tr[data-file=\"' + OCA.External.StatusManager.Utils.jqSelEscape(folder) + '\"]');
}
trFolder.removeClass('externalErroredRow').removeClass('externalDisabledRow');
tdChilds = trFolder.find("td:first-child div.thumbnail");
var tdChilds = trFolder.find("td:first-child div.thumbnail");
tdChilds.each(function () {
var thisElement = $(this);
thisElement.css('background-image', thisElement.data('oldImage'));
@ -525,7 +527,7 @@ OCA.External.StatusManager.Utils = {
});
} else {
file = $("#fileList tr[data-file=\"" + this.jqSelEscape(filename) + "\"] > td:first-child div.thumbnail");
parentTr = file.parents('tr:first');
var parentTr = file.parents('tr:first');
route = OCA.External.StatusManager.Utils.getIconRoute(parentTr);
parentTr.attr("data-icon", route);
file.css('background-image', "url(" + route + ")").css('display', 'none').css('display', 'inline');

View file

@ -74,6 +74,9 @@ class AmazonS3 extends \OC\Files\Storage\Common {
*/
private $rescanDelay = 10;
/** @var string */
private $id;
/**
* @param string $path
* @return string correctly encoded path

View file

@ -49,8 +49,8 @@ class SFTP extends \OC\Files\Storage\Common {
private $auth;
/**
* @var SFTP
*/
* @var \phpseclib\Net\SFTP
*/
protected $client;
/**

View file

@ -221,7 +221,7 @@ class SMB extends \OC\Files\Storage\Common {
/**
* @param string $path
* @param string $mode
* @return resource
* @return resource|false
*/
public function fopen($path, $mode) {
$fullPath = $this->buildPath($path);

View file

@ -68,6 +68,10 @@ class Swift extends \OC\Files\Storage\Common {
* @var array
*/
private $params;
/** @var string */
private $id;
/**
* @var array
*/

View file

@ -71,7 +71,7 @@ $shareManager = \OC::$server->getShareManager();
$share = $shareManager->getShareByToken($token);
$sharePermissions= (int)$share->getPermissions();
if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
if($rootInfo === false || !($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
OCP\JSON::error(array('data' => 'Share is not readable.'));
exit();
}

View file

@ -8,6 +8,8 @@
*
*/
/* @global Handlebars */
(function() {
var TEMPLATE =
'<div>' +

View file

@ -285,19 +285,6 @@ class ShareController extends Controller {
throw $e;
}
$rootFolder = null;
if ($share->getNode() instanceof \OCP\Files\Folder) {
/** @var \OCP\Files\Folder $rootFolder */
$rootFolder = $share->getNode();
try {
$path = $rootFolder->get($path);
} catch (\OCP\Files\NotFoundException $e) {
$this->emitAccessShareHook($share, 404, 'Share not found');
throw new NotFoundException();
}
}
$shareTmpl = [];
$shareTmpl['displayName'] = $this->userManager->get($share->getShareOwner())->getDisplayName();
$shareTmpl['owner'] = $share->getShareOwner();
@ -316,7 +303,17 @@ class ShareController extends Controller {
// Show file list
$hideFileList = false;
if ($share->getNode() instanceof \OCP\Files\Folder) {
$shareTmpl['dir'] = $rootFolder->getRelativePath($path->getPath());
/** @var \OCP\Files\Folder $rootFolder */
$rootFolder = $share->getNode();
try {
$folderNode = $rootFolder->get($path);
} catch (\OCP\Files\NotFoundException $e) {
$this->emitAccessShareHook($share, 404, 'Share not found');
throw new NotFoundException();
}
$shareTmpl['dir'] = $rootFolder->getRelativePath($folderNode->getPath());
/*
* The OC_Util methods require a view. This just uses the node API
@ -333,7 +330,7 @@ class ShareController extends Controller {
$hideFileList = $share->getPermissions() & \OCP\Constants::PERMISSION_READ ? false : true;
$folder = new Template('files', 'list', '');
$folder->assign('dir', $rootFolder->getRelativePath($path->getPath()));
$folder->assign('dir', $rootFolder->getRelativePath($folderNode->getPath()));
$folder->assign('dirToken', $token);
$folder->assign('permissions', \OCP\Constants::PERMISSION_READ);
$folder->assign('isPublic', true);

View file

@ -24,6 +24,7 @@
namespace OCA\Files_Sharing;
use Doctrine\DBAL\Connection;
use OCP\ICache;
use OCP\IDBConnection;
use OC\Cache\CappedMemoryCache;
@ -38,7 +39,7 @@ class Migration {
/** @var IDBConnection */
private $connection;
/** @var array with all shares we already saw */
/** @var ICache with all shares we already saw */
private $shareCache;
/** @var string */

View file

@ -8,6 +8,8 @@
*
*/
/* @global Handlebars */
(function() {
var TEMPLATE_ITEM =
'<li data-revision="{{timestamp}}">' +