Backup Pro 1.9.2 Documentation
Extension Hooks
Backup Pro is completely extensible. Through the use of ExpressionEngine hooks you can make Backup Pro do things that only your situation needs. The flexibility is very powerful. Below are a list of hooks that you can use
- m62_backup_file_backup_start
- m62_backup_file_backup_stop
- m62_backup_db_backup_start
- m62_backup_db_backup_end
- m62_backup_db_backup_zip_start
- m62_backup_db_backup_zip_end
- m62_backup_db_restore_start
- m62_backup_db_restore_stop
m62_backup_file_backup_start
The above hook is called right before the file backup starts. An array of locations on the server that are to be backed up are passed along with this hook. Note that if you want to modify the array you have to pass it as a reference to your extension.
244 245 246 | //M62_backup_lib.php $this->EE->extensions->call('m62_backup_file_backup_start', $this->settings['backup_file_location']); if ($this->EE->extensions->end_script === TRUE) return; |
Example uses:
- adding additional locations to backup dynamically
- running some clean up routines (to remove a cache for example)
m62_backup_file_backup_stop
The above hook is called after the file backup completes. The path to the newly created backup Zip file is passed along with this hook. Back to top
257 258 259 | //M62_backup_lib.php $this->EE->extensions->call('m62_backup_file_backup_stop', $path); if ($this->EE->extensions->end_script === TRUE) return; |
Example uses:
- Transferring backup to a third party server
- Copying the backup to another location
m62_backup_db_backup_start
The above hook is called right before the database backup starts. An array of the database information to back up is passed along with this hook. Note that if you want to modify the array you have to pass it as a reference to your extension. Back to top
141 142 143 | //M62_sql_backup.php $this->EE->extensions->call('m62_backup_db_backup_start', $db_info); if ($this->EE->extensions->end_script === TRUE) return; |
Example uses:
- Setting the database to backup dynamically
- Running cleanup routines against the database
m62_backup_db_backup_end
The above hook is called after the database backup completes. An array of the database information to back up is passed along with this hook. Note that if you want to modify the array you have to pass it as a reference to your extension. Back to top
222 223 224 | //M62_sql_backup.php $this->EE->extensions->call('m62_backup_db_backup_end', $db_info); if ($this->EE->extensions->end_script === TRUE) return; |
Example uses:
- Resetting values modifed by m62_backup_db_backup_start
m62_backup_db_backup_zip_start
The above hook is called right before the database backup file is zipped up. The path to the database backup on the server is passed. Back to top
228 229 230 | //M62_sql_backup.php $this->EE->extensions->call('m62_backup_db_backup_zip_start', $this->m_output); if ($this->EE->extensions->end_script === TRUE) return; |
Example uses:
- Modifying the contents of the file for a production or staging server
m62_backup_db_backup_zip_end
The above hook is called right after the database backup is zipped up and the temporary file dump is deleted. The complete path to the completed zip file stored on the server is passed. This would be a good hook to use for adding additional transfer libraries. Back to top
241 242 243 | //M62_sql_backup.php $this->EE->extensions->call('m62_backup_db_backup_zip_end', $this->m_output.'.zip'); if ($this->EE->extensions->end_script === TRUE) return; |
Example uses:
- Transferring the backup to a third party server
m62_backup_db_restore_start
The above hook is called right before the database is restored. An array of the database information is passed along with this hook. Back to top
58 59 60 | //M62_sql_backup.php $this->EE->extensions->call('m62_backup_db_restore_start', $db_info); if ($this->EE->extensions->end_script === TRUE) return; |
Example uses:
- Taking a snapshot of the database to be restored
m62_backup_db_restore_stop
The above hook is called right after the database is restored. An array of the database information is passed along with this hook. Back to top
84 85 86 | //M62_sql_backup.php $this->EE->extensions->call('m62_backup_db_restore_end', $db_info); if ($this->EE->extensions->end_script === TRUE) return; |
Example uses:
- Updating values and paths for a particular environment

