public async Task <ActionResult> Run() { if (!SiteDefinition.INITIAL_INSTALL || SiteDefinition.INITIAL_INSTALL_ENDED) { return(NotAuthorized()); } List <string> wantedPackages = new List <string>(); FormHelper form = Manager.RequestForm; foreach (string key in form.GetCollection().Keys) { if (form[key] == "on") { wantedPackages.Add(key); } } wantedPackages.AddRange(RequiredPackages); PackagesDataProvider packagesDP = new PackagesDataProvider(); QueryHelper qh = new QueryHelper(); qh.Add("From", "Data"); await packagesDP.InitAllAsync(qh, wantedPackages); return(new EmptyResult()); }
public async Task <ActionResult> SiteAdd_Partial(AddModel model) { if (!ModelState.IsValid) { return(PartialView(model)); } SiteDefinition currentSite = Manager.CurrentSite; SiteDefinition newSite = model.GetData(); await newSite.AddNewAsync(); Manager.CurrentSite = newSite; try { PackagesDataProvider packagesDP = new PackagesDataProvider(); await packagesDP.InitNewAsync(true); } catch (Exception) { throw; } finally { Manager.CurrentSite = currentSite; } string nextPage = Manager.CurrentSite.MakeUrl(RealDomain: Manager.CurrentSite.SiteDomain); Manager.RestartSite(); return(FormProcessed(model, this.__ResStr("okSaved", "New site \"{0}\" created - Click OK to populate the new site with the current site template.(+nl)(+nl)IMPORTANT: This site is not accessible by its Url until the domain \"{0}\" is defined in IIS and in the hosts file.", newSite.SiteDomain), NextPage: nextPage)); }
public async Task <ActionResult> GetInitialInstallLogRecords(int offset) { PackagesDataProvider.RetrieveInitialInstallLogInfo info = await PackagesDataProvider.RetrieveInitialInstallLogAsync(); if (info.Ended) { #if MVC6 info.Lines.AddRange(new List <string> { "*** This site has to be restarted now so the new settings can be activated ***", "*** DONE. PLEASE CLOSE YOUR BROWSER AND RESTART YOUR SITE FROM VISUAL STUDIO ***", "+++DONE", }); #else info.Lines.AddRange(new List <string> { "*** DONE. THE SITE IS NOW RESTARTING ***", "+++DONE", }); #endif } else { info.Lines.RemoveRange(0, Math.Min(offset, info.Lines.Count)); } return(new YJsonResult() { Data = info.Lines }); }
public async Task UpdateDataAsync() { PackagesDataProvider packagesDP = new PackagesDataProvider(); SiteTemplate_List = (from f in await FileSystem.FileSystemProvider.GetFilesAsync(packagesDP.TemplateFolder, "*.txt") orderby f select new SelectionItem <string>() { Text = Path.GetFileName(f), Value = Path.GetFileName(f), }).ToList(); }
public async Task <ActionResult> SiteTemplateUndo(string fileName) { PackagesDataProvider packagesDP = new PackagesDataProvider(); if (!await FileSystem.FileSystemProvider.DirectoryExistsAsync(packagesDP.TemplateFolder)) { return(new EmptyResult()); } EditModel model = new EditModel { }; await model.UpdateDataAsync(); return(View(model)); }
public async Task <ActionResult> SiteTemplateUndo_Partial(EditModel model) { await model.UpdateDataAsync(); if (!ModelState.IsValid) { return(PartialView(model)); } if (YetaWF.Core.Support.Startup.MultiInstance) { throw new InternalError("Site template processing is not possible when distributed caching is enabled"); } PackagesDataProvider packagesDP = new PackagesDataProvider(); await packagesDP.BuildSiteUsingTemplateAsync(model.SiteTemplate, false); return(FormProcessed(model)); }