2023-04-17 07:15:47 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Services\Helpers;
|
|
|
|
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
|
|
|
|
use Pterodactyl\Services\Helpers\BlueprintPlaceholderService;
|
|
|
|
|
|
|
|
class BlueprintVariableService
|
|
|
|
{
|
|
|
|
// Construct BlueprintVariableService
|
|
|
|
public function __construct(
|
|
|
|
private SettingsRepositoryInterface $settings,
|
|
|
|
private BlueprintPlaceholderService $blueprintplaceholderservice,
|
|
|
|
) {
|
2023-04-17 08:30:29 -04:00
|
|
|
}
|
2023-04-17 07:15:47 -04:00
|
|
|
|
|
|
|
|
2023-05-31 04:40:03 -04:00
|
|
|
// $bp->serve()
|
2023-04-17 07:48:45 -04:00
|
|
|
// $bp->version()
|
2023-04-23 14:21:09 -04:00
|
|
|
// $bp->dbGet('db::record')
|
|
|
|
// $bp->dbSet('db::record', 'value')
|
2023-04-17 07:48:45 -04:00
|
|
|
// $bp->exec('arguments')
|
2023-04-17 07:15:47 -04:00
|
|
|
public function serve(): void {
|
|
|
|
return;
|
2023-04-17 08:30:29 -04:00
|
|
|
}
|
2023-04-17 07:15:47 -04:00
|
|
|
|
|
|
|
public function version(): string {
|
|
|
|
return $this->blueprintplaceholderservice->version();
|
2023-04-17 08:30:29 -04:00
|
|
|
}
|
2023-04-17 07:15:47 -04:00
|
|
|
|
2023-04-17 07:48:45 -04:00
|
|
|
public function dbGet($key): string {
|
|
|
|
$a = $this->settings->get("blueprint::".$key);
|
|
|
|
if (!$a) {
|
|
|
|
return "";
|
|
|
|
} else {
|
|
|
|
return $a;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dbSet($key, $value): void
|
|
|
|
{
|
|
|
|
$this->settings->set('blueprint::' . $key, $value);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function exec($arg): string|null
|
|
|
|
{
|
2023-06-18 10:37:46 -04:00
|
|
|
return shell_exec("blueprint -exec ".$arg);
|
2023-04-17 07:48:45 -04:00
|
|
|
}
|
2023-06-18 10:37:46 -04:00
|
|
|
}
|