|
6 | 6 |
|
7 | 7 | use Closure; |
8 | 8 | 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; |
12 | 10 | use OCP\DB\ISchemaWrapper; |
13 | 11 | use OCP\Files\File; |
14 | 12 | use OCP\Files\IRootFolder; |
|
22 | 20 | class Version2040Date20211027183759 extends SimpleMigrationStep { |
23 | 21 | /** @var IRootFolder*/ |
24 | 22 | 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; |
33 | 25 | /** @var array */ |
34 | 26 | 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) { |
41 | 30 | $this->connection = $connection; |
42 | 31 | $this->install = $install; |
43 | 32 | $this->config = $config; |
44 | 33 | $this->systemConfig = $systemConfig; |
45 | 34 | $this->rootFolder = $rootfolder; |
46 | 35 | $this->root = $root; |
| 36 | + $this->PdfParserService = $PdfParserService; |
47 | 37 | } |
48 | 38 |
|
49 | 39 | public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { |
@@ -81,15 +71,15 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array |
81 | 71 | /** @var File[] */ |
82 | 72 | $file = $userFolder->getById($row['node_id']); |
83 | 73 | if (count($file) >= 1) { |
84 | | - $data = $this->getMetadataFromCli($cli, $file[0]->getPath()); |
| 74 | + $data = $this->PdfParserService->getMetadata($file[0]->getPath()); |
85 | 75 | $json = json_encode($data); |
86 | 76 | $query = $this->connection->getQueryBuilder(); |
87 | 77 | $query |
88 | 78 | ->update('libresign_file') |
89 | 79 | ->set('metadata', $query->createNamedParameter($json)) |
90 | 80 | ->where($query->expr()->eq('id', $query->createNamedParameter($row['id']))); |
91 | 81 |
|
92 | | - $query->execute(); |
| 82 | + $query->executeStatement(); |
93 | 83 | } |
94 | 84 | } |
95 | 85 | } |
|
0 commit comments