Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#34903 closed feature request (fixed)

wpdb needs a close function

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

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 9 years ago.
Cleanup unit test logic for this method

Download all attachments as: .zip

Change History (10)

#1 @johnbillion
9 years ago

  • Type changed from enhancement to feature request
  • Version 4.3.1 deleted

#2 @fabifott
9 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
9 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Owner set to pento
  • Status changed from new to accepted

#4 @pento
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

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
9 years ago

Cleanup unit test logic for this method

#5 @markoheijnen
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

#6 @pento
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 36478:

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

Props markoheijnen.

Fixes #34903.

#7 @DrewAPicture
9 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
9 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
9 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.