Skip to content

Commit

Permalink
fixup! Code style fixes and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr committed Nov 25, 2019
1 parent 5f260a3 commit d8ba16c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CleanupDirectEditingTokens extends TimedJob {

const INTERVAL_MINUTES = 15 * 60;
private const INTERVAL_MINUTES = 15 * 60;

/**
* @var IManager
Expand Down
6 changes: 5 additions & 1 deletion apps/files/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@
* @package OCA\Files
*/
class Capabilities implements ICapability {

/** @var IConfig */
protected $config;

/** @var Manager */
protected $directEditingManager;

/**
* Capabilities constructor.
*
Expand All @@ -66,7 +70,7 @@ public function getCapabilities() {
];
}

private function getDirectEditingCapabilitites() {
private function getDirectEditingCapabilitites(): array {
$capabilities = [
'editors' => [],
'creators' => []
Expand Down
6 changes: 3 additions & 3 deletions apps/files/lib/Controller/DirectEditingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct($appName, IRequest $request, $corsMethods, $corsAllo
* @NoAdminRequired
*/
public function create(string $path, string $editorId, string $creatorId, string $templateId = null): DataResponse {
$this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager));
$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));

try {
$token = $this->directEditingManager->create($path, $editorId, $creatorId, $templateId);
Expand All @@ -83,7 +83,7 @@ public function create(string $path, string $editorId, string $creatorId, string
* @NoAdminRequired
*/
public function open(int $fileId, string $editorId = null): DataResponse {
$this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager));
$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));

try {
$token = $this->directEditingManager->open($fileId, $editorId);
Expand All @@ -102,7 +102,7 @@ public function open(int $fileId, string $editorId = null): DataResponse {
* @NoAdminRequired
*/
public function templates(string $editorId, string $creatorId): DataResponse {
$this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager));
$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));

try {
return new DataResponse($this->directEditingManager->getTemplates($editorId, $creatorId));
Expand Down
70 changes: 34 additions & 36 deletions core/Migrations/Version18000Date20191014105105.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,42 @@ public function __construct(IDBConnection $connection) {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('direct_edit')) {
$table = $schema->createTable('direct_edit');
$table = $schema->createTable('direct_edit');

$table->addColumn('id', Type::BIGINT, [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('editor_id', Type::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('token', Type::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('file_id', Type::BIGINT, [
'notnull' => true,
]);
$table->addColumn('user_id', Type::STRING, [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('share_id', Type::BIGINT, [
'notnull' => false
]);
$table->addColumn('timestamp', Type::BIGINT, [
'notnull' => true,
'length' => 20,
'unsigned' => true,
]);
$table->addColumn('accessed', Type::BOOLEAN, [
'notnull' => true,
'default' => false
]);
$table->addColumn('id', Type::BIGINT, [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('editor_id', Type::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('token', Type::STRING, [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('file_id', Type::BIGINT, [
'notnull' => true,
]);
$table->addColumn('user_id', Type::STRING, [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('share_id', Type::BIGINT, [
'notnull' => false
]);
$table->addColumn('timestamp', Type::BIGINT, [
'notnull' => true,
'length' => 20,
'unsigned' => true,
]);
$table->addColumn('accessed', Type::BOOLEAN, [
'notnull' => true,
'default' => false
]);

$table->setPrimaryKey(['id']);
$table->addIndex(['token']);
}
$table->setPrimaryKey(['id']);
$table->addIndex(['token']);

return $schema;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DirectEditing/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct(
$this->connection = $connection;
$this->userId = $userSession->getUser() ? $userSession->getUser()->getUID() : null;
$this->rootFolder = $rootFolder;
$eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this));
$eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this));

}

Expand Down
2 changes: 1 addition & 1 deletion lib/public/DirectEditing/ACreateFromTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract class ACreateFromTemplate extends ACreateEmpty {
* List of available templates for the create from template action
*
* @since 18.0.0
* @return array
* @return ATemplate[]
*/
abstract public function getTemplates(): array;

Expand Down
6 changes: 3 additions & 3 deletions lib/public/DirectEditing/IEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,23 @@ public function getName(): string;
* A list of mimetypes that should open the editor by default
*
* @since 18.0.0
* @return array
* @return string[]
*/
public function getMimetypes(): array;

/**
* A list of mimetypes that can be opened in the editor optionally
*
* @since 18.0.0
* @return array
* @return string[]
*/
public function getMimetypesOptional(): array;

/**
* Return a list of file creation options to be presented to the user
*
* @since 18.0.0
* @return array of ICreateFromTemplate|ICreateEmpty
* @return ACreateFromTemplate[]|ACreateEmpty[]
*/
public function getCreators(): array;

Expand Down

0 comments on commit d8ba16c

Please sign in to comment.