- def backup(self, deployment, options):
- sh = shell.Shell()
- # XXX: duplicate code, refactor, also, race condition
- backupdir = os.path.join(".scripts", "backups")
- backup = str(deployment.version) + "-" + datetime.date.today().isoformat()
- outdir = os.path.join(backupdir, backup)
- if not os.path.exists(backupdir):
- os.mkdir(backupdir)
- if os.path.exists(outdir):
- util.safe_unlink(outdir)
- os.mkdir(outdir)
- outfile = os.path.join(outdir, "db.sql")
- try:
- sh.call("mysqldump", "--compress", "-r", outfile, *get_mysql_args(deployment))
- sh.call("gzip", "--best", outfile)
- except shell.CallError as e:
- raise app.BackupFailure(e.stderr)
- return backup
- def restore(self, deployment, backup, options):
- sh = shell.Shell()
- backup_dir = os.path.join(".scripts", "backups", backup)
- if not os.path.exists(backup_dir):
- raise app.RestoreFailure("Backup %s doesn't exist", backup)
- sql = open(os.path.join(backup_dir, "db.sql"), 'w+')
- sh.call("gunzip", "-c", os.path.join(backup_dir, "db.sql.gz"), stdout=sql)
- sql.seek(0)
- sh.call("mysql", *get_mysql_args(deployment), stdin=sql)
- sql.close()
+ def backup(self, deployment, backup_dir, options):
+ app.backup_database(backup_dir, deployment)
+ def restore(self, deployment, backup_dir, options):
+ app.restore_database(backup_dir, deployment)
+ def remove(self, deployment, options):
+ app.remove_database(deployment)
+ def researchFilter(self, filename, added, deleted):
+ if filename == "LocalSettings.php":
+ return added == deleted == 10 or added == deleted == 9
+ elif filename == "AdminSettings.php":
+ return added == 0 and deleted == 20
+ elif filename == "config/index.php" or filename == "config/index.php5":
+ return added == 0
+ return False
+
+Application.resolutions = {
+'LocalSettings.php': [
+ ("""
+<<<<<<<
+***1***
+=======
+## The URL base path to the directory containing the wiki;
+## defaults for all runtime URL paths are based off of this.
+## For more information on customizing the URLs please see:
+## http://www.mediawiki.org/wiki/Manual:Short_URL
+***2***
+$wgScriptExtension = ".php";
+
+## UPO means: this is also a user preference option
+>>>>>>>
+""", [-1]),
+ ("""
+<<<<<<<
+***1***
+=======
+
+# MySQL specific settings
+$wgDBprefix = "";
+>>>>>>>
+""", ["\n# MySQL specific settings", 1]),
+ ("""
+<<<<<<<
+## is writable, then uncomment this:
+***1***
+=======
+## is writable, then set this to true:
+$wgEnableUploads = false;
+>>>>>>>
+""", [-1]),
+ ("""
+<<<<<<<
+***1***
+$wgMathPath = "{$wgUploadPath}/math";
+$wgMathDirectory = "{$wgUploadDirectory}/math";
+$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
+=======
+$wgUseTeX = false;
+>>>>>>>
+""", [1]),
+ # order of these rules is important
+ ("""
+<<<<<<<
+$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
+$wgCacheEpoch = max( $wgCacheEpoch, $configdate );
+***1***
+?>
+=======
+$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
+>>>>>>>
+""", [0, 1]),
+ ("""
+<<<<<<<
+$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
+$wgCacheEpoch = max( $wgCacheEpoch, $configdate );
+***1***
+=======
+$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
+>>>>>>>
+""", [0, 1]),
+ ("""
+<<<<<<<
+?>
+=======
+# When you make changes to this configuration file, this will make
+# sure that cached pages are cleared.
+$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
+>>>>>>>
+""", [0]),
+ ("""
+<<<<<<<
+***1***
+?>
+=======
+# When you make changes to this configuration file, this will make
+# sure that cached pages are cleared.
+$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
+>>>>>>>
+""", [1, 0]),
+ ("""
+<<<<<<<
+***1***
+=======
+# When you make changes to this configuration file, this will make
+# sure that cached pages are cleared.
+$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
+>>>>>>>
+""", [1, 0]),
+ ]
+}