[wp-hackers] Importer Rework
ryan at boren.nu
Tue Aug 23 22:16:36 GMT 2005
I committed a very rough attempt at reworking the importers. We now have an "Import" tab in the admin UI. The importers themselves are stored in wp-admin/import/. Here's the flow.
* Clicking on "Import" tab loads import.php.
* import.php loads all importers in wp-admin/import/
* Importers registers themselves with register_importer()
* import.php gets the list of registered importers with get_importers()
* import.php lists importers
* Clicking on importer link loads admin.php?import=xxx
* admin.php does some bootstrapping, loads the requested importer, and
kicks the registered callback
* The callback parses GPC and dispatches appropriately
I've started restructuring the importers as classes. The RSS and MT importers are underway. They are just boilerplate at the moment and are not useful except as examples. If you want to try your hand at porting one of the other importers, have at it. As part of the porting effort we need to make use of current API (wp_insert_post, etc.) and mark text for translation.
Further, we need to improve how import source files are specified. Currently, they must reside on the server, and the importers must be edited to point to the file. Here's what we need to do:
* Allow uploading and importing source file from the user's desktop in one go. Delete the source file after the import is complete.
* Allow specifying a source file that is already on the server. We should probably lock this to wp-content.
* Allow importing a source file that lives on the net somewhere (for example, http://get.it/fromhere.txt). Delete the downloaded file from the server when done with it.
This needs to be easy to do from an importer. A simple API for posting the necessary forms and getting the filename/filehandle of the bits to import is needed.
Design and implementation suggestions welcome. I committed what I had simply to have something to argue about. :-)
More information about the wp-hackers