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
|
protected function db(): \wpdb
|
||||||
{
|
{
|
||||||
if ($this->db === null) {
|
return $this->db ?? $GLOBALS['wpdb'];
|
||||||
global $wpdb;
|
|
||||||
$this->db = $wpdb;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->db;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -490,11 +490,6 @@ final class DiviReplaceTextAbility implements Ability
|
|||||||
|
|
||||||
private function db(): \wpdb
|
private function db(): \wpdb
|
||||||
{
|
{
|
||||||
if ($this->db === null) {
|
return $this->db ?? $GLOBALS['wpdb'];
|
||||||
global $wpdb;
|
|
||||||
$this->db = $wpdb;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->db;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,11 +362,6 @@ class PostCloner
|
|||||||
|
|
||||||
private function db(): \wpdb
|
private function db(): \wpdb
|
||||||
{
|
{
|
||||||
if ($this->db === null) {
|
return $this->db ?? $GLOBALS['wpdb'];
|
||||||
global $wpdb;
|
|
||||||
$this->db = $wpdb;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->db;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user