1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

patch: review comments

This commit is contained in:
Christy Jacob 2020-12-18 16:18:00 +05:30
parent 1a9648a6c5
commit c6a105db7e
5 changed files with 25 additions and 22 deletions

View file

@ -94,7 +94,9 @@ ENV _APP_SERVER=swoole \
_APP_FUNCTIONS_CONTAINERS=10 \ _APP_FUNCTIONS_CONTAINERS=10 \
_APP_SETUP=self-hosted \ _APP_SETUP=self-hosted \
_APP_VERSION=$VERSION \ _APP_VERSION=$VERSION \
_APP_MAINTENANCE_INTERVAL=864000 # The interval at which to carry out maintenance tasks
# 1 day = 86400 seconds
_APP_MAINTENANCE_INTERVAL=86400
#ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_SECURE ''
#ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_USERNAME ''
#ENV _APP_SMTP_PASSWORD '' #ENV _APP_SMTP_PASSWORD ''

View file

@ -16,6 +16,7 @@ use Utopia\Config\Config;
define("DELETE_QUEUE_NAME", "v1-deletes"); define("DELETE_QUEUE_NAME", "v1-deletes");
define("DELETE_CLASS_NAME", "DeletesV1"); define("DELETE_CLASS_NAME", "DeletesV1");
// TODO: Think of a better way to access consoleDB
function getConsoleDB() { function getConsoleDB() {
global $register; global $register;
$consoleDB = new Database(); $consoleDB = new Database();
@ -59,7 +60,7 @@ $cli
->task('maintenance') ->task('maintenance')
->desc('Schedules maintenance tasks and publishes them to resque') ->desc('Schedules maintenance tasks and publishes them to resque')
->action(function () { ->action(function () {
// Convert string to integer // # of days in seconds (1 day = 86400s)
$interval = App::getEnv('_APP_MAINTENANCE_INTERVAL', '') + 0; $interval = App::getEnv('_APP_MAINTENANCE_INTERVAL', '') + 0;
//Convert Seconds to microseconds //Convert Seconds to microseconds
$interval = $interval * 1000000; $interval = $interval * 1000000;

View file

@ -125,7 +125,7 @@ class DeletesV1
$adapter = new AuditAdapter($register->get('db')); $adapter = new AuditAdapter($register->get('db'));
$adapter->setNamespace('app_'.$projectId); $adapter->setNamespace('app_'.$projectId);
$audit = new Audit($adapter); $audit = new Audit($adapter);
$status = $audit->deleteLogsOlderThan(); $status = $audit->cleanup();
if (!$status) { if (!$status) {
throw new Exception('Failed to delete Audit logs for project'.$projectId, 500); throw new Exception('Failed to delete Audit logs for project'.$projectId, 500);
} }
@ -141,7 +141,7 @@ class DeletesV1
$adapter = new AuditAdapter($register->get('db')); $adapter = new AuditAdapter($register->get('db'));
$adapter->setNamespace('app_'.$projectId); $adapter->setNamespace('app_'.$projectId);
$audit = new Audit($adapter); $audit = new Audit($adapter);
$status = $audit->deleteLogsOlderThan(); $status = $audit->cleanup();
if (!$status) { if (!$status) {
throw new Exception('Failed to delete Audit logs for project'.$projectId, 500); throw new Exception('Failed to delete Audit logs for project'.$projectId, 500);
} }

View file

@ -36,7 +36,7 @@
"utopia-php/framework": "0.9.8", "utopia-php/framework": "0.9.8",
"utopia-php/abuse": "0.3.*", "utopia-php/abuse": "0.3.*",
"utopia-php/audit": "0.4.*", "utopia-php/audit": "0.5.*",
"utopia-php/cache": "0.2.*", "utopia-php/cache": "0.2.*",
"utopia-php/cli": "0.8.0", "utopia-php/cli": "0.8.0",
"utopia-php/config": "0.2.*", "utopia-php/config": "0.2.*",

34
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "58b7669908833b2a32d550d9e38f112f", "content-hash": "f366e884df2132577f44576e459e3a4b",
"packages": [ "packages": [
{ {
"name": "appwrite/php-clamav", "name": "appwrite/php-clamav",
@ -1112,16 +1112,16 @@
}, },
{ {
"name": "utopia-php/abuse", "name": "utopia-php/abuse",
"version": "0.2.2", "version": "0.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/utopia-php/abuse.git", "url": "https://github.com/utopia-php/abuse.git",
"reference": "8e65890a6d7afa9f57992f1eca9fe64508f9822e" "reference": "5047cb311de8d7609e2678fdc405651f43f7e550"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/8e65890a6d7afa9f57992f1eca9fe64508f9822e", "url": "https://api.github.com/repos/utopia-php/abuse/zipball/5047cb311de8d7609e2678fdc405651f43f7e550",
"reference": "8e65890a6d7afa9f57992f1eca9fe64508f9822e", "reference": "5047cb311de8d7609e2678fdc405651f43f7e550",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1158,22 +1158,22 @@
], ],
"support": { "support": {
"issues": "https://github.com/utopia-php/abuse/issues", "issues": "https://github.com/utopia-php/abuse/issues",
"source": "https://github.com/utopia-php/abuse/tree/0.2.2" "source": "https://github.com/utopia-php/abuse/tree/0.3.0"
}, },
"time": "2020-10-23T06:51:42+00:00" "time": "2020-12-17T18:39:44+00:00"
}, },
{ {
"name": "utopia-php/audit", "name": "utopia-php/audit",
"version": "0.3.2", "version": "0.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/utopia-php/audit.git", "url": "https://github.com/utopia-php/audit.git",
"reference": "544ecff78788d11f60992a721f102cafc22ab084" "reference": "5000fdbe755bbfb1e8bc26c61b90e28c40e5744a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/544ecff78788d11f60992a721f102cafc22ab084", "url": "https://api.github.com/repos/utopia-php/audit/zipball/5000fdbe755bbfb1e8bc26c61b90e28c40e5744a",
"reference": "544ecff78788d11f60992a721f102cafc22ab084", "reference": "5000fdbe755bbfb1e8bc26c61b90e28c40e5744a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1210,9 +1210,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/utopia-php/audit/issues", "issues": "https://github.com/utopia-php/audit/issues",
"source": "https://github.com/utopia-php/audit/tree/0.3.2" "source": "https://github.com/utopia-php/audit/tree/0.5.0"
}, },
"time": "2020-10-23T08:09:44+00:00" "time": "2020-12-17T18:41:34+00:00"
}, },
{ {
"name": "utopia-php/cache", "name": "utopia-php/cache",
@ -4501,12 +4501,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "1ba3caf8ed39a49e39fc8a6cad666724524a5342" "reference": "15c96194f32e1b1aa30d1b302c71c5f83fd4dea9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/1ba3caf8ed39a49e39fc8a6cad666724524a5342", "url": "https://api.github.com/repos/symfony/console/zipball/15c96194f32e1b1aa30d1b302c71c5f83fd4dea9",
"reference": "1ba3caf8ed39a49e39fc8a6cad666724524a5342", "reference": "15c96194f32e1b1aa30d1b302c71c5f83fd4dea9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4591,7 +4591,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-12-12T00:32:42+00:00" "time": "2020-12-18T08:03:24+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",