Exemplo n.º 1
0
        public async Task <ActionResult> PerformSiteBackup()
        {
            List <string> errorList  = new List <string>();
            SiteBackup    siteBackup = new SiteBackup();

            if (!await siteBackup.CreateAsync(errorList, ForDistribution: true))
            {
                ScriptBuilder sb = new ScriptBuilder();
                sb.Append(this.__ResStr("cantBackup", "Can't create a site backup for site {0}:(+nl)"), Manager.CurrentSite.SiteDomain);
                sb.Append(errorList, LeadingNL: true);
                throw new Error(sb.ToString());
            }
            return(Reload(null, PopupText: this.__ResStr("backupCreated", "The site backup has been successfully created"), Reload: ReloadEnum.ModuleParts));
        }
Exemplo n.º 2
0
        public async Task RunItemAsync(SchedulerItemBase evnt)
        {
            if (evnt.EventName == EventCreateBackup)
            {
                SiteBackup    siteBackup = new SiteBackup();
                List <string> errorList  = new List <string>();
                ConfigData    config     = await ConfigDataProvider.GetConfigAsync();

                await siteBackup.CreateAsync(errorList, DataOnly : config.DataOnly);
            }
            else if (evnt.EventName == EventRemoveOldBackups)
            {
                SiteBackup    siteBackup = new SiteBackup();
                List <string> errorList  = new List <string>();
                ConfigData    config     = await ConfigDataProvider.GetConfigAsync();

                await siteBackup.RemoveOldBackupsAsync(errorList, config.Days);
            }
            else
            {
                throw new Error(this.__ResStr("eventNameErr", "Unknown scheduler event {0}"), evnt.EventName);
            }
        }