Make WordPress Core

Opened 12 years ago

Last modified 7 years ago

#28364 new defect (bug)

WordPress Entry Points (wp-load.php occurrences) — at Initial Version

Reported by: szepeviktor's profile szepe.viktor Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.1
Component: Bootstrap/Load Keywords:
Focuses: Cc:

Description

I was looking for entry point by searching for wp-load.php for plugin refactoring. I mean conditionally use require().

  1. There are easy to identify entry points like admin-ajax.php but there are no defines e.g in async-upload.php, wp-loging.php or wp-comments-post.php
  1. wp-trackback.php uses a strange way to detect the core if (empty($wp))
  1. xmlrpc.php uses alone include() all others require()
  1. How to distinguish between admin.php and admin-post.php?

Proposal

  • There should be a uniform way requiring wp-load.
  • All entry point should be distinguished by different defines

List of entry points and ways to detect them

  1. frontend: wp-blog-header.php:12 !is_admin()
  2. admin GET request: wp-admin/admin.php:30 is_admin()
  3. admin POST request: wp-admin/admin-post.php:15 is_admin()
  4. admin upload: wp-admin/async-upload.php:16 @$_SERVER['SCRIPT_FILENAME'] === ABSPATH . 'wp-admin/async-upload.php'
  5. AJAX call: wp-admin/admin-ajax.php:20 defined('DOING_AJAX') && DOING_AJAX
  6. WordPress cron webserver/CLI: wp-cron.php:26 defined('DOING_CRON') && DOING_CRON php_sapi_name() === 'cli'
  7. XML-RPC protocol: xmlrpc.php:29 defined('XMLRPC_REQUEST') && XMLRPC_REQUEST

Frontend low priority

  1. wp-comments-post.php:16 @$_SERVER['SCRIPT_FILENAME'] === ABSPATH . 'wp-comments-post.php'
  2. wp-trackback.php:12 1 === get_query_var('tb')

Dashboard low priority

  1. wp-login.php:12
  2. wp-signup.php:4
  3. wp-activate.php:12
  4. wp-mail.php:11

Exclude from profiling

  1. wp-links-opml.php:15
  2. wp-includes/ms-files.php:12
  3. wp-includes/js/tinymce/wp-mce-help.php:9
  4. wp-admin/install.php:36
  5. wp-admin/install-helper.php:39
  6. wp-admin/upgrade.php:18
  7. wp-admin/maint/repair.php:10
  8. wp-admin/moderation.php:10

Total: 21 entry points as of version 3.9.1

from WPHW

Change History (0)

Note: See TracTickets for help on using tickets.