Crypt::encryptString($command), self::ENCRYPTED_PROPERTY => true, ]; } /** * The plain command, or null when it was already removed. * Activities queued before encryption was added store the command as plain text. */ public static function read(Activity $activity): ?string { $command = $activity->getExtraProperty(self::PROPERTY); if (! is_string($command)) { return null; } return $activity->getExtraProperty(self::ENCRYPTED_PROPERTY) === true ? Crypt::decryptString($command) : $command; } /** * Remove the command after the final attempt of the task. * Reads the stored row first, so a status that Coolify set meanwhile is kept. */ public static function forget(Activity $activity): void { $stored = Activity::query()->whereKey($activity->getKey())->first(); if ($stored === null) { return; } $stored->properties = $stored->properties->except([self::PROPERTY, self::ENCRYPTED_PROPERTY]); $stored->save(); $activity->properties = $stored->properties; } }