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
6 changes: 0 additions & 6 deletions lib/Db/SwarmFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
use OCP\AppFramework\Db\Entity;

/**
* @method void setFileId(int $fileId)
* @method int getFileId()
* @method void setName(string $name)
* @method string getName()
* @method void setSwarmReference(string $swarmReference)
Expand All @@ -50,9 +48,6 @@
* @method int getToken()
*/
class SwarmFile extends Entity {
/** @var null|int */
protected $fileId;

/** @var string */
protected $name;

Expand Down Expand Up @@ -84,7 +79,6 @@ class SwarmFile extends Entity {
protected $token;

public function __construct() {
$this->addType('fileId', 'int');
$this->addType('name', 'string');
$this->addType('swarmReference', 'string');
$this->addType('swarmTag', 'string');
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/SwarmFileMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public function __construct(IDBConnection $db) {
/**
* @throws Exception
*/
public function findByFileId(string $fileId): ?SwarmFile {
public function findById(string $id): ?SwarmFile {
$qb = $this->db->getQueryBuilder();

$select = $qb
->select('*')
->from($this->getTableName())
->where($qb->expr()->eq('fileId', $qb->createNamedParameter($fileId)))
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
;

return $this->findEntities($select)[0] ?? null;
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/EthswarmService.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public function setVisibility(string $fileName, int $storageId, int $visibility)
return $this->fileMapper->update($swarmFile);
}

public function getToken(string $fileId): string {
$swarmFile = $this->fileMapper->findByFileId($fileId);
public function getToken(string $id): string {
$swarmFile = $this->fileMapper->findById($id);
if (!$swarmFile) {
throw new StorageNotAvailableException($this->l10n->t('No token found'));
}
Expand Down
5 changes: 3 additions & 2 deletions lib/Storage/BeeSwarm.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function copy($source, $target): bool {
try {
// Get the source file from the mapper
$sourceFile = $this->fileMapper->find($source, $this->storageId);
if (!$sourceFile->getFileId()) {
if (!$sourceFile->getId()) {
$this->logger->error(
'copy failed: source file not found in mapper '.$source,
['app' => Application::NAME]
Expand All @@ -177,11 +177,12 @@ public function copy($source, $target): bool {
$copyData['storage_mtime'] = time();
$copyData['storage'] = $this->storageId;
$copyData['token'] = $this->token;
$copyData['visibility'] = $sourceFile->getVisibility();

// Create the new file entry in the mapper
$newFile = $this->fileMapper->createFile($copyData);

if (!$newFile->getFileId()) {
if (!$newFile->getId()) {
$this->logger->error(
'copy failed: failed to create new file in mapper '.$target,
['app' => Application::NAME]
Expand Down
12 changes: 6 additions & 6 deletions vendor-bin/sentry/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.