mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Expose list of projects in cache to Python
This commit is contained in:
parent
0a1f4332eb
commit
44b8ed25ab
@ -66,6 +66,13 @@ value is ``False``).
|
||||
Returns the name of the current strategy
|
||||
|
||||
.. versionadded:: 3.26
|
||||
%End
|
||||
|
||||
QMap<QString, QDateTime> projects() const;
|
||||
%Docstring
|
||||
Returns projects currently in cache.
|
||||
|
||||
.. versionadded:: 3.30
|
||||
%End
|
||||
|
||||
public:
|
||||
|
@ -182,6 +182,19 @@ const QgsProject *QgsConfigCache::project( const QString &path, const QgsServerS
|
||||
return entry ? entry->second.get() : nullptr;
|
||||
}
|
||||
|
||||
QMap<QString, QDateTime> QgsConfigCache::projects() const
|
||||
{
|
||||
QMap<QString, QDateTime> projects;
|
||||
|
||||
const auto constKeys { mProjectCache.keys() };
|
||||
for ( const auto &path : std::as_const( constKeys ) )
|
||||
{
|
||||
projects[path] = mProjectCache[path]->first;
|
||||
}
|
||||
|
||||
return projects;
|
||||
}
|
||||
|
||||
QDomDocument *QgsConfigCache::xmlDocument( const QString &filePath )
|
||||
{
|
||||
//first open file
|
||||
|
@ -117,6 +117,12 @@ class SERVER_EXPORT QgsConfigCache : public QObject
|
||||
*/
|
||||
QString strategyName() const { return mStrategy->name(); }
|
||||
|
||||
/**
|
||||
* Returns projects currently in cache.
|
||||
* \since QGIS 3.30
|
||||
*/
|
||||
QMap<QString, QDateTime> projects() const;
|
||||
|
||||
public:
|
||||
//! Initialize from settings
|
||||
QgsConfigCache( QgsServerSettings *settings );
|
||||
|
Loading…
x
Reference in New Issue
Block a user