From 4a265deb5d1d9d3c6aa179e901651bdab00721b3 Mon Sep 17 00:00:00 2001 From: Thalia Date: Mon, 13 Jul 2020 17:52:22 +0100 Subject: [PATCH] GlobalFunctions: Add documentation for replacing wfGetDB Add a note about the difference between LoadBalancer methods ::getMaintenanceConnectionRef, which wfGetDB returns and ::getConnectionRef, which is more commonly needed when replacing wfGetDB. Change-Id: Ic14dcdf7c8af6f20b3a4a697a6c5fbe9a7eb6f2e --- includes/GlobalFunctions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 41ece86c9db..8cd775200a3 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2453,6 +2453,12 @@ function wfWikiID() { * Note 2: use $this->getDB() in maintenance scripts that may be invoked by * updater to ensure that a proper database is being updated. * + * Note 3: When replacing calls to this with calls to methods on an injected + * LoadBalancer, LoadBalancer::getConnectionRef is more commonly needed than + * LoadBalancer::getMaintenanceConnectionRef, which is needed for more advanced + * administrative tasks. See the IMaintainableDatabase and IDatabase interfaces + * for details. + * * @todo Replace calls to wfGetDB with calls to LoadBalancer::getConnection() * on an injected instance of LoadBalancer. *