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
14 changes: 7 additions & 7 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
use OCP\AppFramework\IAppContainer;
use OCP\IGroupManager;
use OCP\IServerContainer;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Notification\IManager as INotificationManager;
use OCP\Share\Events\ShareCreatedEvent;

Expand All @@ -55,16 +57,14 @@ public function register(IRegistrationContext $context): void {
$context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
$context->registerEventListener(ShareCreatedEvent::class, ShareAutoAcceptListener::class);
$context->registerEventListener(BeforeTemplateRenderedEvent::class, TalkIntegrationListener::class);

// need to cheat here since there's no way to register these in IRegistrationContext
$container = $this->getContainer();
$server = $container->getServer();
$server->getUserManager()->registerBackend($container->query(UserBackend::class));
\OC_App::loadApp('theming');
$server->getGroupManager()->addBackend($container->query(GroupBackend::class));
}

public function boot(IBootContext $context): void {
// need to cheat here since there's no way to register these in IRegistrationContext
$container = $context->getServerContainer();
$container->get(IUserManager::class)->registerBackend($container->query(UserBackend::class));
$container->get(IGroupManager::class)->addBackend($container->query(GroupBackend::class));

$this->setupGuestManagement($context->getAppContainer(), $context->getServerContainer());
$this->setupGuestRestrictions($context->getAppContainer(), $context->getServerContainer());
$this->setupNotifications($context->getAppContainer());
Expand Down
2 changes: 1 addition & 1 deletion lib/GroupBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getUserGroups($uid): array {
* Returns a list with all groups
*/
public function getGroups($search = '', $limit = -1, $offset = 0): array {
return $offset === 0 ? [$this->groupName] : [];
return $offset == 0 ? [$this->groupName] : [];
}

/**
Expand Down
36 changes: 21 additions & 15 deletions lib/Storage/DirMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,41 +100,47 @@ public function getPermissions($path): int {
}
}

public function rename($path1, $path2): bool {
if (!$this->isUpdatable($path1)) {
/**
* @psalm-suppress ParamNameMismatch
*/
public function rename($source, $target): bool {
if (!$this->isUpdatable($source)) {
return false;
}
if ($this->file_exists($path2)) {
if ($this->isUpdatable($path2)) {
return $this->storage->rename($path1, $path2);
if ($this->file_exists($target)) {
if ($this->isUpdatable($target)) {
return $this->storage->rename($source, $target);
}
} else {
$parent = dirname($path2);
$parent = dirname($target);
if ($parent === '.') {
$parent = '';
}
if ($this->isCreatable($parent)) {
return $this->storage->rename($path1, $path2);
return $this->storage->rename($source, $target);
}
}
return false;
}

public function copy($path1, $path2): bool {
if (!$this->isReadable($path1)) {

/**
* @psalm-suppress ParamNameMismatch
*/
public function copy($source, $target): bool {
if (!$this->isReadable($source)) {
return false;
}
if ($this->file_exists($path2)) {
if ($this->isUpdatable($path2)) {
return $this->storage->copy($path1, $path2);
if ($this->file_exists($target)) {
if ($this->isUpdatable($target)) {
return $this->storage->copy($source, $target);
}
} else {
$parent = dirname($path2);
$parent = dirname($target);
if ($parent === '.') {
$parent = '';
}
if ($this->isCreatable($parent)) {
return $this->storage->copy($path1, $path2);
return $this->storage->copy($source, $target);
}
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions lib/UserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function getDisplayNames($search = '', $limit = null, $offset = null): ar
/**
* Check if the password is correct
*
* @return string|bool
* @return string|false
*
* Check if the password is correct without logging in the user
* returns the user id or false
Expand Down Expand Up @@ -377,7 +377,7 @@ public function hasUserListings() {
/**
* counts the users in the database
*
* @return int|bool
* @return int|false
*/
public function countUsers() {
$query = $this->dbConn->getQueryBuilder();
Expand Down