Problem/Motivation
We have a bunch of unorganized XML-RPC-related code scattered throughout Drupal core.
Proposed resolution
Move all the XML-RPC code into one single XML-RPC module to help organize it all.
Remaining tasks
- The patch is tested and reviewed. It should be committed.
- #1627496: Switch XML-RPC callback from "xmlrpc.php" to "xmlrpc"
User interface changes
The user now sees an XML-RPC module that they can toggle to enable/disable the XML-RPC capabilities on their site.
API changes
The xmlrpc()
function is only available if the XML-RPC module is enabled.
Original report by catch
Instead of a random xmlrpc.php file in the root of the Drupal directory, we can just have a menu callback for xmlrpc.php provided by a module. Handy thing that Drupal, providing menu callbacks.
Patch is 100% untested, I imagine/hope there are some xmlrpc tests in system somewhere we could move to the xmlrpc folder.
Comment | File | Size | Author |
---|---|---|---|
#70 | 1033818-innerdiff-ignore.patch | 883 bytes | RobLoach |
#70 | 1033818.patch | 24.98 KB | RobLoach |
#66 | 1033818.patch | 24.98 KB | RobLoach |
#63 | 1033818.patch | 17.66 KB | RobLoach |
#61 | 1033818.patch | 8.51 KB | RobLoach |
Comments
Comment #1
catchMissing files from the patch.
Comment #2
sun.
Comment #3
catchMissed xmlprc() in common.inc
Comment #4
catchComment #5
sunFramework is our new tag for all of these issues.
Comment #6
catchSo the patch is big, but the changes are tiny:
1. Removes xmlrpc.php entirely.
2. Adds xmlrpc.module - this implements hook_menu() and registers xmlrpc.php as a callback.
3. Removes xmlrpc() from common.inc and moves it onto xmlrpc.module - modules that need to call xmlrpc() would now need to add xmlrpc module as a dependency. That is the only API change.
4. Moves xmlrpc.inc and xmlrcps.inc into the xmlrpc module directory out of /includes.
Comment #7
sunSleeping over this, there's one non-obvious consequence here: Without clean URL support, you cannot use xmlrpc.php anymore.
If we consider that to be a problem, we could provide the current/legacy xmlrpc.php within the module folder, so sites that cannot or do not want to enable clean URLs are able to copy the file into their site's root directory.
Comment #8
catchThat's an interesting point, I personally cannot remember seeing a real Drupal site running without clean URLs. Another possibility would be to add a hook_requirements().
Comment #9
cweagansI think that clean urls should just be a requirement of using xmlrpc module. Another approach would be that we just completely remove the xmlrpc server and let contrib handle it with Services module (we've already removed the prime reason to even have an xmlrpc server, which was Blog API)
Comment #10
lyricnz CreditAttribution: lyricnz commented+1 for separate module, +1 for this not being in core (and the reason why I won't RTBC the patch)
Comment #12
catchRe-rolled.
Obligatory diffstat:
I am posting these patches just to disentangle the code base - in this case we remove a file from the root directory, two from /includes, and 33 lines from common.inc.
The fact that if we later wanted to remove xmlrpc support from core entirely it would be a simple git rm is just a happy side effect.
It's also possible that the web services initiative may eventually want to add xmlrpc support in core via that mechanism - but if it does then this makes that neither harder nor particularly easier to do so.
If you like this patch, you may also like such issues as #679112: Time for system.module and most of includes to commit seppuku.
I have not yet added the hook_requirements() for clean urls, but marking CNR for the test bot.
Comment #14
catchFixing the syntax error.
Comment #16
catchComment #18
catchgrumble, grumble.
Comment #19
joachim CreditAttribution: joachim commented> Another approach would be that we just completely remove the xmlrpc server and let contrib handle it with Services module (we've already removed the prime reason to even have an xmlrpc server, which was Blog API)
+1 for this option. I don't see why anyone would use core's xmlrpc server when there is Services module available.
Similarly, the code for making xmlrpc calls could be moved out to Clients module. There's no reason for core to be favouring xmlrpc over any other type of service call.
PS. Though isn't part of Services moving into core in D8 anyway? If so, won't that initiative be handling the cleanup of core's xmlrpc code?
Comment #20
catchIf you want to open up an issue to move xmlrpc to contrib, that will be a very easy patch once this is issue is in:
That's not what this issue is about, so I don't know why people keep bringing it up, you're free to open up that issue if you like.
I have no idea whether the web services initiative will have anything to do with xmlrpc by the time it's done, currently that is 100% vapourware, so I have limited interest in having mess in the root directory waiting on that.
Comment #21
marcingy CreditAttribution: marcingy commentedServices provides a wrapper around the core xmlrpc functionality so I would be against this removal for the most part as a services maintainer. If xmlrpc leaves core I can pretty much say it will die (from a services prospective) because the vast majority of services maintainer are only interested in json servers.
Comment #22
catch@marcingy, services could add a requires[] = xmlrpc, or use module_exists() or whatever though if it stays in core as a module though right?
Comment #23
marcingy CreditAttribution: marcingy commented@catch total. my comment was in response to the comments of remove xmlrpc from core.
Comment #24
aspilicious CreditAttribution: aspilicious commentedTrailing whitespace, other docs seems to be ok
Powered by Dreditor.
Comment #25
joachim CreditAttribution: joachim commented> I have no idea whether the web services initiative will have anything to do with xmlrpc by the time it's done, currently that is 100% vapourware, so I have limited interest in having mess in the root directory waiting on that.
Yup, fair point. I see what you mean: clean up what we definitely can now, clean up more later if/when other things happen :)
Comment #26
catchRemoved the trailing whitespace.
Comment #27
joachim CreditAttribution: joachim commentedJust a few points -- and TBH some of it is stuff that could be looked at later.
I had my doubts about this, but I just looked at xmlrpc.php and it does drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL). How much do we lose going via the menu system rather than straight in?
Surely MENU_CALLBACK?
You won't get anything visible back from this with a GET, just a white screen (or a message saying 'only POST', I forget).
Why do we need both the xmlrpc.pages.inc and the xmlrpcs.inc?
Powered by Dreditor.
Comment #28
catchThere is negligible difference between a full bootstrap from a custom .php file and using the router system in terms of performance - more or less just menu_get_item() I think. Hopefully routing of requests is going to be moved to a lower level with WSCCI so it may end up cheaper overall by the time the release is out, but this is very far from critical path so I'm happy with using what we have for now.
The only issue with using the menu system is dropping support for dirty URLs, which I'd like to do in general at #1183208: Remove variable_get('clean_url') and switch to index.php/path pattern for dirty URL support anyway.
Changed MENU_SUGGESTED_ITEM to MENU_CALLBACK, I must have copied a .module file since I can never remember what to write in @file, then failed to clean up the hook_menu() properly.
Merged xmlrpcs.inc into xmlrpc.pages.inc, agreed it is not worth two separate files.
Thanks for the review!
Comment #30
Eric_A CreditAttribution: Eric_A commented#28: xmlrpc_module.patch queued for re-testing.
Oops. First I saw CommentBlockFunctionalTest fails, and only after requesting the retest did I notice that lines have gone missing in the latest patch...
Comment #32
joachim CreditAttribution: joachim commentedThose are some very weird tests that are failing.
A lot of them are to do with file_put_contents(). How can that have been affected by this?
Comment #33
lyricnz CreditAttribution: lyricnz commentedMore likely to be a testbot issue, perhaps out of disk space.
Comment #34
joachim CreditAttribution: joachim commented#28: xmlrpc_module.patch queued for re-testing.
Comment #35
cweagansIt appears that the most recent patch is not creating the xmlrpc module, but removing all traces of the xmlrpc server and client from core. I'm okay with this, but I'm certain that's not what you were aiming for, so back to CNW.
Comment #36
franzYeah, catch probably forgot to add new files on latest patch (#28)
Comment #37
catchpwolanin asked why make this a module since it's currently standalone, here's the justification:
- if something only works by having a single-purpose PHP file in the root folder of the core download I don't think we can call it standalone. If I have my way we'll eventually ditch install.php and update.php too one day.
- it does a full Drupal bootstrap so there is no benefit to a one-off script compared to going via the router.
However having it as a module does add overhead if it's actually enabled compared to now, but it's definitely got issues either way.
Comment #38
podaroksubscribe
Comment #39
RobLoachBlog module was the only thing in Drupal core using the XML-RPC system. Now that Blog module is no longer in core, there is no reason to have XML-RPC in there.
Also, I moved xmlrpc.module, what catch was working on, to http://drupal.org/node/1285602 . We can promote it to a full project if we want. I've given a bunch of you commit rights on there.
Comment #40
cweagans*cough*
:%s/Blog module/Blog API module/g
Comment #41
sunPlease create a separate issue for removing xmlrpc altogether. I'll explain on that one why I'm going to mark it postponed.
Comment #42
sun#28: xmlrpc_module.patch queued for re-testing.
Comment #43
boombatower CreditAttribution: boombatower commentedsub
Comment #44
RobLoachHere ya go: #1285726: Remove XML-RPC
Comment #45
sun#26 / #28 needs to be re-rolled.
Comment #46
amateescu CreditAttribution: amateescu commentedThe patch from #26 was not re-rollable at all, so I basically recreated it and also added the changes advertised in #28 but not really added to that patch :)
Comment #47
amateescu CreditAttribution: amateescu commentedWe've transferred this work to: http://drupalcode.org/sandbox/sun/1255586.git/shortlog/refs/heads/platfo...
Attached patch contains a change by @sun that renames xmlrpc.pages.inc to xmlrpc.server.inc.
Comment #48
pwolanin CreditAttribution: pwolanin commentedA PHP file actually works better than a callback for fastCGI environments, since some headers are not passed through the URL rewrite process.
A separate file could actually have a different bootstrap? e.g. never need the theme layer?
I think sun had such a file for JS callbacks at one point.
Comment #49
Damien Tournoud CreditAttribution: Damien Tournoud commentedI don't think we want more then one front-end controller (ie. a PHP entry point) for now. The are refactoring going on in #1463656: Add a Drupal kernel; leverage HttpFoundation and HttpKernel so let's stick with the proposed
xmlrpc.inc
routing entry for now.Comment #50
RobLoachSince the functionality was enabled by default, do you think we should retain the upgrade path for it?
Comment #51
amateescu CreditAttribution: amateescu commentedYes, definitely. Thanks Rob :)
Comment #52
RobLoachThere's some extra opening whitespace there. Attached patch doesn't have it. If it goes green, I'd consider this RTBC!
14 days to next Drupal core point release.
Comment #53
cweagansI don't agree with this. This means that every single Drupal site that upgrades from 7 -> 8 will have xmlrpc.module enabled, even if they don't need it. I'd say let's leave it disabled, and then document an API change: if your modules depend on XML-RPC functionality, then you need to enable the xmlrpc module.
Should this be named something else? Most of the other modules that we have in core don't have functions that are named the same as the module name. What about xmlrpc_request()?
Comment #54
RobLoachChange notification it is!
Sure!
Comment #56
RobLoachUses
xmlrpc_call()
instead ofxmlrpc_request()
since that's already defined.Comment #57
fgmJust a note: this issue, and others related to XMLRPC in D8, are part of the program for the Paris code sprint on 2012/04/28-29. More info at http://groups.drupal.org/node/223174
Comment #58
sunRe-rolled and adjusted for latest HEAD.
This code lives in the platform/platform-xmlrpc-1033818-sun branch now.
Note: I've intentionally reverted the unnecessary xmlrpc() API change.
Comment #59
RobLoach#58: platform.xmlrpc.58.patch queued for re-testing.
Comment #61
RobLoachRe-roll.
Comment #63
RobLoachGot it! The problem was WSCCI fallout from the index.php change.
Comment #64
sunExcellent, thanks!
Comment #65
catchSorry folks, all core modules need a hook_help().
Comment #66
RobLoachThanks! Also noticed the
system.api.php
hook_xmlrpc() docs could be moved in too.Comment #67
sunAwesome!
Comment #68
RobLoach#66: 1033818.patch queued for re-testing.
Also, updated the issue summary.
Comment #69
tstoecklerMinor, but the placeholders are defined in the opposite order they are used. Also, maybe a dash or two would make the placeholder names more readable.
Is there a reason this is 'xmlrpc.php' vs. just 'xmlrpc'? At first I didn't want to mention this as I thought it would be bikeshedding, but then I noticed that if you don't have mod_rewrite, then that path looks like example.com/index.php/xmlrpc.php, which is super weird IMO.
Leaving at RTBC for now.
Comment #70
RobLoachComment #71
cweagansIMO, backwards compatibility shouldn't be a huge concern here - if a site is making use of the XML-RPC server and they're upgrading from D7->D8, they'd likely also update whatever system is using XML-RPC.
Also? Who really doesn't use mod_rewrite ;)
Comment #72
RobLoachCreated #1627496: Switch XML-RPC callback from "xmlrpc.php" to "xmlrpc" to get that fix in afterwards :-) . I'll stick it in the issue summary.
Comment #72.0
RobLoachUpdated issue summary.
Comment #73
tstoecklerRTBC++
Comment #74
catchThanks! Committed/pushed to 8.x.
Will need a change notification.
Comment #75
RobLoachhttp://drupal.org/node/1632592
Comment #76
cweagansPerfect!
Comment #77
cweagansOh yeah, priority should change too.
Comment #78.0
(not verified) CreditAttribution: commentedUpdated issue summary.