addressing comments
This commit is contained in:
parent
876b0da2e2
commit
0fd7db3c36
4 changed files with 21 additions and 10 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 3a0c8f0334d402a6e27c8b5c0512f3d60080ddbd
|
||||
Subproject commit 9174d8f8cb584744dd7a53f69d324f490ee82ee3
|
2
composer.lock
generated
2
composer.lock
generated
|
@ -5542,5 +5542,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "8.0"
|
||||
},
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.2.0"
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class Tasks extends Service
|
|||
->addAction(VolumeSync::getName(), new VolumeSync())
|
||||
->addAction(Specs::getName(), new Specs())
|
||||
->addAction(CalcUsersStats::getName(), new CalcUsersStats())
|
||||
->addAction(CalctierStats::getName(), new CalcTierStats())
|
||||
->addAction(CalcTierStats::getName(), new CalcTierStats())
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Appwrite\Platform\Tasks;
|
||||
|
||||
use Exception;
|
||||
use League\Csv\CannotInsertRecord;
|
||||
use Utopia\App;
|
||||
use Utopia\Database\Validator\Authorization;
|
||||
use Utopia\Platform\Action;
|
||||
|
@ -20,17 +21,18 @@ class CalcTierStats extends Action
|
|||
private array $columns = [
|
||||
'Project ID',
|
||||
'Organization ID',
|
||||
'Users',
|
||||
'Organization Members',
|
||||
'Teams',
|
||||
'Requests',
|
||||
'Bandwidth',
|
||||
'Domains',
|
||||
'Api keys',
|
||||
'Webhooks',
|
||||
'Platforms',
|
||||
'Buckets',
|
||||
'Files',
|
||||
'Storage',
|
||||
'Max file size',
|
||||
'Storage (bytes)',
|
||||
'Max File Size (bytes)',
|
||||
'Databases',
|
||||
'Functions',
|
||||
'Deployments',
|
||||
|
@ -66,6 +68,10 @@ class CalcTierStats extends Action
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Utopia\Exception
|
||||
* @throws CannotInsertRecord
|
||||
*/
|
||||
public function action(Group $pools, Cache $cache, Database $dbForConsole, Registry $register): void
|
||||
{
|
||||
//docker compose exec -t appwrite calc-tier-stats
|
||||
|
@ -129,12 +135,12 @@ class CalcTierStats extends Action
|
|||
//$teamName = $team->getAttribute('name');
|
||||
// }
|
||||
|
||||
$stats['Organization ID'] = $project->getAttribute('teamInternalId', null);
|
||||
$stats['Organization ID'] = $project->getAttribute('teamId', null);
|
||||
|
||||
/** Get Total Members */
|
||||
$teamInternalId = $project->getAttribute('teamInternalId', null);
|
||||
if ($teamInternalId) {
|
||||
$stats['Users'] = $dbForConsole->count('memberships', [
|
||||
$stats['Organization Members'] = $dbForConsole->count('memberships', [
|
||||
Query::equal('teamInternalId', [$teamInternalId])
|
||||
]);
|
||||
} else {
|
||||
|
@ -190,6 +196,11 @@ class CalcTierStats extends Action
|
|||
]);
|
||||
|
||||
|
||||
/** Get Api keys */
|
||||
$stats['Api keys'] = $dbForConsole->count('keys', [
|
||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||
]);
|
||||
|
||||
/** Get Webhooks */
|
||||
$stats['Webhooks'] = $dbForConsole->count('webhooks', [
|
||||
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||
|
@ -217,8 +228,8 @@ class CalcTierStats extends Action
|
|||
}
|
||||
$stats['Buckets'] = $counter;
|
||||
$stats['Files'] = $filesCount;
|
||||
$stats['Storage'] = $filesSum;
|
||||
$stats['Max file size'] = $maxFileSize;
|
||||
$stats['Storage (bytes)'] = $filesSum;
|
||||
$stats['Max File Size (bytes)'] = $maxFileSize;
|
||||
|
||||
/** Get Total Functions */
|
||||
$stats['Databases'] = $dbForProject->count('databases', []);
|
||||
|
|
Loading…
Reference in a new issue