Home « Server software «
Documentation: control/backup.php
control/backup.php - Handle content of the database through the wire
This script helps either:- to backup the database, by providing a files made of SQL statements that reflects database content
- to restore the database, by processing a set of SQL statements in a file
- to change database content, by processing some SQL statements typed directly in a text area
With a simple click you can create a backup version of the database contents. Without another click you can restore data when necessary.
Returned backup data that are files containing standard SQL-queries, that reconstruct the state of the database as it was when the backup was created.
It's strongly encouraged to take a backup regularly (weekly or so).
The backup function can be limited to the current table prefix, if a database hosts several instances of YACS.
The restoring utility can actually process any set of SQL statements, as long as each statement ends with the character ';' (semicolon). Comment lines starting with the character '#' are also supported.
Therefore, you can use the restore facility as a convenient method to inject new records in your database.
Another facility has been added to ease bulk changes of the database. You just have to type one or several statements in a web form and hit the submit button. Statements have to be separated with the character ';' (semicolon). Comment lines starting with the character '#' are also supported. This is a simple way to achieve small bulk changes of the database when necessary, without the overhead of creating a file.
If you are in trouble with your database, you can try one of following options.
Option 1: If you have been authenticated as a valid associate, trigger this script manually from your web browser. Upload the backup file and let YACS process SQL statements.
Option 2: When triggered, the script complains that you are not an associate. In this case, use your FTP account to delete the switch file, at the YACS installation directory. The file can have either the name
switch.on
or switch.off
.
Then restart the script to make it accept your upload request.
On next click you may have a strange, but harmless, label from setup.php because
it will automatically recreate switch.on
.Option 3: Use phpMyAdmin, or an equivalent web-based interface to MySQL. Use your web browser to trigger phpMyAdmin, and use the backup file to setup and populate tables.
Option 4: use MySQL directly. If you have a shell account, restoring a backup can be done by running the mysql program with the following arguments:
mysql -u username -p -h hostname databasename < backupfile.sql
In all cases, you should run the control/setup.php after any restore, in order to recreate index files that are used by YACS to fasten access to data.
This script is a reference file of this system.
Voir aussi:
Licence: GNU Lesser General Public License
Auteurs:
- Bernard Paques bernard.paques@bigfoot.com
Testeurs:
- Lucrecius
Reste à faire:
- allow for the restore of a local file from inbox/restore (like for script staging)
- add a capability to build a single downloadabe .tgz with all parameter files (egide)
delete_all() - Delete a directory and all of its content
function delete_all($path)
- $path - string the directory to delete