mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
update
This commit is contained in:
parent
8112c05326
commit
1678fa0a49
4 changed files with 17 additions and 13 deletions
|
@ -5,6 +5,7 @@ namespace App\Models;
|
|||
use App\BackupStorage;
|
||||
use App\Filament\Enums\BackupStatus;
|
||||
use App\Helpers;
|
||||
use App\PhyreConfig;
|
||||
use App\ShellApi;
|
||||
use Dotenv\Dotenv;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
@ -213,11 +214,11 @@ class Backup extends Model
|
|||
// Export Phyre Panel database
|
||||
$mysqlAuthConf = '/root/.phyre-mysql.cnf';
|
||||
$mysqlAuthContent = '[client]' . PHP_EOL;
|
||||
$mysqlAuthContent .= 'user="' . env('MYSQL_ROOT_USERNAME') .'"'. PHP_EOL;
|
||||
$mysqlAuthContent .= 'password="' . env('MYSQL_ROOT_PASSWORD') . '"' . PHP_EOL;
|
||||
$mysqlAuthContent .= 'user="' . PhyreConfig::get('MYSQL_ROOT_USERNAME') .'"'. PHP_EOL;
|
||||
$mysqlAuthContent .= 'password="' . PhyreConfig::get('MYSQL_ROOT_PASSWORD') . '"' . PHP_EOL;
|
||||
file_put_contents($mysqlAuthConf, $mysqlAuthContent);
|
||||
|
||||
$shellFileContent .= 'mysqldump --defaults-extra-file='.$mysqlAuthConf.' "'.env('DB_DATABASE').'" > '.$databaseBackupPath . PHP_EOL;
|
||||
$shellFileContent .= 'mysqldump --defaults-extra-file='.$mysqlAuthConf.' "'.PhyreConfig::get('DB_DATABASE').'" > '.$databaseBackupPath . PHP_EOL;
|
||||
|
||||
// Export Phyre Panel Database
|
||||
$database = [];
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\PhyreConfig;
|
||||
use App\Services\RemoteDatabaseService;
|
||||
use App\UniversalDatabaseExecutor;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
@ -60,10 +61,10 @@ class Database extends Model
|
|||
|
||||
} else {
|
||||
$universalDatabaseExecutor = new UniversalDatabaseExecutor(
|
||||
env('MYSQL_HOST'),
|
||||
env('MYSQL_PORT'),
|
||||
env('MYSQL_ROOT_USERNAME'),
|
||||
env('MYSQL_ROOT_PASSWORD'),
|
||||
PhyreConfig::get('MYSQL_HOST'),
|
||||
PhyreConfig::get('MYSQL_PORT'),
|
||||
PhyreConfig::get('MYSQL_ROOT_USERNAME'),
|
||||
PhyreConfig::get('MYSQL_ROOT_PASSWORD'),
|
||||
);
|
||||
$createDatabase = $universalDatabaseExecutor->createDatabase($databaseName);
|
||||
if (isset($createDatabase['error'])) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\PhyreConfig;
|
||||
use App\UniversalDatabaseExecutor;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
@ -56,10 +57,10 @@ class DatabaseUser extends Model
|
|||
}
|
||||
} else {
|
||||
$universalDatabaseExecutor = new UniversalDatabaseExecutor(
|
||||
env('MYSQL_HOST'),
|
||||
env('MYSQL_PORT'),
|
||||
env('MYSQL_ROOT_USERNAME'),
|
||||
env('MYSQL_ROOT_PASSWORD'),
|
||||
PhyreConfig::get('MYSQL_HOST'),
|
||||
PhyreConfig::get('MYSQL_PORT'),
|
||||
PhyreConfig::get('MYSQL_ROOT_USERNAME'),
|
||||
PhyreConfig::get('MYSQL_ROOT_PASSWORD'),
|
||||
$findDatabase->database_name_prefix . $findDatabase->database_name
|
||||
);
|
||||
$createDatabase = $universalDatabaseExecutor->createUser($databaseUsername, $model->password);
|
||||
|
|
|
@ -6,6 +6,7 @@ use App\BackupStorage;
|
|||
use App\Filament\Enums\BackupStatus;
|
||||
use App\Helpers;
|
||||
use App\Jobs\ProcessHostingSubscriptionBackup;
|
||||
use App\PhyreConfig;
|
||||
use App\ShellApi;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
@ -202,8 +203,8 @@ class HostingSubscriptionBackup extends Model
|
|||
// Export Phyre Panel database
|
||||
$mysqlAuthConf = '/root/.phyre-mysql.cnf';
|
||||
$mysqlAuthContent = '[client]' . PHP_EOL;
|
||||
$mysqlAuthContent .= 'user="' . env('MYSQL_ROOT_USERNAME') .'"'. PHP_EOL;
|
||||
$mysqlAuthContent .= 'password="' . env('MYSQL_ROOT_PASSWORD') . '"' . PHP_EOL;
|
||||
$mysqlAuthContent .= 'user="' . PhyreConfig::get('MYSQL_ROOT_USERNAME') .'"'. PHP_EOL;
|
||||
$mysqlAuthContent .= 'password="' . PhyreConfig::get('MYSQL_ROOT_PASSWORD') . '"' . PHP_EOL;
|
||||
file_put_contents($mysqlAuthConf, $mysqlAuthContent);
|
||||
|
||||
$getDatabases = Database::where('hosting_subscription_id', $findHostingSubscription->id)
|
||||
|
|
Loading…
Reference in a new issue