diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index eae5662abd4f..2a25f6354514 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -38,7 +38,6 @@ SET ( qgis_mapserv_SRCS qgsremotedatasourcebuilder.cpp qgssentdatasourcebuilder.cpp qgsserverlogger.cpp - qgsmapserverutils.cpp qgswcsprojectparser.cpp qgswfsprojectparser.cpp qgswmsconfigparser.cpp diff --git a/src/server/qgsmapserverutils.cpp b/src/server/qgsmapserverutils.cpp deleted file mode 100644 index 86e24a546ddf..000000000000 --- a/src/server/qgsmapserverutils.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - qgsmapserverutils.cpp - --------------------- - begin : August 2010 - copyright : (C) 2010 by Marco Hugentobler - email : marco dot hugentobler at sourcepole dot ch - *************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ -#include "qgsmapserverutils.h" -#include "qgslogger.h" -#include -#include -#include -#include -#include - -QString QgsMapServerUtils::createTempFilePath() -{ - - - //save the content of the file into a temporary location - //generate a name considering the current time - //struct timeval currentTime; - //gettimeofday(¤tTime, nullptr); - - time_t seconds; - time( &seconds ); - srand( seconds ); - - int randomNumber = rand(); - QString tempFileName = QString::number( randomNumber ); - QString tempFilePath; - //on windows, store the temporary file in current_path/tmp directory, - //on unix, store it in /tmp/qgis_wms_serv -#ifndef Q_OS_WIN - QDir tempFileDir( QStringLiteral( "/tmp/qgis_map_serv" ) ); - if ( !tempFileDir.exists() ) //make sure the directory exists - { - QDir tmpDir( QStringLiteral( "/tmp" ) ); - tmpDir.mkdir( QStringLiteral( "qgis_map_serv" ) ); - } - tempFilePath = "/tmp/qgis_map_serv/" + tempFileName; -#else - QDir tempFileDir( QDir::currentPath() + "/tmp" ); - if ( !tempFileDir.exists() ) - { - QDir currentDir( QDir::currentPath() ); - currentDir.mkdir( "tmp" ); - } - tempFilePath = QDir::currentPath() + "/tmp" + "/" + tempFileName; -#endif // Q_OS_WIN - - QFileInfo testFile( tempFilePath ); - while ( testFile.exists() ) - { - //change the name - tempFilePath += QLatin1String( "1" ); - testFile.setFile( tempFilePath ); - } - QgsDebugMsg( tempFilePath ); - return tempFilePath; -} - -int QgsMapServerUtils::createTextFile( const QString& filePath, const QString& text ) -{ - QFile file( filePath ); - if ( file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) ) - { - QTextStream fileStream( &file ); - fileStream << text; - file.close(); - return 0; - } - else - { - return 1; - } -} diff --git a/src/server/qgsmapserverutils.h b/src/server/qgsmapserverutils.h deleted file mode 100644 index 3af0659151ad..000000000000 --- a/src/server/qgsmapserverutils.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - qgsmapserverutils.h - --------------------- - begin : August 2010 - copyright : (C) 2010 by Marco Hugentobler - email : marco dot hugentobler at sourcepole dot ch - *************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ -#ifndef QGSMAPSERVERUTILS_H -#define QGSMAPSERVERUTILS_H - -#include - -//! Some utility functions that may be included from everywhere in the code -namespace QgsMapServerUtils -{ - - /** Creates a ramdom filename for a temporary file. This function also creates the directory to store - the temporary files if it does not already exist. The directory is /tmp/qgis_map_serv/ under linux or - the current working directory on windows*/ - QString createTempFilePath(); - //! Stores the specified text in a temporary file. Returns 0 in case of success - int createTextFile( const QString& filePath, const QString& text ); -} - -#endif diff --git a/src/server/qgsserverplugins.cpp b/src/server/qgsserverplugins.cpp index 6efc678b940c..cc02fdabcdab 100644 --- a/src/server/qgsserverplugins.cpp +++ b/src/server/qgsserverplugins.cpp @@ -22,7 +22,6 @@ #include "qgslogger.h" #include "qgspythonutils.h" #include "qgsserverlogger.h" -#include "qgsmapserverutils.h" #include