Browse Source

Count custom backend templates (e.g. *-PHP-x_y) in PHP version usage screen (#5228)

* Count custom backend templates (e.g. *-PHP-x_y) in PHP version usage without duplicates

* Run npm run format

---------

Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
Lucas 6 days ago
parent
commit
6b9ff5c466
1 changed files with 8 additions and 0 deletions
  1. 8 0
      web/inc/main.php

+ 8 - 0
web/inc/main.php

@@ -575,6 +575,14 @@ function backendtpl_with_webdomains() {
 			if (!empty($domain_details["BACKEND"])) {
 				$backend = $domain_details["BACKEND"];
 				$backend_list[$backend][$user][] = $domain;
+
+				// Also count custom backend template names like YOURNAME-PHP-8_4 under PHP-8_4
+				if (preg_match('/(PHP-\d+_\d+)$/', $backend, $m)) {
+					// Avoid duplicates when backend already is the base template
+					if ($backend !== $m[1]) {
+						$backend_list[$m[1]][$user][] = $domain;
+					}
+				}
 			}
 		}
 	}