AdminDatabase
extends Singleton
in package
Class for installing Magrathea's Admin
Table of Contents
Properties
- $instance : array<string|int, mixed>|null
- $backupPath : mixed
Methods
- __wakeup() : mixed
- DoBackup() : mixed
- Backup database
- GetBackupFolder() : string
- Gets the backup path
- GetCommand() : string
- Gets mysqldump command
- GetDefaultFileName() : string
- Gets the default file name ("backup_[date].sql")
- GetSQLFile() : string
- Get sql file location
- GetSQLFileContents() : string
- Get sql file content
- GetTableColumns() : array<string|int, mixed>
- Get Table Columns for object
- GetTables() : array<string|int, mixed>
- Gets tables from Database
- Initialize() : mixed
- Instance() : static|Singleton
- LoadBackupFolder() : mixed
- Loads the backup folder
- MockClass() : static|Singleton
- SetInstance() : mixed
- __clone() : mixed
- __construct() : mixed
- NormalizeFilename() : string
- Normalize file's name (for ending with .sql)
Properties
$instance
protected
static array<string|int, mixed>|null
$instance
= []
$backupPath
private
mixed
$backupPath
Methods
__wakeup()
public
final __wakeup() : mixed
DoBackup()
Backup database
public
DoBackup(string $fileName) : mixed
Parameters
- $fileName : string
GetBackupFolder()
Gets the backup path
public
GetBackupFolder() : string
Return values
string —path
GetCommand()
Gets mysqldump command
public
GetCommand(string $fileName) : string
Parameters
- $fileName : string
Return values
string —command
GetDefaultFileName()
Gets the default file name ("backup_[date].sql")
public
GetDefaultFileName() : string
Return values
stringGetSQLFile()
Get sql file location
public
GetSQLFile() : string
Return values
string —String with full path for admin's sql file
GetSQLFileContents()
Get sql file content
public
GetSQLFileContents() : string
Return values
string —SQL for create admin's database
GetTableColumns()
Get Table Columns for object
public
GetTableColumns(string $table) : array<string|int, mixed>
Parameters
- $table : string
-
table name
Return values
array<string|int, mixed> —return with ["name", "type", "null", "default" "pk"]
GetTables()
Gets tables from Database
public
GetTables([bool $allTables = true ][, string $db = null ]) : array<string|int, mixed>
Parameters
- $allTables : bool = true
-
if true, gets all tables, if false, gets only tables that does not belongs to magrathea db system
- $db : string = null
-
db name. If none sent, will use default from config file
Return values
array<string|int, mixed> —array with data from tables
Initialize()
public
Initialize() : mixed
Instance()
public
static Instance() : static|Singleton
Return values
static|SingletonLoadBackupFolder()
Loads the backup folder
public
LoadBackupFolder() : mixed
MockClass()
public
static MockClass(mixed $mocker) : static|Singleton
Parameters
- $mocker : mixed
Return values
static|SingletonSetInstance()
public
SetInstance(mixed $inst) : mixed
Parameters
- $inst : mixed
__clone()
protected
final __clone() : mixed
__construct()
private
final __construct() : mixed
NormalizeFilename()
Normalize file's name (for ending with .sql)
private
NormalizeFilename(string $filename) : string
Parameters
- $filename : string
-
filename
Return values
string —filename fixed