CpmFetch will now be in server partsParts? Yes. GauGau pushed me toward implementing CpmFetch as a plugin under 1.5's architecture. Plugins are a really really cool thing that has been in CPG for awhile - but I've not really played with them until now.
Now, doing it as a plugin means that installation will be a snap (similar to adding a theme), and I get to use a lot of code directly from the Coppermine Photo Gallery as is... I don't have to duplicate all the permission checking, etc like I had to do before on my own.
The downside is that it becomes problematic to get the data back into your pages easily. Also - each time you made a request it has to start up a big chunk of CPG to execute your call. If you put three different displays on your page at the same time, it would have to start CPG three times.
The solution:
CpmFetchService:RPC - this will be the plugin that sites on the server. It will accept requests in a format called JSON-RPC. To the layperson, this means that the client web site can bundle up as many requests as they want and submit them to the plugin. The plugin will process them all individually and send back the results. One call and start up for as many things as you want.
For the hardcode coder out there - the JSON-RPC layout is very very easy and I plan on documenting the available calls very well. This means that this component can be talked to by anyone out there writing in PHP, ASP, PERL, HTML & JS, etc... You won't need to deal with a client side cpmfetch library at all.
For the layperson - I play on recreating the cpmfetch code similar to how it is now - except you will:
- Have a very easy configuration - where is the http://www.yourgallery.com site
- No limitations on crossing servers or different sites
- Configuration and control right in the CPG gallery for most options
- It will talk to CPG, not directly to the database
My thoughts at this time are to develop a basic PHP library to handling making the request for people who don't want to deal with crafting JSON-RPC, and a similar offering in pure javascript. Then adding on to that.
Also, since the CpmFetchService is going to be coded around getting data, I will be expanding that into other areas like:
CpmFetchService:RSS
etc... but those are farther down the road.
I am most excited to see what people do with just getting at the data directly in combination with all the cool js / jquery type effects out there...
What did I get done tonight and up till now?Well, these are not meant for everyone to understand - but more to keep me moving, so some of you will understand the progress, some may not.
- All code is being done with unit tests
- All code is being PHPDoc'd
- All code is being done in an OO fashion
- I am making sure the code is beautiful - not slapped together
- Created a test db and gallery in 1.5 to test against
- Completed a proof of concept test with the plugins
- Completed a proof of concept with JSON-RPC calls
- Designed an JSON-RPC implementation in PHP to handle it on both ends
- Coded a unit test and Request object
- Coded a unit test and most of the Envelope object (to put multiple requests into it)
- Migrated a Response / Error Response object from the proof of concept into better code
See you tomorrow.
EDIT: Went back and completed the envelope object including implementing iteration across it. I should be able to start firing test requests at the CpmFetchService:RPC in the next day or two.