__construct (Constructor) [line 217]
return __construct(
string
$database)
|
|
Instantiate a new SQLite_Tools Object Expects a db location or an array of db locations for multiple checks
Parameters:
cacheSize [line 303]
true cacheSize(
[int
$pages = ''])
|
|
Check or Set the cacheSize of the database I
As a default value an sqlite database will hold 2000 disk pages in the memory each page requires approximately 1.5 K of memory For intensive UPDATE or DELETE queries an higher memory might result in a speed increase If pages parameter is not defined it will return the current cache size of the database or the multiple databases if $this->database is an array with more then one element
If a valid integer is passed as $pages parameter it will set the cache size for the database or for multiple database if $this->database is an array with more then one element
if defined it will set the new cache size (in pages) as per the specified integer.
Note: When setting a new cache size It might get a query error if on the database or one of the databases doesn't have the relevant write permissions. Please set the necessary permissions on the database/databases before attemping to change their cache value.
Parameters:
checkIntegrity [line 259]
true checkIntegrity(
string
$multiple)
|
|
Checks the database integrity I
does an integrity check of the entire database including malformed records, corrupted pages out of order records, invalid indeces returns okay on success or the error details if multiple is true the the value for $database in the constructor is expected to be an array with a list of databases.
Parameters:
copySafe [line 432]
void copySafe(
[string
$path = ''])
|
|
Safely duplicates a database file. copySafe should be performed before a backup as transfering via ftp or rsync.
With this function we obtain an exclusive lock on the database before the copy, we then check the integrity of the copied databases. if the integrity check on the copied database returns OK this means that we have a cloned database ready for backup purposes.
Individual or multiple databases are duplicated with the same name of the original database and the suffix .bkp
Parameters:
createDBFromXML [line 915]
void createDBFromXML(
string
$xmlFile, string
$db)
|
|
Converts an XML exported database back to an Sqlite database
Parameters:
createXMLDumps [line 882]
true createXMLDumps(
[
$path = ''])
|
|
For each of the databases in our contructor array creates an XML dump including all the tables of that database.
The XML file is generated via the function performXMLDump The backup file is by default the database name .xml
Parameters:
dbFileInfo [line 380]
true dbFileInfo(
string
$multiple)
|
|
Retrieve general information on the database files I
like filename, owner id, group, name, permissions, library encoding and version, the size of the database, last time it was modified, blocks and generally every possible information on the database files
Parameters:
ftpBackup [line 513]
true ftpBackup(
string
$server, string
$username, string
$password, [string
$path = ''])
|
|
Safely copy the backup db to a remote ftp server.
this function can be called only after a copySafe operation is performed
It will backup every database in the backup dir which is set with copySafe If the intended use is to backup different group of databases the user can simply set a different path for copySafe
Parameters:
localBackup [line 563]
void localBackup(
string
$destination)
|
|
Creates a local backup of the database file and
checks for its integrity
Parameters:
localRsync [line 603]
void localRsync(
string
$databasesPath, string
$backupsPath, [string
$options = '
--verbose --stats --recursive --progress --delete'])
|
|
Initiaties a local rsync of a given database path
requires rsync installed locally
Parameters:
remoteRsync [line 637]
void remoteRsync(
sting
$databasesPath, string
$configfile, string
$configfilepath, string
$uid, string
$gid, string
$allowedhost, string
$logs, string
$secretfile)
|
|
remoteRsync prepared the server where this package is running to receive read connections over rsync for the purpose of remote synchronisation.
it created a valid rsync configuration file and starts the deamon allowing connection from the allowed host.
This function is experimental.
Parameters:
sqliteLogs [line 712]
void sqliteLogs(
[string
$db = ""], [string
$maketable = true], [string
$table = ""])
|
|
Logs all the perfomed action in a database log this includes backups, integrity checks each of the integrity queries. Verbose XML style output for each of the actions.
Sample log output - <logevent> <class>DB_Sqlite_Tools</class> <function>cacheSize</function> <data> 'cache correctly reset to 10000' </data> </logevent>
All the logs are saved with the time of execution. The user can easily generate customized logs from the raw data provided in this package.
Parameters:
sync [line 346]
true sync(
[sting
$value = ''])
|
|
Check or Set the synchronous value for the databaseI Sqlite provides with different synchronous modes.
The synchronous level determines the integrity protection. At NORMAL (default mode) the sqlite engine will stop at most critical moment providing with a limited integrity protection of the database. In FULL mode the engine will stop more often thus ensuring and higher integrity level. When OFF the engine will continue as soon as the new data is provided without stopping. Values are represented by an integer, 1 for NORMAL, 2 for FULL and 0 for off.
if the parameter value is not set it will return the current default syncronous for the databases. If value is set with either FULL, NORMAL or OFF it will change the default syncronous value for each of the databases.
Parameters:
XMLDecode [line 798]
void XMLDecode(
string
$str)
|
|
Decodes the XML content
Parameters:
XMLEncode [line 807]
void XMLEncode(
string
$str)
|
|
Encodes the XML content
Parameters: