Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Psalm
uses: docker://jakzal/phpqa:php7.4-alpine
with:
args: psalm --monochrome --no-progress --output-format=text --update-baseline
args: psalm --monochrome --no-progress --output-format=text --update-baseline || ( git diff && exit 1 )
- name: Check for changes in Psalm baseline
run: |
bash -c "[[ ! \"`git status --porcelain build/psalm-baseline.xml`\" ]] || ( echo 'Uncommited changes in Psalm baseline' && git status && git diff && exit 1 )"
bash -c "[[ ! \"`git status --porcelain build/psalm-baseline.xml`\" ]] || ( echo 'Uncommited changes in Psalm baseline' && git status && git diff build/psalm-baseline.xml && exit 1 )"
26 changes: 13 additions & 13 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -905,15 +905,15 @@ public function deleteAllSharesByUser($principaluri) {
* used/fetched to determine these numbers. If both are specified the
* amount of times this is needed is reduced by a great degree.
*
* @param mixed $id
* @param mixed $calendarId
* @param int $calendarType
* @return array
*/
public function getCalendarObjects($id, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
public function getCalendarObjects($calendarId, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
$query = $this->db->getQueryBuilder();
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
->from('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($id)))
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
$stmt = $query->execute();

Expand Down Expand Up @@ -946,16 +946,16 @@ public function getCalendarObjects($id, $calendarType=self::CALENDAR_TYPE_CALEND
*
* This method must return null if the object did not exist.
*
* @param mixed $id
* @param mixed $calendarId
* @param string $objectUri
* @param int $calendarType
* @return array|null
*/
public function getCalendarObject($id, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
public function getCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
$query = $this->db->getQueryBuilder();
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
->from('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($id)))
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
$stmt = $query->execute();
Expand Down Expand Up @@ -991,7 +991,7 @@ public function getCalendarObject($id, $objectUri, $calendarType=self::CALENDAR_
* @param int $calendarType
* @return array
*/
public function getMultipleCalendarObjects($id, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
if (empty($uris)) {
return [];
}
Expand All @@ -1002,7 +1002,7 @@ public function getMultipleCalendarObjects($id, array $uris, $calendarType=self:
$query = $this->db->getQueryBuilder();
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
->from('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($id)))
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->in('uri', $query->createParameter('uri')))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));

Expand Down Expand Up @@ -1288,12 +1288,12 @@ public function deleteCalendarObject($calendarId, $objectUri, $calendarType=self
* as possible, so it gives you a good idea on what type of stuff you need
* to think of.
*
* @param mixed $id
* @param mixed $calendarId
* @param array $filters
* @param int $calendarType
* @return array
*/
public function calendarQuery($id, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
public function calendarQuery($calendarId, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
$componentType = null;
$requirePostFilter = true;
$timeRange = null;
Expand Down Expand Up @@ -1329,7 +1329,7 @@ public function calendarQuery($id, array $filters, $calendarType=self::CALENDAR_
$query = $this->db->getQueryBuilder();
$query->select($columns)
->from('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($id)))
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));

if ($componentType) {
Expand All @@ -1355,13 +1355,13 @@ public function calendarQuery($id, array $filters, $calendarType=self::CALENDAR_
} catch (ParseException $ex) {
$this->logger->logException($ex, [
'app' => 'dav',
'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri']
'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri']
]);
continue;
} catch (InvalidDataException $ex) {
$this->logger->logException($ex, [
'app' => 'dav',
'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri']
'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri']
]);
continue;
}
Expand Down
18 changes: 9 additions & 9 deletions apps/dav/lib/Connector/Sabre/ObjectTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ public function getNodeForPath($path) {
* This method must work recursively and delete the destination
* if it exists
*
* @param string $source
* @param string $destination
* @param string $sourcePath
* @param string $destinationPath
* @throws FileLocked
* @throws Forbidden
* @throws InvalidPath
Expand All @@ -201,14 +201,14 @@ public function getNodeForPath($path) {
* @throws \Sabre\DAV\Exception\ServiceUnavailable
* @return void
*/
public function copy($source, $destination) {
public function copy($sourcePath, $destinationPath) {
if (!$this->fileView) {
throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
}


$info = $this->fileView->getFileInfo(dirname($destination));
if ($this->fileView->file_exists($destination)) {
$info = $this->fileView->getFileInfo(dirname($destinationPath));
if ($this->fileView->file_exists($destinationPath)) {
$destinationPermission = $info && $info->isUpdateable();
} else {
$destinationPermission = $info && $info->isCreatable();
Expand All @@ -218,17 +218,17 @@ public function copy($source, $destination) {
}

// this will trigger existence check
$this->getNodeForPath($source);
$this->getNodeForPath($sourcePath);

list($destinationDir, $destinationName) = \Sabre\Uri\split($destination);
list($destinationDir, $destinationName) = \Sabre\Uri\split($destinationPath);
try {
$this->fileView->verifyPath($destinationDir, $destinationName);
} catch (\OCP\Files\InvalidPathException $ex) {
throw new InvalidPath($ex->getMessage());
}

try {
$this->fileView->copy($source, $destination);
$this->fileView->copy($sourcePath, $destinationPath);
} catch (StorageNotAvailableException $e) {
throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
} catch (ForbiddenException $ex) {
Expand All @@ -237,7 +237,7 @@ public function copy($source, $destination) {
throw new FileLocked($e->getMessage(), $e->getCode(), $e);
}

list($destinationDir,) = \Sabre\Uri\split($destination);
list($destinationDir,) = \Sabre\Uri\split($destinationPath);
$this->markDirty($destinationDir);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public function __construct(
$this->user = $user;
}

public function createFile($tagId, $data = null) {
public function createFile($name, $data = null) {
$tagId = $name;
try {
$tags = $this->tagManager->getTagsByIds([$tagId]);
$tag = current($tags);
Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/Lib/Auth/Password/UserProvided.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ private function getCredentialsIdentifier($storageId) {
return self::CREDENTIALS_IDENTIFIER_PREFIX . $storageId;
}

public function saveBackendOptions(IUser $user, $id, array $options) {
$this->credentialsManager->store($user->getUID(), $this->getCredentialsIdentifier($id), [
public function saveBackendOptions(IUser $user, $mountId, array $options) {
$this->credentialsManager->store($user->getUID(), $this->getCredentialsIdentifier($mountId), [
'user' => $options['user'], // explicitly copy the fields we want instead of just passing the entire $options array
'password' => $options['password'] // this way we prevent users from being able to modify any other field
]);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public function rmdir($path) {
}
}

public function touch($path, $time = null) {
public function touch($path, $mtime = null) {
try {
if (!$this->file_exists($path)) {
$fh = $this->share->write($this->buildPath($path));
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Migration/DummyUserSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DummyUserSession implements IUserSession {
*/
private $user;

public function login($user, $password) {
public function login($uid, $password) {
}

public function logout() {
Expand Down
6 changes: 3 additions & 3 deletions apps/files_sharing/lib/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public function __construct(IConfig $config, IManager $shareManager, ILogger $lo
* Get all mountpoints applicable for the user and check for shares where we need to update the etags
*
* @param \OCP\IUser $user
* @param \OCP\Files\Storage\IStorageFactory $storageFactory
* @param \OCP\Files\Storage\IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
public function getMountsForUser(IUser $user, IStorageFactory $loader) {
$shares = $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_USER, null, -1);
$shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_GROUP, null, -1));
$shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_CIRCLE, null, -1));
Expand Down Expand Up @@ -120,7 +120,7 @@ public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
'ownerView' => $ownerViews[$owner],
'sharingDisabledForUser' => $sharingDisabledForUser
],
$storageFactory,
$loader,
$view,
$foldersExistCache
);
Expand Down
7 changes: 4 additions & 3 deletions apps/files_sharing/lib/ShareBackend/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public function getFilePath($itemSource, $uidOwner) {

/**
* create unique target
* @param string $filePath
*
* @param string $itemSource
* @param string $shareWith
* @param array $exclude (optional)
* @return string
*/
public function generateTarget($filePath, $shareWith, $exclude = null) {
public function generateTarget($itemSource, $shareWith, $exclude = null) {
$shareFolder = \OCA\Files_Sharing\Helper::getShareFolder();
$target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($filePath));
$target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($itemSource));

// for group shares we return the target right away
if ($shareWith === false) {
Expand Down
14 changes: 8 additions & 6 deletions apps/user_ldap/lib/Group_Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap, GroupPlug
/**
* Tries the backends one after the other until a positive result is returned from the specified method
*
* @param string $gid the gid connected to the request
* @param string $id the gid connected to the request
* @param string $method the method of the group backend that shall be called
* @param array $parameters an array of parameters to be passed
* @return mixed, the result of the method or false
* @return mixed the result of the method or false
*/
protected function walkBackends($gid, $method, $parameters) {
protected function walkBackends($id, $method, $parameters) {
$gid = $id;
$cacheKey = $this->getGroupCacheKey($gid);
foreach ($this->backends as $configPrefix => $backend) {
if ($result = call_user_func_array([$backend, $method], $parameters)) {
Expand All @@ -74,13 +75,14 @@ protected function walkBackends($gid, $method, $parameters) {
/**
* Asks the backend connected to the server that supposely takes care of the gid from the request.
*
* @param string $gid the gid connected to the request
* @param string $id the gid connected to the request
* @param string $method the method of the group backend that shall be called
* @param array $parameters an array of parameters to be passed
* @param mixed $passOnWhen the result matches this variable
* @return mixed, the result of the method or false
* @return mixed the result of the method or false
*/
protected function callOnLastSeenOn($gid, $method, $parameters, $passOnWhen) {
protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen) {
$gid = $id;
$cacheKey = $this->getGroupCacheKey($gid);
$prefix = $this->getFromCache($cacheKey);
//in case the uid has been found in the past, try this stored connection first
Expand Down
10 changes: 6 additions & 4 deletions apps/user_ldap/lib/User_Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ public function __construct(
/**
* Tries the backends one after the other until a positive result is returned from the specified method
*
* @param string $uid the uid connected to the request
* @param string $id the uid connected to the request
* @param string $method the method of the user backend that shall be called
* @param array $parameters an array of parameters to be passed
* @return mixed the result of the method or false
*/
protected function walkBackends($uid, $method, $parameters) {
protected function walkBackends($id, $method, $parameters) {
$uid = $id;
$cacheKey = $this->getUserCacheKey($uid);
foreach ($this->backends as $configPrefix => $backend) {
$instance = $backend;
Expand All @@ -99,13 +100,14 @@ protected function walkBackends($uid, $method, $parameters) {
/**
* Asks the backend connected to the server that supposely takes care of the uid from the request.
*
* @param string $uid the uid connected to the request
* @param string $id the uid connected to the request
* @param string $method the method of the user backend that shall be called
* @param array $parameters an array of parameters to be passed
* @param mixed $passOnWhen the result matches this variable
* @return mixed the result of the method or false
*/
protected function callOnLastSeenOn($uid, $method, $parameters, $passOnWhen) {
protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen) {
$uid = $id;
$cacheKey = $this->getUserCacheKey($uid);
$prefix = $this->getFromCache($cacheKey);
//in case the uid has been found in the past, try this stored connection first
Expand Down
Loading