Beispiel #1
0
        public void Save(EncryptionSettings encryptionSettings)
        {
            var settings = Serialize(encryptionSettings);

            CoreConfiguration.SaveSetting(key, settings);

            AscCacheNotify.ClearCache();
        }
 public RestorePortalTask(
     DbFactory dbFactory,
     IOptionsMonitor <ILog> options,
     StorageFactory storageFactory,
     StorageFactoryConfig storageFactoryConfig,
     CoreBaseSettings coreBaseSettings,
     LicenseReader licenseReader,
     TenantManager tenantManager,
     AscCacheNotify ascCacheNotify,
     ModuleProvider moduleProvider)
     : base(dbFactory, options, storageFactory, storageFactoryConfig, moduleProvider)
 {
     CoreBaseSettings = coreBaseSettings;
     LicenseReader    = licenseReader;
     TenantManager    = tenantManager;
     AscCacheNotify   = ascCacheNotify;
     Options          = options;
 }
Beispiel #3
0
 public EncryptionSettingsHelper(CoreConfiguration coreConfiguration, AscCacheNotify ascCacheNotify, InstanceCrypto instanceCrypto)
 {
     CoreConfiguration = coreConfiguration;
     AscCacheNotify    = ascCacheNotify;
     InstanceCrypto    = instanceCrypto;
 }
        public override void RunJob()
        {
            Logger.Debug("begin restore portal");

            Logger.Debug("begin restore data");

            using (var dataReader = new ZipReadOperator(BackupFilePath))
            {
                using (var entry = dataReader.GetEntry(KeyHelper.GetDumpKey()))
                {
                    Dump = entry != null && CoreBaseSettings.Standalone;
                }

                if (Dump)
                {
                    RestoreFromDump(dataReader);
                }
                else
                {
                    var modulesToProcess = GetModulesToProcess().ToList();
                    SetStepsCount(ProcessStorage ? modulesToProcess.Count + 1 : modulesToProcess.Count);

                    foreach (var module in modulesToProcess)
                    {
                        var restoreTask = new RestoreDbModuleTask(Options, module, dataReader, ColumnMapper, DbFactory, ReplaceDate, Dump, StorageFactory, StorageFactoryConfig, ModuleProvider);
                        restoreTask.ProgressChanged += (sender, args) => SetCurrentStepProgress(args.Progress);
                        foreach (var tableName in IgnoredTables)
                        {
                            restoreTask.IgnoreTable(tableName);
                        }
                        restoreTask.RunJob();
                    }
                }

                Logger.Debug("end restore data");

                if (ProcessStorage)
                {
                    if (CoreBaseSettings.Standalone)
                    {
                        Logger.Debug("clear cache");
                        AscCacheNotify.ClearCache();
                    }

                    DoRestoreStorage(dataReader);
                }
                if (UnblockPortalAfterCompleted)
                {
                    SetTenantActive(ColumnMapper.GetTenantMapping());
                }
            }

            if (CoreBaseSettings.Standalone)
            {
                Logger.Debug("refresh license");
                try
                {
                    LicenseReader.RejectLicense();
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }

                Logger.Debug("clear cache");
                AscCacheNotify.ClearCache();
            }

            Logger.Debug("end restore portal");
        }