1
0
Fork 0
mirror of synced 2024-06-30 04:00:34 +12:00

downgraded csv writer ver

This commit is contained in:
shimon 2023-05-24 12:17:14 +03:00
parent 31e6492dbc
commit 99b56b3584
5 changed files with 10 additions and 11 deletions

View file

@ -119,7 +119,7 @@ RUN mkdir -p /storage/uploads && \
RUN chmod +x /usr/local/bin/doctor && \
chmod +x /usr/local/bin/patch-delete-schedule-updated-at-attribute && \
chmod +x /usr/local/bin/clear-card-cache && \
chmod +x /usr/local/bin/users-calc && \
chmod +x /usr/local/bin/calc-users-stats && \
chmod +x /usr/local/bin/maintenance && \
chmod +x /usr/local/bin/volume-sync && \
chmod +x /usr/local/bin/usage && \

3
bin/calc-users-stats Normal file
View file

@ -0,0 +1,3 @@
#!/bin/sh
php /usr/src/code/app/cli.php calc-users-stats $@

View file

@ -1,3 +0,0 @@
#!/bin/sh
php /usr/src/code/app/cli.php users-calc $@

View file

@ -19,7 +19,7 @@ use Appwrite\Platform\Tasks\Usage;
use Appwrite\Platform\Tasks\Vars;
use Appwrite\Platform\Tasks\Version;
use Appwrite\Platform\Tasks\VolumeSync;
use Appwrite\Platform\Tasks\UsersCalc;
use Appwrite\Platform\Tasks\CalcUsersStats;
class Tasks extends Service
{
@ -43,6 +43,6 @@ class Tasks extends Service
->addAction(SDKs::getName(), new SDKs())
->addAction(VolumeSync::getName(), new VolumeSync())
->addAction(Specs::getName(), new Specs())
->addAction(UsersCalc::getName(), new UsersCalc());
->addAction(CalcUsersStats::getName(), new CalcUsersStats());
}
}

View file

@ -3,7 +3,6 @@
namespace Appwrite\Platform\Tasks;
use Exception;
use League\Csv\Reader;
use Utopia\App;
use Utopia\Platform\Action;
use Utopia\Cache\Cache;
@ -15,7 +14,7 @@ use PHPMailer\PHPMailer\PHPMailer;
use Utopia\Pools\Group;
use Utopia\Registry\Registry;
class UsersCalc extends Action
class CalcUsersStats extends Action
{
private array $columns = [
'Project ID',
@ -29,7 +28,7 @@ class UsersCalc extends Action
public static function getName(): string
{
return 'users-calc';
return 'calc-users-stats';
}
public function __construct()
@ -48,6 +47,7 @@ class UsersCalc extends Action
public function action(Group $pools, Cache $cache, Database $dbForConsole, Registry $register): void
{
//docker compose exec -t appwrite calc-users-stats
Console::title('Cloud Users calculation V1');
Console::success(APP_NAME . ' cloud Users calculation has started');
@ -141,7 +141,7 @@ class UsersCalc extends Action
try {
/** Addresses */
$mail->setFrom(App::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM), 'Appwrite Cloud Hamster');
$recipients = explode(',', App::getEnv('_APP_HAMSTER_RECIPIENTS', 'shimon@appwrite.io'));
$recipients = explode(',', App::getEnv('_APP_HAMSTER_RECIPIENTS', ''));
foreach ($recipients as $recipient) {
$mail->addAddress($recipient);
@ -153,7 +153,6 @@ class UsersCalc extends Action
/** Content */
$mail->Subject = "Cloud Report for {$this->date}";
$mail->Body = "Please find the daily cloud report atttached";
$mail->send();
Console::success('Email has been sent!');
} catch (Exception $e) {