mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Revert "Merge branch 'vboxtester' into feature/pluginsmanager"
This reverts commit25a909d7a7, reversing changes made toed46c8521d.
This commit is contained in:
@ -138,6 +138,6 @@ L" For example, --remove=\"Youtube, PhotoEditor, {7327FC
|
||||
L" --remove-all = Optional parameter without value. Remove all installed plugins.\n\n" \
|
||||
|
||||
L" --ignore = Optional parameter. Set comma-separated quoted list of plugins to ignore actions,\n" \
|
||||
L" such as update, remove, rename or restore.\n" \
|
||||
L" such as update, remove or rename.\n" \
|
||||
L" For example, --ignore=\"youtube, {7327FC95-16DA-41D9-9AF2-0E7F449F6800}\"\n" \
|
||||
;
|
||||
|
||||
@ -217,6 +217,7 @@ public:
|
||||
CVersion* m_pVersion;
|
||||
bool m_isValid;
|
||||
bool m_isDirGuid;
|
||||
bool m_bIgnore;
|
||||
|
||||
CPluginInfo()
|
||||
{
|
||||
@ -227,6 +228,7 @@ public:
|
||||
m_pVersion = new CVersion();
|
||||
m_isValid = true;
|
||||
m_isDirGuid = true;
|
||||
m_bIgnore = false;
|
||||
}
|
||||
|
||||
CPluginInfo(std::wstring& sName, std::wstring& sNameConfig, std::wstring& sGuid, CVersion* pVersion)
|
||||
@ -567,7 +569,11 @@ public:
|
||||
{
|
||||
CPluginInfo* pPluginInfo = m_arrInstalled[i];
|
||||
|
||||
if ( !pPluginInfo->m_isDirGuid )
|
||||
if ( pPluginInfo->m_bIgnore )
|
||||
{
|
||||
Message(L"Rename plugin: " + pPluginInfo->m_sName + L". Ignored", BoolToStr(bResult), true);
|
||||
}
|
||||
else if ( !pPluginInfo->m_isDirGuid )
|
||||
{
|
||||
std::wstring sPluginDir = m_sPluginsDir + L"/" + pPluginInfo->m_sGuid;
|
||||
|
||||
@ -915,18 +921,25 @@ private:
|
||||
// Check new version
|
||||
if ( pLocalPlugin && pMarketPlugin )
|
||||
{
|
||||
if ( *pMarketPlugin->m_pVersion > *pLocalPlugin->m_pVersion )
|
||||
if ( pLocalPlugin->m_bIgnore )
|
||||
{
|
||||
sVerToVer = L"(" + pLocalPlugin->m_pVersion->m_sVersion + L" -> " + pMarketPlugin->m_pVersion->m_sVersion + L")";
|
||||
|
||||
bResult &= RemovePlugin(pLocalPlugin->m_sGuid, false, false);
|
||||
bResult &= InstallPlugin(pLocalPlugin->m_sGuid, pLocalPlugin->m_isDirGuid, false);
|
||||
|
||||
Message(L"Update plugin: " + sPlugin + L" " + sVerToVer, BoolToStr(bResult), true);
|
||||
Message(L"Update plugin: " + sPlugin + L". Ignored", BoolToStr(false), true);
|
||||
}
|
||||
else if ( *pMarketPlugin->m_pVersion == *pLocalPlugin->m_pVersion )
|
||||
else
|
||||
{
|
||||
Message(L"Update plugin: " + sPlugin + L". No updates available", BoolToStr(bResult), true);
|
||||
if ( *pMarketPlugin->m_pVersion > *pLocalPlugin->m_pVersion )
|
||||
{
|
||||
sVerToVer = L"(" + pLocalPlugin->m_pVersion->m_sVersion + L" -> " + pMarketPlugin->m_pVersion->m_sVersion + L")";
|
||||
|
||||
bResult &= RemovePlugin(pLocalPlugin->m_sGuid, false, false);
|
||||
bResult &= InstallPlugin(pLocalPlugin->m_sGuid, pLocalPlugin->m_isDirGuid, false);
|
||||
|
||||
Message(L"Update plugin: " + sPlugin + L" " + sVerToVer, BoolToStr(bResult), true);
|
||||
}
|
||||
else if ( *pMarketPlugin->m_pVersion == *pLocalPlugin->m_pVersion )
|
||||
{
|
||||
Message(L"Update plugin: " + sPlugin + L". No updates available", BoolToStr(bResult), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -946,15 +959,22 @@ private:
|
||||
|
||||
if ( pPlugin )
|
||||
{
|
||||
std::wstring sPluginDir = m_sPluginsDir + L"/" + pPlugin->m_sGuid;
|
||||
std::wstring sPluginBackupDir = m_sPluginsDir + L"/backup/" + pPlugin->m_sGuid;
|
||||
|
||||
if (NSDirectory::Exists(sPluginBackupDir))
|
||||
if ( pPlugin->m_bIgnore )
|
||||
{
|
||||
NSDirectory::CopyDirectory(sPluginBackupDir, sPluginDir);
|
||||
NSDirectory::DeleteDirectory(sPluginBackupDir);
|
||||
sPrintInfo = L"Ignored";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sPluginDir = m_sPluginsDir + L"/" + pPlugin->m_sGuid;
|
||||
std::wstring sPluginBackupDir = m_sPluginsDir + L"/backup/" + pPlugin->m_sGuid;
|
||||
|
||||
bResult = true;
|
||||
if (NSDirectory::Exists(sPluginBackupDir))
|
||||
{
|
||||
NSDirectory::CopyDirectory(sPluginBackupDir, sPluginDir);
|
||||
NSDirectory::DeleteDirectory(sPluginBackupDir);
|
||||
|
||||
bResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -973,6 +993,7 @@ private:
|
||||
bool RemovePlugin(const std::wstring& sPlugin, bool bSave = true, bool bPrint = true)
|
||||
{
|
||||
bool bResult = false;
|
||||
bool bIgnore = false;
|
||||
|
||||
if (sPlugin.length())
|
||||
{
|
||||
@ -1015,51 +1036,58 @@ private:
|
||||
|
||||
if (NSDirectory::Exists(sPluginDir))
|
||||
{
|
||||
if (bBackup)
|
||||
if ( pPlugin->m_bIgnore )
|
||||
{
|
||||
std::wstring sBackupDir = m_sPluginsDir + L"/backup";
|
||||
|
||||
std::wstring sPluginBackupDir = sBackupDir + L"/" + pPlugin->m_sGuid;
|
||||
|
||||
if ( !NSDirectory::Exists(sBackupDir) )
|
||||
NSDirectory::CreateDirectory(sBackupDir);
|
||||
|
||||
if ( NSDirectory::Exists(sPluginBackupDir) )
|
||||
NSDirectory::DeleteDirectory(sPluginBackupDir);
|
||||
|
||||
NSDirectory::CopyDirectory(sPluginDir, sPluginBackupDir);
|
||||
|
||||
if (bPrint)
|
||||
Message(L"Backup plugin: " + sPlugin, BoolToStr(bBackup), true);
|
||||
bIgnore = true;
|
||||
}
|
||||
|
||||
NSDirectory::DeleteDirectory(sPluginDir);
|
||||
|
||||
// Update installed
|
||||
GetLocalPlugins(false, false);
|
||||
|
||||
// Check duplicate (bug #62807)
|
||||
CPluginInfo* pDuplicate = FindLocalPlugin(pPlugin->m_sGuid);
|
||||
if ( pDuplicate )
|
||||
else
|
||||
{
|
||||
bool bRes = RemovePlugin(pDuplicate->m_sName, false, false);
|
||||
if (bPrint)
|
||||
Message(L"Remove duplicate plugin: " + pDuplicate->m_sName, BoolToStr(bRes), true);
|
||||
if (bBackup)
|
||||
{
|
||||
std::wstring sBackupDir = m_sPluginsDir + L"/backup";
|
||||
|
||||
std::wstring sPluginBackupDir = sBackupDir + L"/" + pPlugin->m_sGuid;
|
||||
|
||||
if ( !NSDirectory::Exists(sBackupDir) )
|
||||
NSDirectory::CreateDirectory(sBackupDir);
|
||||
|
||||
if ( NSDirectory::Exists(sPluginBackupDir) )
|
||||
NSDirectory::DeleteDirectory(sPluginBackupDir);
|
||||
|
||||
NSDirectory::CopyDirectory(sPluginDir, sPluginBackupDir);
|
||||
|
||||
if (bPrint)
|
||||
Message(L"Backup plugin: " + sPlugin, BoolToStr(bBackup), true);
|
||||
}
|
||||
|
||||
NSDirectory::DeleteDirectory(sPluginDir);
|
||||
|
||||
// Update installed
|
||||
GetLocalPlugins(false, false);
|
||||
|
||||
// Check duplicate (bug #62807)
|
||||
CPluginInfo* pDuplicate = FindLocalPlugin(pPlugin->m_sGuid);
|
||||
if ( pDuplicate )
|
||||
{
|
||||
bool bRes = RemovePlugin(pDuplicate->m_sName, false, false);
|
||||
if (bPrint)
|
||||
Message(L"Remove duplicate plugin: " + pDuplicate->m_sName, BoolToStr(bRes), true);
|
||||
}
|
||||
|
||||
// Save to settings
|
||||
CPluginInfo* pRemoved = FindLocalPlugin(pPlugin->m_sGuid, Removed);
|
||||
if ( bSave && !pRemoved )
|
||||
m_arrRemoved.push_back(pPlugin);
|
||||
|
||||
bResult = true;
|
||||
}
|
||||
|
||||
// Save to settings
|
||||
CPluginInfo* pRemoved = FindLocalPlugin(pPlugin->m_sGuid, Removed);
|
||||
if ( bSave && !pRemoved )
|
||||
m_arrRemoved.push_back(pPlugin);
|
||||
|
||||
bResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bPrint)
|
||||
{
|
||||
std::wstring sInfo = L"Remove plugin: " + sPlugin;
|
||||
std::wstring sInfo = L"Remove plugin: " + sPlugin + (bIgnore ? L". Ignored" : L"");
|
||||
Message(sInfo, BoolToStr(bResult), true);
|
||||
}
|
||||
|
||||
@ -1116,7 +1144,6 @@ private:
|
||||
pPluginInfo->m_sName = pMarketPlugin->m_sName;
|
||||
|
||||
// Check ignored
|
||||
bool bIgnored = false;
|
||||
if ( m_arrIgnore.size() )
|
||||
{
|
||||
for (size_t i = 0; i < m_arrIgnore.size(); i++)
|
||||
@ -1130,17 +1157,14 @@ private:
|
||||
pPluginInfo->m_sNameConfig == sName ||
|
||||
pPluginInfo->m_sGuid == sGuid)
|
||||
{
|
||||
bIgnored = true;
|
||||
pPluginInfo->m_bIgnore = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save
|
||||
if ( !bIgnored )
|
||||
{
|
||||
arrPlugins.push_back(pPluginInfo);
|
||||
bResult = true;
|
||||
}
|
||||
arrPlugins.push_back(pPluginInfo);
|
||||
bResult = true;
|
||||
|
||||
if ( bPrint )
|
||||
{
|
||||
@ -1153,7 +1177,7 @@ private:
|
||||
sVersion += L" (new " + pMarketPlugin->m_pVersion->m_sVersion + L")";
|
||||
}
|
||||
|
||||
MessagePluginInfo(pPluginInfo->m_sNameConfig, sVersion, pPluginInfo->m_sGuid, bIgnored);
|
||||
MessagePluginInfo(pPluginInfo->m_sNameConfig, sVersion, pPluginInfo->m_sGuid, pPluginInfo->m_bIgnore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user