Gallery: 如何用备份文件进行还原操作:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
 
第1行: 第1行:
__FORCETOC__
__FORCETOC__


=How to restore Gallery 2 from a backup? =
=如何用备份还原Gallery 2? =
* Either you have a regular backup consisting of:
* 常规备份包括有:
** A database backup
** 数据库备份
** A storage directory (g2data) backup from the same point in time as the database backup (including all files / directories within g2data, not just g2data/albums)
** 存储目录(g2data)备份(包含g2data中所有文件和目录,不仅仅是g2data/相册)
** A backup of your config.php and optionally of your whole gallery2 directory
** 你config.php文件的备份,可选的还有整个gallery2目录的备份
* Or something bad happened and you only have your old g2data or just the g2data/albums folder
* 或者遇上麻烦,只有旧g2data或g2data/相册文件夹的备份


Then Gallery 2 can be restored from your backup. If you have just the g2data folder and not the database, then only the album structure with all images can be restored. The registered users, comments, customfields etc. are all lost if you don't have a database backup. Also, all item titles, summries, descriptions etc. are lost without a database backup.
Gallery 2可以通过你所作的备份来进行还原。如果只有g2data文件夹备份没有数据库备份的话,那就只能还原含有全部图片的相册结构而注册用户数据,评论和自定义字段等都无法还原,因为你没有数据库备份。另外所有项目标题,摘要和描述等也因无数据库备份而无法还原。


If you have just a database backup and no g2data backup, you've lost all your albums and images. And G2 cannot be restored from the database only.
如果只有数据库备份而无g2data备份的话,所有相册及图片将无法还原。G2无法仅通过数据库备份进行还原


