1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 //TODO: Large parts of this file were copied from dp_component.cxx; those parts
21 // should be consolidated.
23 #include <config_extensions.h>
25 #include <dp_backend.h>
26 #if HAVE_FEATURE_EXTENSIONS
27 #include <dp_persmap.h>
31 #include <rtl/string.hxx>
32 #include <rtl/strbuf.hxx>
33 #include <rtl/ustrbuf.hxx>
34 #include <cppuhelper/exc_hlp.hxx>
35 #include <cppuhelper/supportsservice.hxx>
36 #include <ucbhelper/content.hxx>
37 #include <unotools/ucbhelper.hxx>
38 #include <xmlscript/xml_helper.hxx>
39 #include <comphelper/lok.hxx>
40 #include <comphelper/xmlencode.hxx>
41 #include <svl/inettype.hxx>
42 #include <o3tl/string_view.hxx>
43 #include <com/sun/star/configuration/Update.hpp>
44 #include <com/sun/star/lang/IllegalArgumentException.hpp>
45 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
48 #include <string_view>
51 #include "dp_configurationbackenddb.hxx"
53 using namespace ::dp_misc
;
54 using namespace ::com::sun::star
;
55 using namespace ::com::sun::star::uno
;
56 using namespace ::com::sun::star::ucb
;
58 namespace dp_registry::backend::configuration
{
61 class BackendImpl
: public ::dp_registry::backend::PackageRegistryBackend
63 class PackageImpl
: public ::dp_registry::backend::Package
65 BackendImpl
* getMyBackend() const ;
67 const bool m_isSchema
;
70 virtual beans::Optional
< beans::Ambiguous
<sal_Bool
> > isRegistered_(
71 ::osl::ResettableMutexGuard
& guard
,
72 ::rtl::Reference
<AbortChannel
> const & abortChannel
,
73 Reference
<XCommandEnvironment
> const & xCmdEnv
) override
;
74 virtual void processPackage_(
75 ::osl::ResettableMutexGuard
& guard
,
78 ::rtl::Reference
<AbortChannel
> const & abortChannel
,
79 Reference
<XCommandEnvironment
> const & xCmdEnv
) override
;
83 ::rtl::Reference
<PackageRegistryBackend
> const & myBackend
,
84 OUString
const & url
, OUString
const & name
,
85 Reference
<deployment::XPackageTypeInfo
> const & xPackageType
,
86 bool isSchema
, bool bRemoved
, OUString
const & identifier
)
87 : Package( myBackend
, url
, name
, name
/* display-name */,
88 xPackageType
, bRemoved
, identifier
),
89 m_isSchema( isSchema
)
92 friend class PackageImpl
;
94 std::deque
<OUString
> m_xcs_files
;
95 std::deque
<OUString
> m_xcu_files
;
96 std::deque
<OUString
> & getFiles( bool xcs
) {
97 return xcs
? m_xcs_files
: m_xcu_files
;
100 bool m_configmgrini_inited
;
101 bool m_configmgrini_modified
;
102 std::unique_ptr
<ConfigurationBackendDb
> m_backendDb
;
104 // PackageRegistryBackend
105 virtual Reference
<deployment::XPackage
> bindPackage_(
106 OUString
const & url
, OUString
const & mediaType
, bool bRemoved
,
107 OUString
const & identifier
,
108 Reference
<XCommandEnvironment
> const & xCmdEnv
) override
;
110 #if HAVE_FEATURE_EXTENSIONS
111 // for backwards compatibility - nil if no (compatible) back-compat db present
112 std::unique_ptr
<PersistentMap
> m_registeredPackages
;
115 virtual void SAL_CALL
disposing() override
;
117 const Reference
<deployment::XPackageTypeInfo
> m_xConfDataTypeInfo
;
118 const Reference
<deployment::XPackageTypeInfo
> m_xConfSchemaTypeInfo
;
119 Sequence
< Reference
<deployment::XPackageTypeInfo
> > m_typeInfos
;
121 void configmgrini_verify_init(
122 Reference
<XCommandEnvironment
> const & xCmdEnv
);
123 void configmgrini_flush( Reference
<XCommandEnvironment
> const & xCmdEnv
);
125 /* The parameter isURL is false in the case of adding the conf:ini-entry
126 value from the backend db. This entry already contains the path as it
127 is used in the configmgr.ini.
129 void addToConfigmgrIni( bool isSchema
, bool isURL
, OUString
const & url
,
130 Reference
<XCommandEnvironment
> const & xCmdEnv
);
131 #if HAVE_FEATURE_EXTENSIONS
132 bool removeFromConfigmgrIni( bool isSchema
, OUString
const & url
,
133 Reference
<XCommandEnvironment
> const & xCmdEnv
);
135 void addDataToDb(OUString
const & url
, ConfigurationBackendDb::Data
const & data
);
136 ::std::optional
<ConfigurationBackendDb::Data
> readDataFromDb(std::u16string_view url
);
137 void revokeEntryFromDb(std::u16string_view url
);
138 bool hasActiveEntry(std::u16string_view url
);
139 bool activateEntry(std::u16string_view url
);
142 BackendImpl( Sequence
<Any
> const & args
,
143 Reference
<XComponentContext
> const & xComponentContext
);
146 virtual OUString SAL_CALL
getImplementationName() override
;
147 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
148 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
151 virtual Sequence
< Reference
<deployment::XPackageTypeInfo
> > SAL_CALL
152 getSupportedPackageTypes() override
;
153 virtual void SAL_CALL
packageRemoved(OUString
const & url
, OUString
const & mediaType
) override
;
155 using PackageRegistryBackend::disposing
;
159 void BackendImpl::disposing()
162 configmgrini_flush( Reference
<XCommandEnvironment
>() );
164 PackageRegistryBackend::disposing();
166 catch (const RuntimeException
&) {
169 catch (const Exception
&) {
170 Any
exc( ::cppu::getCaughtException() );
171 throw lang::WrappedTargetRuntimeException(
172 "caught unexpected exception while disposing...",
173 static_cast<OWeakObject
*>(this), exc
);
178 BackendImpl::BackendImpl(
179 Sequence
<Any
> const & args
,
180 Reference
<XComponentContext
> const & xComponentContext
)
181 : PackageRegistryBackend( args
, xComponentContext
),
182 m_configmgrini_inited( false ),
183 m_configmgrini_modified( false ),
184 m_xConfDataTypeInfo( new Package::TypeInfo(
185 "application/vnd.sun.star.configuration-data",
187 DpResId(RID_STR_CONF_DATA
)
189 m_xConfSchemaTypeInfo( new Package::TypeInfo(
190 "application/vnd.sun.star.configuration-schema",
192 DpResId(RID_STR_CONF_SCHEMA
)
194 m_typeInfos
{ m_xConfDataTypeInfo
, m_xConfSchemaTypeInfo
}
196 const Reference
<XCommandEnvironment
> xCmdEnv
;
204 OUString dbFile
= makeURL(getCachePath(), "backenddb.xml");
206 new ConfigurationBackendDb(getComponentContext(), dbFile
));
207 //clean up data folders which are no longer used.
208 //This must not be done in the same process where the help files
209 //are still registers. Only after revoking and restarting OOo the folders
210 //can be removed. This works now, because the extension manager is a singleton
211 //and the backends are only create once per process.
212 std::vector
<OUString
> folders
= m_backendDb
->getAllDataUrls();
213 deleteUnusedFolders(folders
);
215 configmgrini_verify_init( xCmdEnv
);
217 #if HAVE_FEATURE_EXTENSIONS
218 std::unique_ptr
<PersistentMap
> pMap
;
219 OUString
aCompatURL( makeURL( getCachePath(), "registered_packages.pmap" ) );
221 // Don't create it if it doesn't exist already
222 if ( ::utl::UCBContentHelper::Exists( expandUnoRcUrl( aCompatURL
) ) )
226 pMap
.reset( new PersistentMap( aCompatURL
) );
228 catch (const Exception
&e
)
230 OUString aStr
= "Exception loading legacy package database: '" +
232 "' - ignoring file, please remove it.\n";
233 dp_misc::writeConsole( aStr
);
236 m_registeredPackages
= std::move(pMap
);
242 OUString
BackendImpl::getImplementationName()
244 return "com.sun.star.comp.deployment.configuration.PackageRegistryBackend";
247 sal_Bool
BackendImpl::supportsService( const OUString
& ServiceName
)
249 return cppu::supportsService(this, ServiceName
);
252 css::uno::Sequence
< OUString
> BackendImpl::getSupportedServiceNames()
254 return { BACKEND_SERVICE_NAME
};
257 void BackendImpl::addDataToDb(
258 OUString
const & url
, ConfigurationBackendDb::Data
const & data
)
261 m_backendDb
->addEntry(url
, data
);
264 ::std::optional
<ConfigurationBackendDb::Data
> BackendImpl::readDataFromDb(
265 std::u16string_view url
)
267 ::std::optional
<ConfigurationBackendDb::Data
> data
;
269 data
= m_backendDb
->getEntry(url
);
273 void BackendImpl::revokeEntryFromDb(std::u16string_view url
)
276 m_backendDb
->revokeEntry(url
);
279 bool BackendImpl::hasActiveEntry(std::u16string_view url
)
282 return m_backendDb
->hasActiveEntry(url
);
286 bool BackendImpl::activateEntry(std::u16string_view url
)
289 return m_backendDb
->activateEntry(url
);
296 Sequence
< Reference
<deployment::XPackageTypeInfo
> >
297 BackendImpl::getSupportedPackageTypes()
301 void BackendImpl::packageRemoved(OUString
const & url
, OUString
const & /*mediaType*/)
304 m_backendDb
->removeEntry(url
);
307 // PackageRegistryBackend
309 Reference
<deployment::XPackage
> BackendImpl::bindPackage_(
310 OUString
const & url
, OUString
const & mediaType_
,
311 bool bRemoved
, OUString
const & identifier
,
312 Reference
<XCommandEnvironment
> const & xCmdEnv
)
314 OUString
mediaType( mediaType_
);
315 if (mediaType
.isEmpty())
317 // detect media-type:
318 ::ucbhelper::Content ucbContent
;
319 if (create_ucb_content( &ucbContent
, url
, xCmdEnv
))
321 const OUString
title( StrTitle::getTitle( ucbContent
) );
322 if (title
.endsWithIgnoreAsciiCase( ".xcu" )) {
323 mediaType
= "application/vnd.sun.star.configuration-data";
325 if (title
.endsWithIgnoreAsciiCase( ".xcs" )) {
326 mediaType
= "application/vnd.sun.star.configuration-schema";
329 if (mediaType
.isEmpty())
330 throw lang::IllegalArgumentException(
331 StrCannotDetectMediaType() + url
,
332 static_cast<OWeakObject
*>(this), static_cast<sal_Int16
>(-1) );
335 OUString type
, subType
;
336 INetContentTypeParameterList params
;
337 if (INetContentTypes::parse( mediaType
, type
, subType
, ¶ms
))
339 if (type
.equalsIgnoreAsciiCase("application"))
344 ::ucbhelper::Content
ucbContent( url
, xCmdEnv
, m_xComponentContext
);
345 name
= StrTitle::getTitle( ucbContent
);
348 if (subType
.equalsIgnoreAsciiCase( "vnd.sun.star.configuration-data"))
350 return new PackageImpl(
351 this, url
, name
, m_xConfDataTypeInfo
, false /* data file */,
352 bRemoved
, identifier
);
354 else if (subType
.equalsIgnoreAsciiCase( "vnd.sun.star.configuration-schema")) {
355 return new PackageImpl(
356 this, url
, name
, m_xConfSchemaTypeInfo
, true /* schema file */,
357 bRemoved
, identifier
);
361 throw lang::IllegalArgumentException(
362 StrUnsupportedMediaType() + mediaType
,
363 static_cast<OWeakObject
*>(this),
364 static_cast<sal_Int16
>(-1) );
368 void BackendImpl::configmgrini_verify_init(
369 Reference
<XCommandEnvironment
> const & xCmdEnv
)
373 const ::osl::MutexGuard
guard( m_aMutex
);
374 if ( m_configmgrini_inited
)
378 ::ucbhelper::Content ucb_content
;
379 if (create_ucb_content(
381 makeURL( getCachePath(), "configmgr.ini" ),
382 xCmdEnv
, false /* no throw */ ))
385 if (readLine( &line
, u
"SCHEMA=", ucb_content
,
386 RTL_TEXTENCODING_UTF8
))
388 sal_Int32 index
= RTL_CONSTASCII_LENGTH("SCHEMA=");
390 OUString
token( o3tl::trim(o3tl::getToken(line
, 0, ' ', index
)) );
391 if (!token
.isEmpty()) {
392 //The file may not exist anymore if a shared or bundled
393 //extension was removed, but it can still be in the configmgrini.
394 //After running XExtensionManager::synchronize, the configmgrini is
396 m_xcs_files
.push_back( token
);
401 if (readLine( &line
, u
"DATA=", ucb_content
,
402 RTL_TEXTENCODING_UTF8
)) {
403 sal_Int32 index
= RTL_CONSTASCII_LENGTH("DATA=");
405 std::u16string_view
token( o3tl::trim(o3tl::getToken(line
, 0, ' ', index
)) );
408 if (token
[ 0 ] == '?')
409 token
= token
.substr( 1 );
410 //The file may not exist anymore if a shared or bundled
411 //extension was removed, but it can still be in the configmgrini.
412 //After running XExtensionManager::synchronize, the configmgrini is
414 m_xcu_files
.push_back( OUString(token
) );
420 m_configmgrini_modified
= false;
421 m_configmgrini_inited
= true;
425 void BackendImpl::configmgrini_flush(
426 Reference
<XCommandEnvironment
> const & xCmdEnv
)
430 if (!m_configmgrini_inited
|| !m_configmgrini_modified
)
434 if (! m_xcs_files
.empty())
436 auto iPos( m_xcs_files
.cbegin() );
437 auto const iEnd( m_xcs_files
.cend() );
438 buf
.append( "SCHEMA=" );
439 while (iPos
!= iEnd
) {
440 // encoded ASCII file-urls:
442 OUStringToOString( *iPos
, RTL_TEXTENCODING_ASCII_US
) );
450 if (! m_xcu_files
.empty())
452 auto iPos( m_xcu_files
.cbegin() );
453 auto const iEnd( m_xcu_files
.cend() );
454 buf
.append( "DATA=" );
455 while (iPos
!= iEnd
) {
456 // encoded ASCII file-urls:
458 OUStringToOString( *iPos
, RTL_TEXTENCODING_ASCII_US
) );
467 // write configmgr.ini:
468 const Reference
<io::XInputStream
> xData(
469 ::xmlscript::createInputStream(
470 reinterpret_cast<sal_Int8
const *>(buf
.getStr()),
472 ::ucbhelper::Content
ucb_content(
473 makeURL( getCachePath(), "configmgr.ini" ), xCmdEnv
, m_xComponentContext
);
474 ucb_content
.writeStream( xData
, true /* replace existing */ );
476 m_configmgrini_modified
= false;
480 void BackendImpl::addToConfigmgrIni( bool isSchema
, bool isURL
, OUString
const & url_
,
481 Reference
<XCommandEnvironment
> const & xCmdEnv
)
483 const OUString
rcterm( isURL
? dp_misc::makeRcTerm(url_
) : url_
);
484 const ::osl::MutexGuard
guard( m_aMutex
);
485 configmgrini_verify_init( xCmdEnv
);
486 std::deque
<OUString
> & rSet
= getFiles(isSchema
);
487 if (std::find( rSet
.begin(), rSet
.end(), rcterm
) == rSet
.end()) {
488 rSet
.push_front( rcterm
); // prepend to list, thus overriding
489 // write immediately:
490 m_configmgrini_modified
= true;
491 configmgrini_flush( xCmdEnv
);
495 #if HAVE_FEATURE_EXTENSIONS
496 bool BackendImpl::removeFromConfigmgrIni(
497 bool isSchema
, OUString
const & url_
,
498 Reference
<XCommandEnvironment
> const & xCmdEnv
)
500 const OUString
rcterm( dp_misc::makeRcTerm(url_
) );
501 const ::osl::MutexGuard
guard( m_aMutex
);
502 configmgrini_verify_init( xCmdEnv
);
503 std::deque
<OUString
> & rSet
= getFiles(isSchema
);
504 auto i(std::find(rSet
.begin(), rSet
.end(), rcterm
));
505 if (i
== rSet
.end() && !isSchema
)
507 //in case the xcu contained %origin% then the configmr.ini contains the
508 //url to the file in the user installation (e.g. $BUNDLED_EXTENSIONS_USER)
509 //However, m_url (getURL()) contains the URL for the file in the actual
510 //extension installation.
511 ::std::optional
<ConfigurationBackendDb::Data
> data
= readDataFromDb(url_
);
513 i
= std::find(rSet
.begin(), rSet
.end(), data
->iniEntry
);
515 if (i
== rSet
.end()) {
519 // write immediately:
520 m_configmgrini_modified
= true;
521 configmgrini_flush( xCmdEnv
);
529 BackendImpl
* BackendImpl::PackageImpl::getMyBackend() const
531 BackendImpl
* pBackend
= static_cast<BackendImpl
*>(m_myBackend
.get());
532 if (nullptr == pBackend
)
534 //May throw a DisposedException
536 //We should never get here...
537 throw RuntimeException(
538 "Failed to get the BackendImpl",
539 static_cast<OWeakObject
*>(const_cast<PackageImpl
*>(this)));
544 beans::Optional
< beans::Ambiguous
<sal_Bool
> >
545 BackendImpl::PackageImpl::isRegistered_(
546 ::osl::ResettableMutexGuard
&,
547 ::rtl::Reference
<AbortChannel
> const &,
548 Reference
<XCommandEnvironment
> const & )
550 BackendImpl
* that
= getMyBackend();
553 if (that
->hasActiveEntry(getURL()))
556 #if HAVE_FEATURE_EXTENSIONS
557 const OUString
url(getURL());
558 if (!bReg
&& that
->m_registeredPackages
)
560 // fallback for user extension registered in berkeley DB
561 bReg
= that
->m_registeredPackages
->has(
562 OUStringToOString( url
, RTL_TEXTENCODING_UTF8
));
565 return beans::Optional
< beans::Ambiguous
<sal_Bool
> >(
566 true, beans::Ambiguous
<sal_Bool
>( bReg
, false ) );
570 OUString
replaceOrigin(
571 OUString
const & url
, std::u16string_view destFolder
, Reference
< XCommandEnvironment
> const & xCmdEnv
, Reference
< XComponentContext
> const & xContext
, bool & out_replaced
)
573 // looking for %origin%:
574 ::ucbhelper::Content
ucb_content( url
, xCmdEnv
, xContext
);
575 std::vector
<sal_Int8
> bytes( readFile( ucb_content
) );
576 std::vector
<sal_Int8
> filtered( bytes
.size() * 2 );
577 bool use_filtered
= false;
579 char const * pBytes
= reinterpret_cast<char const *>(
581 std::size_t nBytes
= bytes
.size();
582 size_t write_pos
= 0;
585 sal_Int32 index
= rtl_str_indexOfChar_WithLength( pBytes
, nBytes
, '%' );
587 if (! use_filtered
) // opt
592 if ((write_pos
+ index
) > filtered
.size())
593 filtered
.resize( (filtered
.size() + index
) * 2 );
594 memcpy( filtered
.data() + write_pos
, pBytes
, index
);
604 char const * pAdd
= "%";
606 if (nBytes
> 1 && pBytes
[ 0 ] == '%')
613 else if (rtl_str_shortenedCompare_WithLength(
616 RTL_CONSTASCII_LENGTH("origin%"),
617 RTL_CONSTASCII_LENGTH("origin%")) == 0)
619 if (origin
.isEmpty()) {
621 origin
= OUStringToOString(
622 comphelper::string::encodeForXml( url
.subView( 0, url
.lastIndexOf( '/' ) ) ),
623 // xxx todo: encode always for UTF-8? => lookup doc-header?
624 RTL_TEXTENCODING_UTF8
);
626 pAdd
= origin
.getStr();
627 nAdd
= origin
.getLength();
628 pBytes
+= RTL_CONSTASCII_LENGTH("origin%");
629 nBytes
-= RTL_CONSTASCII_LENGTH("origin%");
632 if ((write_pos
+ nAdd
) > filtered
.size())
633 filtered
.resize( (filtered
.size() + nAdd
) * 2 );
634 memcpy( filtered
.data() + write_pos
, pAdd
, nAdd
);
639 if (write_pos
< filtered
.size())
640 filtered
.resize( write_pos
);
641 OUString
newUrl(url
);
642 if (!destFolder
.empty())
644 //get the file name of the xcu and add it to the url of the temporary folder
645 sal_Int32 i
= url
.lastIndexOf('/');
646 newUrl
= OUString::Concat(destFolder
) + url
.subView(i
);
649 ucbhelper::Content(newUrl
, xCmdEnv
, xContext
).writeStream(
650 xmlscript::createInputStream(std::move(filtered
)), true);
656 void BackendImpl::PackageImpl::processPackage_(
657 ::osl::ResettableMutexGuard
&,
658 bool doRegisterPackage
,
660 ::rtl::Reference
<AbortChannel
> const &,
661 Reference
<XCommandEnvironment
> const & xCmdEnv
)
663 BackendImpl
* that
= getMyBackend();
664 OUString
url( getURL() );
666 if (doRegisterPackage
)
668 if (getMyBackend()->activateEntry(getURL()))
670 ::std::optional
<ConfigurationBackendDb::Data
> data
= that
->readDataFromDb(url
);
672 that
->addToConfigmgrIni( m_isSchema
, false, data
->iniEntry
, xCmdEnv
);
676 ConfigurationBackendDb::Data data
;
679 const OUString sModFolder
= that
->createFolder(xCmdEnv
);
680 bool out_replaced
= false;
681 url
= replaceOrigin(url
, sModFolder
, xCmdEnv
, that
->getComponentContext(), out_replaced
);
683 data
.dataUrl
= sModFolder
;
685 deleteTempFolder(sModFolder
);
687 //No need for live-deployment for bundled extension, because OOo
688 //restarts after installation
689 if ((that
->m_eContext
!= Context::Bundled
&& !startup
)
690 || comphelper::LibreOfficeKit::isActive())
694 css::configuration::Update::get(
695 that
->m_xComponentContext
)->insertExtensionXcsFile(
696 that
->m_eContext
== Context::Shared
, expandUnoRcUrl(url
));
700 css::configuration::Update::get(
701 that
->m_xComponentContext
)->insertExtensionXcuFile(
702 that
->m_eContext
== Context::Shared
, expandUnoRcUrl(url
));
705 that
->addToConfigmgrIni( m_isSchema
, true, url
, xCmdEnv
);
706 data
.iniEntry
= dp_misc::makeRcTerm(url
);
707 that
->addDataToDb(getURL(), data
);
712 #if HAVE_FEATURE_EXTENSIONS
713 if (!that
->removeFromConfigmgrIni(m_isSchema
, url
, xCmdEnv
) &&
714 that
->m_registeredPackages
) {
715 // Obsolete package database handling - should be removed for LibreOffice 4.0
716 t_string2string_map
entries(
717 that
->m_registeredPackages
->getEntries());
718 for (auto const& entry
: entries
)
720 //If the xcu file was installed before the configmgr was changed
721 //to use the configmgr.ini, one needed to rebuild to whole directory
722 //structure containing the xcu, xcs files from all extensions. Now,
723 //we just add all other xcu/xcs files to the configmgr.ini instead of
724 //rebuilding the directory structure.
726 OStringToOUString(entry
.first
, RTL_TEXTENCODING_UTF8
));
728 bool schema
= entry
.second
.equalsIgnoreAsciiCase(
729 "vnd.sun.star.configuration-schema");
730 OUString
url_replaced(url2
);
731 ConfigurationBackendDb::Data data
;
734 const OUString sModFolder
= that
->createFolder(xCmdEnv
);
735 bool out_replaced
= false;
736 url_replaced
= replaceOrigin(
737 url2
, sModFolder
, xCmdEnv
, that
->getComponentContext(), out_replaced
);
739 data
.dataUrl
= sModFolder
;
741 deleteTempFolder(sModFolder
);
743 that
->addToConfigmgrIni(schema
, true, url_replaced
, xCmdEnv
);
744 data
.iniEntry
= dp_misc::makeRcTerm(url_replaced
);
745 that
->addDataToDb(url2
, data
);
747 that
->m_registeredPackages
->erase(entry
.first
);
751 ::ucbhelper::Content(
752 makeURL( that
->getCachePath(), "registry" ),
753 xCmdEnv
, that
->getComponentContext() ).executeCommand(
754 "delete", Any( true /* delete physically */ ) );
756 catch(const Exception
&)
762 ::std::optional
<ConfigurationBackendDb::Data
> data
= that
->readDataFromDb(url
);
763 //If an xcu file was life deployed then always a data entry is written.
764 //If the xcu file was already in the configmr.ini then there is also
766 if (!m_isSchema
&& data
)
768 css::configuration::Update::get(
769 that
->m_xComponentContext
)->removeExtensionXcuFile(expandUnoRcTerm(data
->iniEntry
));
771 that
->revokeEntryFromDb(url
);
777 } // namespace dp_registry
779 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
780 com_sun_star_comp_deployment_configuration_PackageRegistryBackend_get_implementation(
781 css::uno::XComponentContext
* context
, css::uno::Sequence
<css::uno::Any
> const& args
)
783 return cppu::acquire(new dp_registry::backend::configuration::BackendImpl(args
, context
));
786 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */