peliprint/app/Services/Helpers/BlueprintExtensionLibrary.php

46 lines
1.1 KiB
PHP
Raw Normal View History

<?php
/*
| Welcome to the Blueprint Extension Library.
|
| This allows developers to interact with
| Pterodactyl easely and without hassle.
*/
namespace Pterodactyl\Services\Helpers;
2023-04-14 11:18:24 -04:00
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
class BlueprintExtensionLibrary
{
// Construct BlueprintExtensionLibrary
public function __construct(
private SettingsRepositoryInterface $settings,
) {
}
/*
| Databasing
|
| dbGet("table", "record");
| dbSet("table", "record", "value");
*/
public function dbGet($table, $record) {
return $this->settings->get($table."::".$record);
}
public function dbSet($table, $record, $value) {
return $this->settings->set($table."::".$record, $value);
}
/*
| Notifications
|
| notify("text");
*/
public function notify($text) {
$this->dbSet("blueprint", "notification:text", $text);
shell_exec("cd /var/www/pterodactyl;echo \"$text\" > .blueprint/.storage/notification;");
return;
}
2023-03-26 12:18:54 -04:00
}