Skip to content
  • Sponsor cloud-py-api/cloud_py_api

  • Notifications You must be signed in to change notification settings
  • Fork 7

Commit f2e1563

Browse files
authoredDec 23, 2022
Added AppDataUpdate repair step to sync settings changes on app update (#34)
1 parent c79426b commit f2e1563

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
 

‎appinfo/info.xml

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ You can support us in several ways:
5252
<nextcloud min-version="25" max-version="26" />
5353
</dependencies>
5454
<repair-steps>
55+
<post-migration>
56+
<step>OCA\Cloud_Py_API\Migration\AppUpdateStep</step>
57+
</post-migration>
5558
<install>
5659
<step>OCA\Cloud_Py_API\Migration\AppDataInitializationStep</step>
5760
</install>

‎lib/Migration/AppUpdateStep.php

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* @copyright Copyright (c) 2022-2023 Andrey Borysenko <andrey18106x@gmail.com>
7+
*
8+
* @copyright Copyright (c) 2022-2023 Alexander Piskun <bigcat88@icloud.com>
9+
*
10+
* @author 2022-2023 Andrey Borysenko <andrey18106x@gmail.com>
11+
*
12+
* @license AGPL-3.0-or-later
13+
*
14+
* This program is free software: you can redistribute it and/or modify
15+
* it under the terms of the GNU Affero General Public License as
16+
* published by the Free Software Foundation, either version 3 of the
17+
* License, or (at your option) any later version.
18+
*
19+
* This program is distributed in the hope that it will be useful,
20+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
* GNU Affero General Public License for more details.
23+
*
24+
* You should have received a copy of the GNU Affero General Public License
25+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26+
*
27+
*/
28+
29+
namespace OCA\Cloud_Py_API\Migration;
30+
31+
use OCP\Migration\IOutput;
32+
use OCP\Migration\IRepairStep;
33+
34+
use OCA\Cloud_Py_API\Migration\data\AppInitialData;
35+
use OCA\Cloud_Py_API\Service\UtilsService;
36+
37+
class AppUpdateStep implements IRepairStep {
38+
/** @var UtilsService */
39+
private $utils;
40+
41+
public function __construct(UtilsService $utils) {
42+
$this->utils = $utils;
43+
}
44+
45+
public function getName(): string {
46+
return "Updating Cloud_Py_API data";
47+
}
48+
49+
public function run(IOutput $output) {
50+
$output->startProgress(1);
51+
$app_data = AppInitialData::$INITIAL_DATA;
52+
53+
$output->advance(1, 'Checking for inital data changes and syncing with database');
54+
$this->utils->checkForSettingsUpdates($app_data);
55+
56+
$output->finishProgress();
57+
}
58+
}

0 commit comments

Comments
 (0)
Please sign in to comment.