Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#34903 closed feature request (fixed)

wpdb needs a close function

Reported by: fabifott Owned by: pento
Priority: normal Milestone: 4.5
Component: Database Version:
Severity: normal Keywords:
Cc: Focuses: performance

Description

For a complete abstraction of the database access, the wpdb class needs a close() function.
A sample situation is a file-serving script, that runs for a long time reading a big file and pumping the bytes to the browser. Here a database connection is an unneeded resource and should be closed as soon as the IO pump starts.

Attachments (1)

34903.patch (586 bytes ) - added by markoheijnen 11 years ago.
Cleanup unit test logic for this method

Download all attachments as: .zip

Change History (10)

#1 @johnbillion
11 years ago

  • Type enhancementfeature request
  • Version 4.3.1

#2 @fabifott
11 years ago

Would you accept a pull request?

Or at least make wpdb::$dbh somehow accessible. Its not good practice to hide the DB layer completly in an non-complete abstraction.

#3 @pento
11 years ago

  • Milestone Awaiting Review4.5
  • Owner set to pento
  • Status newaccepted

#4 @pento
11 years ago

  • Resolutionfixed
  • Status acceptedclosed

In 36433:

WPDB: Add a close() method to wpdb, for when the connection needs to be manually closed.

In the event that it was closed prematurely, wpdb::query() will re-open the connection automatically.

Fixes #34903.

@markoheijnen
11 years ago

Cleanup unit test logic for this method

#5 @markoheijnen
11 years ago

  • Resolution fixed
  • Status closedreopened

Hey @pento, I assume the logic inside the unit tests can now also be deleted?

#6 @pento
11 years ago

  • Resolutionfixed
  • Status reopenedclosed

In 36478:

Tests: Use the new wpdb::close() method for closing the DB connection.

Props markoheijnen.

Fixes #34903.

#7 @DrewAPicture
11 years ago

In 36493:

Docs: Add an @access tag and fix a typo in the DocBlock for wpdb::close().

See #34903. See #32246.

#8 @DrewAPicture
11 years ago

In 36840:

Docs: Remove an errant period following the @access tag in the DocBlock for wpdb::close(), mistakenly introduced in [36493].

Props markoheijnen.
See #34903. See #35986.

#9 @spacedmonkey
10 years ago

What does close method mean if you are using a db dropin like hyperdb? The hyperdb drop in is massively out of date now, many of the features in core not reflected. Changed like this need to be communicated db drop-in creators.

Note: See TracTickets for help on using tickets.