MDL-49298 backup: Make tgz file format standard for backups
This commit is contained in:
@@ -18,15 +18,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$enablecssoptimiser->set_updatedcallback('theme_reset_all_caches');
|
||||
$temp->add($enablecssoptimiser);
|
||||
|
||||
// Backup archive .mbz format: switching to .tar.gz enables larger files, better
|
||||
// progress reporting and possibly better performance. This is an experimental
|
||||
// setting but if successful, should be removed and enabled by default in a future
|
||||
// version. Note: this setting controls newly-created backups only; restore always
|
||||
// supports both formats.
|
||||
$temp->add(new admin_setting_configcheckbox('enabletgzbackups',
|
||||
new lang_string('enabletgzbackups', 'admin'),
|
||||
new lang_string('enabletgzbackups_desc', 'admin'), 0));
|
||||
|
||||
$ADMIN->add('experimental', $temp);
|
||||
|
||||
// "debugging" settingpage
|
||||
|
||||
@@ -173,6 +173,11 @@ $CFG->admin = 'admin';
|
||||
// and then restore on the target server.
|
||||
// $CFG->forcedifferentsitecheckingusersonrestore = true;
|
||||
//
|
||||
// Force the backup system to continue to create backups in the legacy zip
|
||||
// format instead of the new tgz format. Does not affect restore, which
|
||||
// auto-detects the underlying file format.
|
||||
// $CFG->usezipbackups = true;
|
||||
//
|
||||
// Prevent stats processing and hide the GUI
|
||||
// $CFG->disablestatsprocessing = true;
|
||||
//
|
||||
|
||||
@@ -481,8 +481,6 @@ $string['enablerecordcache'] = 'Enable record cache';
|
||||
$string['enablerssfeeds'] = 'Enable RSS feeds';
|
||||
$string['enablesafebrowserintegration'] = 'Enable Safe Exam Browser integration';
|
||||
$string['enablestats'] = 'Enable statistics';
|
||||
$string['enabletgzbackups'] = 'Enable new backup format';
|
||||
$string['enabletgzbackups_desc'] = 'If enabled, future backups will be created in a new compression format for .mbz files (internally stored as a .tar.gz file). This removes the 4GB backup size restriction and may improve performance. Restore supports both formats and the difference should be transparent to users.';
|
||||
$string['enabletrusttext'] = 'Enable trusted content';
|
||||
$string['enablewebservices'] = 'Enable web services';
|
||||
$string['enablewsdocumentation'] = 'Web services documentation';
|
||||
|
||||
@@ -4216,5 +4216,12 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2015030400.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015030500.01) {
|
||||
// Unset old config variable.
|
||||
unset_config('enabletgzbackups');
|
||||
|
||||
upgrade_main_savepoint(true, 2015030500.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -146,10 +146,11 @@ class mbz_packer extends file_packer {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/lib/filestorage/tgz_packer.php');
|
||||
|
||||
if ($CFG->enabletgzbackups) {
|
||||
return get_file_packer('application/x-gzip');
|
||||
} else {
|
||||
if (!empty($CFG->usezipbackups)) {
|
||||
// Allow forced use of zip backups.
|
||||
return get_file_packer('application/zip');
|
||||
} else {
|
||||
return get_file_packer('application/x-gzip');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ class core_files_mbz_packer_testcase extends advanced_testcase {
|
||||
// Set up basic archive contents.
|
||||
$files = array('1.txt' => array('frog'));
|
||||
|
||||
// Create 2 archives (each with one file in) in default mode.
|
||||
$CFG->enabletgzbackups = false;
|
||||
// Create 2 archives (each with one file in) in zip mode.
|
||||
$CFG->usezipbackups = true;
|
||||
$filefalse = $CFG->tempdir . '/false.mbz';
|
||||
$this->assertNotEmpty($packer->archive_to_pathname($files, $filefalse));
|
||||
$context = context_system::instance();
|
||||
@@ -49,7 +49,7 @@ class core_files_mbz_packer_testcase extends advanced_testcase {
|
||||
$files, $context->id, 'phpunit', 'data', 0, '/', 'false.mbz'));
|
||||
|
||||
// Create 2 archives in tgz mode.
|
||||
$CFG->enabletgzbackups = true;
|
||||
$CFG->usezipbackups = false;
|
||||
$filetrue = $CFG->tempdir . '/true.mbz';
|
||||
$this->assertNotEmpty($packer->archive_to_pathname($files, $filetrue));
|
||||
$context = context_system::instance();
|
||||
@@ -61,8 +61,6 @@ class core_files_mbz_packer_testcase extends advanced_testcase {
|
||||
$this->assertNotEquals($storagefalse->get_filesize(), $storagetrue->get_filesize());
|
||||
|
||||
// Extract files into storage and into filesystem from both formats.
|
||||
// (Note: the setting does not matter, but set to false just to check.)
|
||||
$CFG->enabletgzbackups = false;
|
||||
|
||||
// Extract to path (zip).
|
||||
$packer->extract_to_pathname($filefalse, $CFG->tempdir);
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2015030500.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2015030500.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user