Skip to content

Commit 4b9500c

Browse files
committed
Improvements on feedback
1 parent 66a6b0f commit 4b9500c

File tree

6 files changed

+417
-23
lines changed

6 files changed

+417
-23
lines changed

lib/Migration/Version2040Date20211027183759.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
use Closure;
88
use Doctrine\DBAL\Types\Types;
9-
use OC\SystemConfig;
10-
use OCA\Libresign\AppInfo\Application;
11-
use OCA\Libresign\Command\Install;
9+
use OCA\Libresign\Service\PdfParserService;
1210
use OCP\DB\ISchemaWrapper;
1311
use OCP\Files\File;
1412
use OCP\Files\IRootFolder;
@@ -22,28 +20,20 @@
2220
class Version2040Date20211027183759 extends SimpleMigrationStep {
2321
/** @var IRootFolder*/
2422
private $root;
25-
/** @var IDBConnection */
26-
private $connection;
27-
/** @var Install */
28-
private $install;
29-
/** @var IConfig */
30-
private $config;
31-
/** @var SystemConfig */
32-
private $systemConfig;
23+
/** @var PdfParserService */
24+
private $PdfParserService;
3325
/** @var array */
3426
private $rows;
35-
public function __construct(IRootFolder $root,
36-
IDBConnection $connection,
37-
IRootFolder $rootfolder,
38-
Install $install,
39-
IConfig $config,
40-
SystemConfig $systemConfig) {
27+
public function __construct(IDBConnection $connection,
28+
IRootFolder $root,
29+
PdfParserService $PdfParserService) {
4130
$this->connection = $connection;
4231
$this->install = $install;
4332
$this->config = $config;
4433
$this->systemConfig = $systemConfig;
4534
$this->rootFolder = $rootfolder;
4635
$this->root = $root;
36+
$this->PdfParserService = $PdfParserService;
4737
}
4838

4939
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
@@ -81,15 +71,15 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array
8171
/** @var File[] */
8272
$file = $userFolder->getById($row['node_id']);
8373
if (count($file) >= 1) {
84-
$data = $this->getMetadataFromCli($cli, $file[0]->getPath());
74+
$data = $this->PdfParserService->getMetadata($file[0]->getPath());
8575
$json = json_encode($data);
8676
$query = $this->connection->getQueryBuilder();
8777
$query
8878
->update('libresign_file')
8979
->set('metadata', $query->createNamedParameter($json))
9080
->where($query->expr()->eq('id', $query->createNamedParameter($row['id'])));
9181

92-
$query->execute();
82+
$query->executeStatement();
9383
}
9484
}
9585
}

0 commit comments

Comments
 (0)