Merge branch 'feat-db-pools-master' into feat-console-oauth
This commit is contained in:
commit
9b4d9d7c6d
1 changed files with 22 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Appwrite\Platform\Tasks;
|
namespace Appwrite\Platform\Tasks;
|
||||||
|
|
||||||
|
use Appwrite\Network\Validator\Origin;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Utopia\App;
|
use Utopia\App;
|
||||||
use Utopia\Platform\Action;
|
use Utopia\Platform\Action;
|
||||||
|
@ -12,6 +13,7 @@ use Utopia\Database\Query;
|
||||||
use Utopia\Database\Validator\Authorization;
|
use Utopia\Database\Validator\Authorization;
|
||||||
use Utopia\Analytics\Adapter\Mixpanel;
|
use Utopia\Analytics\Adapter\Mixpanel;
|
||||||
use Utopia\Analytics\Event;
|
use Utopia\Analytics\Event;
|
||||||
|
use Utopia\Config\Config;
|
||||||
use Utopia\Database\Document;
|
use Utopia\Database\Document;
|
||||||
use Utopia\Pools\Group;
|
use Utopia\Pools\Group;
|
||||||
|
|
||||||
|
@ -98,6 +100,12 @@ class Hamster extends Action
|
||||||
/** Get Total Functions */
|
/** Get Total Functions */
|
||||||
$statsPerProject['custom_functions'] = $dbForProject->count('functions', [], APP_LIMIT_COUNT);
|
$statsPerProject['custom_functions'] = $dbForProject->count('functions', [], APP_LIMIT_COUNT);
|
||||||
|
|
||||||
|
foreach (\array_keys(Config::getParam('runtimes')) as $runtime) {
|
||||||
|
$statsPerProject['custom_functions_' . $runtime] = $dbForProject->count('functions', [
|
||||||
|
Query::equal('runtime', [$runtime]),
|
||||||
|
], APP_LIMIT_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
/** Get Total Deployments */
|
/** Get Total Deployments */
|
||||||
$statsPerProject['custom_deployments'] = $dbForProject->count('deployments', [], APP_LIMIT_COUNT);
|
$statsPerProject['custom_deployments'] = $dbForProject->count('deployments', [], APP_LIMIT_COUNT);
|
||||||
|
|
||||||
|
@ -152,7 +160,7 @@ class Hamster extends Action
|
||||||
return $platform['type'] === 'android';
|
return $platform['type'] === 'android';
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$statsPerProject['custom_platforms_iOS'] = sizeof(array_filter($platforms, function ($platform) {
|
$statsPerProject['custom_platforms_apple'] = sizeof(array_filter($platforms, function ($platform) {
|
||||||
return str_contains($platform['type'], 'apple');
|
return str_contains($platform['type'], 'apple');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -160,6 +168,19 @@ class Hamster extends Action
|
||||||
return str_contains($platform['type'], 'flutter');
|
return str_contains($platform['type'], 'flutter');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
$flutterPlatforms = [Origin::CLIENT_TYPE_FLUTTER_ANDROID, Origin::CLIENT_TYPE_FLUTTER_IOS, Origin::CLIENT_TYPE_FLUTTER_MACOS, Origin::CLIENT_TYPE_FLUTTER_WINDOWS, Origin::CLIENT_TYPE_FLUTTER_LINUX];
|
||||||
|
|
||||||
|
foreach ($flutterPlatforms as $flutterPlatform) {
|
||||||
|
$statsPerProject['custom_platforms_' . $flutterPlatform] = sizeof(array_filter($platforms, function ($platform) use ($flutterPlatform) {
|
||||||
|
return $platform['type'] === $flutterPlatform;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
$statsPerProject['custom_platforms_api_keys'] = $dbForConsole->count('keys', [
|
||||||
|
Query::equal('projectInternalId', [$project->getInternalId()]),
|
||||||
|
Query::limit(APP_LIMIT_COUNT)
|
||||||
|
]);
|
||||||
|
|
||||||
/** Get Usage $statsPerProject */
|
/** Get Usage $statsPerProject */
|
||||||
$periods = [
|
$periods = [
|
||||||
'infinity' => [
|
'infinity' => [
|
||||||
|
|
Loading…
Reference in a new issue