1
0
Fork 0
mirror of synced 2024-06-29 11:40:45 +12:00

fix: workers

This commit is contained in:
Torsten Dittmann 2024-01-24 12:29:36 +01:00
parent e148617d3e
commit 62e459c581
4 changed files with 7 additions and 3 deletions

View file

@ -1107,7 +1107,6 @@ App::post('/v1/account/tokens/magic-url')
$message = Template::fromFile(__DIR__ . '/../../config/locale/templates/email-magic-url.tpl'); $message = Template::fromFile(__DIR__ . '/../../config/locale/templates/email-magic-url.tpl');
$message $message
->setParam('{{body}}', $body, escapeHtml: false)
->setParam('{{hello}}', $locale->getText("emails.magicSession.hello")) ->setParam('{{hello}}', $locale->getText("emails.magicSession.hello"))
->setParam('{{optionButton}}', $locale->getText("emails.magicSession.optionButton")) ->setParam('{{optionButton}}', $locale->getText("emails.magicSession.optionButton"))
->setParam('{{buttonText}}', $locale->getText("emails.magicSession.buttonText")) ->setParam('{{buttonText}}', $locale->getText("emails.magicSession.buttonText"))

View file

@ -11,6 +11,7 @@ use Appwrite\Event\Delete;
use Appwrite\Event\Func; use Appwrite\Event\Func;
use Appwrite\Event\Hamster; use Appwrite\Event\Hamster;
use Appwrite\Event\Mail; use Appwrite\Event\Mail;
use Appwrite\Event\Messaging;
use Appwrite\Event\Migration; use Appwrite\Event\Migration;
use Appwrite\Event\Phone; use Appwrite\Event\Phone;
use Appwrite\Event\Usage; use Appwrite\Event\Usage;

View file

@ -539,13 +539,13 @@ class Builds extends Action
/** Trigger usage queue */ /** Trigger usage queue */
$queueForUsage $queueForUsage
->setProject($project)
->addMetric(METRIC_BUILDS, 1) // per project ->addMetric(METRIC_BUILDS, 1) // per project
->addMetric(METRIC_BUILDS_STORAGE, $build->getAttribute('size', 0)) ->addMetric(METRIC_BUILDS_STORAGE, $build->getAttribute('size', 0))
->addMetric(METRIC_BUILDS_COMPUTE, (int)$build->getAttribute('duration', 0) * 1000) ->addMetric(METRIC_BUILDS_COMPUTE, (int)$build->getAttribute('duration', 0) * 1000)
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS), 1) // per function ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS), 1) // per function
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_STORAGE), $build->getAttribute('size', 0)) ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_STORAGE), $build->getAttribute('size', 0))
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE), (int)$build->getAttribute('duration', 0) * 1000) ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE), (int)$build->getAttribute('duration', 0) * 1000)
->setProject($project)
->trigger(); ->trigger();
} }
} }

View file

@ -22,6 +22,7 @@ use Utopia\Database\Exception\Structure;
use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\ID;
use Utopia\Database\Query; use Utopia\Database\Query;
use Utopia\Domains\Domain; use Utopia\Domains\Domain;
use Utopia\Locale\Locale;
use Utopia\Logger\Log; use Utopia\Logger\Log;
use Utopia\Platform\Action; use Utopia\Platform\Action;
use Utopia\Queue\Message; use Utopia\Queue\Message;
@ -423,6 +424,8 @@ class Certificates extends Action
// Log error into console // Log error into console
Console::warning('Cannot renew domain (' . $domain . ') on attempt no. ' . $attempt . ' certificate: ' . $errorMessage); Console::warning('Cannot renew domain (' . $domain . ') on attempt no. ' . $attempt . ' certificate: ' . $errorMessage);
$locale = new Locale(App::getEnv('_APP_LOCALE', 'en'));
// Send mail to administratore mail // Send mail to administratore mail
$template = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-certificate-failed.tpl'); $template = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-certificate-failed.tpl');
$template->setParam('{{domain}}', $domain); $template->setParam('{{domain}}', $domain);
@ -455,8 +458,9 @@ class Certificates extends Action
$queueForMails $queueForMails
->setSubject($subject) ->setSubject($subject)
->setBody($body->render()) ->setBody($body)
->setName('Appwrite Administrator') ->setName('Appwrite Administrator')
->setVariables($emailVariables)
->setRecipient(App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS')) ->setRecipient(App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS'))
->trigger(); ->trigger();
} }