refactoring (#116)

- refactoring architecture
- fix incomplete ssh logs
- code editor for scripts in the app
- remove Jobs and SSHCommands
This commit is contained in:
Saeed Vaziry
2024-03-14 20:03:43 +01:00
committed by GitHub
parent cee4a70c3c
commit 428140b931
472 changed files with 24110 additions and 8159 deletions

View File

@ -15,7 +15,6 @@
* @property string $disk
* @property Server $server
* @property ?Site $site
* @property string $content
*/
class ServerLog extends AbstractModel
{
@ -72,7 +71,7 @@ public function write($buf): void
}
}
public function getContentAttribute(): ?string
public function getContent(): ?string
{
if (Storage::disk($this->disk)->exists($this->name)) {
return Storage::disk($this->disk)->get($this->name);
@ -80,4 +79,17 @@ public function getContentAttribute(): ?string
return '';
}
public static function log(Server $server, string $type, string $content, ?Site $site = null): void
{
$log = new static([
'server_id' => $server->id,
'site_id' => $site?->id,
'name' => $server->id.'-'.strtotime('now').'-'.$type.'.log',
'type' => $type,
'disk' => config('core.logs_disk'),
]);
$log->save();
$log->write($content);
}
}