Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 665b717

Browse files
committed
Merged dev into main
2 parents a927cfb + 02d6442 commit 665b717

19 files changed

+245
-64
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.1.6 - 2021-10-22]
6+
7+
### Added
8+
9+
- Added Delete file confirmation setting (sidebar settings)
10+
11+
### Fixed
12+
13+
- Fixed MediaDC not working if specified another apps directory in Nextcloud config (apps_paths)
14+
- Fixed MediaDC install fails on Configuration page on some server configs
15+
- Changed function callbacks syntax to support PHP 7.3
16+
517
## [0.1.5 - 2021-10-12]
618

719
### Added

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This app allows to find duplicate or similar 📸📹 photos and videos
1717
Quick start guide and further information in our [Wiki](https://github.com/andrey18106/mediadc/wiki).
1818
]]>
1919
</description>
20-
<version>0.1.5</version>
20+
<version>0.1.6</version>
2121
<licence>agpl</licence>
2222
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
2323
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author>

js/mediadc-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/mediadc-main.js.LICENSE.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,28 @@
257257
*
258258
*/
259259

260+
/**
261+
* @copyright Copyright (c) 2021 John Molakvoæ <[email protected]>
262+
*
263+
* @author John Molakvoæ <[email protected]>
264+
*
265+
* @license GNU AGPL version 3 or any later version
266+
*
267+
* This program is free software: you can redistribute it and/or modify
268+
* it under the terms of the GNU Affero General Public License as
269+
* published by the Free Software Foundation, either version 3 of the
270+
* License, or (at your option) any later version.
271+
*
272+
* This program is distributed in the hope that it will be useful,
273+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
274+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
275+
* GNU Affero General Public License for more details.
276+
*
277+
* You should have received a copy of the GNU Affero General Public License
278+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
279+
*
280+
*/
281+
260282
/**!
261283
* @fileOverview Kickass library to create and place poppers near their reference elements.
262284
* @version 1.16.1

js/mediadc-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/mediadc-node_modules_moment_locale_sync_recursive_-src_views_CollectorDetails_vue.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/mediadc-node_modules_moment_locale_sync_recursive_-src_views_CollectorDetails_vue.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Migration/AppDataInitializationStep.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use OCA\MediaDC\AppInfo\Application;
3232
use OCA\MediaDC\Db\Setting;
3333
use OCA\MediaDC\Db\SettingMapper;
34+
use OCP\IConfig;
3435
use OCP\Migration\IOutput;
3536
use OCP\Migration\IRepairStep;
3637

@@ -40,8 +41,12 @@ class AppDataInitializationStep implements IRepairStep {
4041
/** @var SettingMapper */
4142
private $settingMapper;
4243

43-
public function __construct(SettingMapper $settingMapper) {
44+
/** @var IConfig */
45+
private $config;
46+
47+
public function __construct(SettingMapper $settingMapper, IConfig $config) {
4448
$this->settingMapper = $settingMapper;
49+
$this->config = $config;
4550
}
4651

4752
public function getName(): string {
@@ -50,7 +55,7 @@ public function getName(): string {
5055

5156
public function run(IOutput $output) {
5257
$output->startProgress(1);
53-
$data_file = getcwd() . '/apps//' . Application::APP_ID . "/lib/Migration/data/app_data_Version0001Date20210627153636.json";
58+
$data_file = $this->getCustomAppsDirectory() . Application::APP_ID . "/lib/Migration/data/app_data_Version0001Date20210627153636.json";
5459
$app_data = json_decode(file_get_contents($data_file), true);
5560

5661
if (count($this->settingMapper->findAll()) === 0) {
@@ -70,4 +75,18 @@ public function run(IOutput $output) {
7075
$output->finishProgress();
7176
}
7277

78+
private function getCustomAppsDirectory() {
79+
$apps_directory = $this->config->getSystemValue('apps_paths');
80+
if ($apps_directory !== "" && is_array($apps_directory) && count($apps_directory) > 0) {
81+
foreach ($apps_directory as $custom_apps_dir) {
82+
$mediadcDir = $custom_apps_dir['path'] . '/' . Application::APP_ID;
83+
if (file_exists($custom_apps_dir['path']) && is_dir($custom_apps_dir['path']) && $custom_apps_dir['writable']
84+
&& file_exists($mediadcDir) && is_dir($mediadcDir)) {
85+
return $custom_apps_dir['path'] . '/';
86+
}
87+
}
88+
}
89+
return getcwd() . '/apps/';
90+
}
91+
7392
}

lib/Service/CleanupService.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* You should have received a copy of the GNU Affero General Public License
2525
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26-
*!
26+
*
2727
*/
2828

2929
namespace OCA\MediaDC\Service;
@@ -50,15 +50,24 @@ public function __construct(IDBConnection $db, ISchemaWrapper $schema)
5050
}
5151

5252
public function dropAppTables() {
53-
$tables = array_filter($this->schema->getTableNames(),
54-
fn($tableName): bool => strpos($tableName, Application::APP_ID) !== false
55-
);
53+
$tables = array_filter($this->schema->getTableNames(), '\OCA\MediaDC\Service\CleanupService::tablesCallback');
5654
foreach ($tables as $table) {
5755
$this->db->dropTable($table);
5856
}
5957
$this->removeAppMigrations();
6058
}
6159

60+
/**
61+
* Callback for tables filter
62+
*
63+
* @param string $tableName
64+
*
65+
* @return bool
66+
*/
67+
static function tablesCallback($tableName) {
68+
return strpos($tableName, Application::APP_ID) !== false;
69+
}
70+
6271
private function removeAppMigrations() {
6372
/** @var IQueryBuilder */
6473
$qb = $this->db->getQueryBuilder();

lib/Service/CollectorService.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function restart($params = []) {
174174
/** @var Setting */
175175
$pyLimitSetting = $this->settingsMapper->findByName('python_limit');
176176
$processesRunning = $this->tasksMapper->findAllRunning();
177-
$taskIdsRunning = array_map(fn($task) => $task->getId(), $processesRunning);
177+
$taskIdsRunning = array_map('\OCA\MediaDC\Service\CollectorService::taskIdCallback', $processesRunning);
178178
/** @var CollectorTask */
179179
$collectorTask = $this->tasksMapper->find($taskId);
180180
$taskData = $this->getTargetDirectoriesData($params['targetDirectoryIds'], intval($params['collectorSettings']['target_mtype']), $excludeList);
@@ -213,6 +213,17 @@ public function restart($params = []) {
213213
return ['success' => $collectorTask !== null, 'queued' => $queuedTask !== null];
214214
}
215215

216+
/**
217+
* Callback to extract ColectorTask id
218+
*
219+
* @param CollectorTask $task
220+
*
221+
* @return int
222+
*/
223+
static function taskIdCallback($task) {
224+
return $task->getId();
225+
}
226+
216227
/**
217228
* Terminate CollectorTask background Python process
218229
*

0 commit comments

Comments
 (0)