Prune unused uploaded files when the file quota is reached
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jul 2017 21:13:42 +0000 (21:13 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jul 2017 21:13:42 +0000 (21:13 +0000)
commit49bf888e274b3c08bd4dd6eb3f1c5b163f2cf58f
treeaf95fb4584a79b7d4748f7150fcab54f5cd19ee2
parent9314b2403e6fcd442144850e2cca58a79c26fba2
Prune unused uploaded files when the file quota is reached
https://bugs.webkit.org/show_bug.cgi?id=174086

Reviewed by Andreas Kling.

Made /privileged-api/uploaded-file and /api/upload-root automatically delete old uploaded files when
uploading a new file results in the file quota to be exceeded. Also added the notion of the total quota
to avoid running out of a disk when there are hundreds of users each uploading near their quota.

* config.json: Added a sample total disk quota of 100GB.
* public/include/uploaded-file-helpers.php:
(query_file_usage_for_user): Renamed from query_total_file_size.
(query_total_file_usage): Added.
(upload_file_in_transaction):
(delete_file): Added.
(prune_old_files): Added.
* server-tests/privileged-api-upload-file-tests.js: Added tests for deleting old uploaded files as well as
tests for the total quota.
* server-tests/resources/test-server.js:
(TestServer.prototype.testConfig): Added uploadTotalQuotaInMB to the test configuration.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/config.json
Websites/perf.webkit.org/public/include/uploaded-file-helpers.php
Websites/perf.webkit.org/server-tests/privileged-api-upload-file-tests.js
Websites/perf.webkit.org/server-tests/resources/test-server.js