MySqlBackupRepository
in package
implements
BackupRepositoryInterface
MySQL repository for backup operations.
Provides database access for backup/restore functionality.
Tags
Table of Contents
Interfaces
- BackupRepositoryInterface
- Repository interface for backup operations.
Constants
- BACKUP_TABLES = ['feed_links', 'languages', 'word_occurrences', 'news_feeds', 'sentences', 'settings', 'tags', 'text_tags', 'texts', 'text_tag_map', 'words', 'word_tag_map']
- Tables to include in backup.
- OFFICIAL_BACKUP_TABLES = ['languages', 'sentences', 'settings', 'tags', 'text_tags', 'word_occurrences', 'texts', 'text_tag_map', 'words', 'word_tag_map']
- Tables for official LWT backup format.
Methods
- generateBackupSql() : string
- Get backup SQL for all tables.
- generateOfficialBackupSql() : string
- Get official LWT format backup SQL.
- getBackupTables() : array<string|int, string>
- Get list of tables to backup.
- getDatabaseName() : string
- Get the database name.
- getOfficialBackupTables() : array<string|int, string>
- Get list of tables for official backup format.
- restoreFromHandle() : string
- Restore database from a file handle.
- truncateUserTables() : void
- Truncate all user data tables (keep settings).
- getOfficialTableSchema() : string
- Get the official table schema for a given table.
Constants
BACKUP_TABLES
Tables to include in backup.
private
array<string|int, string>
BACKUP_TABLES
= ['feed_links', 'languages', 'word_occurrences', 'news_feeds', 'sentences', 'settings', 'tags', 'text_tags', 'texts', 'text_tag_map', 'words', 'word_tag_map']
OFFICIAL_BACKUP_TABLES
Tables for official LWT backup format.
private
array<string|int, string>
OFFICIAL_BACKUP_TABLES
= ['languages', 'sentences', 'settings', 'tags', 'text_tags', 'word_occurrences', 'texts', 'text_tag_map', 'words', 'word_tag_map']
Methods
generateBackupSql()
Get backup SQL for all tables.
public
generateBackupSql() : string
Return values
string —SQL dump content
generateOfficialBackupSql()
Get official LWT format backup SQL.
public
generateOfficialBackupSql() : string
Return values
string —SQL dump in official format
getBackupTables()
Get list of tables to backup.
public
getBackupTables() : array<string|int, string>
Return values
array<string|int, string> —Table names
getDatabaseName()
Get the database name.
public
getDatabaseName() : string
Return values
string —Database name
getOfficialBackupTables()
Get list of tables for official backup format.
public
getOfficialBackupTables() : array<string|int, string>
Return values
array<string|int, string> —Table names
restoreFromHandle()
Restore database from a file handle.
public
restoreFromHandle(mixed $handle, string $fileName) : string
Parameters
- $handle : mixed
-
File handle to read from
- $fileName : string
-
File name for logging
Return values
string —Status message
truncateUserTables()
Truncate all user data tables (keep settings).
public
truncateUserTables() : void
getOfficialTableSchema()
Get the official table schema for a given table.
private
getOfficialTableSchema(string $table) : string
Parameters
- $table : string
-
Table name
Return values
string —SQL CREATE TABLE statement