Plugin re-enabled

This commit is contained in:
Alessandro Pasotti 2016-12-10 14:06:21 +01:00
parent fc8493f5d3
commit ba143d0225
3 changed files with 28 additions and 23 deletions

View File

@ -39,6 +39,9 @@ int main( int argc, char * argv[] )
{
QgsApplication app( argc, argv, getenv( "DISPLAY" ), QString(), QStringLiteral( "server" ) );
QgsServer server( false );
#ifdef HAVE_SERVER_PYTHON_PLUGINS
server.initPython();
#endif
// Starts FCGI loop
while ( fcgi_accept() >= 0 )
{

View File

@ -64,7 +64,6 @@ QgsCapabilitiesCache* QgsServer::sCapabilitiesCache = nullptr;
QgsMapRenderer* QgsServer::sMapRenderer = nullptr;
#ifdef HAVE_SERVER_PYTHON_PLUGINS
QgsServerInterfaceImpl*QgsServer::sServerInterface = nullptr;
bool QgsServer::sInitPython = true;
#endif
// Initialization must run once for all servers
bool QgsServer::sInitialised = false;
@ -316,10 +315,6 @@ bool QgsServer::init( )
return false;
}
#ifdef HAVE_SERVER_PYTHON_PLUGINS
sInitPython = false;
#endif
QgsServerLogger::instance();
#ifndef _MSC_VER
@ -398,28 +393,14 @@ bool QgsServer::init( )
QgsFontUtils::loadStandardTestFonts( QStringList() << QStringLiteral( "Roman" ) << QStringLiteral( "Bold" ) );
#endif
#ifdef HAVE_SERVER_PYTHON_PLUGINS
sServerInterface = new QgsServerInterfaceImpl( sCapabilitiesCache );
if ( sInitPython )
{
// Init plugins
if ( ! QgsServerPlugins::initPlugins( sServerInterface ) )
{
QgsMessageLog::logMessage( QStringLiteral( "No server python plugins are available" ), QStringLiteral( "Server" ), QgsMessageLog::INFO );
}
else
{
QgsMessageLog::logMessage( QStringLiteral( "Server python plugins loaded" ), QStringLiteral( "Server" ), QgsMessageLog::INFO );
}
}
#endif
QgsEditorWidgetRegistry::initEditors();
sInitialised = true;
QgsMessageLog::logMessage( QStringLiteral( "Server initialized" ), QStringLiteral( "Server" ), QgsMessageLog::INFO );
return true;
}
void QgsServer::putenv( const QString &var, const QString &val )
{
#ifdef _MSC_VER
@ -645,6 +626,24 @@ QPair<QByteArray, QByteArray> QgsServer::handleRequest( const QString& queryStri
return theRequestHandler->getResponse();
}
#ifdef HAVE_SERVER_PYTHON_PLUGINS
void QgsServer::initPython()
{
/*
sServerInterface = new QgsServerInterfaceImpl( sCapabilitiesCache );
// Init plugins
if ( ! QgsServerPlugins::initPlugins( sServerInterface ) )
{
QgsMessageLog::logMessage( QStringLiteral( "No server python plugins are available" ), QStringLiteral( "Server" ), QgsMessageLog::INFO );
}
else
{
QgsMessageLog::logMessage( QStringLiteral( "Server python plugins loaded" ), QStringLiteral( "Server" ), QgsMessageLog::INFO );
}
*/
}
#endif
#if 0
// The following code was used to test type conversion in python bindings
QPair<QByteArray, QByteArray> QgsServer::testQPair( QPair<QByteArray, QByteArray> pair )

View File

@ -78,9 +78,13 @@ class SERVER_EXPORT QgsServer
QPair<QByteArray, QByteArray> testQPair( QPair<QByteArray, QByteArray> pair );
#endif
//! Returns a pointer to the server interface
#ifdef HAVE_SERVER_PYTHON_PLUGINS
//! Returns a pointer to the server interface
QgsServerInterfaceImpl* serverInterface() { return sServerInterface; }
//! Intialize python
//! Note: not in python bindings
void initPython( );
#endif
private:
@ -120,7 +124,6 @@ class SERVER_EXPORT QgsServer
static QgsMapRenderer* sMapRenderer;
#ifdef HAVE_SERVER_PYTHON_PLUGINS
static QgsServerInterfaceImpl* sServerInterface;
static bool sInitPython;
#endif
//! Initialization must run once for all servers
static bool sInitialised;