Skip to content

Commit

Permalink
Merge branch 'MDL-49298-master' of git://github.com/merrill-oakland/m…
Browse files Browse the repository at this point in the history
…oodle

Conflicts:
	version.php
  • Loading branch information
David Monllao committed Mar 11, 2015
2 parents 43e1517 + c803fa6 commit 42d81ef
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
9 changes: 0 additions & 9 deletions admin/settings/development.php
Expand Up @@ -18,15 +18,6 @@
$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
Expand Down
5 changes: 5 additions & 0 deletions config-dist.php
Expand Up @@ -173,6 +173,11 @@
// 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;
//
Expand Down
2 changes: 0 additions & 2 deletions lang/en/admin.php
Expand Up @@ -481,8 +481,6 @@
$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';
Expand Down
7 changes: 7 additions & 0 deletions lib/db/upgrade.php
Expand Up @@ -4216,5 +4216,12 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2015030400.00);
}

if ($oldversion < 2015031100.00) {
// Unset old config variable.
unset_config('enabletgzbackups');

upgrade_main_savepoint(true, 2015031100.00);
}

return true;
}
7 changes: 4 additions & 3 deletions lib/filestorage/mbz_packer.php
Expand Up @@ -146,10 +146,11 @@ protected function get_packer_for_archive_operation() {
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');
}
}

Expand Down
8 changes: 3 additions & 5 deletions lib/filestorage/tests/mbz_packer_test.php
Expand Up @@ -40,16 +40,16 @@ public function test_archive_with_both_options() {
// 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();
$this->assertNotEmpty($storagefalse = $packer->archive_to_storage(
$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();
Expand All @@ -61,8 +61,6 @@ public function test_archive_with_both_options() {
$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);
Expand Down
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2015031000.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2015031100.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.

Expand Down

0 comments on commit 42d81ef

Please sign in to comment.