mirror of
https://codeberg.org/vlw/wp.git
synced 2026-02-26 03:51:58 +01:00
refactor: get site_url from method instead of static property
This commit is contained in:
parent
1b0a9f385f
commit
e0851bd27c
1 changed files with 3 additions and 6 deletions
|
|
@ -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"];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue