Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/318220
Change subject: Add short-circuit to DatabasePostgres::schemaExists()
......................................................................
Add short-circuit to DatabasePostgres::schemaExists()
Change-Id: I5221f7d937be1e87689df5a21fd64e244dbd4c2a
---
M includes/libs/rdbms/database/DatabasePostgres.php
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/20/318220/1
diff --git a/includes/libs/rdbms/database/DatabasePostgres.php
b/includes/libs/rdbms/database/DatabasePostgres.php
index 7acd8dc..b72557a 100644
--- a/includes/libs/rdbms/database/DatabasePostgres.php
+++ b/includes/libs/rdbms/database/DatabasePostgres.php
@@ -1175,8 +1175,12 @@
* @return bool
*/
function schemaExists( $schema ) {
- $exists = $this->selectField( '"pg_catalog"."pg_namespace"', 1,
- [ 'nspname' => $schema ], __METHOD__ );
+ if ( !strlen( $schema ) ) {
+ return false; // short-circuit
+ }
+
+ $exists = $this->selectField(
+ '"pg_catalog"."pg_namespace"', 1, [ 'nspname' =>
$schema ], __METHOD__ );
return (bool)$exists;
}
--
To view, visit https://gerrit.wikimedia.org/r/318220
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5221f7d937be1e87689df5a21fd64e244dbd4c2a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits