summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-04-24 19:16:06 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-04-24 20:22:49 +0200
commit2d2b19dea1ab401b1b4971ff5b12b87bb11fd666 (patch)
treea13afa06cc3e153353077180c973024c39ea5f8e
parentde562138eabd3ee3ecab28e5d1348a3fee7301e0 (diff)
Force ExtensionManager resync when the implementation changes
...as checking the lastsynchronized time-stamps can give wrong results if new and old impl use same user config and old impl is started once more after new impl is installed, in which case per-user data of bundled exts of new impl would not be regenerated, leading to inconsistencies.
-rw-r--r--desktop/inc/app.hxx4
-rw-r--r--desktop/source/app/app.cxx12
-rw-r--r--desktop/source/app/check_ext_deps.cxx55
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx2
-rw-r--r--desktop/source/deployment/inc/dp_misc.h3
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx2
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx6
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_app.cxx2
8 files changed, 42 insertions, 44 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index fa4553afdc87..28b2c63d965a 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -130,12 +130,14 @@ class Desktop : public Application
static sal_Bool isCrashReporterEnabled();
// first-start (ever) related methods
+ static bool newInstallation();
+
static sal_Bool CheckExtensionDependencies();
static void DoRestartActionsIfNecessary( sal_Bool bQuickStart );
static void SetRestartState();
- void SynchronizeExtensionRepositories();
+ void SynchronizeExtensionRepositories(bool force);
void SetSplashScreenText( const ::rtl::OUString& rText );
void SetSplashScreenProgress( sal_Int32 );
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 6df1561c2c84..5d299e125526 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1608,10 +1608,14 @@ int Desktop::Main()
// Check if bundled or shared extensions were added /removed
// and process those extensions (has to be done before checking
// the extension dependencies!
- SynchronizeExtensionRepositories();
- bool bAbort = CheckExtensionDependencies();
- if ( bAbort )
- return EXIT_FAILURE;
+ bool newInst = newInstallation();
+ SynchronizeExtensionRepositories(newInst);
+ if ( newInst )
+ {
+ bool bAbort = CheckExtensionDependencies();
+ if ( bAbort )
+ return EXIT_FAILURE;
+ }
{
::comphelper::ComponentContext aContext( xSMgr );
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
index 9a48732091f7..2e0d24a3d3b9 100644
--- a/desktop/source/app/check_ext_deps.cxx
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -344,33 +344,12 @@ static void impl_setNeedsCompatCheck()
}
//------------------------------------------------------------------------------
-static bool impl_check()
-{
- uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext();
-
- bool bDependenciesValid = impl_checkDependencies( xContext );
-
- short nRet = 0;
-
- if ( !bDependenciesValid )
- nRet = impl_showExtensionDialog( xContext );
-
- if ( nRet == -1 )
- {
- impl_setNeedsCompatCheck();
- return true;
- }
- else
- return false;
-}
-
-//------------------------------------------------------------------------------
// to check if we need checking the dependencies of the extensions again, we compare
// the build id of the office with the one of the last check
//------------------------------------------------------------------------------
-static bool impl_needsCompatCheck()
+bool Desktop::newInstallation()
{
- bool bNeedsCheck = false;
+ bool bNewInst = false;
rtl::OUString aLastCheckBuildID;
rtl::OUString aCurrentBuildID( UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) );
rtl::Bootstrap::expandMacros( aCurrentBuildID );
@@ -392,18 +371,18 @@ static bool impl_needsCompatCheck()
result >>= aLastCheckBuildID;
if ( aLastCheckBuildID != aCurrentBuildID )
{
- bNeedsCheck = true;
+ bNewInst = true;
result <<= aCurrentBuildID;
pset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LastCompatibilityCheckID")), result );
Reference< util::XChangesBatch >( pset, UNO_QUERY_THROW )->commitChanges();
}
#ifdef DEBUG
- bNeedsCheck = true;
+ bNewInst = true;
#endif
}
- catch (const Exception&) {}
+ catch (const com::sun::star::uno::Exception&) {}
- return bNeedsCheck;
+ return bNewInst;
}
//------------------------------------------------------------------------------
@@ -411,18 +390,28 @@ static bool impl_needsCompatCheck()
// When there are unresolved issues, we can't continue with startup
sal_Bool Desktop::CheckExtensionDependencies()
{
- sal_Bool bAbort = false;
+ uno::Reference< uno::XComponentContext > xContext = comphelper_getProcessComponentContext();
- if ( impl_needsCompatCheck() )
- bAbort = impl_check();
+ bool bDependenciesValid = impl_checkDependencies( xContext );
- return bAbort;
+ short nRet = 0;
+
+ if ( !bDependenciesValid )
+ nRet = impl_showExtensionDialog( xContext );
+
+ if ( nRet == -1 )
+ {
+ impl_setNeedsCompatCheck();
+ return true;
+ }
+ else
+ return false;
}
-void Desktop::SynchronizeExtensionRepositories()
+void Desktop::SynchronizeExtensionRepositories(bool force)
{
RTL_LOGFILE_CONTEXT(aLog,"desktop (jl) ::Desktop::SynchronizeExtensionRepositories");
- dp_misc::syncRepositories( new SilentCommandEnv( this ) );
+ dp_misc::syncRepositories( force, new SilentCommandEnv( this ) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 29ded177175a..7795e3093cc3 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -1124,7 +1124,7 @@ void ExtensionCmdQueue::acceptLicense( const uno::Reference< deployment::XPackag
void ExtensionCmdQueue::syncRepositories( const uno::Reference< uno::XComponentContext > &xContext )
{
- dp_misc::syncRepositories( new ProgressCmdEnv( xContext, NULL, OUSTR("Extension Manager") ) );
+ dp_misc::syncRepositories( false, new ProgressCmdEnv( xContext, NULL, OUSTR("Extension Manager") ) );
}
void ExtensionCmdQueue::stop()
diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h
index 29fd14007d71..e9ad4a2b1d24 100644
--- a/desktop/source/deployment/inc/dp_misc.h
+++ b/desktop/source/deployment/inc/dp_misc.h
@@ -154,7 +154,8 @@ void TRACE(::rtl::OUString const & sText);
recently added or removed.
*/
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
-void syncRepositories(::com::sun::star::uno::Reference<
+void syncRepositories(bool force,
+ ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment> const & xCmdEnv);
}
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index b5822ecfbcc4..2e22863536d4 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -1223,7 +1223,7 @@ void ExtensionManager::reinstallDeployedExtensions(
xPackageManager->reinstallDeployedPackages(xAbortChannel, xCmdEnv);
//We must sync here, otherwise we will get exceptions when extensions
//are removed.
- dp_misc::syncRepositories(xCmdEnv);
+ dp_misc::syncRepositories(false, xCmdEnv);
const uno::Sequence< Reference<deploy::XPackage> > extensions(
xPackageManager->getDeployedPackages(xAbortChannel, xCmdEnv));
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index eb4e6dc4720d..9ed579fbb97c 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -590,7 +590,8 @@ void TRACE(::rtl::OString const & sText)
#endif
}
-void syncRepositories(Reference<ucb::XCommandEnvironment> const & xCmdEnv)
+void syncRepositories(
+ bool force, Reference<ucb::XCommandEnvironment> const & xCmdEnv)
{
OUString sDisable;
::rtl::Bootstrap::get( OUSTR( "DISABLE_EXTENSION_SYNCHRONIZATION" ), sDisable, OUString() );
@@ -601,7 +602,8 @@ void syncRepositories(Reference<ucb::XCommandEnvironment> const & xCmdEnv)
//synchronize shared before bundled otherewise there are
//more revoke and registration calls.
sal_Bool bModified = false;
- if (needToSyncRepostitory(OUString(RTL_CONSTASCII_USTRINGPARAM("shared")))
+ if (force
+ || needToSyncRepostitory(OUString(RTL_CONSTASCII_USTRINGPARAM("shared")))
|| needToSyncRepostitory(OUString(RTL_CONSTASCII_USTRINGPARAM("bundled"))))
{
xExtensionManager =
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index 2bd4d1b99214..205e6ef82a31 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -432,7 +432,7 @@ extern "C" DESKTOP_DLLPUBLIC int unopkg_main()
if (!subcmd_gui && ! subCommand.equals(OUSTR("reinstall"))
&& ! subCommand.equals(OUSTR("sync"))
&& ! dp_misc::office_is_running())
- dp_misc::syncRepositories(xCmdEnv);
+ dp_misc::syncRepositories(false, xCmdEnv);
if ( subcmd_add || subCommand == "remove" )
{