Skip to content
Permalink
Browse files

Plugin re-enabled

  • Loading branch information
elpaso committed Dec 10, 2016
1 parent fc8493f commit ba143d0225313d262734297064ccd19a2f66bb19
Showing with 28 additions and 23 deletions.
  1. +3 −0 src/server/qgis_map_serv.cpp
  2. +20 −21 src/server/qgsserver.cpp
  3. +5 −2 src/server/qgsserver.h
@@ -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 )
{
@@ -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 )
@@ -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;

0 comments on commit ba143d0

Please sign in to comment.
You can’t perform that action at this time.