Page tree

Categorybackup

Purpose

Creates a ZIP archive of a whole task (inkl. database dumps) before deleting a task.

Bootstrap Class

editor_Plugins_ArchiveTaskBeforeDelete_Bootstrap
TypeCore plug-in (delivered with translate5 core)

Description

This plug-in is intended to create a task archive / backup before the task will get deleted. That means the archive is created directly before delete.

The ZIP archive contains the whole task as database dumps and the task data directory. The ZIP archive is named TASKGUID.zip and is stored in the task data directory:

  APPLICATION_ROOT/data/editorImportedTasks

Configuration

No configuration available.

Test it before use it!

Please test this plug-in with a test task on your translate5 instance. If you getting wired DB errors on restoring your test task, this is because your DB structure was not correctly updated. Perhaps you have dismissed some minor DB updates.

Also test all features in your test task (MQM, statistics, termtagging etc) and check if all changes are restored after restoring the whole task.

Restore your archive

Currently restoring an archive has to be done manually.

Therefore extract the zip in the task data directory

  APPLICATION_ROOT/data/editorImportedTasks

then a new folder named with the Task GUID is created. In this directory you will find the tasks data and two directories "db_data" and "db_structure".

 

Warning 1 - use same instance:

Since all numeric IDs are stored in the archived database files, the archive can only be restored in the same instance of translate5, where the task has been deleted before, or in a new translate5 instance with a empty database structure!

 

 

Warning 2 - what happens if database structure was updated:

By updating translate5 the database structure can be changed, and differs then to the structure in the archive. To check this compare Zf_dbversion dump and the same named table in the database.

If the both entries with the highest IDs are the same in the structure is identical.

 

Start restore if structure is unchanged:

If the DB and data dump structure is the same, and you are on the same DB instance (or a fresh one), the task can simply be restored by changing to the db_data directory:

  cd APPLICATION_ROOT/data/editorImportedTasks/TASKGUID/db_data

and apply all LEK_ tables to the database. The Zf_dbversion table must not be applied in this case!

under linux you can merge all data files in one file:

  cat LEK_* > data.sql

then apply the merged data SQL file to the DB:

  mysql -h HOSTNAME -u DBUSERNAME -p DBNAME < data.sql

And thats it. The task should be available again.

Restore if structure has changed:

This is possible, but a little bit more complicated:

  1. Call the install and update script to ensure that your instance is up to date.
  2. Make a database clone of the instance where you want to restore the task.
  3. Switch with your instance to the database clone by changing the DB name in "installation.ini". All the following steps must be done in the DB clone!
  4. Apply all SQL files found in the "db_structure" directory to your cloned DB. All tables are recreated now empty with the old structure. (This is because you have to do it on a cloned DB!)
  5. Apply all SQL files found in the "db_data" directory to your cloned DB.
  6. Call the install and update script (or the database updater if no script available) so that all missing DB updates are getting applied. No you have migrated your task from old DB structure to the new one.
  7. Delete the old archive ZIP.
  8. Export your task again from your cloned DB.
  9. Switch your system back to your production DB.
  10. Now you can simply restore the task as described above for unchanged DB structures.

Debugging

Adding the following line to your installation.ini enables debugging output for ArchiveTaskBeforeDelete Plugin.

  runtimeOptions.debug.plugin.ArchiveTaskBeforeDelete = 1

With enabled debugging more information is written to the PHP error log while creating the archive.

  • No labels