X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fpeermaintenancepage.cpp;h=5daaa01b87f576e7f4ea2751acdb3d89377048a6;hb=18b45335ba24f3b6b6d4f4acfe8c5a5ae845ce00;hp=f7946008933b4bd13a7ce906f06099457c8b6421;hpb=df316253862dc50e8e5a790d9634ef90be37badb;p=fms.git diff --git a/src/http/pages/peermaintenancepage.cpp b/src/http/pages/peermaintenancepage.cpp index f794600..5daaa01 100644 --- a/src/http/pages/peermaintenancepage.cpp +++ b/src/http/pages/peermaintenancepage.cpp @@ -45,7 +45,33 @@ const std::string PeerMaintenancePage::GeneratePage(const std::string &method, c StringFunctions::Convert((*queryvars.find("daysago")).second,tempint); date.SetToGMTime(); date.Add(0,0,0,-tempint); - st=m_db->Prepare("DELETE FROM tblIdentity WHERE IdentityID NOT IN (SELECT IdentityID FROM tblMessage GROUP BY IdentityID) AND LastSeen;"); + st=m_db->Prepare("DELETE FROM tblIdentity WHERE LastSeen;"); + st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S")); + st.Step(); + } + else if((*queryvars.find("formaction")).second=="removenulldaysago" && queryvars.find("daysago")!=queryvars.end() && (*queryvars.find("daysago")).second!="") + { + int tempint=10000; + StringFunctions::Convert((*queryvars.find("daysago")).second,tempint); + date.SetToGMTime(); + date.Add(0,0,0,-tempint); + st=m_db->Prepare("DELETE FROM tblIdentity WHERE LastSeen AND LocalMessageTrust IS NULL AND LocalTrustListTrust IS NULL;"); + st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S")); + st.Step(); + } + else if((*queryvars.find("formaction")).second=="removeposted30daysago") + { + date.SetToGMTime(); + date.Add(0,0,0,-30); + st=m_db->Prepare("DELETE FROM tblIdentity WHERE IdentityID IN (SELECT tblIdentity.IdentityID FROM tblIdentity INNER JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE (SELECT MAX(MessageDate) FROM tblMessage WHERE tblMessage.IdentityID=tblIdentity.IdentityID)<=? GROUP BY tblIdentity.IdentityID);"); + st.Bind(0,date.Format("%Y-%m-%d")); + st.Step(); + } + else if((*queryvars.find("formaction")).second=="removeadded20daysneversent") + { + date.SetToGMTime(); + date.Add(0,0,0,-20); + st=m_db->Prepare("DELETE FROM tblIdentity WHERE IdentityID IN (SELECT tblIdentity.IdentityID FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE tblMessage.IdentityID IS NULL AND tblIdentity.DateAdded);"); st.Bind(0,date.Format("%Y-%m-%d %H:%M:%S")); st.Step(); } @@ -95,6 +121,23 @@ const std::string PeerMaintenancePage::GeneratePage(const std::string &method, c content+=""; content+=""; + date.SetToGMTime(); + date.Add(0,0,0,-30); + st=m_db->Prepare("SELECT COUNT(*) FROM (SELECT tblIdentity.IdentityID FROM tblIdentity INNER JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID WHERE (SELECT MAX(MessageDate) FROM tblMessage WHERE tblMessage.IdentityID=tblIdentity.IdentityID)<=? GROUP BY tblIdentity.IdentityID);"); + st.Bind(0,date.Format("%Y-%m-%d")); + st.Step(); + st.ResultText(0,tempval); + content+="