Merge branch '1.0.x' into fix-boolean-attribute-default-value
This commit is contained in:
commit
6c1e2ae537
|
@ -1,6 +1,7 @@
|
|||
# Version 1.0.2
|
||||
## Bugs
|
||||
- Fixed default value for creating Boolean Attribute [#4040](https://github.com/appwrite/appwrite/pull/404)
|
||||
- Fixed migration for audit by migrating the `time` attribute [4038](https://github.com/appwrite/appwrite/pull/4038)
|
||||
|
||||
# Version 1.0.1
|
||||
## Bugs
|
||||
|
|
|
@ -71,8 +71,13 @@ App::post('/v1/functions')
|
|||
->param('enabled', true, new Boolean(), 'Is function enabled?', true)
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->inject('project')
|
||||
->inject('user')
|
||||
->inject('events')
|
||||
->action(function (string $functionId, string $name, array $execute, string $runtime, array $events, string $schedule, int $timeout, bool $enabled, Response $response, Database $dbForProject, Event $eventsInstance) {
|
||||
->action(function (string $functionId, string $name, array $execute, string $runtime, array $events, string $schedule, int $timeout, bool $enabled, Response $response, Database $dbForProject, Document $project, Document $user, Event $eventsInstance) {
|
||||
|
||||
$cron = !empty($schedule) ? new CronExpression($schedule) : null;
|
||||
$next = !empty($schedule) ? DateTime::format($cron->getNextRunDate()) : null;
|
||||
|
||||
$functionId = ($functionId == 'unique()') ? ID::unique() : $functionId;
|
||||
$function = $dbForProject->createDocument('functions', new Document([
|
||||
|
@ -86,11 +91,22 @@ App::post('/v1/functions')
|
|||
'schedule' => $schedule,
|
||||
'scheduleUpdatedAt' => DateTime::now(),
|
||||
'schedulePrevious' => null,
|
||||
'scheduleNext' => null,
|
||||
'scheduleNext' => $next,
|
||||
'timeout' => $timeout,
|
||||
'search' => implode(' ', [$functionId, $name, $runtime])
|
||||
]));
|
||||
|
||||
if ($next) {
|
||||
// Async task reschedule
|
||||
$functionEvent = new Func();
|
||||
$functionEvent
|
||||
->setFunction($function)
|
||||
->setType('schedule')
|
||||
->setUser($user)
|
||||
->setProject($project)
|
||||
->schedule(new \DateTime($next));
|
||||
}
|
||||
|
||||
$eventsInstance->setParam('functionId', $function->getId());
|
||||
|
||||
$response
|
||||
|
@ -442,11 +458,9 @@ App::put('/v1/functions/:functionId')
|
|||
throw new Exception(Exception::FUNCTION_NOT_FOUND);
|
||||
}
|
||||
|
||||
$original = $function->getAttribute('schedule', '');
|
||||
$cron = (!empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
|
||||
$next = (!empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::format($cron->getNextRunDate()) : null;
|
||||
$cron = !empty($schedule) ? new CronExpression($schedule) : null;
|
||||
$next = !empty($schedule) ? DateTime::format($cron->getNextRunDate()) : null;
|
||||
|
||||
$scheduleUpdatedAt = $schedule !== $original ? DateTime::now() : $function->getAttribute('scheduleUpdatedAt');
|
||||
$enabled ??= $function->getAttribute('enabled', true);
|
||||
|
||||
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
||||
|
@ -454,14 +468,14 @@ App::put('/v1/functions/:functionId')
|
|||
'name' => $name,
|
||||
'events' => $events,
|
||||
'schedule' => $schedule,
|
||||
'scheduleUpdatedAt' => $scheduleUpdatedAt,
|
||||
'scheduleUpdatedAt' => DateTime::now(),
|
||||
'scheduleNext' => $next,
|
||||
'timeout' => $timeout,
|
||||
'enabled' => $enabled,
|
||||
'search' => implode(' ', [$functionId, $name, $function->getAttribute('runtime')]),
|
||||
])));
|
||||
|
||||
if ($next && $schedule !== $original) {
|
||||
if ($next) {
|
||||
// Async task reschedule
|
||||
$functionEvent = new Func();
|
||||
$functionEvent
|
||||
|
@ -519,24 +533,10 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId')
|
|||
throw new Exception(Exception::BUILD_NOT_READY);
|
||||
}
|
||||
|
||||
$schedule = $function->getAttribute('schedule', '');
|
||||
$cron = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
|
||||
$next = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::format($cron->getNextRunDate()) : null;
|
||||
|
||||
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
||||
'deployment' => $deployment->getId(),
|
||||
'scheduleNext' => $next,
|
||||
'deployment' => $deployment->getId()
|
||||
])));
|
||||
|
||||
if ($next) { // Init first schedule
|
||||
$functionEvent = new Func();
|
||||
$functionEvent
|
||||
->setType('schedule')
|
||||
->setFunction($function)
|
||||
->setProject($project)
|
||||
->schedule(new \DateTime($next));
|
||||
}
|
||||
|
||||
$events
|
||||
->setParam('functionId', $function->getId())
|
||||
->setParam('deploymentId', $deployment->getId());
|
||||
|
|
|
@ -109,6 +109,7 @@ class BuildsV1 extends Worker
|
|||
|
||||
/** Trigger Webhook */
|
||||
$deploymentModel = new Deployment();
|
||||
|
||||
$deploymentUpdate = new Event(Event::WEBHOOK_QUEUE_NAME, Event::WEBHOOK_CLASS_NAME);
|
||||
$deploymentUpdate
|
||||
->setProject($project)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Appwrite\Event\Event;
|
||||
use Appwrite\Event\Mail;
|
||||
use Appwrite\Network\Validator\CNAME;
|
||||
use Appwrite\Resque\Worker;
|
||||
use Utopia\App;
|
||||
|
@ -374,19 +375,19 @@ class CertificatesV1 extends Worker
|
|||
Console::warning('Cannot renew domain (' . $domain . ') on attempt no. ' . $attempt . ' certificate: ' . $errorMessage);
|
||||
|
||||
// Send mail to administratore mail
|
||||
Resque::enqueue(Event::MAILS_QUEUE_NAME, Event::MAILS_CLASS_NAME, [
|
||||
'from' => 'console',
|
||||
'project' => 'console',
|
||||
'name' => 'Appwrite Administrator',
|
||||
'recipient' => App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS'),
|
||||
'url' => 'https://' . $domain,
|
||||
'locale' => App::getEnv('_APP_LOCALE', 'en'),
|
||||
'type' => MAIL_TYPE_CERTIFICATE,
|
||||
|
||||
'domain' => $domain,
|
||||
'error' => $errorMessage,
|
||||
'attempt' => $attempt
|
||||
]);
|
||||
$mail = new Mail();
|
||||
$mail
|
||||
->setType(MAIL_TYPE_CERTIFICATE)
|
||||
->setRecipient(App::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS'))
|
||||
->setUrl('https://' . $domain)
|
||||
->setLocale(App::getEnv('_APP_LOCALE', 'en'))
|
||||
->setName('Appwrite Administrator')
|
||||
->setPayload([
|
||||
'domain' => $domain,
|
||||
'error' => $errorMessage,
|
||||
'attempt' => $attempt
|
||||
])
|
||||
->trigger();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,9 +32,10 @@ class MailsV1 extends Worker
|
|||
return;
|
||||
}
|
||||
|
||||
$project = new Document($this->args['project']);
|
||||
$project = new Document($this->args['project'] ?? []);
|
||||
$user = new Document($this->args['user'] ?? []);
|
||||
$team = new Document($this->args['team'] ?? []);
|
||||
$payload = $this->args['payload'] ?? [];
|
||||
|
||||
$recipient = $this->args['recipient'];
|
||||
$url = $this->args['url'];
|
||||
|
@ -42,20 +43,20 @@ class MailsV1 extends Worker
|
|||
$type = $this->args['type'];
|
||||
$prefix = $this->getPrefix($type);
|
||||
$locale = new Locale($this->args['locale']);
|
||||
$projectName = $project->getAttribute('name', '[APP-NAME]');
|
||||
$projectName = $project->isEmpty() ? 'Console' : $project->getAttribute('name', '[APP-NAME]');
|
||||
|
||||
if (!$this->doesLocaleExist($locale, $prefix)) {
|
||||
$locale->setDefault('en');
|
||||
}
|
||||
|
||||
$from = $project->getId() === 'console' ? '' : \sprintf($locale->getText('emails.sender'), $projectName);
|
||||
$from = $project->isEmpty() || $project->getId() === 'console' ? '' : \sprintf($locale->getText('emails.sender'), $projectName);
|
||||
$body = Template::fromFile(__DIR__ . '/../config/locale/templates/email-base.tpl');
|
||||
$subject = '';
|
||||
switch ($type) {
|
||||
case MAIL_TYPE_CERTIFICATE:
|
||||
$domain = $this->args['domain'];
|
||||
$error = $this->args['error'];
|
||||
$attempt = $this->args['attempt'];
|
||||
$domain = $payload['domain'];
|
||||
$error = $payload['error'];
|
||||
$attempt = $payload['attempt'];
|
||||
|
||||
$subject = \sprintf($locale->getText("$prefix.subject"), $domain);
|
||||
$body->setParam('{{domain}}', $domain);
|
||||
|
|
|
@ -504,6 +504,7 @@ class V15 extends Migration
|
|||
$this->createPermissionsColumn($id);
|
||||
$this->migrateDateTimeAttribute($id, '_createdAt');
|
||||
$this->migrateDateTimeAttribute($id, '_updatedAt');
|
||||
$this->migrateDateTimeAttribute($id, 'time');
|
||||
break;
|
||||
|
||||
case 'buckets':
|
||||
|
|
Loading…
Reference in a new issue