summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-08-02 18:10:03 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-08-02 18:26:39 +0200
commit81fd6b084b0f3c0eb5a97c77592f5ceb21d2dfb1 (patch)
treee5a9ee88b2e11c00060cc8f8e1e9d2d77b5c2f60
parent85a8a72067c4e13f3bddbe11e0899702202f4c4f (diff)
fdo#53006 Force reinstall of all bundled extensions on upgrade
...as the per-user data about bundled extensions can otherwise contain stale $BUNDLED_EXTENSIONS_PREREG references if the old installation used share/prereg/bundled/, the new one does not (cf. the fixing for fdo#51252 "LO cannot start (reports runtime error with Visual C++ Runtime Library)"), and a bundled extension did not change version. It is safe to tie this behavior to the existing "force" parameter of dp_misc::syncRepositories, as the only place that calls it with force=true is the call to Desktop::SynchronizeExtensionRepositories(newInst) in Desktop::Main, where newInst=true is the relevant condition for this behavior, too. As stated in XExtensionManager.idl, "this [...] can go again once no exisiting UserInstallation's user/extensions/bundled/ data can contain any $BUNDLED_EXTENSIONS_PREREG references any longer." Change-Id: I630dec8f2d20282ee47c65ac61ed2c9b062448e1
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx7
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.hxx1
-rw-r--r--desktop/source/deployment/manager/dp_manager.cxx26
-rw-r--r--desktop/source/deployment/manager/dp_manager.h2
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx2
-rw-r--r--offapi/com/sun/star/deployment/XExtensionManager.idl8
-rw-r--r--offapi/com/sun/star/deployment/XPackageManager.idl8
7 files changed, 39 insertions, 15 deletions
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index e5a16b7f6a0c..290df139a250 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -1278,7 +1278,7 @@ void ExtensionManager::synchronizeBundledPrereg(
Reference<deploy::XPackageManager> xMgr =
xPackageManagerFactory->getPackageManager(OUSTR("bundled_prereg"));
- xMgr->synchronize(xAbortChannel, xCmdEnv);
+ xMgr->synchronize(false, xAbortChannel, xCmdEnv);
progressBundled.update(OUSTR("\n\n"));
uno::Sequence<Reference<deploy::XPackage> > extensions = xMgr->getDeployedPackages(
@@ -1317,6 +1317,7 @@ void ExtensionManager::synchronizeBundledPrereg(
}
sal_Bool ExtensionManager::synchronize(
+ sal_Bool forceBundled,
Reference<task::XAbortChannel> const & xAbortChannel,
Reference<ucb::XCommandEnvironment> const & xCmdEnv )
throw (deploy::DeploymentException,
@@ -1333,13 +1334,13 @@ sal_Bool ExtensionManager::synchronize(
String sSynchronizingShared(StrSyncRepository::get());
sSynchronizingShared.SearchAndReplaceAllAscii( "%NAME", OUSTR("shared"));
dp_misc::ProgressLevel progressShared(xCmdEnv, sSynchronizingShared);
- bModified = getSharedRepository()->synchronize(xAbortChannel, xCmdEnv);
+ bModified = getSharedRepository()->synchronize(false, xAbortChannel, xCmdEnv);
progressShared.update(OUSTR("\n\n"));
String sSynchronizingBundled(StrSyncRepository::get());
sSynchronizingBundled.SearchAndReplaceAllAscii( "%NAME", OUSTR("bundled"));
dp_misc::ProgressLevel progressBundled(xCmdEnv, sSynchronizingBundled);
- bModified |= getBundledRepository()->synchronize(xAbortChannel, xCmdEnv);
+ bModified |= getBundledRepository()->synchronize(forceBundled, xAbortChannel, xCmdEnv);
progressBundled.update(OUSTR("\n\n"));
//Always determine the active extension. This is necessary for the
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx
index 800d91f437b6..05fcde825fbf 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.hxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx
@@ -193,6 +193,7 @@ public:
css::uno::RuntimeException);
virtual sal_Bool SAL_CALL synchronize(
+ sal_Bool forceBundled,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
throw (css::deployment::DeploymentException,
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index 2ddee4a55cc5..d7c8a2a3a154 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -1248,6 +1248,7 @@ void PackageManagerImpl::reinstallDeployedPackages(
return m_readOnly;
}
bool PackageManagerImpl::synchronizeRemovedExtensions(
+ bool force,
Reference<task::XAbortChannel> const & xAbortChannel,
Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
{
@@ -1271,15 +1272,19 @@ bool PackageManagerImpl::synchronizeRemovedExtensions(
if (bShared)
url = makeURLAppendSysPathSegment( url + OUSTR("_"), i->second.fileName);
- bool bRemoved = false;
- //Check if the URL to the extension is still the same
- ::ucbhelper::Content contentExtension;
+ bool bRemoved = force;
- if (!create_ucb_content(
- &contentExtension, url,
- Reference<XCommandEnvironment>(), false))
+ //Check if the URL to the extension is still the same
+ if (!bRemoved)
{
- bRemoved = true;
+ ::ucbhelper::Content contentExtension;
+
+ if (!create_ucb_content(
+ &contentExtension, url,
+ Reference<XCommandEnvironment>(), false))
+ {
+ bRemoved = true;
+ }
}
//The folder is in the extension database, but it can still be deleted.
@@ -1455,15 +1460,16 @@ bool PackageManagerImpl::synchronizeAddedExtensions(
}
}
}
- catch (const uno::Exception &)
+ catch (const uno::Exception & e)
{
- OSL_ASSERT(0);
+ SAL_WARN("desktop.deployment", e.Message);
}
}
return bModified;
}
sal_Bool PackageManagerImpl::synchronize(
+ sal_Bool force,
Reference<task::XAbortChannel> const & xAbortChannel,
Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
throw (css::deployment::DeploymentException,
@@ -1476,7 +1482,7 @@ sal_Bool PackageManagerImpl::synchronize(
if (m_context.equals(OUSTR("user")))
return bModified;
bModified |=
- synchronizeRemovedExtensions(xAbortChannel, xCmdEnv);
+ synchronizeRemovedExtensions(force, xAbortChannel, xCmdEnv);
bModified |= synchronizeAddedExtensions(xAbortChannel, xCmdEnv);
return bModified;
diff --git a/desktop/source/deployment/manager/dp_manager.h b/desktop/source/deployment/manager/dp_manager.h
index b88b51111062..cb3cbe82357b 100644
--- a/desktop/source/deployment/manager/dp_manager.h
+++ b/desktop/source/deployment/manager/dp_manager.h
@@ -82,6 +82,7 @@ class PackageManagerImpl : private ::dp_misc::MutexHolder, public t_pm_helper
css::uno::Reference<css::deployment::XPackage> const & package);
bool synchronizeRemovedExtensions(
+ bool force,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv);
@@ -239,6 +240,7 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL synchronize(
+ sal_Bool force,
css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel,
css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv )
throw (css::deployment::DeploymentException,
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index a2628164b64b..6f47e3df9c2c 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -568,7 +568,7 @@ void syncRepositories(
if (xExtensionManager.is())
{
bModified = xExtensionManager->synchronize(
- Reference<task::XAbortChannel>(), xCmdEnv);
+ force, Reference<task::XAbortChannel>(), xCmdEnv);
}
}
diff --git a/offapi/com/sun/star/deployment/XExtensionManager.idl b/offapi/com/sun/star/deployment/XExtensionManager.idl
index 7744ea6d839e..3809d905fa5a 100644
--- a/offapi/com/sun/star/deployment/XExtensionManager.idl
+++ b/offapi/com/sun/star/deployment/XExtensionManager.idl
@@ -285,11 +285,19 @@ interface XExtensionManager
The active extensions are determined. That is, shared or bundled extensions
are not necessaryly registered (<member>XPackage::registerPackage</member>).
+ @param forceBundled
+ whether to reinstall all bundled extensions even if their versions
+ have not changed (which might be necessary when an upgraded
+ installation outdates references to any share/prereg/bundled/
+ data; this parameter can go again once no exisiting
+ UserInstallation's user/extensions/bundled/ data can contain any
+ $BUNDLED_EXTENSIONS_PREREG references any longer)
@return
If true - then at least one extension was removed or added. Otherwise
nothing was changed.
*/
boolean synchronize(
+ [in] boolean forceBundled,
[in] com::sun::star::task::XAbortChannel xAbortChannel,
[in] com::sun::star::ucb::XCommandEnvironment xCmdEnv )
raises (DeploymentException,
diff --git a/offapi/com/sun/star/deployment/XPackageManager.idl b/offapi/com/sun/star/deployment/XPackageManager.idl
index 65cb24a6ac0f..842efdf3b5e4 100644
--- a/offapi/com/sun/star/deployment/XPackageManager.idl
+++ b/offapi/com/sun/star/deployment/XPackageManager.idl
@@ -259,6 +259,10 @@ interface XPackageManager
Added extensions will be added to the database and removed extensions
will be removed from the database.
+ @param force
+ whether to reinstall all extensions even if their versions have not
+ changed (see forceBundled parameter of
+ XExtensionManager.synchronize)
@param xAddedExtension
new extensions which may need to be registered.
@@ -268,7 +272,9 @@ interface XPackageManager
If true - then at least one extension was removed or added. Otherwise
nothing was changed.
*/
- boolean synchronize([in] com::sun::star::task::XAbortChannel xAbortChannel,
+ boolean synchronize(
+ [in] boolean force,
+ [in] com::sun::star::task::XAbortChannel xAbortChannel,
[in] com::sun::star::ucb::XCommandEnvironment xCmdEnv )
raises (DeploymentException,
com::sun::star::ucb::CommandFailedException,