1
0
Fork 0
mirror of synced 2024-06-18 18:54:55 +12:00

change function names

This commit is contained in:
fogelito 2022-07-13 17:02:49 +03:00
parent 76b65c5dea
commit 45ac40cc85
19 changed files with 81 additions and 5464 deletions

View file

@ -103,8 +103,8 @@ App::post('/v1/account')
'emailVerification' => false,
'status' => true,
'password' => Auth::passwordHash($password),
'passwordUpdate' => DateTime::getCurrentDateTime(),
'registration' => DateTime::getCurrentDateTime(),
'passwordUpdate' => DateTime::now(),
'registration' => DateTime::now(),
'reset' => false,
'name' => $name,
'prefs' => new \stdClass(),
@ -176,7 +176,7 @@ App::post('/v1/account/sessions/email')
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$secret = Auth::tokenGenerator();
$session = new Document(array_merge(
[
@ -485,7 +485,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
'status' => true, // Email should already be authenticated by OAuth2 provider
'password' => Auth::passwordHash(Auth::passwordGenerator()),
'passwordUpdate' => null,
'registration' => DateTime::getCurrentDateTime(),
'registration' => DateTime::now(),
'reset' => false,
'name' => $name,
'prefs' => new \stdClass(),
@ -508,7 +508,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$secret = Auth::tokenGenerator();
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$session = new Document(array_merge([
'$id' => $dbForProject->getId(),
@ -518,7 +518,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
'providerUid' => $oauth2ID,
'providerAccessToken' => $accessToken,
'providerRefreshToken' => $refreshToken,
'providerAccessTokenExpiry' => DateTime::dateAddSeconds(new \DateTime(), (int)$accessTokenExpiry),
'providerAccessTokenExpiry' => DateTime::addSeconds(new \DateTime(), (int)$accessTokenExpiry),
'secret' => Auth::hash($secret), // One way hash encryption to protect DB leak
'expire' => $expire,
'userAgent' => $request->getUserAgent('UNKNOWN'),
@ -651,7 +651,7 @@ App::post('/v1/account/sessions/magic-url')
'status' => true,
'password' => null,
'passwordUpdate' => null,
'registration' => DateTime::getCurrentDateTime(),
'registration' => DateTime::now(),
'reset' => false,
'prefs' => new \stdClass(),
'sessions' => null,
@ -662,7 +662,7 @@ App::post('/v1/account/sessions/magic-url')
}
$loginSecret = Auth::tokenGenerator();
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
$token = new Document([
'$id' => $dbForProject->getId(),
@ -762,7 +762,7 @@ App::put('/v1/account/sessions/magic-url')
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$secret = Auth::tokenGenerator();
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$session = new Document(array_merge(
[
@ -894,7 +894,7 @@ App::post('/v1/account/sessions/phone')
'status' => true,
'password' => null,
'passwordUpdate' => null,
'registration' => DateTime::getCurrentDateTime(),
'registration' => DateTime::now(),
'reset' => false,
'prefs' => new \stdClass(),
'sessions' => null,
@ -905,7 +905,7 @@ App::post('/v1/account/sessions/phone')
}
$secret = $phone->generateSecretDigits();
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_PHONE);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_PHONE);
$token = new Document([
'$id' => $dbForProject->getId(),
@ -992,7 +992,7 @@ App::put('/v1/account/sessions/phone')
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$secret = Auth::tokenGenerator();
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$session = new Document(array_merge(
[
@ -1120,7 +1120,7 @@ App::post('/v1/account/sessions/anonymous')
'status' => true,
'password' => null,
'passwordUpdate' => null,
'registration' => DateTime::getCurrentDateTime(),
'registration' => DateTime::now(),
'reset' => false,
'name' => null,
'prefs' => new \stdClass(),
@ -1135,7 +1135,7 @@ App::post('/v1/account/sessions/anonymous')
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$secret = Auth::tokenGenerator();
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$session = new Document(array_merge(
[
@ -1490,7 +1490,7 @@ App::patch('/v1/account/password')
$user->getId(),
$user
->setAttribute('password', Auth::passwordHash($password))
->setAttribute('passwordUpdate', DateTime::getCurrentDateTime())
->setAttribute('passwordUpdate', DateTime::now())
);
$audits
@ -1821,7 +1821,7 @@ App::patch('/v1/account/sessions/:sessionId')
$session
->setAttribute('providerAccessToken', $oauth2->getAccessToken(''))
->setAttribute('providerRefreshToken', $oauth2->getRefreshToken(''))
->setAttribute('providerAccessTokenExpiry', DateTime::dateAddSeconds(new \DateTime(), (int)$oauth2->getAccessTokenExpiry('')));
->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$oauth2->getAccessTokenExpiry('')));
$dbForProject->updateDocument('sessions', $sessionId, $session);
@ -1964,7 +1964,7 @@ App::post('/v1/account/recovery')
throw new Exception('Invalid credentials. User is blocked', 401, Exception::USER_BLOCKED);
}
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_RECOVERY);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_RECOVERY);
$secret = Auth::tokenGenerator();
$recovery = new Document([
@ -2065,7 +2065,7 @@ App::put('/v1/account/recovery')
$profile = $dbForProject->updateDocument('users', $profile->getId(), $profile
->setAttribute('password', Auth::passwordHash($password))
->setAttribute('passwordUpdate', DateTime::getCurrentDateTime())
->setAttribute('passwordUpdate', DateTime::now())
->setAttribute('emailVerification', true));
$recoveryDocument = $dbForProject->getDocument('tokens', $recovery);
@ -2124,7 +2124,7 @@ App::post('/v1/account/verification')
$isPrivilegedUser = Auth::isPrivilegedUser($roles);
$isAppUser = Auth::isAppUser($roles);
$verificationSecret = Auth::tokenGenerator();
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
$verification = new Document([
'$id' => $dbForProject->getId(),
@ -2277,7 +2277,7 @@ App::post('/v1/account/verification/phone')
$isAppUser = Auth::isAppUser($roles);
$verificationSecret = Auth::tokenGenerator();
$secret = $phone->generateSecretDigits();
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
$verification = new Document([
'$id' => $dbForProject->getId(),

View file

@ -2530,7 +2530,7 @@ App::get('/v1/databases/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}
@ -2642,7 +2642,7 @@ App::get('/v1/databases/:databaseId/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}
@ -2755,7 +2755,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}

View file

@ -257,7 +257,7 @@ App::get('/v1/functions/:functionId/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}
@ -310,7 +310,7 @@ App::put('/v1/functions/:functionId')
$original = $function->getAttribute('schedule', '');
$cron = (!empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
$next = (!empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::dateFormat($cron->getNextRunDate()) : 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(), [
'execute' => $execute,
@ -381,7 +381,7 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId')
$schedule = $function->getAttribute('schedule', '');
$cron = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
$next = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::dateFormat($cron->getNextRunDate()) : 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(),

View file

@ -315,7 +315,7 @@ App::get('/v1/projects/:projectId/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}
@ -1246,7 +1246,7 @@ App::post('/v1/projects/:projectId/domains')
'$write' => ['role:all'],
'projectInternalId' => $project->getInternalId(),
'projectId' => $project->getId(),
'updated' => DateTime::getCurrentDateTime(),
'updated' => DateTime::now(),
'domain' => $domain->get(),
'tld' => $domain->getSuffix(),
'registerable' => $domain->getRegisterable(),

View file

@ -1548,7 +1548,7 @@ App::get('/v1/storage/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}
@ -1657,7 +1657,7 @@ App::get('/v1/storage/:bucketId/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}

View file

@ -78,8 +78,8 @@ App::post('/v1/teams')
'teamId' => $team->getId(),
'teamInternalId' => $team->getInternalId(),
'roles' => $roles,
'invited' => DateTime::getCurrentDateTime(),
'joined' => DateTime::getCurrentDateTime(),
'invited' => DateTime::now(),
'joined' => DateTime::now(),
'confirm' => true,
'secret' => '',
'search' => implode(' ', [$membershipId, $user->getId()])
@ -341,7 +341,7 @@ App::post('/v1/teams/:teamId/memberships')
* old password
*/
'passwordUpdate' => null,
'registration' => DateTime::getCurrentDateTime(),
'registration' => DateTime::now(),
'reset' => false,
'name' => $name,
'prefs' => new \stdClass(),
@ -373,8 +373,8 @@ App::post('/v1/teams/:teamId/memberships')
'teamId' => $team->getId(),
'teamInternalId' => $team->getInternalId(),
'roles' => $roles,
'invited' => DateTime::getCurrentDateTime(),
'joined' => ($isPrivilegedUser || $isAppUser) ? DateTime::getCurrentDateTime() : null,
'invited' => DateTime::now(),
'joined' => ($isPrivilegedUser || $isAppUser) ? DateTime::now() : null,
'confirm' => ($isPrivilegedUser || $isAppUser),
'secret' => Auth::hash($secret),
'search' => implode(' ', [$membershipId, $invitee->getId()])
@ -687,7 +687,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
}
$membership // Attach user to team
->setAttribute('joined', DateTime::getCurrentDateTime())
->setAttribute('joined', DateTime::now())
->setAttribute('confirm', true)
;
@ -701,7 +701,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
$detector = new Detector($request->getUserAgent('UNKNOWN'));
$record = $geodb->get($request->getIP());
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
$secret = Auth::tokenGenerator();
$session = new Document(array_merge([
'$id' => $dbForProject->getId(),

View file

@ -64,8 +64,8 @@ App::post('/v1/users')
'emailVerification' => false,
'status' => true,
'password' => Auth::passwordHash($password),
'passwordUpdate' => DateTime::getCurrentDateTime(),
'registration' => DateTime::getCurrentDateTime(),
'passwordUpdate' => DateTime::now(),
'registration' => DateTime::now(),
'reset' => false,
'name' => $name,
'prefs' => new \stdClass(),
@ -551,7 +551,7 @@ App::patch('/v1/users/:userId/password')
$user
->setAttribute('password', Auth::passwordHash($password))
->setAttribute('passwordUpdate', DateTime::getCurrentDateTime());
->setAttribute('passwordUpdate', DateTime::now());
$user = $dbForProject->updateDocument('users', $user->getId(), $user);
@ -926,7 +926,7 @@ App::get('/v1/users/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}

View file

@ -286,7 +286,7 @@ App::init(function (App $utopia, Request $request, Response $response, Document
$expire = $key->getAttribute('expire');
if (!empty($expire) && $expire < DateTime::getCurrentDateTime()) {
if (!empty($expire) && $expire < DateTime::now()) {
throw new AppwriteException('Project key expired', 401, AppwriteException:: PROJECT_KEY_EXPIRED);
}

View file

@ -189,7 +189,7 @@ App::post('/v1/runtimes')
$containerId = '';
$stdout = '';
$stderr = '';
$startTime = DateTime::getCurrentDateTime();
$startTime = DateTime::now();
$startTimeUnix = (new \DateTime($startTime))->getTimestamp();
$endTimeUnix = 0;
$orchestration = $orchestrationPool->get();
@ -321,7 +321,7 @@ App::post('/v1/runtimes')
$stdout = 'Build Successful!';
}
$endTime = DateTime::getCurrentDateTime();
$endTime = DateTime::now();
$endTimeUnix = (new \DateTime($endTime))->getTimestamp();
$duration = $endTimeUnix - $startTimeUnix;

View file

@ -58,7 +58,7 @@ $cli
{
(new Delete())
->setType(DELETE_TYPE_EXECUTIONS)
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval))
->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * $interval))
->trigger();
}
@ -66,7 +66,7 @@ $cli
{
(new Delete())
->setType(DELETE_TYPE_ABUSE)
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval))
->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * $interval))
->trigger();
}
@ -74,7 +74,7 @@ $cli
{
(new Delete())
->setType(DELETE_TYPE_AUDIT)
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval))
->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * $interval))
->trigger();
}
@ -82,8 +82,8 @@ $cli
{
(new Delete())
->setType(DELETE_TYPE_USAGE)
->setDateTime1d(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval1d))
->setDateTime30m(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval30m))
->setDateTime1d(DateTime::addSeconds(new \DateTime(), -1 * $interval1d))
->setDateTime30m(DateTime::addSeconds(new \DateTime(), -1 * $interval30m))
->trigger();
}
@ -91,7 +91,7 @@ $cli
{
(new Delete())
->setType(DELETE_TYPE_REALTIME)
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -60))
->setDatetime(DateTime::addSeconds(new \DateTime(), -60))
->trigger();
}
@ -99,13 +99,13 @@ $cli
{
(new Delete())
->setType(DELETE_TYPE_SESSIONS)
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -1 * Auth::TOKEN_EXPIRATION_LOGIN_LONG))
->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * Auth::TOKEN_EXPIRATION_LOGIN_LONG))
->trigger();
}
function renewCertificates($dbForConsole)
{
$time = DateTime::getCurrentDateTime();
$time = DateTime::now();
$certificates = $dbForConsole->find('certificates', [
new Query('attempts', Query::TYPE_LESSEREQUAL, [5]), // Maximum 5 attempts
@ -140,7 +140,7 @@ $cli
Console::loop(function () use ($interval, $executionLogsRetention, $abuseLogsRetention, $auditLogRetention, $usageStatsRetention30m, $usageStatsRetention1d) {
$database = getConsoleDB();
$time = DateTime::getCurrentDateTime();
$time = DateTime::now();
Console::info("[{$time}] Notifying workers with maintenance tasks every {$interval} seconds");
notifyDeleteExecutionLogs($executionLogsRetention);

View file

@ -76,7 +76,7 @@ class BuildsV1 extends Worker
}
$buildId = $deployment->getAttribute('buildId', '');
$startTime = DateTime::getCurrentDateTime();
$startTime = DateTime::now();
if (empty($buildId)) {
$buildId = $dbForProject->getId();
$build = $dbForProject->createDocument('builds', new Document([
@ -167,7 +167,7 @@ class BuildsV1 extends Worker
/** Update the build document */
//$response['endTime'] = DateTime::dateFormat((new \DateTime())->setTimestamp($response['endTime'])); //todo: fix to datetime
//$response['endTime'] = DateTime::format((new \DateTime())->setTimestamp($response['endTime'])); //todo: fix to datetime
$build->setAttribute('endTime', $response['endTime']);
$build->setAttribute('duration', $response['duration']);
@ -187,11 +187,11 @@ class BuildsV1 extends Worker
/** Update function schedule */
$schedule = $function->getAttribute('schedule', '');
$cron = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
$next = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::dateFormat($cron->getNextRunDate()) : null;
$next = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::format($cron->getNextRunDate()) : null;
$function->setAttribute('scheduleNext', $next);
$function = $dbForProject->updateDocument('functions', $function->getId(), $function);
} catch (\Throwable $th) {
$endtime = DateTime::getCurrentDateTime();
$endtime = DateTime::now();
$interval = (new \DateTime($endtime))->diff(new \DateTime($startTime));
$build->setAttribute('endTime', $endtime);
$build->setAttribute('duration', $interval->format('%s'));

View file

@ -116,7 +116,7 @@ class CertificatesV1 extends Worker
// Update certificate info stored in database
$certificate->setAttribute('renewDate', $this->getRenewDate($domain->get()));
$certificate->setAttribute('attempts', 0);
$certificate->setAttribute('issueDate', DateTime::getCurrentDateTime());
$certificate->setAttribute('issueDate', DateTime::now());
} catch (Throwable $e) {
// Set exception as log in certificate document
$certificate->setAttribute('log', $e->getMessage());
@ -129,7 +129,7 @@ class CertificatesV1 extends Worker
$this->notifyError($domain->get(), $e->getMessage(), $attempts);
} finally {
// All actions result in new updatedAt date
$certificate->setAttribute('updated', DateTime::getCurrentDateTime());
$certificate->setAttribute('updated', DateTime::now());
// Save all changes we made to certificate document into database
$this->saveCertificateDocument($domain->get(), $certificate);
@ -298,7 +298,7 @@ class CertificatesV1 extends Worker
$certData = openssl_x509_parse(file_get_contents($certPath));
$validTo = $certData['validTo_time_t'] ?? null;
$dt = (new \DateTime())->setTimestamp($validTo);
return DateTime::dateAddSeconds($dt, -60 * 60 * 24 * 30); // -30 days
return DateTime::addSeconds($dt, -60 * 60 * 24 * 30); // -30 days
}
/**
@ -398,7 +398,7 @@ class CertificatesV1 extends Worker
], 1000);
foreach ($domains as $domainDocument) {
$domainDocument->setAttribute('updated', DateTime::getCurrentDateTime());
$domainDocument->setAttribute('updated', DateTime::now());
$domainDocument->setAttribute('certificateId', $certificateId);
$this->dbForConsole->updateDocument('domains', $domainDocument->getId(), $domainDocument);

View file

@ -147,11 +147,11 @@ class FunctionsV1 extends Worker
}
$cron = new CronExpression($function->getAttribute('schedule'));
$next = DateTime::dateFormat($cron->getNextRunDate());
$next = DateTime::format($cron->getNextRunDate());
$function
->setAttribute('scheduleNext', $next)
->setAttribute('schedulePrevious', DateTime::getCurrentDateTime());
->setAttribute('schedulePrevious', DateTime::now());
$function = $database->updateDocument(
'functions',

5383
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -207,7 +207,7 @@ class Auth
$token->isSet('expire') &&
$token->getAttribute('type') == $type &&
$token->getAttribute('secret') === self::hash($secret) &&
$token->getAttribute('expire') >= DateTime::getCurrentDateTime()
$token->getAttribute('expire') >= DateTime::now()
) {
return (string)$token->getId();
}
@ -226,7 +226,7 @@ class Auth
$token->isSet('expire') &&
$token->getAttribute('type') == Auth::TOKEN_TYPE_PHONE &&
$token->getAttribute('secret') === $secret &&
$token->getAttribute('expire') >= DateTime::getCurrentDateTime()
$token->getAttribute('expire') >= DateTime::now()
) {
return (string) $token->getId();
}
@ -252,7 +252,7 @@ class Auth
$session->isSet('expire') &&
$session->isSet('provider') &&
$session->getAttribute('secret') === self::hash($secret) &&
$session->getAttribute('expire') >= DateTime::getCurrentDateTime()
$session->getAttribute('expire') >= DateTime::now()
) {
return $session->getId();
}

View file

@ -539,7 +539,7 @@ class AccountCustomClientTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('123456', $response['body']['providerAccessToken']);
$this->assertEquals('tuvwxyz', $response['body']['providerRefreshToken']);
$this->assertGreaterThan(DateTime::dateAddSeconds(new \DateTime(), 14400 - 5), $response['body']['providerAccessTokenExpiry']); // 5 seconds allowed networking delay
$this->assertGreaterThan(DateTime::addSeconds(new \DateTime(), 14400 - 5), $response['body']['providerAccessTokenExpiry']); // 5 seconds allowed networking delay
$initialExpiry = $response['body']['providerAccessTokenExpiry'];

View file

@ -1281,7 +1281,7 @@ class ProjectsConsoleClientTest extends Scope
], $this->getHeaders()), [
'name' => 'Key Test',
'scopes' => ['health.read'],
'expire' => DateTime::dateAddSeconds(new \DateTime(), 3600),
'expire' => DateTime::addSeconds(new \DateTime(), 3600),
]);
$response = $this->client->call(Client::METHOD_GET, '/health', [
@ -1321,7 +1321,7 @@ class ProjectsConsoleClientTest extends Scope
], $this->getHeaders()), [
'name' => 'Key Test',
'scopes' => ['health.read'],
'expire' => DateTime::dateAddSeconds(new \DateTime(), -3600),
'expire' => DateTime::addSeconds(new \DateTime(), -3600),
]);
$response = $this->client->call(Client::METHOD_GET, '/health', [
@ -1348,7 +1348,7 @@ class ProjectsConsoleClientTest extends Scope
], $this->getHeaders()), [
'name' => 'Key Test Update',
'scopes' => ['users.read', 'users.write', 'collections.read'],
'expire' => DateTime::dateAddSeconds(new \DateTime(), 360),
'expire' => DateTime::addSeconds(new \DateTime(), 360),
]);
$this->assertEquals(200, $response['headers']['status-code']);

View file

@ -62,7 +62,7 @@ trait TeamsBaseServer
$this->assertNotEmpty($response['body']['teamId']);
$this->assertCount(2, $response['body']['roles']);
$this->assertEquals(true, DateTime::isValid($response['body']['joined']));
$this->assertGreaterThan('2020-07-07 07:58:44', DateTime::getCurrentDateTime());
$this->assertGreaterThan('2020-07-07 07:58:44', DateTime::now());
$this->assertEquals(true, $response['body']['confirm']);
$userUid = $response['body']['userId'];

View file

@ -77,14 +77,14 @@ class AuthTest extends TestCase
$tokens1 = [
new Document([
'$id' => 'token1',
'expire' => DateTime::dateAddSeconds(new \DateTime(), 60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), 60 * 60 * 24),
'secret' => $hash,
'provider' => Auth::SESSION_PROVIDER_EMAIL,
'providerUid' => 'test@example.com',
]),
new Document([
'$id' => 'token2',
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
'secret' => 'secret2',
'provider' => Auth::SESSION_PROVIDER_EMAIL,
'providerUid' => 'test@example.com',
@ -94,14 +94,14 @@ class AuthTest extends TestCase
$tokens2 = [
new Document([ // Correct secret and type time, wrong expire time
'$id' => 'token1',
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
'secret' => $hash,
'provider' => Auth::SESSION_PROVIDER_EMAIL,
'providerUid' => 'test@example.com',
]),
new Document([
'$id' => 'token2',
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
'secret' => 'secret2',
'provider' => Auth::SESSION_PROVIDER_EMAIL,
'providerUid' => 'test@example.com',
@ -122,13 +122,13 @@ class AuthTest extends TestCase
new Document([
'$id' => 'token1',
'type' => Auth::TOKEN_TYPE_RECOVERY,
'expire' => DateTime::dateAddSeconds(new \DateTime(), 60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), 60 * 60 * 24),
'secret' => $hash,
]),
new Document([
'$id' => 'token2',
'type' => Auth::TOKEN_TYPE_RECOVERY,
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
'secret' => 'secret2',
]),
];
@ -137,13 +137,13 @@ class AuthTest extends TestCase
new Document([ // Correct secret and type time, wrong expire time
'$id' => 'token1',
'type' => Auth::TOKEN_TYPE_RECOVERY,
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
'secret' => $hash,
]),
new Document([
'$id' => 'token2',
'type' => Auth::TOKEN_TYPE_RECOVERY,
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
'secret' => 'secret2',
]),
];
@ -152,13 +152,13 @@ class AuthTest extends TestCase
new Document([
'$id' => 'token1',
'type' => Auth::TOKEN_TYPE_INVITE,
'expire' => DateTime::dateAddSeconds(new \DateTime(), 60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), 60 * 60 * 24),
'secret' => $hash,
]),
new Document([
'$id' => 'token2',
'type' => Auth::TOKEN_TYPE_RECOVERY,
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
'secret' => 'secret2',
]),
];