WordPress.org

Making WordPress.org

Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#3135 closed enhancement (wontfix)

Browse Happy API: Replace require() with require_once()

Reported by: ronakganatra Owned by:
Milestone: Priority: normal
Component: API Keywords: has-patch
Cc:

Description

I suggest to use require_once() function in index.php of api.wordpress.org instead of only require()

Attachments (1)

3135.diff (697 bytes) - added by ronakganatra 9 months ago.
Changed Require() function to require_once() for improvement.

Download all attachments as: .zip

Change History (6)

@ronakganatra
9 months ago

Changed Require() function to require_once() for improvement.

#1 @iandunn
9 months ago

  • Summary changed from Improvement suggestion in api.wordpress.org to Browse Happy API: Replace require() with require_once()

#2 follow-up: @SergeyBiryukov
9 months ago

  • Keywords reporter-feedback added

Hi @ronakganatra, welcome to WordPress Meta Trac!

What problem would that solve?

Last edited 9 months ago by SergeyBiryukov (previous) (diff)

#3 in reply to: ↑ 2 ; follow-up: @ronakganatra
9 months ago

  • Keywords reporter-feedback removed

Replying to SergeyBiryukov:

Hi @ronakganatra, welcome to WordPress Meta Trac!

What problem would that solve?

Hello @SergeyBiryukov Thanks for reviewing it and responding to this ticket below is my feedback :
Currently, any problem is not occurring but I have added this as an improvement. because it adds file every time instead if we use require_once it only include that file once so, efficiency will be improved.

#4 @ocean90
9 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

Thanks for the patch, but there's actually no need for using require_once() here.

I you want to start contributing to meta I suggest to take a look at some of the open tickets: https://meta.trac.wordpress.org/report/1.

#5 in reply to: ↑ 3 @SergeyBiryukov
9 months ago

Replying to ronakganatra:

I have added this as an improvement. because it adds file every time instead if we use require_once it only include that file once so, efficiency will be improved.

require_once() is actually slower than require(), because it has to check if the file has already been included. The performance difference might be negligible, but the function still should not be changed without a good reason.

Note: See TracTickets for help on using tickets.