Bug 63557 - Settings: Restore.

This commit is contained in:
Anton Suhorukov 2023-08-07 17:06:46 +03:00
parent 2a7b044307
commit 50e2b26f95
4 changed files with 73 additions and 2 deletions

View File

@ -33,7 +33,8 @@ public enum ModuleName
Files,
Files2,
Tenants,
WebStudio
WebStudio,
RoomLogos
}
public interface IModuleSpecifics

View File

@ -30,6 +30,7 @@ namespace ASC.Data.Backup.Tasks.Modules;
public class ModuleProvider
{
public List<IModuleSpecifics> AllModules { get; }
private IModuleSpecifics RoomLogosModule { get; }
public ModuleProvider(ILogger<ModuleProvider> logger, Helpers helpers, CoreSettings coreSettings)
{
@ -43,12 +44,16 @@ public class ModuleProvider
new CoreModuleSpecifics(helpers)
}
.ToList();
RoomLogosModule = new RoomLogosModuleSpecifics(helpers);
}
public IModuleSpecifics GetByStorageModule(string storageModuleName, string storageDomainName = null)
{
return storageModuleName switch
{
"files" => AllModules.FirstOrDefault(m => m.ModuleName == ModuleName.Files),
"room_logos" => RoomLogosModule,
_ => null,
};
}

View File

@ -0,0 +1,64 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Data.Backup.Tasks.Modules;
public class RoomLogosModuleSpecifics : ModuleSpecificsBase
{
public RoomLogosModuleSpecifics(Helpers helpers) : base(helpers)
{
}
public override ModuleName ModuleName => ModuleName.RoomLogos;
public override IEnumerable<TableInfo> Tables => new List<TableInfo>();
public override IEnumerable<RelationInfo> TableRelations => new List<RelationInfo>();
public override bool TryAdjustFilePath(bool dump, ColumnMapper columnMapper, ref string filePath)
{
try
{
var split = filePath.Split('_');
var roomId = columnMapper.GetMapping("files_folder", "id", split[0]);
if (roomId == null)
{
if (!dump)
{
return false;
}
roomId = split[0];
}
filePath = roomId + "_" + split[1];
return true;
}
catch
{
return false;
}
}
}

View File

@ -132,7 +132,8 @@ public abstract class PortalTaskBase
"mailaggregator",
"whitelabel",
"customnavigation",
"userPhotos"
"userPhotos",
"room_logos"
};
if (!allowedStorageModules.Contains(storageModuleName))