From e0851bd27c2e4277e62dc653fe2fc68ff6b2fd70 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Sun, 22 Feb 2026 11:00:20 +0100 Subject: [PATCH] refactor: get site_url from method instead of static property --- src/Database.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Database.php b/src/Database.php index 7a224c1..e85f780 100644 --- a/src/Database.php +++ b/src/Database.php @@ -9,7 +9,6 @@ class Database extends DatabaseFramework { public static string $name = ""; - public static string $site_url = ""; private static string $prefix = "wp"; private static string $hostname = ""; @@ -71,8 +70,6 @@ $database ); - $this->set_site_url(); - parent::__construct(); } @@ -90,11 +87,11 @@ } /** - * Fetch and set the WordPress siteurl from the options table + * Fetch the WordPress siteurl from the options table * * @return void */ - public function set_site_url() { + public function site_url() { $query = new DatabaseFramework() ->from(static::$prefix . "_options") ->where(["option_name" => "siteurl"]) @@ -105,6 +102,6 @@ throw new Exception("Failed to fetch siteurl from options table"); } - self::$site_url = $query->fetch_assoc()["option_value"]; + return $query->fetch_assoc()["option_value"]; } }