refactor: one wpdb accessor style (L4)
The three lazy db() methods use the $this->db ?? $GLOBALS['wpdb'] one-liner that SampledMetaSource, MediaUsageFinder and ConnectionRepository already use. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -181,11 +181,6 @@ class ChangeLog
|
||||
|
||||
protected function db(): \wpdb
|
||||
{
|
||||
if ($this->db === null) {
|
||||
global $wpdb;
|
||||
$this->db = $wpdb;
|
||||
}
|
||||
|
||||
return $this->db;
|
||||
return $this->db ?? $GLOBALS['wpdb'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,11 +490,6 @@ final class DiviReplaceTextAbility implements Ability
|
||||
|
||||
private function db(): \wpdb
|
||||
{
|
||||
if ($this->db === null) {
|
||||
global $wpdb;
|
||||
$this->db = $wpdb;
|
||||
}
|
||||
|
||||
return $this->db;
|
||||
return $this->db ?? $GLOBALS['wpdb'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,11 +362,6 @@ class PostCloner
|
||||
|
||||
private function db(): \wpdb
|
||||
{
|
||||
if ($this->db === null) {
|
||||
global $wpdb;
|
||||
$this->db = $wpdb;
|
||||
}
|
||||
|
||||
return $this->db;
|
||||
return $this->db ?? $GLOBALS['wpdb'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user