备份: Difference between revisions

Jump to navigation Jump to search
Line 12: Line 12:
{{Template用户手册}}
{{Template用户手册}}


=[[File:Who.png]] 为什么?=
=[[File:Who.png]] 为什么要备份?=
有几个原因可以说明“备份”一个完整的 Dolibarr 实例数据库是非常重要的。例如:
有几个原因可以说明“备份”一个完整的 Dolibarr 实例数据库是非常重要的。例如:


Line 21: Line 21:
基于上述所有原因,建议'''定期'''对Dolibarr使用和保存的所有数据进行备份。
基于上述所有原因,建议'''定期'''对Dolibarr使用和保存的所有数据进行备份。


=[[File:Who.png]] What to save ?=
=[[File:Who.png]] 备份什么内容?=
Dolibarr save its data in 3 different spaces. They all must be saved before each version upgrade to be sure to be able to get back its data if a problem occurs or if you want to go back on previous version. This is the 3 kind of data you need to save to be sure to loose nothing.
Dolibarr将其数据存储在三个不同的位置。它们都必须在每次版本升级之前备份,以确保在出现问题或需要回溯到前版本时,能够恢复数据。 以下是无损恢复所需备份的3种类型的数据。


==A) The database==
==A) 数据库==
The database contains all data you have added from Dolibarr screens (except the attached/generated files that are presented in next chapter).
该数据库包含您从 Dolibarr 界面录入的所有数据(除了下一章中介绍的附加/生成的文档)。
Saving the database must be done in a global way (all content). It is advised to '''save the database regularly'''. See the chapter "How" later in this  document.


==B) Documents==
必须在全局范围(所有内容)内对其进行备份。建议'''定期备份数据库'''。请参阅下面的注释。
All documents related to your Dolibarr instance are saved into directory defined into your config file ''dolibarrdir/htdocs/conf/conf.php''. If you kept the choice by default during first installation, it should be something like ''dolibarrdir/documents''. This directory must be completely saved.
When making an upgrade, the upgrade process should not change this directory, however this directory can be read and write by web server at any time, it might be altered by a bad action or a bug. To be sure to keep all your joined files and be able to restore them if they are accidentally deleted or altered, just make a copy of all content of this directory.


''Note'': copying the whole folder containing all your documents might be an heavy process, so if you can't do this regularly, at least make a backup of your database (which should be a lot smaller and would still enable you to recover most of your data, which can then be used to regenerate most of your documents).
==B) 文档==
与Dolibarr实例相关的所有文档都保存在配置文件 ''dolibarr/htdocs/conf/conf.php'' 中 ''$dolibarr_main_document_root'' 变量指定的目录中。如果您在安装时使用了默认选项,则为 ''dolibarrdir/documents'' 。此目录必须完整备份,因为它包含上传到应用程序的所有附件(如员工或产品照片)以及应用程序生成的所有文档(如PDF)。


==C) The configuration file==
系统升级时,升级过程不应更改此目录,但 web 服务器可以随时读取和写入此目录,它可能会因错误操作或 bug 而被更改。为了确保备份所有附加的文件,并在它们被意外删除或更改时能够恢复它们,复制此目录的所有内容即可。
The configuration file should not be modified by upgrade process, but it is more prudent to save it also when you do an upgrade.
The configuration file is called ''conf.php'' and you can find it into directory ''dolibarrdir/htdocs/conf/''.
Make a copy of this file into the dedicated area of your backup.


''Note'': This backup is however optional as you can still rebuild this file manually from scratch or with the Dolibarr install wizard if you know your database credentials (this file contains only parameters to connect to database and directory where you Dolibarr is installed). When making a restore, it is still possible to rebuild this file by an installation from scratch.
''注意:复制包含所有文档的整个文件夹可能是一个繁重的过程,所以如果你不能经常这样做,至少要备份你的数据库(数据库应该小得多,仍然可以恢复大部分数据,然后可以用来重新生成大部分文档)。''


==D) Code change==
==C) 配置文件==
虽然配置文件通常不会在升级过程中被更改,但升级前也最好对任何可能发生的情况进行防范。


Finally, any custom development of modules, ie: all php files (or others) that would have been added or modified to accommodate specific needs, should also be saved. In most cases, you are not concerned by this point.
配置文件名为 ''conf.php,位于 dolibar/htdocs/conf/ 目录中。''


=[[File:Who.png]] When ?=
请将此文件复制到备份的专用区域中。
Frequency of backups depends on how often you use Dolibarr and what you accept to loose if something happens. More often the frequency, less data will be lost in case of a crash/failure.


Also, you can choose to backup more often one part (like the database) that is more critical, and less regularly others because they are more heavy (like the documents).
''注意:此备份是可选的,因为如果您知道数据库密码(以及任何其他非标准配置),就可以手动重建此文件,或者使用 Dolibarr 安装向导重建此文件(此文件仅包含连接到安装Dolibarr的数据库和目录的参数)。进行还原时,仍然可以通过重新安装来重新生成此文件。''


As a good starting point, you database should be backed every 1 month or even every 1 week depending on your usage, while documents can be backed every 6 months or every 1 month depending on your usage once again.
==D) 变更后的代码==


Also, the conf.php file needs to be backed only once (since it only changes if you change your host, and anyway can be made manually).
最后,任何模块的自定义开发,即:所有为了满足特定需求而添加或修改的php文件(或其他文件)也必须被备份。在大多数情况下,这一点与您无关。


=[[File:Who.png]] How ?=
=[[File:Who.png]] 什么时候备份?=
备份的频率取决于您使用Dolibarr的强度和您可接受的数据丢失容忍度。频率越高,在恢复崩溃/故障时丢失的数据越少。


==A) The database==
此外,您可以选择更频繁地备份一个更关键的部分(如数据库),而不定期地备份其他部分,因为它们更重要(如文档)。
 
作为一个很好的起点,您的数据库应该每月甚至每周备份一次,具体取决于您的使用情况;而文档可以每月或每半年备份一次(具体取决于您的使用情况)。
 
此外,conf.php 文件只需要备份一次(因为它只会在更改主机时更改,而且无论如何都可以手动创建)。
 
=[[File:Who.png]] 如何备份?=
 
==A) 数据库==
There are 4 ways to backup your database:
There are 4 ways to backup your database:


714

edits

Navigation menu