====== Backup and restore ======
Data backups are an essential step in maintaining your installation. You need to be able to backup and restore your data in case of problem.
===== Import/Export =====
The Import/Export plugin natively provided with Dotclear is the easiest way to backup and restore your data. This plugin was designed to easily export and import large volumes of data and it can handle export/import orders sent by other plugins.
==== Exporting your content ====
Two options are available. You may either export your whole installation or the data of an individual blog.
To export the content of your blog, click on **Import/Export** in the sidebar menu then on the **Flat file export** and click on **Export** button. A dialogue box asks you where you want to save the export file. Choose a location and confirm. Depending on the volume, the process can take some time.
If you wish to backup your whole Dotclear installation, click **Export all content** button instead.
You have to be super administrator to export the whole installation.
In any case, you get a text file containing all the data in a format very close to [[wp>Comma-separated_values|CSV]].
==== Importing data ====
Your now have a backup file and you wish to restore the data it contains. Go back to the **Import/Export** plugin page and select **Flat file import**.
If your file is a full installation backup, upload it in the //Import a full backup file// section. If it is only a blog backup file, upload it in the **Import a single blog** section.
You're done !
Importing a full backup file overwrites all of the data existing in your database. However, if a problem occurs during this phase, your data will not be lost.
If your backup file only contains data for a single blog, the import process adds data without deleting the previous content (but you may delete the blog entries if you wish).
When you import a single blog, it may happen that the user associated to an entry does not exist. If so, and if the current user is not superadmin on the blog, the entry author will be the current user. If the current user is superadmin, a new user will be created from the author.
In both cases, if your file is to big, you can upload it to your media directory through FTP and select it from the drop-down menu in the plugin interface.
==== Note for blog managers ====
If you are hosting a great number of blogs, using this plugin is not recommended and you are strongly invited to implement a backup strategy through your [[#base_de_donnees|database manager]].
===== Files =====
==== Backup ====
==== Restore ====
===== Database =====
==== Backup ====
FIXME (should be completed and reviewed)
Several backup options are available depending on the database type you are using.
The easiest case is that of **SQLite**, where you already have a file containing all your data in the directory you specified when you installed.
However, this file might become corrupted, therefore it may be useful to export your data regularly.
Exporting the data contained in an SQLite file is very straightforward. On a Unix server, at the command prompt, type:
sqlite sqlite_file ".dump" > backup.sql
If you are using a **MySQL** database, you will need to backup your data regularly. If your blog is hosted on a shared server, you will need to use a specific tool such as phpMyAdmin, which includes an export tool.
If you're lucky and have access to your web server through SSH (or even physically), you can backup your database using the command line as follows (remember to specify the user and password options):
mysqldump -Q --opt --skip-extended-insert \
--skip-character-set db_name > backup.sql
Now, if you're a happy **PostgreSQL** user, you need to use a similar process. Assuming you have access to your server through SSH, the backup command line would look like this:
pgdump -U db_user database_name > backup.slq
==== Restoring ====