]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 30 May 2025 13:29:47 +0000 (15:29 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 30 May 2025 13:31:52 +0000 (15:31 +0200)
- let's not include original software in queries anymore when --software=xxx is provided
- set software to None when --domain=xxx is provided (or --force-all/update-none)

fba/commands.py

index 3f0c5d577ea65916e5f4247308b434c28bee42f5..bdebbfe4ec741b8c8ad60dba19dded4008e36a34 100644 (file)
@@ -296,7 +296,7 @@ def fetch_blocks(args: argparse.Namespace) -> int:
     elif args.software not in [None, ""]:
         # Re-check single software
         logger.debug("Querying database for args.software='%s' ...", args.software)
-        database.cursor.execute("SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software = ? OR original_software = ? ORDER BY last_blocked ASC, total_blocks DESC", [args.software, args.software])
+        database.cursor.execute("SELECT domain, software, origin, nodeinfo_url FROM instances WHERE software = ? ORDER BY last_blocked ASC, total_blocks DESC", [args.software])
     elif args.only_none:
         # Check only entries with total_blocked=None
         logger.debug("Checking only entries with total_blocked=None ...")
@@ -1342,7 +1342,7 @@ def recheck_obfuscation(args: argparse.Namespace) -> int:
         database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE domain = ? LIMIT 1", [args.domain])
     elif isinstance(args.software, str) and args.software != "" and validators.domain(args.software, rfc_2782=True) == args.software:
         logger.debug("Fetching records for args.software='%s' ...", args.software)
-        database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE (has_obfuscation = 1 OR has_obfuscation IS NULL) AND software = ? OR original_software = ? ORDER BY last_blocked ASC", [args.software, args.software])
+        database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE (has_obfuscation = 1 OR has_obfuscation IS NULL) AND software = ? ORDER BY last_blocked ASC", [args.software])
     elif args.no_obfuscation:
         logger.debug("Fetching records with no obfuscation of blocked domain ...")
         database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE has_obfuscation = 0 AND total_blocks > 0 AND software IS NOT NULL ORDER BY last_blocked ASC")
@@ -1552,7 +1552,7 @@ def update_nodeinfo(args: argparse.Namespace) -> int:
         database.cursor.execute("SELECT domain, software FROM instances WHERE domain = ? LIMIT 1", [args.domain])
     elif args.software not in [None, ""]:
         logger.info("Fetching domains for args.software='%s'", args.software)
-        database.cursor.execute("SELECT domain, software FROM instances WHERE software = ? OR original_software = ? ORDER BY last_updated ASC", [args.software, args.software])
+        database.cursor.execute("SELECT domain, software FROM instances WHERE software = ? ORDER BY last_updated ASC", [args.software])
     elif args.mode not in [None, ""]:
         logger.info("Fetching domains for args.mode='%s'", args.mode.upper())
         database.cursor.execute("SELECT domain, software FROM instances WHERE detection_mode = ? ORDER BY last_updated ASC", [args.mode])
@@ -1620,6 +1620,11 @@ def update_nodeinfo(args: argparse.Namespace) -> int:
             logger.warning("Exception '%s' during updating nodeinfo for row[domain]='%s'", type(exception), row["domain"])
             instances.set_last_error(row["domain"], exception)
 
+            logger.debug("args.domain='%s',args.force_all='%s',args.force_update_none='%s'", args.domain, args.force_all, args.force_update_none)
+            if args.domain not in [None, ""] or args.force_all is True or args.force_update_none is True:
+                logger.debug("Setting software=None for row[domain]='%s' ...", row["domain"])
+                instances.set_software(row["domain"], None)
+
         logger.debug("Updating instanes for row[domain]='%s' ...", row["domain"])
         instances.set_last_nodeinfo(row["domain"])
         instances.update(row["domain"])