protected bool IsStorageModuleAllowed(string storageModuleName) { var allowedStorageModules = new List<string> { "forum", "photo", "bookmarking", "wiki", "files", "crm", "projects", "logo", "fckuploaders", "talk", "mailaggregator", "whitelabel", "customnavigation", "userPhotos" }; if (!allowedStorageModules.Contains(storageModuleName)) return false; IModuleSpecifics moduleSpecifics = ModuleProvider.GetByStorageModule(storageModuleName); return moduleSpecifics == null || !IgnoredModules.Contains(moduleSpecifics.ModuleName); }
protected virtual bool IsStorageModuleAllowed(string storageModuleName) { var allowedStorageModules = new List <string> { "forum", "photo", "bookmarking", "wiki", "files", "crm", "projects", "logo", "fckuploaders", "talk", "mailaggregator" }; if (!allowedStorageModules.Contains(storageModuleName)) { return(false); } IModuleSpecifics moduleSpecifics = ModuleProvider.GetByStorageModule(storageModuleName); return(moduleSpecifics == null || !IgnoredModules.Contains(moduleSpecifics.ModuleName)); }
private void DoRestoreStorage(IDataReadOperator dataReader) { Logger.Debug("begin restore storage"); var fileGroups = GetFilesToProcess(dataReader).GroupBy(file => file.Module).ToList(); var groupsProcessed = 0; foreach (var group in fileGroups) { foreach (var file in group) { var storage = StorageFactory.GetStorage(ConfigPath, Dump ? file.Tenant.ToString() : _columnMapper.GetTenantMapping().ToString(), group.Key); var quotaController = storage.QuotaController; storage.SetQuotaController(null); try { var adjustedPath = file.Path; var module = ModuleProvider.GetByStorageModule(file.Module, file.Domain); if (module == null || module.TryAdjustFilePath(Dump, _columnMapper, ref adjustedPath)) { var key = file.GetZipKey(); if (Dump) { key = Path.Combine(KeyHelper.GetStorage(), key); } using (var stream = dataReader.GetEntry(key)) { try { storage.Save(file.Domain, adjustedPath, module != null ? module.PrepareData(key, stream, _columnMapper) : stream); } catch (Exception error) { Logger.WarnFormat("can't restore file ({0}:{1}): {2}", file.Module, file.Path, error); } } } } finally { if (quotaController != null) { storage.SetQuotaController(quotaController); } } } SetCurrentStepProgress((int)(++groupsProcessed * 100 / (double)fileGroups.Count)); } if (fileGroups.Count == 0) { SetStepCompleted(); } Logger.Debug("end restore storage"); }
private void DoTransferStorage(ColumnMapper columnMapper) { Logger.Debug("begin transfer storage"); var fileGroups = GetFilesToProcess().GroupBy(file => file.Module).ToList(); int groupsProcessed = 0; foreach (var group in fileGroups) { ICrossModuleTransferUtility transferUtility = StorageFactory.GetCrossModuleTransferUtility( ConfigPath, TenantId, group.Key, ToConfigPath, columnMapper.GetTenantMapping(), group.Key); foreach (BackupFileInfo file in group) { string adjustedPath = file.Path; IModuleSpecifics module = ModuleProvider.GetByStorageModule(file.Module, file.Domain); if (module == null || module.TryAdjustFilePath(columnMapper, ref adjustedPath)) { try { transferUtility.CopyFile(file.Domain, file.Path, file.Domain, adjustedPath); } catch (Exception error) { Logger.Warn("Can't copy file ({0}:{1}): {2}", file.Module, file.Path, error); } } else { Logger.Warn("Can't adjust file path \"{0}\".", file.Path); } } SetCurrentStepProgress((int)(++groupsProcessed * 100 / (double)fileGroups.Count)); } if (fileGroups.Count == 0) { SetStepCompleted(); } Logger.Debug("end transfer storage"); }
private void DoTransferStorage(ColumnMapper columnMapper) { Logger.Debug("begin transfer storage"); var fileGroups = GetFilesToProcess(TenantId).GroupBy(file => file.Module).ToList(); var groupsProcessed = 0; foreach (var group in fileGroups) { var baseStorage = StorageFactory.GetStorage(ConfigPath, TenantId.ToString(), group.Key); var destStorage = StorageFactory.GetStorage(ToConfigPath, columnMapper.GetTenantMapping().ToString(), group.Key); var utility = new CrossModuleTransferUtility(Options, baseStorage, destStorage); foreach (var file in group) { var adjustedPath = file.Path; var module = ModuleProvider.GetByStorageModule(file.Module, file.Domain); if (module == null || module.TryAdjustFilePath(false, columnMapper, ref adjustedPath)) { try { utility.CopyFile(file.Domain, file.Path, file.Domain, adjustedPath); } catch (Exception error) { Logger.WarnFormat("Can't copy file ({0}:{1}): {2}", file.Module, file.Path, error); } } else { Logger.WarnFormat("Can't adjust file path \"{0}\".", file.Path); } } SetCurrentStepProgress((int)(++groupsProcessed * 100 / (double)fileGroups.Count)); } if (fileGroups.Count == 0) { SetStepCompleted(); } Logger.Debug("end transfer storage"); }
private void DoRestoreStorage(IDataReadOperator dataReader) { InvokeInfo("begin restore storage"); var fileGroups = GetFilesToProcess(dataReader).GroupBy(file => file.Module).ToList(); int groupsProcessed = 0; foreach (var group in fileGroups) { IDataStore storage = StorageFactory.GetStorage(ConfigPath, _columnMapper.GetTenantMapping().ToString(), group.Key, null, null); foreach (BackupFileInfo file in group) { string adjustedPath = file.Path; IModuleSpecifics module = ModuleProvider.GetByStorageModule(file.Module); if (module == null || module.TryAdjustFilePath(_columnMapper, ref adjustedPath)) { Stream stream = dataReader.GetEntry(KeyHelper.GetFileZipKey(file)); try { storage.Save(file.Domain, adjustedPath, stream); } catch (Exception error) { InvokeWarning("can't restore file ({0}:{1}): {2}", file.Module, file.Path, error); } } } SetStepProgress((int)(++groupsProcessed * 100 / (double)fileGroups.Count)); } if (fileGroups.Count == 0) { SetStepCompleted(); } InvokeInfo("end restore storage"); }