See:
参见:
* [[Gallery:How_do_I_Make_Backups_of_My_Database|How do I make backups of my database?]]
* [[Gallery:How_do_I_Make_Backups_of_My_Database|如何对我的数据库进行备份?]]
* [[Gallery:faq#How_can_I_move_my_gallery_installation_from_one_server_to_another.3F|How can I move my Gallery installation from one server to another?]]
* [[Gallery:常见问题#如何将Gallery的安装从一个服务器移动到另一个中?|如何将Gallery的安装从一个服务器移动到另一个中?]]
* [[Gallery:faq#How_can_I_move_my_gallery_installation_from_one_folder_to_another.3F|How can I move my Gallery installation from one folder to another?]]
* [[Gallery:常见问题#如何将Gallery的安装从一个文件夹移动到另一个中?|如何将Gallery的安装从一个文件夹移动到另一个中?]]


==Restoring Gallery 2 from a full backup==
==用完整的备份还原Gallery 2==
* If you have a complete backup (database, g2data folder, gallery2 folder including config.php), then just put those things back in place and make sure the webserver user has write permissions on the g2data folder (chmod -R 777 g2data) and it should work again
* 如果你有一个完整的备份(数据库,g2data文件夹,含有config.php的gallery2文件夹),那就将这些都放归原位,并确保web服务器用户对g2data文件夹可写(chmod -R 777 g2data)并且可以正常运行。


* If you have lost config.php or if your g2data backup is incomplete (only albums/ folder, or lost g2data/versions.dat file, ...) then...
* 如果你丢失了config.php文件夹或者你的g2data备份不完整(仅有albums/文件夹或g2data/versions.dat文件缺失)的话,那么…
** you need to run the installer again, but point to your existing storage folder (g2data) and to your existing database in the appropriate installer steps (step 4 and 5).
** 你需要重新运行安装程序,在适当的安装步骤(第四步和第五步)中指向现有的存储文件夹(g2data)以及现有的数据库。
** In the setup storage directory step, it will automatically recreate the missing folders if there are any (locks, sessions, ...). Make sure the webserver user has write permissions on the g2data folder (chmod -R 777 g2data)
** 安装存储目录步骤中,如果有缺失的文件夹(lock,session)的话,它会重新进行创建。确保web服务器用户对g2data文件夹可写(chmod -R 777 g2data)。
** If you have lost or did not make a backup of g2data/versions.dat, you need to manually create a new one (or recover the first line).  A versions.dat file is just a text file and has 2 lines, e.g.
** 如果你丢失了g2data/versions.dat文件夹或没有对其做备份的话,就需要手动新建一个(或恢复第一行)。versions.dat文件就是一个文本文件并含有两行 ,如
  1.0.0
  1.0.0
  Gallery-2.0
  Gallery-2.0
or something like that.  The second line isn't important.  The first line must be the version of your g2 core module. You can find the version in the database.
这样的语句。第二行不重要而第一行则必须为你g2核心模块的版本。你可以在数据库中找到此版本号。
  SELECT g_parameterValue FROM g2_PluginParameterMap WHERE g_pluginId = 'core' and g_parameterName = '_version';
  SELECT g_parameterValue FROM g2_PluginParameterMap WHERE g_pluginId = 'core' and g_parameterName = '_version';
** In the Database Setup Step, enter the database connection information to use your existing Gallery 2 database. After hitting save, you should see 2 new options: "erase" and "reuse". ''Reuse'' will reuse your existing g2data/database and that's what you want. Click reuse. (Warning: Erase would delete everything in your database and in g2data and you'd lose everything).
** 在数据库安装步骤,输入数据库连接来使用你现有的Gallery2数据库。点击保存后,就可以看到两个新选项:"清除(erase)"和"重新使用(reuse)"。选择"重新使用(reuse)"将重新使用你现有的g2data/数据库而这正是你需要的。那么就点击它(警告:清除(erase)会删除数据库和g2data中的所有内容)。
** And after the write config.php step (step 7), you can stop the installer and just browse to main.php. Your Gallery 2 should be up and running again.
** 在写入config.php步骤(第七步)完成后,你就可以停止安装程序并浏览main.php了。现在你的Gallery2就还原并可使用了。


==Recovering Gallery 2 from the storage directory only==
==仅用存储目录还原Gallery 2==
If you have lost everything but your g2data folder or just g2data/albums/ , then you can recover the whole album structure with all images with a few clicks
如果除了g2data文件夹或g2data/albums/以外所有东西都没有的话,那么回复含有全部图片的整个相册结构还是很简单的。


# Move your albums/ folder away into another directory
# 将albums/文件夹移动到其他的某个目录之下。
# Then install a fresh Gallery 2. Forget about your old g2data folder, it's of no use anymore (just make sure your old albums folder is in a safe place, outside your new g2data directory).
# 接着新安装一个Gallery 2。不用管你的旧g2data文件夹了,现在它已毫无用处(只要保证旧的相册文件夹放置在一个安全的位置,即新g2data目录之外即可)。
# After the installation has been completed, use the "Add items" -> "from local server" method to add the whole old structure with all albums and images.
# 安装完成之后,使用"添加项目(Add items)" -> "自本地服务器(from local server)"的方法来添加含有所有相册和图片的旧结构。
:: See: [[Gallery:How_to_Add_Items#How_to_Add_Items_from_the_Local_Server|How to Add items from the Local Server]]
:: 参见:[[Gallery:How_to_Add_Items#How_to_Add_Items_from_the_Local_Server|如何从本地服务器添加项目]]


[[Category:Gallery 2:Administration and Maintenance]]
[[Category:Gallery 2:Administration and Maintenance]]

2008年8月18日 (一) 10:04的最新版本


如何用备份还原Gallery 2?[ ]

  • 常规备份包括有:
    • 数据库备份
    • 存储目录(g2data)备份(包含g2data中所有文件和目录,不仅仅是g2data/相册)
    • 你config.php文件的备份,可选的还有整个gallery2目录的备份
  • 或者遇上麻烦,只有旧g2data或g2data/相册文件夹的备份

Gallery 2可以通过你所作的备份来进行还原。如果只有g2data文件夹备份没有数据库备份的话,那就只能还原含有全部图片的相册结构而注册用户数据,评论和自定义字段等都无法还原,因为你没有数据库备份。另外所有项目标题,摘要和描述等也因无数据库备份而无法还原。

如果只有数据库备份而无g2data备份的话,所有相册及图片将无法还原。G2无法仅通过数据库备份进行还原

参见:

用完整的备份还原Gallery 2[ ]

  • 如果你有一个完整的备份(数据库,g2data文件夹,含有config.php的gallery2文件夹),那就将这些都放归原位,并确保web服务器用户对g2data文件夹可写(chmod -R 777 g2data)并且可以正常运行。
  • 如果你丢失了config.php文件夹或者你的g2data备份不完整(仅有albums/文件夹或g2data/versions.dat文件缺失)的话,那么…
    • 你需要重新运行安装程序,在适当的安装步骤(第四步和第五步)中指向现有的存储文件夹(g2data)以及现有的数据库。
    • 安装存储目录步骤中,如果有缺失的文件夹(lock,session)的话,它会重新进行创建。确保web服务器用户对g2data文件夹可写(chmod -R 777 g2data)。
    • 如果你丢失了g2data/versions.dat文件夹或没有对其做备份的话,就需要手动新建一个(或恢复第一行)。versions.dat文件就是一个文本文件并含有两行 ,如
1.0.0
Gallery-2.0

这样的语句。第二行不重要而第一行则必须为你g2核心模块的版本。你可以在数据库中找到此版本号。

SELECT g_parameterValue FROM g2_PluginParameterMap WHERE g_pluginId = 'core' and g_parameterName = '_version';
    • 在数据库安装步骤,输入数据库连接来使用你现有的Gallery2数据库。点击保存后,就可以看到两个新选项:"清除(erase)"和"重新使用(reuse)"。选择"重新使用(reuse)"将重新使用你现有的g2data/数据库而这正是你需要的。那么就点击它(警告:清除(erase)会删除数据库和g2data中的所有内容)。
    • 在写入config.php步骤(第七步)完成后,你就可以停止安装程序并浏览main.php了。现在你的Gallery2就还原并可使用了。

仅用存储目录还原Gallery 2[ ]

如果除了g2data文件夹或g2data/albums/以外所有东西都没有的话,那么回复含有全部图片的整个相册结构还是很简单的。

  1. 将albums/文件夹移动到其他的某个目录之下。
  2. 接着新安装一个Gallery 2。不用管你的旧g2data文件夹了,现在它已毫无用处(只要保证旧的相册文件夹放置在一个安全的位置,即新g2data目录之外即可)。
  3. 安装完成之后,使用"添加项目(Add items)" -> "自本地服务器(from local server)"的方法来添加含有所有相册和图片的旧结构。
参见:如何从本地服务器添加项目