Skip to content

Commit

Permalink
Revert "Merge pull request #25 from chrros95/background_task"
Browse files Browse the repository at this point in the history
This reverts commit d222547.
  • Loading branch information
PaulLereverend committed May 8, 2021
1 parent 972c611 commit c020135
Show file tree
Hide file tree
Showing 61 changed files with 357 additions and 11,981 deletions.
121 changes: 0 additions & 121 deletions .github/workflows/integration-tests.yml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/php-static-code-check.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
.DS_Store

build/
node_modules/
vendor/
.phpunit.result.cache
composer.lock
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ before_install:
# install core
- cd ../
- git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $CORE_BRANCH nextcloud
- mv "$TRAVIS_BUILD_DIR" nextcloud/apps/duplicatefinder
- mv "$TRAVIS_BUILD_DIR" nextcloud/apps/duplicatefinderbis

before_script:
- if [[ "$DB" == 'pgsql' ]]; then createuser -U travis -s oc_autotest; fi
Expand All @@ -45,9 +45,9 @@ before_script:
- cd nextcloud
- mkdir data
- ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass=''
- ./occ app:enable duplicatefinder
- ./occ app:enable duplicatefinderbis
- php -S localhost:8080 &
- cd apps/duplicatefinder
- cd apps/duplicatefinderbis

script:
- make test
Expand Down
6 changes: 1 addition & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## 0.0.7 Big thanks to @chrros95

- Added DB back-end to store detected duplicates.
- Added event based duplicate detection.
## 0.0.6

* Fix regression : only admins could get their duplicates file
Expand All @@ -12,4 +8,4 @@
## 0.0.5

* Support for NC21
* Refactoring (#18)
* Refactoring (#18)
30 changes: 6 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ appstore_build_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_build_directory)/$(app_name)
npm=$(shell which npm 2> /dev/null)
composer=$(shell which composer 2> /dev/null)
composer_home=$(build_tools_directory)/.composer

all: build

Expand All @@ -72,15 +71,13 @@ endif
composer:
ifeq (, $(composer))
@echo "No composer command available, downloading a copy from the web"
export COMPOSER_HOME=$(composer_home); \
mkdir -p $(composer_home); \
curl -sS https://getcomposer.org/installer | php -- --install-dir=$(build_tools_directory) ; \
$(build_tools_directory)/composer.phar config --global home ; \
php $(build_tools_directory)/composer.phar install --prefer-dist ; \
mkdir -p $(build_tools_directory)
curl -sS https://getcomposer.org/installer | php
mv composer.phar $(build_tools_directory)
php $(build_tools_directory)/composer.phar install --prefer-dist
php $(build_tools_directory)/composer.phar update --prefer-dist
else
export COMPOSER_HOME=$(composer_home); \
composer install --prefer-dist; \
composer install --prefer-dist
composer update --prefer-dist
endif

Expand Down Expand Up @@ -155,21 +152,6 @@ appstore:
-f $(appstore_package_name).tar.gz ../$(app_name) \

.PHONY: test
test: phpunit phpcs phpstan

.PHONY: phpunit
phpunit: composer
test: composer
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.xml
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml

.PHONY: phpcs
phpcs: composer
./vendor/bin/phpcs --standard=PSR2 lib

.PHONY: phpstan
phpstan: composer
./vendor/bin/phpstan analyse --level=8 lib

.PHONY: bats-hashes
bats-hashes:
@echo "$$(for f in `ls tests/bats/outputs/*`; do printf "%50s %10s\n" "$$f" $$(cat "$$f" | LC_ALL=C sort -h | sha256sum | awk '{ print $$1 }'); done)"
40 changes: 8 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,23 @@
# Duplicate Finder
Install app using the Nextcloud App Store inside your Nextcloud. See https://apps.nextcloud.com/apps/duplicatefinder

Click on the icon and find if you have duplicate files.

You can either use the command or the cron job to do a full scan.
Each time a new file is uploaded or a file is changed the app automatically checks if a duplicate of this file exists.

## Usage

Beginning with version 0.0.7 the detection of duplicates has changed. If you're updating from an older version you don't have to do anything special.
There are there are three possible ways duplicates can be detected.
1. Event-based-detection
For every new or changed file Nextcloud creates an internal event. The app is listening to these and analyse if the file has a duplicate
2. Background-job-based-detection
With an interval of 5 days a background job is executed, if you have enabled either cron, webcron or ajax based background jobs. This is only for events that have not been processed for any reason or a file was added manually.
3. Command-based-detection
A scan for duplicates can be forced by using the occ-command (please see #Command usage)

Normally the detection-methods should by used in the order as listed, but if you are installing the app on an existing installation it can be quite useful to start with a full scan by using the command-based-detection.
You can either use the command or the gui.

## Command usage

`occ [-v] duplicates:ACTION [options]`

```occ duplicates:find-all [options]```
Depending on your NextCloud setup, the `occ` command may need to be called differently, such as `sudo php occ duplicates:find-all [options]` or `nextcloud.occ duplicates:find-all [options]`. Please refer to the [occ documentation](https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html) for more details

If you increase the verbosity of the occ command, the shows a little bit more what is currently done (e.g. what file is currently scanned).

ACTION
find-all The command scans the files for duplicates. By using the options the scan can be limited
options
-u, --user scan files of the specified user (-u admin)
-p, --path limit scan to this path (--path="./Photos"). The path is relative the root of each user or the specified user.
list The command lists all duplicates that have been found until yet. If no option is given duplicates across users are shown.
options
-u, --user list only duplicates of the specified user (-u admin)
clear The command will clear all information that has been stored in the database
options
-f, --force the flag forces to do the cleanup. _attention_ you will not be asked any questions
### Options
- `-u --user` scan files of the specified user (-u admin)
- `-p --path` limit scan to this path (--path="/alice/files/Photos")


## Preview

![Preview of the GUI](https://raw.githubusercontent.com/PaulLereverend/NextcloudDuplicateFinder/master/img/preview.png)
![alt text](https://raw.githubusercontent.com/PaulLereverend/NextcloudDuplicateFinder/master/img/preview.png)

## Special thanks

Expand Down
Loading

0 comments on commit c020135

Please sign in to comment.