From: SomeDude Date: Fri, 11 Jul 2008 17:01:00 +0000 (+0200) Subject: version 0.3.7 X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=commitdiff_plain;h=4855de56590e2f27d39036922339992c96bce9d1 version 0.3.7 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ab671d..db5f4f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,7 @@ src/http/pages/peerdetailspage.cpp src/http/pages/peermaintenancepage.cpp src/http/pages/peertrustpage.cpp src/http/pages/showcaptchapage.cpp +src/http/pages/versioninfopage.cpp src/nntp/extensiontrust.cpp src/nntp/mime src/nntp/nntpconnection.cpp diff --git a/include/global.h b/include/global.h index 204aa45..34eb58a 100644 --- a/include/global.h +++ b/include/global.h @@ -7,7 +7,7 @@ #define VERSION_MAJOR "0" #define VERSION_MINOR "3" -#define VERSION_RELEASE "6" +#define VERSION_RELEASE "7" #define FMS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_RELEASE typedef Poco::ScopedLock Guard; diff --git a/include/http/pages/versioninfopage.h b/include/http/pages/versioninfopage.h new file mode 100644 index 0000000..1d87554 --- /dev/null +++ b/include/http/pages/versioninfopage.h @@ -0,0 +1,20 @@ +#ifndef _versioninfopage_ +#define _versioninfopage_ + +#include "../ipagehandler.h" +#include "../../idatabase.h" + +class VersionInfoPage:public IPageHandler,public IDatabase +{ +public: + VersionInfoPage(const std::string &templatestr):IPageHandler(templatestr) {} + + IPageHandler *New() { return new VersionInfoPage(m_template); } + +private: + const bool WillHandleURI(const std::string &uri); + const std::string GeneratePage(const std::string &method, const std::map &queryvars); + +}; + +#endif // _versioninfopage_ diff --git a/src/dbmaintenancethread.cpp b/src/dbmaintenancethread.cpp index b613715..bfee4fb 100644 --- a/src/dbmaintenancethread.cpp +++ b/src/dbmaintenancethread.cpp @@ -20,6 +20,7 @@ DBMaintenanceThread::DBMaintenanceThread() m_last1day=Poco::Timestamp(); m_last1day-=Poco::Timespan(0,23,51,0,0); + m_deletemessagesolderthan=180; std::string tempval="180"; Option::Instance()->Get("DeleteMessagesOlderThan",tempval); StringFunctions::Convert(tempval,m_deletemessagesolderthan); @@ -252,6 +253,7 @@ void DBMaintenanceThread::Do1DayMaintenance() // delete old messages date=Poco::Timestamp(); date-=Poco::Timespan(m_deletemessagesolderthan,0,0,0,0); + m_log->trace("PeriodicDBMaintenance::Do1DayMaintenance deleting messages prior to "+Poco::DateTimeFormatter::format(date,"%Y-%m-%d")); st=m_db->Prepare("DELETE FROM tblMessage WHERE MessageDate #include #include +#include #ifdef _WIN32 #include @@ -99,7 +100,8 @@ void FMSApp::initialize(Poco::Util::Application &self) ServerApplication::initialize(self); // set working directory - fall back on application.dir if working directory isn't set - if(m_workingdirectory=="") + // if we are runing as a service, then working directory needs to be set to the application directory + if(m_workingdirectory=="" || config().getBool("application.runAsService",false)==true) { m_workingdirectory=config().getString("application.dir"); } diff --git a/src/http/fmshttprequesthandlerfactory.cpp b/src/http/fmshttprequesthandlerfactory.cpp index 46f31a2..8d89baa 100644 --- a/src/http/fmshttprequesthandlerfactory.cpp +++ b/src/http/fmshttprequesthandlerfactory.cpp @@ -16,6 +16,7 @@ #include "../../include/http/pages/controlboardpage.h" #include "../../include/http/pages/peermaintenancepage.h" #include "../../include/http/pages/peertrustpage.h" +#include "../../include/http/pages/versioninfopage.h" FMSHTTPRequestHandlerFactory::FMSHTTPRequestHandlerFactory() { @@ -52,6 +53,7 @@ FMSHTTPRequestHandlerFactory::FMSHTTPRequestHandlerFactory() m_pagehandlers.push_back(new ControlBoardPage(templatestr)); m_pagehandlers.push_back(new PeerMaintenancePage(templatestr)); m_pagehandlers.push_back(new PeerTrustPage(templatestr)); + m_pagehandlers.push_back(new VersionInfoPage(templatestr)); // homepage must be last - catch all page handler m_pagehandlers.push_back(new HomePage(templatestr)); diff --git a/src/http/pages/homepage.cpp b/src/http/pages/homepage.cpp index a64efd2..2f41fac 100644 --- a/src/http/pages/homepage.cpp +++ b/src/http/pages/homepage.cpp @@ -51,6 +51,7 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m if(currentmajorFMS "+major+"."+minor+"."+release+"
"; + content+="You can see the release info here
"; showgenericupdate=false; } @@ -58,7 +59,7 @@ const std::string HomePage::GeneratePage(const std::string &method, const std::m if(showgenericupdate) { - content+="Check for new versions at the FMS Freesite
"; + content+="Check for new versions at the FMS Freesite
"; } content+="Use these pages to administer your FMS installation."; diff --git a/src/http/pages/versioninfopage.cpp b/src/http/pages/versioninfopage.cpp new file mode 100644 index 0000000..670e9da --- /dev/null +++ b/src/http/pages/versioninfopage.cpp @@ -0,0 +1,62 @@ +#include "../../../include/http/pages/versioninfopage.h" +#include "../../../include/global.h" +#include "../../../include/stringfunctions.h" + +#include + +const std::string VersionInfoPage::GeneratePage(const std::string &method, const std::map &queryvars) +{ + std::string content=""; + + std::string major=VERSION_MAJOR; + std::string minor=VERSION_MINOR; + std::string release=VERSION_RELEASE; + + if(queryvars.find("Major")!=queryvars.end()) + { + major=(*queryvars.find("Major")).second; + } + if(queryvars.find("Minor")!=queryvars.end()) + { + minor=(*queryvars.find("Minor")).second; + } + if(queryvars.find("Release")!=queryvars.end()) + { + release=(*queryvars.find("Release")).second; + } + + SQLite3DB::Statement st=m_db->Prepare("SELECT Notes, Changes FROM tblFMSVersion WHERE Major=? AND Minor=? AND Release=?;"); + st.Bind(0,major); + st.Bind(1,minor); + st.Bind(2,release); + st.Step(); + + if(st.RowReturned()) + { + std::string notes=""; + std::string changes=""; + + st.ResultText(0,notes); + st.ResultText(1,changes); + + content+="

Release "+major+"."+minor+"."+release+"

"; + content+="

Notes

"; + content+=StringFunctions::Replace(notes,"\n","
"); + content+="

Changes

"; + content+=StringFunctions::Replace(changes,"\n","
"); + } + + return StringFunctions::Replace(m_template,"[CONTENT]",content); +} + +const bool VersionInfoPage::WillHandleURI(const std::string &uri) +{ + if(uri.find("versioninfo.")!=std::string::npos) + { + return true; + } + else + { + return false; + } +} diff --git a/src/optionssetup.cpp b/src/optionssetup.cpp index 9395454..7965b16 100644 --- a/src/optionssetup.cpp +++ b/src/optionssetup.cpp @@ -107,7 +107,7 @@ void SetupDefaultOptions() // NNTPBindAddresses st.Bind(0,"NNTPBindAddresses"); - st.Bind(1,"localhost"); + st.Bind(1,"localhost,127.0.0.1"); st.Step(); st.Reset(); upd.Bind(0,"NNTP Server");