WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20042 closed enhancement (fixed)

Move AtomServer class to class-atomserver.php

Reported by: ryan Owned by: ryan
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: AtomPub Keywords: has-patch dev-feedback
Focuses: Cc:

Description

Move the class to its own file, much as was done with the xmlrpc server class. wp-app.php would then be just the basic endpoint handling bits.

Attachments (2)

20042.patch (57.7 KB) - added by kurtpayne 2 years ago.
20042.diff (2.9 KB) - added by nacin 2 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 westi2 years ago

I like the idea of this.

If we are touch the APP code this much we should look at merging in #7652 and testing out Gorilla (https://github.com/rmccue/Gorilla) for testing it (As last I checked APE was too broken to test with)

kurtpayne2 years ago

comment:2 kurtpayne2 years ago

  • Cc kpayne@… added
  • Keywords has-patch added

20042.patch does the following:

  • separates the atom server into a separate class
  • removes the log_api calls per #20051
  • updates the query filter per IRC chat with nacin, ryan
  • replaces the exit calls with wp_die calls for future unit tests
  • installs an override handler for wp_die
  • allows a plugin to replace the atom class with a wp_atom_server_class hook
  • whitespace cleanup

It passes the Gorilla test:

Gorilla is beginning testing on http://127.0.0.1/wordpress-trunk/wp-app.php...


testServiceDocumentExists with data set #0
------------------------------------------
[info] Service document found
[result] success

testCollectionsExist with data set #0
-------------------------------------
[info] Collections found:
    Test Blog Posts accepts application/atom+xml;type=entry
    Test Blog Media accepts image/*, audio/*, video/*
[result] success

testHasJPEGCollection with data set #0
--------------------------------------
[info] JPEG collections found:
    Test Blog Media
[result] success
Gorilla is beginning testing on http://127.0.0.1/wordpress-trunk/wp-app.php...


testListPosts
-------------
[info] Post collections found:
    Test Blog Posts
[info] Using Test Blog Posts at http://127.0.0.1/wordpress-trunk/wp-app.php/posts
[info] Checking current
[result] success

testSparsePost
--------------
[info] Testing basics
[info] Posting of new entry reported success, location: http://127.0.0.1/wordpress-trunk/wp-app.php/post/1848
[result] success

testPostFromTemplate with data set #0
-------------------------------------
[info] Creating from Gorilla/lib/tests/data/posts/example-1.xml
[info] Posting of new entry reported success, location: http://127.0.0.1/wordpress-trunk/wp-app.php/post/1851
[info] Examining the new entry as returned in the POST response
[info] Slug was used in server-generated URI
[info] Checking at the new location
[result] success

comment:3 kurtpayne2 years ago

  • Keywords dev-feedback added

comment:4 ryan2 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [20062]:

wp-app.php cleanup:

  • Put the atom server class in class-wp-atom-server.php
  • Remove log_api calls
  • Update the query filter
  • Replace exit calls with wp_die() for unit test compat
  • Add override handler for wp_die()
  • Allow plugins to replace the atom class
  • Whitespace cleanup

Props kurtpayne. fixes #20042

nacin2 years ago

comment:5 nacin2 years ago

In [20063]:

New wp_die_app_handler context in wp_die() for APP requests. Introduces _scalar_wp_die_handler() as a generic handler that wraps die(), for use by plugins. Move deprecated function to the end of the wp-app.php file (same as xmlrpc.php). see #20042.

Note: See TracTickets for help on using tickets.