Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Cleanup on Dropbox #175

Closed
aalokshah opened this issue Feb 12, 2019 · 7 comments
Closed

Remote Cleanup on Dropbox #175

aalokshah opened this issue Feb 12, 2019 · 7 comments
Assignees
Labels

Comments

@aalokshah
Copy link

aalokshah commented Feb 12, 2019

Hello,
When using the latest version, phpbu-5.1.7.phar. It works fine, with a dropbox sync, but the dropbox cleanup does not work. I downloaded the .phar from the releases link.

My PHP Version:

$ php -v
PHP 7.2.14-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jan 13 2019 10:05:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.14-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

When I add these lines:

<option name="cleanup.type" value="quantity" />
<option name="cleanup.amount" value="240" />

to the DropBox section (entire block here):

<sync type="dropbox">
	<option name="token" value="mykey"/>
	<option name="path" value="/MyDatabase"/>
	<!-- remote cleanup options -->
	<option name="cleanup.type" value="quantity" />
	<option name="cleanup.amount" value="240" />
</sync>

I get the following error:

PHP Fatal error:  Class 'Illuminate\Support\Collection' not found in phar:///apachewww/_admin/phpbu/phpbu.phar/lib/dropbox/Models/ModelCollection.php on line 9

Am I missing something?

Thanks,

@sebastianfeldmann
Copy link
Owner

There are some files missing in the PHAR file. I'll try to figure out which ones and fix it ASAP

sebastianfeldmann added a commit that referenced this issue Feb 13, 2019
In order to make the dropbox collections work some class aliases and
helper function have to be loaded.
@sebastianfeldmann
Copy link
Owner

I just release version 5.1.8
I hope I included all files needed.
Please update to the latest version in give it a try ;)

@aalokshah
Copy link
Author

Hello,
Thank you for the very quick turnaround time in addressing the bug. I just tested it out, and it does not generate the error anymore.

However, I have about 1000 backups in the Dropbox folder (but, I want only the last 240 -- per the XML cleanup option). In my local web server, I have the correct number of backups. After running it with the cleanup options added in the XML from my previous message, I noticed that it did not clean up the old files in Dropbox.

I ran version 5.1.8, with the debug switch and here's the log (sensitive info removed):

phpbu 5.1.8 by Sebastian Feldmann and contributors.

Runtime:       PHP 7.2.14-1+ubuntu16.04.1+deb.sury.org+1
Configuration: /apachewww/phpbu/phpbu.xml

backup: [mysqldump] *******************************************************
/usr/bin/mysqldump --user='MYUSER' --password='******' 'DBTABLE' | /bin/bzip2 > /apachewww/phpbu/backup/mysql/mysqldump-20190213-1945.sql.bz2
ok

check: [SizeMin] **********************************************************
checking: [10M] ok

crypt: [openssl] **********************************************************
phpbu\app\backup\crypter\openssl:(/usr/bin/openssl enc -e -a -aes-256-cbc -pass 'pass:******' -in '/apachewww/phpbu/backup/mysql/mysqldump-20190213-1945.sql.bz2' -out '/apachewww/phpbu/backup/mysql/mysqldump-20190213-1945.sql.bz2.enc' && rm '/apachewww/phpbu/backup/mysql/mysqldump-20190213-1945.sql.bz2')
ok

sync: [dropbox] ***********************************************************
upload: done  (22487510)
remote cleanup: quantity 
ok

cleanup: [Capacity] *******************************************************
delete /apachewww/phpbu/backup/mysql/mysqldump-20190206-0100.sql.bz2.enc
ok

Time: 28 seconds, Memory: 11.82MB

backup mysqldump: OK

          | executed | skipped | failed |
----------+----------+---------+--------+
 checks   |        1 |         |      0 |
 crypts   |        1 |       0 |      0 |
 syncs    |        1 |       0 |      0 |
 cleanups |        1 |       0 |      0 |
----------+----------+---------+--------+

OK (1 backup, 1 check, 1 crypt, 1 sync, 1 cleanup)


@sebastianfeldmann
Copy link
Owner

Thanks for the detailed feedback, I will try to reproduce this

@sebastianfeldmann
Copy link
Owner

sebastianfeldmann commented Feb 14, 2019

OK I found the cause for this issue

DropboxRemoteCollector is collecting "all" remote backups ;)

   'limit'     => 100,

So we will only search for 100 Backups and will never delete any because 100 is always below 240 :)

@sebastianfeldmann
Copy link
Owner

I removed the limit. The default API limit is 1000.
So please don't try to keep more then 999 Backups ;)

@aalokshah
Copy link
Author

I see! Perfect. Thank you for the quick update. The 1000 files were there because I wasn't doing cleanups on a regular basis. For me, and my use case, I do hourly backups, and keep them for 10 days in case need to go back due to some human error that wasn't detected in time. (24 hours * 10 days = 240) :-)

Again thank you for your quick help in resolving this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants