From 4461c8c0f69e136031a31f543714aba56c4f0fef Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 20:26:06 +0530 Subject: [PATCH 01/11] feat: add new env vars for audit and abuse logs --- .env | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 5ce383713..436098cbe 100644 --- a/.env +++ b/.env @@ -30,4 +30,6 @@ _APP_FUNCTIONS_CONTAINERS=10 _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 -_APP_MAINTENANCE_INTERVAL=86400 +_APP_MAINTENANCE_EXECUTION_LOG_RETENTION=60 +_APP_MAINTENANCE_ABUSE_LOG_RETENTION=60 +_APP_MAINTENANCE_AUDIT_LOG_RETENTION=60 From e85fc0282eeb1e11a037d47955606c4cab15fa55 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 20:31:08 +0530 Subject: [PATCH 02/11] feat: add description of new env variables --- app/config/variables.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 6215b18f7..a52f1950c 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -357,13 +357,29 @@ return [ 'description' => '', 'variables' => [ [ - 'name' => '_APP_MAINTENANCE_INTERVAL', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', + 'name' => '_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the execution logs. The default value is 1209600 seconds (14 days).', + 'introduction' => '0.7.0', + 'default' => '1209600', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_MAINTENANCE_AUDIT_LOG_RETENTION', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the audit logs. The default value is 1209600 seconds (14 days).', + 'introduction' => '0.7.0', + 'default' => '1209600', + 'required' => false, + 'question' => '', + ], + [ + 'name' => '_APP_MAINTENANCE_ABUSE_LOG_RETENTION', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the abuse logs. The default value is 86400 seconds (1 day).', 'introduction' => '0.7.0', 'default' => '86400', 'required' => false, 'question' => '', - ], + ] ], ], ], From 04f14816d78d98f97eee98d4b38d74fa1bc5b0a9 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 20:58:52 +0530 Subject: [PATCH 03/11] feat: add filter to delete execution logs older than --- Dockerfile | 5 ++++- app/tasks/maintenance.php | 44 ++++++++++++++++++++++++++------------- app/workers/deletes.php | 9 ++++---- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0017d68dc..d8ab69bbb 100755 --- a/Dockerfile +++ b/Dockerfile @@ -100,8 +100,11 @@ ENV _APP_SERVER=swoole \ _APP_SETUP=self-hosted \ _APP_VERSION=$VERSION \ _APP_USAGE_STATS=enabled \ + # 14 Days = 1209600 s + _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 \ + _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 \ # 1 Day = 86400 s - _APP_MAINTENANCE_INTERVAL=86400 + _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 \ #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_PASSWORD '' diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index 34c34cfb8..cc15a4dce 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -12,26 +12,27 @@ Console::title('Maintenance V1'); Console::success(APP_NAME.' maintenance process v1 has started'); -function notifyDeleteExecutionLogs() +function notifyDeleteExecutionLogs(int $retention) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ - 'type' => DELETE_TYPE_EXECUTIONS + 'type' => DELETE_TYPE_EXECUTIONS, + 'timestamp' => time() - $retention ]); } -function notifyDeleteAbuseLogs(int $interval) +function notifyDeleteAbuseLogs(int $retention) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_ABUSE, - 'timestamp' => time() - $interval + 'timestamp' => time() - $retention ]); } -function notifyDeleteAuditLogs(int $interval) +function notifyDeleteAuditLogs(int $retention) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_AUDIT, - 'timestamp' => time() - $interval + 'timestamp' => time() - $retention ]); } @@ -40,15 +41,30 @@ $cli ->desc('Schedules maintenance tasks and publishes them to resque') ->action(function () { // # of days in seconds (1 day = 86400s) - $interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); + // $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', '60'); + $executionLogsRetention = 120; + $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_ABUSE_LOG_RETENTION', '60'); + $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_AUDIT_LOG_RETENTION', '60'); - Console::loop(function() use ($interval){ + // Schedule delete execution logs + Console::loop(function() use ($executionLogsRetention){ $time = date('d-m-Y H:i:s', time()); - Console::info("[{$time}] Notifying deletes workers every {$interval} seconds"); - notifyDeleteExecutionLogs(); - notifyDeleteAbuseLogs($interval); - notifyDeleteAuditLogs($interval); - - }, $interval); + Console::info("[{$time}] Notifying deletes workers every {$executionLogsRetention} seconds"); + notifyDeleteExecutionLogs($executionLogsRetention); + }, $executionLogsRetention); + + // // Schedule delete abuse logs + // Console::loop(function() use ($abuseLogsRetention){ + // $time = date('d-m-Y H:i:s', time()); + // Console::info("[{$time}] Notifying deletes workers every {$abuseLogsRetention} seconds"); + // notifyDeleteAbuseLogs($abuseLogsRetention); + // }, $abuseLogsRetention); + + // // Schedule delete audit logs + // Console::loop(function() use ($auditLogRetention){ + // $time = date('d-m-Y H:i:s', time()); + // Console::info("[{$time}] Notifying deletes workers every {$auditLogRetention} seconds"); + // notifyDeleteAuditLogs($auditLogRetention); + // }, $auditLogRetention); }); \ No newline at end of file diff --git a/app/workers/deletes.php b/app/workers/deletes.php index cf9aa2c45..ac168d6bc 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -59,7 +59,7 @@ class DeletesV1 break; case DELETE_TYPE_EXECUTIONS: - $this->deleteExecutionLogs(); + $this->deleteExecutionLogs($this->args['timestamp']); break; case DELETE_TYPE_AUDIT: @@ -121,16 +121,17 @@ class DeletesV1 ], $this->getProjectDB($projectId)); } - protected function deleteExecutionLogs() + protected function deleteExecutionLogs($timestamp) { - $this->deleteForProjectIds(function($projectId) { + $this->deleteForProjectIds(function($projectId) use ($timestamp) { if (!($projectDB = $this->getProjectDB($projectId))) { throw new Exception('Failed to get projectDB for project '.$projectId); } // Delete Executions $this->deleteByGroup([ - '$collection='.Database::SYSTEM_COLLECTION_EXECUTIONS + '$collection='.Database::SYSTEM_COLLECTION_EXECUTIONS, + 'dateCreated<'.$timestamp ], $projectDB); }); } From 395c3225b7172d43c2ee34e919d56f4bf221dd6f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 21:00:09 +0530 Subject: [PATCH 04/11] feat: added env variables to docker-compose --- docker-compose.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e9d82cbf0..8d2de2046 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -328,7 +328,9 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT - - _APP_MAINTENANCE_INTERVAL + - _APP_MAINTENANCE_EXECUTION_LOG_RETENTION + - _APP_MAINTENANCE_ABUSE_LOG_RETENTION + - _APP_MAINTENANCE_AUDIT_LOG_RETENTION appwrite-schedule: entrypoint: schedule From 68b7e22b90e47b0cc3a3aa363509d1ff5917b52e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 21:16:05 +0530 Subject: [PATCH 05/11] feat: update default env var values --- .env | 6 +++--- Dockerfile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 07fb4a7a6..92aaee3ae 100644 --- a/.env +++ b/.env @@ -34,7 +34,7 @@ _APP_FUNCTIONS_CONTAINERS=10 _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 -_APP_MAINTENANCE_EXECUTION_LOG_RETENTION=60 -_APP_MAINTENANCE_ABUSE_LOG_RETENTION=60 -_APP_MAINTENANCE_AUDIT_LOG_RETENTION=60 +_APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 +_APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 +_APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 _APP_USAGE_STATS=enabled diff --git a/Dockerfile b/Dockerfile index d8ab69bbb..c116e34fb 100755 --- a/Dockerfile +++ b/Dockerfile @@ -104,7 +104,7 @@ ENV _APP_SERVER=swoole \ _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 \ _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 \ # 1 Day = 86400 s - _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 \ + _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_PASSWORD '' From 0156e00a9d8824eaf3939dc89b4b1f2221e393c5 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 23:27:49 +0530 Subject: [PATCH 06/11] feat: update default env var values --- .env | 1 + Dockerfile | 3 ++- app/config/variables.php | 10 ++++++++- app/tasks/maintenance.php | 44 +++++++++++++-------------------------- docker-compose.yml | 1 + 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/.env b/.env index 92aaee3ae..d514529a9 100644 --- a/.env +++ b/.env @@ -34,6 +34,7 @@ _APP_FUNCTIONS_CONTAINERS=10 _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 +_APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 diff --git a/Dockerfile b/Dockerfile index c116e34fb..0f97e3ec4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -104,7 +104,8 @@ ENV _APP_SERVER=swoole \ _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 \ _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 \ # 1 Day = 86400 s - _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 + _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 \ + _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_PASSWORD '' diff --git a/app/config/variables.php b/app/config/variables.php index a52f1950c..f662d5768 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -356,9 +356,17 @@ return [ 'category' => 'Maintenance', 'description' => '', 'variables' => [ + [ + 'name' => '_APP_MAINTENANCE_INTERVAL', + 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before executing system cleanups and optimizations. The default value is 86400 seconds (1 day).', + 'introduction' => '0.7.0', + 'default' => '86400', + 'required' => false, + 'question' => '', + ], [ 'name' => '_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the execution logs. The default value is 1209600 seconds (14 days).', + 'description' => 'The maximum time period . The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', 'required' => false, diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index cc15a4dce..df4005593 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -12,27 +12,27 @@ Console::title('Maintenance V1'); Console::success(APP_NAME.' maintenance process v1 has started'); -function notifyDeleteExecutionLogs(int $retention) +function notifyDeleteExecutionLogs(int $interval) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_EXECUTIONS, - 'timestamp' => time() - $retention + 'timestamp' => time() - $interval ]); } -function notifyDeleteAbuseLogs(int $retention) +function notifyDeleteAbuseLogs(int $interval) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_ABUSE, - 'timestamp' => time() - $retention + 'timestamp' => time() - $interval ]); } -function notifyDeleteAuditLogs(int $retention) +function notifyDeleteAuditLogs(int $interval) { Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [ 'type' => DELETE_TYPE_AUDIT, - 'timestamp' => time() - $retention + 'timestamp' => time() - $interval ]); } @@ -41,30 +41,16 @@ $cli ->desc('Schedules maintenance tasks and publishes them to resque') ->action(function () { // # of days in seconds (1 day = 86400s) - // $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', '60'); - $executionLogsRetention = 120; - $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_ABUSE_LOG_RETENTION', '60'); - $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_AUDIT_LOG_RETENTION', '60'); + $interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); + $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', '1209600'); + $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_AUDIT_LOG_RETENTION', '1209600'); + $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_ABUSE_LOG_RETENTION', '86400'); - // Schedule delete execution logs - Console::loop(function() use ($executionLogsRetention){ + Console::loop(function() use ($interval, $executionLogsRetention, $abuseLogsRetention, $auditLogRetention){ $time = date('d-m-Y H:i:s', time()); - Console::info("[{$time}] Notifying deletes workers every {$executionLogsRetention} seconds"); + Console::info("[{$time}] Notifying deletes workers every {$interval} seconds"); notifyDeleteExecutionLogs($executionLogsRetention); - }, $executionLogsRetention); - - // // Schedule delete abuse logs - // Console::loop(function() use ($abuseLogsRetention){ - // $time = date('d-m-Y H:i:s', time()); - // Console::info("[{$time}] Notifying deletes workers every {$abuseLogsRetention} seconds"); - // notifyDeleteAbuseLogs($abuseLogsRetention); - // }, $abuseLogsRetention); - - // // Schedule delete audit logs - // Console::loop(function() use ($auditLogRetention){ - // $time = date('d-m-Y H:i:s', time()); - // Console::info("[{$time}] Notifying deletes workers every {$auditLogRetention} seconds"); - // notifyDeleteAuditLogs($auditLogRetention); - // }, $auditLogRetention); - + notifyDeleteAbuseLogs($abuseLogsRetention); + notifyDeleteAuditLogs($auditLogRetention); + }, $interval); }); \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8d2de2046..9d47f1024 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -328,6 +328,7 @@ services: - _APP_ENV - _APP_REDIS_HOST - _APP_REDIS_PORT + - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_EXECUTION_LOG_RETENTION - _APP_MAINTENANCE_ABUSE_LOG_RETENTION - _APP_MAINTENANCE_AUDIT_LOG_RETENTION From f538c1d2bfe73f84a38a1d8e6ba76f7367cbd366 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 23:45:30 +0530 Subject: [PATCH 07/11] feat: update env var description --- app/config/variables.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index f662d5768..5b710ad3f 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -366,7 +366,7 @@ return [ ], [ 'name' => '_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', - 'description' => 'The maximum time period . The default value is 1209600 seconds (14 days).', + 'description' => 'The maximum duration (in seconds) upto which to retain execution logs. The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', 'required' => false, @@ -374,7 +374,7 @@ return [ ], [ 'name' => '_APP_MAINTENANCE_AUDIT_LOG_RETENTION', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the audit logs. The default value is 1209600 seconds (14 days).', + 'description' => 'IThe maximum duration (in seconds) upto which to retain audit logs. The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', 'required' => false, @@ -382,7 +382,7 @@ return [ ], [ 'name' => '_APP_MAINTENANCE_ABUSE_LOG_RETENTION', - 'description' => 'Interval value containing the number of seconds that the Appwrite maintenance process should wait before cleaning up the abuse logs. The default value is 86400 seconds (1 day).', + 'description' => 'The maximum duration (in seconds) upto which to retain abuse logs. The default value is 86400 seconds (1 day).', 'introduction' => '0.7.0', 'default' => '86400', 'required' => false, From 2a29e10007a7d9bad68c9f9c9938c6c0a452dbf8 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 20 Jan 2021 23:53:48 +0530 Subject: [PATCH 08/11] feat: review comments --- .env | 6 +++--- Dockerfile | 6 +++--- app/config/variables.php | 6 +++--- app/tasks/maintenance.php | 6 +++--- app/views/install/compose.phtml | 9 ++++----- docker-compose.yml | 6 +++--- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.env b/.env index d514529a9..3406ba100 100644 --- a/.env +++ b/.env @@ -35,7 +35,7 @@ _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=128 _APP_FUNCTIONS_MEMORY_SWAP=128 _APP_MAINTENANCE_INTERVAL=86400 -_APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 -_APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 -_APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 +_APP_MAINTENANCE_RETENTION_EXECUTION=1209600 +_APP_MAINTENANCE_RETENTION_ABUSE=86400 +_APP_MAINTENANCE_RETENTION_AUDIT=1209600 _APP_USAGE_STATS=enabled diff --git a/Dockerfile b/Dockerfile index 0f97e3ec4..c7316bd1d 100755 --- a/Dockerfile +++ b/Dockerfile @@ -101,10 +101,10 @@ ENV _APP_SERVER=swoole \ _APP_VERSION=$VERSION \ _APP_USAGE_STATS=enabled \ # 14 Days = 1209600 s - _APP_MAINTENANCE_EXECUTION_LOG_RETENTION=1209600 \ - _APP_MAINTENANCE_AUDIT_LOG_RETENTION=1209600 \ + _APP_MAINTENANCE_RETENTION_EXECUTION=1209600 \ + _APP_MAINTENANCE_RETENTION_AUDIT=1209600 \ # 1 Day = 86400 s - _APP_MAINTENANCE_ABUSE_LOG_RETENTION=86400 \ + _APP_MAINTENANCE_RETENTION_ABUSE=86400 \ _APP_MAINTENANCE_INTERVAL=86400 #ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_USERNAME '' diff --git a/app/config/variables.php b/app/config/variables.php index 5b710ad3f..cd5d220f3 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -365,7 +365,7 @@ return [ 'question' => '', ], [ - 'name' => '_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', + 'name' => '_APP_MAINTENANCE_RETENTION_EXECUTION', 'description' => 'The maximum duration (in seconds) upto which to retain execution logs. The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', @@ -373,7 +373,7 @@ return [ 'question' => '', ], [ - 'name' => '_APP_MAINTENANCE_AUDIT_LOG_RETENTION', + 'name' => '_APP_MAINTENANCE_RETENTION_AUDIT', 'description' => 'IThe maximum duration (in seconds) upto which to retain audit logs. The default value is 1209600 seconds (14 days).', 'introduction' => '0.7.0', 'default' => '1209600', @@ -381,7 +381,7 @@ return [ 'question' => '', ], [ - 'name' => '_APP_MAINTENANCE_ABUSE_LOG_RETENTION', + 'name' => '_APP_MAINTENANCE_RETENTION_ABUSE', 'description' => 'The maximum duration (in seconds) upto which to retain abuse logs. The default value is 86400 seconds (1 day).', 'introduction' => '0.7.0', 'default' => '86400', diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index df4005593..78a31e6dd 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -42,9 +42,9 @@ $cli ->action(function () { // # of days in seconds (1 day = 86400s) $interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); - $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_EXECUTION_LOG_RETENTION', '1209600'); - $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_AUDIT_LOG_RETENTION', '1209600'); - $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_ABUSE_LOG_RETENTION', '86400'); + $executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_EXECUTION', '1209600'); + $auditLogRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_AUDIT', '1209600'); + $abuseLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_ABUSE', '86400'); Console::loop(function() use ($interval, $executionLogsRetention, $abuseLogsRetention, $auditLogRetention){ $time = date('d-m-Y H:i:s', time()); diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 098d4d407..231d2f857 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -279,11 +279,10 @@ services: - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_MAINTENANCE_INTERVAL - - _APP_DB_HOST - - _APP_DB_PORT - - _APP_DB_SCHEMA - - _APP_DB_USER - - _APP_DB_PASS + - _APP_MAINTENANCE_RETENTION_EXECUTION + - _APP_MAINTENANCE_RETENTION_ABUSE + - _APP_MAINTENANCE_RETENTION_AUDIT + appwrite-schedule: image: appwrite/appwrite: diff --git a/docker-compose.yml b/docker-compose.yml index 9d47f1024..e601ae708 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -329,9 +329,9 @@ services: - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_MAINTENANCE_INTERVAL - - _APP_MAINTENANCE_EXECUTION_LOG_RETENTION - - _APP_MAINTENANCE_ABUSE_LOG_RETENTION - - _APP_MAINTENANCE_AUDIT_LOG_RETENTION + - _APP_MAINTENANCE_RETENTION_EXECUTION + - _APP_MAINTENANCE_RETENTION_ABUSE + - _APP_MAINTENANCE_RETENTION_AUDIT appwrite-schedule: entrypoint: schedule From d4c7ab045a015023bde23ac20403aea1c823e98d Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 22 Jan 2021 14:13:33 +0545 Subject: [PATCH 09/11] Switching to utopia-php/storage --- app/controllers/api/functions.php | 10 +- app/controllers/api/health.php | 4 +- app/controllers/api/storage.php | 10 +- app/controllers/general.php | 4 +- app/controllers/mock.php | 2 +- app/controllers/shared/api.php | 4 +- app/controllers/web/console.php | 2 +- app/tasks/doctor.php | 4 +- app/workers/deletes.php | 2 +- composer.json | 1 + .../Specification/Format/OpenAPI3.php | 2 +- .../Specification/Format/Swagger2.php | 2 +- .../Storage/Compression/Algorithms/GZIP.php | 45 --- .../Storage/Compression/Compression.php | 27 -- src/Appwrite/Storage/Device.php | 167 ----------- src/Appwrite/Storage/Device/Local.php | 280 ------------------ src/Appwrite/Storage/Device/S3.php | 196 ------------ src/Appwrite/Storage/Storage.php | 113 ------- src/Appwrite/Storage/Validator/File.php | 27 -- src/Appwrite/Storage/Validator/FileName.php | 37 --- src/Appwrite/Storage/Validator/FileSize.php | 48 --- src/Appwrite/Storage/Validator/FileType.php | 93 ------ src/Appwrite/Storage/Validator/Upload.php | 33 --- .../Compression/Algorithms/GZIPTest.php | 2 +- tests/unit/Storage/Device/LocalTest.php | 2 +- tests/unit/Storage/StorageTest.php | 8 +- tests/unit/Storage/Validator/FileNameTest.php | 2 +- tests/unit/Storage/Validator/FileSizeTest.php | 2 +- tests/unit/Storage/Validator/FileTypeTest.php | 2 +- tests/unit/Storage/Validator/UploadTest.php | 2 +- 30 files changed, 34 insertions(+), 1099 deletions(-) delete mode 100644 src/Appwrite/Storage/Compression/Algorithms/GZIP.php delete mode 100644 src/Appwrite/Storage/Compression/Compression.php delete mode 100644 src/Appwrite/Storage/Device.php delete mode 100644 src/Appwrite/Storage/Device/Local.php delete mode 100644 src/Appwrite/Storage/Device/S3.php delete mode 100644 src/Appwrite/Storage/Storage.php delete mode 100644 src/Appwrite/Storage/Validator/File.php delete mode 100644 src/Appwrite/Storage/Validator/FileName.php delete mode 100644 src/Appwrite/Storage/Validator/FileSize.php delete mode 100644 src/Appwrite/Storage/Validator/FileType.php delete mode 100644 src/Appwrite/Storage/Validator/Upload.php diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 0572b8137..733a20ddd 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -4,11 +4,11 @@ use Appwrite\Database\Database; use Appwrite\Database\Document; use Appwrite\Database\Validator\Authorization; use Appwrite\Database\Validator\UID; -use Appwrite\Storage\Storage; -use Appwrite\Storage\Validator\File; -use Appwrite\Storage\Validator\FileSize; -use Appwrite\Storage\Validator\FileType; -use Appwrite\Storage\Validator\Upload; +use Utopia\Storage\Storage; +use Utopia\Storage\Validator\File; +use Utopia\Storage\Validator\FileSize; +use Utopia\Storage\Validator\FileType; +use Utopia\Storage\Validator\Upload; use Appwrite\Utopia\Response; use Appwrite\Task\Validator\Cron; use Utopia\App; diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 21e9f2c94..696247f3d 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -2,8 +2,8 @@ use Utopia\App; use Utopia\Exception; -use Appwrite\Storage\Device\Local; -use Appwrite\Storage\Storage; +use Utopia\Storage\Device\Local; +use Utopia\Storage\Storage; use Appwrite\ClamAV\Network; use Appwrite\Event\Event; diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index b70fe9f95..18e023347 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -13,11 +13,11 @@ use Appwrite\ClamAV\Network; use Appwrite\Database\Database; use Appwrite\Database\Document; use Appwrite\Database\Validator\UID; -use Appwrite\Storage\Storage; -use Appwrite\Storage\Validator\File; -use Appwrite\Storage\Validator\FileSize; -use Appwrite\Storage\Validator\Upload; -use Appwrite\Storage\Compression\Algorithms\GZIP; +use Utopia\Storage\Storage; +use Utopia\Storage\Validator\File; +use Utopia\Storage\Validator\FileSize; +use Utopia\Storage\Validator\Upload; +use Utopia\Storage\Compression\Algorithms\GZIP; use Appwrite\Resize\Resize; use Appwrite\OpenSSL\OpenSSL; use Appwrite\Utopia\Response; diff --git a/app/controllers/general.php b/app/controllers/general.php index 445563301..76d0c5db8 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -14,8 +14,8 @@ use Appwrite\Database\Database; use Appwrite\Database\Document; use Appwrite\Database\Validator\Authorization; use Appwrite\Network\Validator\Origin; -use Appwrite\Storage\Device\Local; -use Appwrite\Storage\Storage; +use Utopia\Storage\Device\Local; +use Utopia\Storage\Storage; use Appwrite\Utopia\Response\Filters\V06; use Utopia\CLI\Console; diff --git a/app/controllers/mock.php b/app/controllers/mock.php index ca26867c8..4c9f3faf9 100644 --- a/app/controllers/mock.php +++ b/app/controllers/mock.php @@ -8,7 +8,7 @@ use Utopia\Validator\Numeric; use Utopia\Validator\Text; use Utopia\Validator\ArrayList; use Utopia\Validator\Host; -use Appwrite\Storage\Validator\File; +use Utopia\Storage\Validator\File; App::get('/v1/mock/tests/foo') ->desc('Mock a get request for SDK tests') diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index bc2707f24..8dc0c097c 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -6,8 +6,8 @@ use Utopia\App; use Utopia\Exception; use Utopia\Abuse\Abuse; use Utopia\Abuse\Adapters\TimeLimit; -use Appwrite\Storage\Device\Local; -use Appwrite\Storage\Storage; +use Utopia\Storage\Device\Local; +use Utopia\Storage\Storage; App::init(function ($utopia, $request, $response, $project, $user, $register, $events, $audits, $usage, $deletes) { /** @var Utopia\App $utopia */ diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index b8fc5a621..6b3e105aa 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -7,7 +7,7 @@ use Utopia\Domains\Domain; use Appwrite\Database\Database; use Appwrite\Database\Validator\Authorization; use Appwrite\Database\Validator\UID; -use Appwrite\Storage\Storage; +use Utopia\Storage\Storage; App::init(function ($layout) { /** @var Utopia\View $layout */ diff --git a/app/tasks/doctor.php b/app/tasks/doctor.php index e3985c8e7..2918d4f1e 100644 --- a/app/tasks/doctor.php +++ b/app/tasks/doctor.php @@ -3,8 +3,8 @@ global $cli; use Appwrite\ClamAV\Network; -use Appwrite\Storage\Device\Local; -use Appwrite\Storage\Storage; +use Utopia\Storage\Device\Local; +use Utopia\Storage\Storage; use Utopia\App; use Utopia\CLI\Console; use Utopia\Domains\Domain; diff --git a/app/workers/deletes.php b/app/workers/deletes.php index ac168d6bc..2aa1fddc9 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -5,7 +5,7 @@ use Appwrite\Database\Adapter\MySQL as MySQLAdapter; use Appwrite\Database\Adapter\Redis as RedisAdapter; use Appwrite\Database\Document; use Appwrite\Database\Validator\Authorization; -use Appwrite\Storage\Device\Local; +use Utopia\Storage\Device\Local; use Utopia\Abuse\Abuse; use Utopia\Abuse\Adapters\TimeLimit; use Utopia\CLI\Console; diff --git a/composer.json b/composer.json index 7384811bd..973592f48 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,7 @@ "utopia-php/preloader": "0.2.*", "utopia-php/domains": "0.2.*", "utopia-php/swoole": "0.2.*", + "utopia-php/storage": "0.1.*", "resque/php-resque": "1.3.6", "matomo/device-detector": "3.13.0", diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php index 90f054d0a..117c7c93b 100644 --- a/src/Appwrite/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/Specification/Format/OpenAPI3.php @@ -218,7 +218,7 @@ class OpenAPI3 extends Format $node['schema']['x-example'] = '{}'; //$node['schema']['format'] = 'json'; break; - case 'Appwrite\Storage\Validator\File': + case 'Utopia\Storage\Validator\File': $consumes = ['multipart/form-data']; $node['schema']['type'] = 'string'; $node['schema']['format'] = 'binary'; diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index 56becd236..fbe8ded4e 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -210,7 +210,7 @@ class Swagger2 extends Format $node['x-example'] = '{}'; //$node['format'] = 'json'; break; - case 'Appwrite\Storage\Validator\File': + case 'Utopia\Storage\Validator\File': $consumes = ['multipart/form-data']; $node['type'] = 'file'; break; diff --git a/src/Appwrite/Storage/Compression/Algorithms/GZIP.php b/src/Appwrite/Storage/Compression/Algorithms/GZIP.php deleted file mode 100644 index df4e0236b..000000000 --- a/src/Appwrite/Storage/Compression/Algorithms/GZIP.php +++ /dev/null @@ -1,45 +0,0 @@ -root = $root; - } - - /** - * @return string - */ - public function getName():string - { - return 'Local Storage'; - } - - /** - * @return string - */ - public function getDescription():string - { - return 'Adapter for Local storage that is in the physical or virtual machine or mounted to it.'; - } - - /** - * @return string - */ - public function getRoot():string - { - return $this->root; - } - - /** - * @param string $filename - * - * @return string - */ - public function getPath($filename):string - { - $path = ''; - - for ($i = 0; $i < 4; ++$i) { - $path = ($i < \strlen($filename)) ? $path.DIRECTORY_SEPARATOR.$filename[$i] : $path.DIRECTORY_SEPARATOR.'x'; - } - - return $this->getRoot().$path.DIRECTORY_SEPARATOR.$filename; - } - - /** - * Upload. - * - * Upload a file to desired destination in the selected disk. - * - * @param string $target - * @param string $filename - * - * @throws \Exception - * - * @return bool - */ - public function upload($source, $path):bool - { - if (!\file_exists(\dirname($path))) { // Checks if directory path to file exists - if (!@\mkdir(\dirname($path), 0755, true)) { - throw new Exception('Can\'t create directory: '.\dirname($path)); - } - } - - if (\move_uploaded_file($source, $path)) { - return true; - } - - return false; - } - - /** - * Read file by given path. - * - * @param string $path - * - * @return string - */ - public function read(string $path):string - { - return \file_get_contents($path); - } - - /** - * Write file by given path. - * - * @param string $path - * @param string $data - * - * @return bool - */ - public function write(string $path, string $data): bool - { - if (!\file_exists(\dirname($path))) { // Checks if directory path to file exists - if (!@\mkdir(\dirname($path), 0755, true)) { - throw new Exception('Can\'t create directory '.\dirname($path)); - } - } - - return (bool)\file_put_contents($path, $data); - } - - /** - * Move file from given source to given path, Return true on success and false on failure. - * - * @see http://php.net/manual/en/function.filesize.php - * - * @param string $source - * @param string $target - * - * @return bool - */ - public function move(string $source, string $target):bool - { - if (!\file_exists(\dirname($target))) { // Checks if directory path to file exists - if (!@\mkdir(\dirname($target), 0755, true)) { - throw new Exception('Can\'t create directory '.\dirname($target)); - } - } - - if (\rename($source, $target)) { - return true; - } - - return false; - } - - /** - * Delete file in given path, Return true on success and false on failure. - * - * @see http://php.net/manual/en/function.filesize.php - * - * @param string $path - * @param bool $recursive - * - * @return bool - */ - public function delete(string $path, bool $recursive = false):bool - { - if (\is_dir($path) && $recursive) { - $files = \glob($path.'*', GLOB_MARK); // GLOB_MARK adds a slash to directories returned - - foreach ($files as $file) { - $this->delete($file, true); - } - - \rmdir($path); - } elseif (\is_file($path)) { - return \unlink($path); - } - - return false; - } - - /** - * Returns given file path its size. - * - * @see http://php.net/manual/en/function.filesize.php - * - * @param $path - * - * @return int - */ - public function getFileSize(string $path):int - { - return \filesize($path); - } - - /** - * Returns given file path its mime type. - * - * @see http://php.net/manual/en/function.mime-content-type.php - * - * @param $path - * - * @return string - */ - public function getFileMimeType(string $path):string - { - return \mime_content_type($path); - } - - /** - * Returns given file path its MD5 hash value. - * - * @see http://php.net/manual/en/function.md5-file.php - * - * @param $path - * - * @return string - */ - public function getFileHash(string $path):string - { - return \md5_file($path); - } - - /** - * Get directory size in bytes. - * - * Return -1 on error - * - * Based on http://www.jonasjohn.de/snippets/php/dir-size.htm - * - * @param $path - * - * @return int - */ - public function getDirectorySize(string $path):int - { - $size = 0; - - $directory = \opendir($path); - - if (!$directory) { - return -1; - } - - while (($file = \readdir($directory)) !== false) { - // Skip file pointers - if ($file[0] == '.') { - continue; - } - - // Go recursive down, or add the file size - if (\is_dir($path.$file)) { - $size += $this->getDirectorySize($path.$file.DIRECTORY_SEPARATOR); - } else { - $size += \filesize($path.$file); - } - } - - \closedir($directory); - - return $size; - } - - /** - * Get Partition Free Space. - * - * disk_free_space — Returns available space on filesystem or disk partition - * - * @return float - */ - public function getPartitionFreeSpace():float - { - return \disk_free_space($this->getRoot()); - } - - /** - * Get Partition Total Space. - * - * disk_total_space — Returns the total size of a filesystem or disk partition - * - * @return float - */ - public function getPartitionTotalSpace():float - { - return \disk_total_space($this->getRoot()); - } -} diff --git a/src/Appwrite/Storage/Device/S3.php b/src/Appwrite/Storage/Device/S3.php deleted file mode 100644 index adfe7e8be..000000000 --- a/src/Appwrite/Storage/Device/S3.php +++ /dev/null @@ -1,196 +0,0 @@ - array( - 'B', - 'KiB', - 'MiB', - 'GiB', - 'TiB', - 'PiB', - 'EiB', - 'ZiB', - 'YiB', - ), - 'metric' => array( - 'B', - 'kB', - 'MB', - 'GB', - 'TB', - 'PB', - 'EB', - 'ZB', - 'YB', - ), - ); - - $factor = (int)floor((strlen((string)$bytes) - 1) / 3); - - return sprintf("%.{$decimals}f%s", $bytes / pow($mod, $factor), $units[$system][$factor]); - } -} \ No newline at end of file diff --git a/src/Appwrite/Storage/Validator/File.php b/src/Appwrite/Storage/Validator/File.php deleted file mode 100644 index 1ca7140bb..000000000 --- a/src/Appwrite/Storage/Validator/File.php +++ /dev/null @@ -1,27 +0,0 @@ -max = $max; - } - - public function getDescription() - { - return 'File size can\'t be bigger than '.$this->max; - } - - /** - * Finds whether a file size is smaller than required limit. - * - * @param mixed $fileSize - * - * @return bool - */ - public function isValid($fileSize) - { - if (!is_int($fileSize)) { - return false; - } - - if ($fileSize > $this->max) { - return false; - } - - return true; - } -} diff --git a/src/Appwrite/Storage/Validator/FileType.php b/src/Appwrite/Storage/Validator/FileType.php deleted file mode 100644 index 7b13a9839..000000000 --- a/src/Appwrite/Storage/Validator/FileType.php +++ /dev/null @@ -1,93 +0,0 @@ - "\xFF\xD8\xFF", - self::FILE_TYPE_GIF => 'GIF', - self::FILE_TYPE_PNG => "\x89\x50\x4e\x47\x0d\x0a", - self::FILE_TYPE_GZIP => "application/x-gzip", - ); - - /** - * @var array - */ - protected $whiteList; - - /** - * @param array $whiteList - * - * @throws Exception - */ - public function __construct(array $whiteList) - { - foreach ($whiteList as $key) { - if (!isset($this->types[$key])) { - throw new Exception('Unknown file mime type'); - } - } - - $this->whiteList = $whiteList; - } - - public function getDescription() - { - return 'File mime-type is not allowed '; - } - - /** - * Is Valid. - * - * Binary check to finds whether a file is of valid type - * - * @see http://stackoverflow.com/a/3313196 - * - * @param string $path - * - * @return bool - */ - public function isValid($path) - { - if (!\is_readable($path)) { - return false; - } - - $handle = \fopen($path, 'r'); - - if (!$handle) { - return false; - } - - $bytes = \fgets($handle, 8); - - foreach ($this->whiteList as $key) { - if (\strpos($bytes, $this->types[$key]) === 0) { - \fclose($handle); - - return true; - } - } - - \fclose($handle); - - return false; - } -} diff --git a/src/Appwrite/Storage/Validator/Upload.php b/src/Appwrite/Storage/Validator/Upload.php deleted file mode 100644 index 38296e8d0..000000000 --- a/src/Appwrite/Storage/Validator/Upload.php +++ /dev/null @@ -1,33 +0,0 @@ -assertEquals(get_class(Storage::getDevice('disk-a')), 'Appwrite\Storage\Device\Local'); - $this->assertEquals(get_class(Storage::getDevice('disk-b')), 'Appwrite\Storage\Device\Local'); + $this->assertEquals(get_class(Storage::getDevice('disk-a')), 'Utopia\Storage\Device\Local'); + $this->assertEquals(get_class(Storage::getDevice('disk-b')), 'Utopia\Storage\Device\Local'); try { get_class(Storage::getDevice('disk-c')); diff --git a/tests/unit/Storage/Validator/FileNameTest.php b/tests/unit/Storage/Validator/FileNameTest.php index fcd2d1e7e..833cd4d67 100644 --- a/tests/unit/Storage/Validator/FileNameTest.php +++ b/tests/unit/Storage/Validator/FileNameTest.php @@ -2,7 +2,7 @@ namespace Appwrite\Tests; -use Appwrite\Storage\Validator\FileName; +use Utopia\Storage\Validator\FileName; use PHPUnit\Framework\TestCase; class FileNameTest extends TestCase diff --git a/tests/unit/Storage/Validator/FileSizeTest.php b/tests/unit/Storage/Validator/FileSizeTest.php index b4044dbc0..903c8703a 100644 --- a/tests/unit/Storage/Validator/FileSizeTest.php +++ b/tests/unit/Storage/Validator/FileSizeTest.php @@ -2,7 +2,7 @@ namespace Appwrite\Tests; -use Appwrite\Storage\Validator\FileSize; +use Utopia\Storage\Validator\FileSize; use PHPUnit\Framework\TestCase; class FileSizeTest extends TestCase diff --git a/tests/unit/Storage/Validator/FileTypeTest.php b/tests/unit/Storage/Validator/FileTypeTest.php index 7041efefb..8543c4ad6 100644 --- a/tests/unit/Storage/Validator/FileTypeTest.php +++ b/tests/unit/Storage/Validator/FileTypeTest.php @@ -2,7 +2,7 @@ namespace Appwrite\Tests; -use Appwrite\Storage\Validator\FileType; +use Utopia\Storage\Validator\FileType; use PHPUnit\Framework\TestCase; class FileTypeTest extends TestCase diff --git a/tests/unit/Storage/Validator/UploadTest.php b/tests/unit/Storage/Validator/UploadTest.php index 4d360ef41..a42f9c371 100644 --- a/tests/unit/Storage/Validator/UploadTest.php +++ b/tests/unit/Storage/Validator/UploadTest.php @@ -2,7 +2,7 @@ namespace Appwrite\Tests; -use Appwrite\Storage\Validator\Upload; +use Utopia\Storage\Validator\Upload; use PHPUnit\Framework\TestCase; class UploadTest extends TestCase From 9f949cedabdd143dfffcf1c633a2ecaad6b4e91b Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 22 Jan 2021 17:21:25 +0545 Subject: [PATCH 10/11] removing duplicated storage tests --- .../Compression/Algorithms/GZIPTest.php | 80 ------------ tests/unit/Storage/Device/LocalTest.php | 123 ------------------ tests/unit/Storage/StorageTest.php | 42 ------ tests/unit/Storage/Validator/FileNameTest.php | 33 ----- tests/unit/Storage/Validator/FileSizeTest.php | 30 ----- tests/unit/Storage/Validator/FileTypeTest.php | 31 ----- tests/unit/Storage/Validator/UploadTest.php | 32 ----- 7 files changed, 371 deletions(-) delete mode 100644 tests/unit/Storage/Compression/Algorithms/GZIPTest.php delete mode 100644 tests/unit/Storage/Device/LocalTest.php delete mode 100644 tests/unit/Storage/StorageTest.php delete mode 100644 tests/unit/Storage/Validator/FileNameTest.php delete mode 100644 tests/unit/Storage/Validator/FileSizeTest.php delete mode 100644 tests/unit/Storage/Validator/FileTypeTest.php delete mode 100644 tests/unit/Storage/Validator/UploadTest.php diff --git a/tests/unit/Storage/Compression/Algorithms/GZIPTest.php b/tests/unit/Storage/Compression/Algorithms/GZIPTest.php deleted file mode 100644 index 4db2036f0..000000000 --- a/tests/unit/Storage/Compression/Algorithms/GZIPTest.php +++ /dev/null @@ -1,80 +0,0 @@ -object = new GZIP(); - } - - public function tearDown(): void - { - } - - public function testName() - { - $this->assertEquals($this->object->getName(), 'gzip'); - } - - public function testCompressDecompressWithText() - { - $demo = 'This is a demo string'; - $demoSize = mb_strlen($demo, '8bit'); - - $data = $this->object->compress($demo); - $dataSize = mb_strlen($data, '8bit'); - - $this->assertEquals($demoSize, 21); - $this->assertEquals($dataSize, 39); - - $this->assertEquals($this->object->decompress($data), $demo); - } - - public function testCompressDecompressWithJPGImage() - { - $demo = \file_get_contents(__DIR__ . '/../../../../resources/disk-a/kitten-1.jpg'); - $demoSize = mb_strlen($demo, '8bit'); - - $data = $this->object->compress($demo); - $dataSize = mb_strlen($data, '8bit'); - - $this->assertEquals($demoSize, 599639); - $this->assertEquals($dataSize, 599107); - - $this->assertGreaterThan($dataSize, $demoSize); - - $data = $this->object->decompress($data); - $dataSize = mb_strlen($data, '8bit'); - - $this->assertEquals($dataSize, 599639); - } - - public function testCompressDecompressWithPNGImage() - { - $demo = \file_get_contents(__DIR__ . '/../../../../resources/disk-b/kitten-1.png'); - $demoSize = mb_strlen($demo, '8bit'); - - $data = $this->object->compress($demo); - $dataSize = mb_strlen($data, '8bit'); - - $this->assertEquals($demoSize, 3038056); - $this->assertEquals($dataSize, 3029202); - - $this->assertGreaterThan($dataSize, $demoSize); - - $data = $this->object->decompress($data); - $dataSize = mb_strlen($data, '8bit'); - - $this->assertEquals($dataSize, 3038056); - } -} diff --git a/tests/unit/Storage/Device/LocalTest.php b/tests/unit/Storage/Device/LocalTest.php deleted file mode 100644 index d6a26570b..000000000 --- a/tests/unit/Storage/Device/LocalTest.php +++ /dev/null @@ -1,123 +0,0 @@ -object = new Local(realpath(__DIR__ . '/../../../resources/disk-a')); - } - - public function tearDown(): void - { - } - - public function testName() - { - $this->assertEquals($this->object->getName(), 'Local Storage'); - } - - public function testDescription() - { - $this->assertEquals($this->object->getDescription(), 'Adapter for Local storage that is in the physical or virtual machine or mounted to it.'); - } - - public function testRoot() - { - $this->assertEquals($this->object->getRoot(), '/usr/src/code/tests/resources/disk-a'); - } - - public function testPath() - { - $this->assertEquals($this->object->getPath('image.png'), '/usr/src/code/tests/resources/disk-a/i/m/a/g/image.png'); - $this->assertEquals($this->object->getPath('x.png'), '/usr/src/code/tests/resources/disk-a/x/./p/n/x.png'); - $this->assertEquals($this->object->getPath('y'), '/usr/src/code/tests/resources/disk-a/y/x/x/x/y'); - } - - public function testWrite() - { - $this->assertEquals($this->object->write($this->object->getPath('text.txt'), 'Hello World'), true); - $this->assertEquals(file_exists($this->object->getPath('text.txt')), true); - $this->assertEquals(is_readable($this->object->getPath('text.txt')), true); - - $this->object->delete($this->object->getPath('text.txt')); - } - - public function testRead() - { - $this->assertEquals($this->object->write($this->object->getPath('text-for-read.txt'), 'Hello World'), true); - $this->assertEquals($this->object->read($this->object->getPath('text-for-read.txt')), 'Hello World'); - - $this->object->delete($this->object->getPath('text-for-read.txt')); - } - - public function testMove() - { - $this->assertEquals($this->object->write($this->object->getPath('text-for-move.txt'), 'Hello World'), true); - $this->assertEquals($this->object->read($this->object->getPath('text-for-move.txt')), 'Hello World'); - $this->assertEquals($this->object->move($this->object->getPath('text-for-move.txt'), $this->object->getPath('text-for-move-new.txt')), true); - $this->assertEquals($this->object->read($this->object->getPath('text-for-move-new.txt')), 'Hello World'); - $this->assertEquals(file_exists($this->object->getPath('text-for-move.txt')), false); - $this->assertEquals(is_readable($this->object->getPath('text-for-move.txt')), false); - $this->assertEquals(file_exists($this->object->getPath('text-for-move-new.txt')), true); - $this->assertEquals(is_readable($this->object->getPath('text-for-move-new.txt')), true); - - $this->object->delete($this->object->getPath('text-for-move-new.txt')); - } - - public function testDelete() - { - $this->assertEquals($this->object->write($this->object->getPath('text-for-delete.txt'), 'Hello World'), true); - $this->assertEquals($this->object->read($this->object->getPath('text-for-delete.txt')), 'Hello World'); - $this->assertEquals($this->object->delete($this->object->getPath('text-for-delete.txt')), true); - $this->assertEquals(file_exists($this->object->getPath('text-for-delete.txt')), false); - $this->assertEquals(is_readable($this->object->getPath('text-for-delete.txt')), false); - } - - public function testFileSize() - { - $this->assertEquals($this->object->getFileSize(__DIR__ . '/../../../resources/disk-a/kitten-1.jpg'), 599639); - $this->assertEquals($this->object->getFileSize(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), 131958); - } - - public function testFileMimeType() - { - $this->assertEquals($this->object->getFileMimeType(__DIR__ . '/../../../resources/disk-a/kitten-1.jpg'), 'image/jpeg'); - $this->assertEquals($this->object->getFileMimeType(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), 'image/jpeg'); - $this->assertEquals($this->object->getFileMimeType(__DIR__ . '/../../../resources/disk-b/kitten-1.png'), 'image/png'); - $this->assertEquals($this->object->getFileMimeType(__DIR__ . '/../../../resources/disk-b/kitten-2.png'), 'image/png'); - } - - public function testFileHash() - { - $this->assertEquals($this->object->getFileHash(__DIR__ . '/../../../resources/disk-a/kitten-1.jpg'), '7551f343143d2e24ab4aaf4624996b6a'); - $this->assertEquals($this->object->getFileHash(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), '81702fdeef2e55b1a22617bce4951cb5'); - $this->assertEquals($this->object->getFileHash(__DIR__ . '/../../../resources/disk-b/kitten-1.png'), '03010f4f02980521a8fd6213b52ec313'); - $this->assertEquals($this->object->getFileHash(__DIR__ . '/../../../resources/disk-b/kitten-2.png'), '8a9ed992b77e4b62b10e3a5c8ed72062'); - } - - public function testDirectorySize() - { - $this->assertGreaterThan(0, $this->object->getDirectorySize(__DIR__ . '/../../../resources/disk-a/')); - $this->assertGreaterThan(0, $this->object->getDirectorySize(__DIR__ . '/../../../resources/disk-b/')); - } - - public function testPartitionFreeSpace() - { - $this->assertGreaterThan(0, $this->object->getPartitionFreeSpace()); - } - - public function testPartitionTotalSpace() - { - $this->assertGreaterThan(0, $this->object->getPartitionTotalSpace()); - } -} diff --git a/tests/unit/Storage/StorageTest.php b/tests/unit/Storage/StorageTest.php deleted file mode 100644 index e624bbd67..000000000 --- a/tests/unit/Storage/StorageTest.php +++ /dev/null @@ -1,42 +0,0 @@ -assertEquals(get_class(Storage::getDevice('disk-a')), 'Utopia\Storage\Device\Local'); - $this->assertEquals(get_class(Storage::getDevice('disk-b')), 'Utopia\Storage\Device\Local'); - - try { - get_class(Storage::getDevice('disk-c')); - $this->fail("Expected exception not thrown"); - } catch (Exception $e) { - $this->assertEquals('The device "disk-c" is not listed', $e->getMessage()); - } - } - - public function testExists() - { - $this->assertEquals(Storage::exists('disk-a'), true); - $this->assertEquals(Storage::exists('disk-b'), true); - $this->assertEquals(Storage::exists('disk-c'), false); - } -} diff --git a/tests/unit/Storage/Validator/FileNameTest.php b/tests/unit/Storage/Validator/FileNameTest.php deleted file mode 100644 index 833cd4d67..000000000 --- a/tests/unit/Storage/Validator/FileNameTest.php +++ /dev/null @@ -1,33 +0,0 @@ -object = new FileName(); - } - - public function tearDown(): void - { - } - - public function testValues() - { - $this->assertEquals($this->object->isValid(''), false); - $this->assertEquals($this->object->isValid(null), false); - $this->assertEquals($this->object->isValid(false), false); - $this->assertEquals($this->object->isValid('../test'), false); - $this->assertEquals($this->object->isValid('test.png'), true); - $this->assertEquals($this->object->isValid('test'), true); - } -} diff --git a/tests/unit/Storage/Validator/FileSizeTest.php b/tests/unit/Storage/Validator/FileSizeTest.php deleted file mode 100644 index 903c8703a..000000000 --- a/tests/unit/Storage/Validator/FileSizeTest.php +++ /dev/null @@ -1,30 +0,0 @@ -object = new FileSize(1000); - } - - public function tearDown(): void - { - } - - public function testValues() - { - $this->assertEquals($this->object->isValid(1001), false); - $this->assertEquals($this->object->isValid(1000), true); - $this->assertEquals($this->object->isValid(999), true); - } -} diff --git a/tests/unit/Storage/Validator/FileTypeTest.php b/tests/unit/Storage/Validator/FileTypeTest.php deleted file mode 100644 index 8543c4ad6..000000000 --- a/tests/unit/Storage/Validator/FileTypeTest.php +++ /dev/null @@ -1,31 +0,0 @@ -object = new FileType([FileType::FILE_TYPE_JPEG]); - } - - public function tearDown(): void - { - } - - public function testValues() - { - $this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-1.jpg'), true); - $this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), true); - $this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-b/kitten-1.png'), false); - $this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-b/kitten-2.png'), false); - } -} diff --git a/tests/unit/Storage/Validator/UploadTest.php b/tests/unit/Storage/Validator/UploadTest.php deleted file mode 100644 index a42f9c371..000000000 --- a/tests/unit/Storage/Validator/UploadTest.php +++ /dev/null @@ -1,32 +0,0 @@ -object = new Upload(); - } - - public function tearDown(): void - { - } - - public function testValues() - { - $this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-1.jpg'), false); - $this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), false); - $this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-b/kitten-1.png'), false); - $this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-b/kitten-2.png'), false); - $this->assertEquals($this->object->isValid(__FILE__), false); - } -} From 921b0e067183be7048b6334d4a2c57e21f4ea5d3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 24 Jan 2021 07:41:23 +0200 Subject: [PATCH 11/11] Fixed multiple storage init --- app/controllers/general.php | 3 - composer.lock | 214 ++++++++++++++++++++++-------------- 2 files changed, 133 insertions(+), 84 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 76d0c5db8..f5a3c09c9 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -83,9 +83,6 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo : '.'.$request->getHostname() ); - Storage::setDevice('files', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId())); - Storage::setDevice('functions', new Local(APP_STORAGE_FUNCTIONS.'/app-'.$project->getId())); - /* * Response format */ diff --git a/composer.lock b/composer.lock index 3ff9072c5..7f0af1fc7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "54c20e10875569003e57dd930bdde8a3", + "content-hash": "3c94b5ea6b60232905b6831bec020b69", "packages": [ { "name": "adhocore/jwt", @@ -1695,6 +1695,58 @@ }, "time": "2020-10-24T08:51:37+00:00" }, + { + "name": "utopia-php/storage", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/storage.git", + "reference": "00e9045cee6bd1ec1d1f27329c329494ef420c19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/00e9045cee6bd1ec1d1f27329c329494ef420c19", + "reference": "00e9045cee6bd1ec1d1f27329c329494ef420c19", + "shasum": "" + }, + "require": { + "php": ">=7.4", + "utopia-php/framework": "0.10.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "vimeo/psalm": "4.0.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Storage\\": "src/Storage" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eldad Fux", + "email": "eldad@appwrite.io" + } + ], + "description": "A simple Storage library to manage application storage", + "keywords": [ + "framework", + "php", + "storage", + "upf", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/storage/issues", + "source": "https://github.com/utopia-php/storage/tree/0.1.0" + }, + "time": "2021-01-22T07:27:20+00:00" + }, { "name": "utopia-php/swoole", "version": "0.2.0", @@ -3082,12 +3134,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "cbe315f4d3b653ac0310862697866ffddabc502f" + "reference": "0bf76e406e6b1d08d8be732db3ec8e6cbe2f8cc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cbe315f4d3b653ac0310862697866ffddabc502f", - "reference": "cbe315f4d3b653ac0310862697866ffddabc502f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0bf76e406e6b1d08d8be732db3ec8e6cbe2f8cc2", + "reference": "0bf76e406e6b1d08d8be732db3ec8e6cbe2f8cc2", "shasum": "" }, "require": { @@ -3151,7 +3203,7 @@ "type": "github" } ], - "time": "2021-01-02T06:24:37+00:00" + "time": "2021-01-21T05:59:53+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3159,12 +3211,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "ec77a26a4afef3ab3b4d4f8f25777218f935e53d" + "reference": "d66b11be20460c55f9655b50d06c0070d6de0ab8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/ec77a26a4afef3ab3b4d4f8f25777218f935e53d", - "reference": "ec77a26a4afef3ab3b4d4f8f25777218f935e53d", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/d66b11be20460c55f9655b50d06c0070d6de0ab8", + "reference": "d66b11be20460c55f9655b50d06c0070d6de0ab8", "shasum": "" }, "require": { @@ -3212,7 +3264,7 @@ "type": "github" } ], - "time": "2021-01-18T13:04:09+00:00" + "time": "2021-01-23T09:14:26+00:00" }, { "name": "phpunit/php-invoker", @@ -3220,12 +3272,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "da682a733325bf5db48ee2786bd640f8cd0f2622" + "reference": "24d9117c920e229e4dd4e65ed966951dc8d6c0ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/da682a733325bf5db48ee2786bd640f8cd0f2622", - "reference": "da682a733325bf5db48ee2786bd640f8cd0f2622", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/24d9117c920e229e4dd4e65ed966951dc8d6c0ee", + "reference": "24d9117c920e229e4dd4e65ed966951dc8d6c0ee", "shasum": "" }, "require": { @@ -3276,7 +3328,7 @@ "type": "github" } ], - "time": "2021-01-18T13:04:19+00:00" + "time": "2021-01-23T09:14:34+00:00" }, { "name": "phpunit/php-text-template", @@ -3284,12 +3336,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "ccece2717f047bf9b04848ea84059374b07170bc" + "reference": "3ace7e098d9ae64fdf2ee12e69ec1ed3eb16d6ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/ccece2717f047bf9b04848ea84059374b07170bc", - "reference": "ccece2717f047bf9b04848ea84059374b07170bc", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3ace7e098d9ae64fdf2ee12e69ec1ed3eb16d6ec", + "reference": "3ace7e098d9ae64fdf2ee12e69ec1ed3eb16d6ec", "shasum": "" }, "require": { @@ -3336,7 +3388,7 @@ "type": "github" } ], - "time": "2021-01-18T13:04:58+00:00" + "time": "2021-01-23T09:15:08+00:00" }, { "name": "phpunit/php-timer", @@ -3344,12 +3396,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "c9b3e07891acf6f6679cf2956c99b847aa73bcff" + "reference": "7fe4501c193086a375125ff31e7b8bb6122f00bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/c9b3e07891acf6f6679cf2956c99b847aa73bcff", - "reference": "c9b3e07891acf6f6679cf2956c99b847aa73bcff", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/7fe4501c193086a375125ff31e7b8bb6122f00bd", + "reference": "7fe4501c193086a375125ff31e7b8bb6122f00bd", "shasum": "" }, "require": { @@ -3396,7 +3448,7 @@ "type": "github" } ], - "time": "2021-01-18T13:04:29+00:00" + "time": "2021-01-23T09:14:43+00:00" }, { "name": "phpunit/phpunit", @@ -3561,12 +3613,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "0b90e32f4fc2ed2618af8470384335383a99eeb2" + "reference": "72cbe9a5d3ac979d81dbe177c8bd6d103699c502" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/0b90e32f4fc2ed2618af8470384335383a99eeb2", - "reference": "0b90e32f4fc2ed2618af8470384335383a99eeb2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/72cbe9a5d3ac979d81dbe177c8bd6d103699c502", + "reference": "72cbe9a5d3ac979d81dbe177c8bd6d103699c502", "shasum": "" }, "require": { @@ -3610,7 +3662,7 @@ "type": "github" } ], - "time": "2021-01-18T13:05:31+00:00" + "time": "2021-01-23T09:15:35+00:00" }, { "name": "sebastian/code-unit", @@ -3674,12 +3726,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "822d88cf8f07aedea4c6cdd48dde9e19b1cd35dd" + "reference": "e49b92c16b780c4d526c118d49d904c4626b8c63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/822d88cf8f07aedea4c6cdd48dde9e19b1cd35dd", - "reference": "822d88cf8f07aedea4c6cdd48dde9e19b1cd35dd", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/e49b92c16b780c4d526c118d49d904c4626b8c63", + "reference": "e49b92c16b780c4d526c118d49d904c4626b8c63", "shasum": "" }, "require": { @@ -3722,7 +3774,7 @@ "type": "github" } ], - "time": "2021-01-18T13:02:48+00:00" + "time": "2021-01-23T09:13:19+00:00" }, { "name": "sebastian/comparator", @@ -3730,12 +3782,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "b06bf31dec5ef18a8f5bccaf51c0f4af128a08e1" + "reference": "33c94310f57ca21d5ea6018c4e799be699e85650" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b06bf31dec5ef18a8f5bccaf51c0f4af128a08e1", - "reference": "b06bf31dec5ef18a8f5bccaf51c0f4af128a08e1", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/33c94310f57ca21d5ea6018c4e799be699e85650", + "reference": "33c94310f57ca21d5ea6018c4e799be699e85650", "shasum": "" }, "require": { @@ -3797,7 +3849,7 @@ "type": "github" } ], - "time": "2021-01-18T13:02:58+00:00" + "time": "2021-01-23T09:13:27+00:00" }, { "name": "sebastian/complexity", @@ -3805,12 +3857,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "291f1710889bce9382b87e17ffec544d9b2c3078" + "reference": "b251b4b76965b9a24a847ac5641ed7419723e7e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/291f1710889bce9382b87e17ffec544d9b2c3078", - "reference": "291f1710889bce9382b87e17ffec544d9b2c3078", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/b251b4b76965b9a24a847ac5641ed7419723e7e3", + "reference": "b251b4b76965b9a24a847ac5641ed7419723e7e3", "shasum": "" }, "require": { @@ -3855,7 +3907,7 @@ "type": "github" } ], - "time": "2021-01-18T13:05:10+00:00" + "time": "2021-01-23T09:15:17+00:00" }, { "name": "sebastian/diff", @@ -3863,12 +3915,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3b28ccb04205dbe3f54685d91c34d54f5f09c64e" + "reference": "1c3726f5fc6ecdf41a7d7a992c18db936d79345e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3b28ccb04205dbe3f54685d91c34d54f5f09c64e", - "reference": "3b28ccb04205dbe3f54685d91c34d54f5f09c64e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1c3726f5fc6ecdf41a7d7a992c18db936d79345e", + "reference": "1c3726f5fc6ecdf41a7d7a992c18db936d79345e", "shasum": "" }, "require": { @@ -3922,7 +3974,7 @@ "type": "github" } ], - "time": "2021-01-18T13:03:08+00:00" + "time": "2021-01-23T09:13:35+00:00" }, { "name": "sebastian/environment", @@ -3930,12 +3982,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1733c33db8c2fb5939ba4b3c2de53eff99528298" + "reference": "71408304f2a06879d9306d6126ff19c26b77ab8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1733c33db8c2fb5939ba4b3c2de53eff99528298", - "reference": "1733c33db8c2fb5939ba4b3c2de53eff99528298", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/71408304f2a06879d9306d6126ff19c26b77ab8f", + "reference": "71408304f2a06879d9306d6126ff19c26b77ab8f", "shasum": "" }, "require": { @@ -3986,7 +4038,7 @@ "type": "github" } ], - "time": "2021-01-18T13:03:18+00:00" + "time": "2021-01-23T09:13:44+00:00" }, { "name": "sebastian/exporter", @@ -3994,12 +4046,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "21b3e1f135974b44d51d85634a255ae84a2fe986" + "reference": "9fdb8e271acb70c94fc378d0cd32de380e1a6f9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/21b3e1f135974b44d51d85634a255ae84a2fe986", - "reference": "21b3e1f135974b44d51d85634a255ae84a2fe986", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/9fdb8e271acb70c94fc378d0cd32de380e1a6f9d", + "reference": "9fdb8e271acb70c94fc378d0cd32de380e1a6f9d", "shasum": "" }, "require": { @@ -4064,7 +4116,7 @@ "type": "github" } ], - "time": "2021-01-18T13:03:28+00:00" + "time": "2021-01-23T09:13:52+00:00" }, { "name": "sebastian/global-state", @@ -4072,12 +4124,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "f51241632128604e92fb08adc3c95eec5228efe2" + "reference": "483fae6c9f89aee344c35547df17b130827a0981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/f51241632128604e92fb08adc3c95eec5228efe2", - "reference": "f51241632128604e92fb08adc3c95eec5228efe2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/483fae6c9f89aee344c35547df17b130827a0981", + "reference": "483fae6c9f89aee344c35547df17b130827a0981", "shasum": "" }, "require": { @@ -4129,7 +4181,7 @@ "type": "github" } ], - "time": "2021-01-18T13:03:37+00:00" + "time": "2021-01-23T09:14:00+00:00" }, { "name": "sebastian/lines-of-code", @@ -4137,12 +4189,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e79c302abc8371a61d1b0d1ff0a4aeac1fe050b8" + "reference": "815e6e5f9021de94a4f896835e9a7b0fd9557e2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e79c302abc8371a61d1b0d1ff0a4aeac1fe050b8", - "reference": "e79c302abc8371a61d1b0d1ff0a4aeac1fe050b8", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/815e6e5f9021de94a4f896835e9a7b0fd9557e2d", + "reference": "815e6e5f9021de94a4f896835e9a7b0fd9557e2d", "shasum": "" }, "require": { @@ -4187,7 +4239,7 @@ "type": "github" } ], - "time": "2021-01-18T13:05:21+00:00" + "time": "2021-01-23T09:15:26+00:00" }, { "name": "sebastian/object-enumerator", @@ -4195,12 +4247,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "b87fec01050be216f000b0bd1b8c44c657d25f1a" + "reference": "5f8c843a728ed5433bbd6f4426923f9d750be40b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/b87fec01050be216f000b0bd1b8c44c657d25f1a", - "reference": "b87fec01050be216f000b0bd1b8c44c657d25f1a", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5f8c843a728ed5433bbd6f4426923f9d750be40b", + "reference": "5f8c843a728ed5433bbd6f4426923f9d750be40b", "shasum": "" }, "require": { @@ -4245,7 +4297,7 @@ "type": "github" } ], - "time": "2021-01-18T13:03:48+00:00" + "time": "2021-01-23T09:14:09+00:00" }, { "name": "sebastian/object-reflector", @@ -4253,12 +4305,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "d205aaa619485dbaf797e67c2af79186c606d7ea" + "reference": "d41ef59df68d6f470c8084fae471b56fd2812bb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/d205aaa619485dbaf797e67c2af79186c606d7ea", - "reference": "d205aaa619485dbaf797e67c2af79186c606d7ea", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/d41ef59df68d6f470c8084fae471b56fd2812bb2", + "reference": "d41ef59df68d6f470c8084fae471b56fd2812bb2", "shasum": "" }, "require": { @@ -4301,7 +4353,7 @@ "type": "github" } ], - "time": "2021-01-18T13:03:58+00:00" + "time": "2021-01-23T09:14:18+00:00" }, { "name": "sebastian/recursion-context", @@ -4309,12 +4361,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "141035d37fad4cf8d8d0f83097792355cfcbb379" + "reference": "f78f35f8c348f59a47e7973ec0533ae7be54254d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/141035d37fad4cf8d8d0f83097792355cfcbb379", - "reference": "141035d37fad4cf8d8d0f83097792355cfcbb379", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/f78f35f8c348f59a47e7973ec0533ae7be54254d", + "reference": "f78f35f8c348f59a47e7973ec0533ae7be54254d", "shasum": "" }, "require": { @@ -4365,7 +4417,7 @@ "type": "github" } ], - "time": "2021-01-18T13:04:39+00:00" + "time": "2021-01-23T09:14:51+00:00" }, { "name": "sebastian/resource-operations", @@ -4429,12 +4481,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "c415636f612a62bfba64ea53f2f63038e1c2e32e" + "reference": "55fa25ad7fc6fb7caf2f7cfada5e5e20adf731aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/c415636f612a62bfba64ea53f2f63038e1c2e32e", - "reference": "c415636f612a62bfba64ea53f2f63038e1c2e32e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/55fa25ad7fc6fb7caf2f7cfada5e5e20adf731aa", + "reference": "55fa25ad7fc6fb7caf2f7cfada5e5e20adf731aa", "shasum": "" }, "require": { @@ -4478,7 +4530,7 @@ "type": "github" } ], - "time": "2021-01-18T13:04:49+00:00" + "time": "2021-01-23T09:14:59+00:00" }, { "name": "sebastian/version", @@ -4578,12 +4630,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "356c70659d6b48595f9f275cd7c4de0d5544c49c" + "reference": "5d9e349571fa1fed2ed89fe1f5ffd58331468e87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/356c70659d6b48595f9f275cd7c4de0d5544c49c", - "reference": "356c70659d6b48595f9f275cd7c4de0d5544c49c", + "url": "https://api.github.com/repos/symfony/console/zipball/5d9e349571fa1fed2ed89fe1f5ffd58331468e87", + "reference": "5d9e349571fa1fed2ed89fe1f5ffd58331468e87", "shasum": "" }, "require": { @@ -4668,7 +4720,7 @@ "type": "tidelift" } ], - "time": "2021-01-14T15:43:35+00:00" + "time": "2021-01-23T09:52:46+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5566,12 +5618,12 @@ "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", + "url": "https://github.com/webmozarts/assert.git", "reference": "9c89b265ccc4092d58e66d72af5d343ee77a41ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9c89b265ccc4092d58e66d72af5d343ee77a41ae", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/9c89b265ccc4092d58e66d72af5d343ee77a41ae", "reference": "9c89b265ccc4092d58e66d72af5d343ee77a41ae", "shasum": "" }, @@ -5615,8 +5667,8 @@ "validate" ], "support": { - "issues": "https://github.com/webmozart/assert/issues", - "source": "https://github.com/webmozart/assert/tree/master" + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/master" }, "time": "2021-01-18T12:52:36+00:00" },