Use new export API#525
Conversation
|
@danielbachhuber Please give this a spin when you get the chance. |
|
Will do early next week On Mon, Jun 17, 2013 at 2:39 AM, Cristi Burcă notifications@github.com
|
* replace --file_item_count with --max_file_size * --verbose is ignored, for now
had to copy over the whole WP_Export_Split_Files_Writer class.
The idea is to be reasonably verbose by default and completely silent when --quiet is passed.
|
I find myself overusing Let's make a |
|
If a branch gets really outdated, we just abandon it and start a new one, with a different name. |
Works for me. Hopefully this leads to smaller branches too, so there aren't a bunch of merge commits clogging the history :) I took a brief look at this. It seems like a good improvement, but I'm not yet sold on it as a great improvement. Some thoughts:
cc @nb |
No idea; need to test.
I'm not sure how easy it would be to add them back; we'd have to fork even more of the new export API.
I don't think including the CLI arguments verbatim was a good idea to start. We could add their md5 hash though.
I think it makes sense; the file size is what you really care about when splitting. |
Can we instead ask Nikolay to include actions within the export API that achieve the end results we want? I haven't done a diff to see what we've changed, but my preference would be no forking at all.
Care to explain? Including them verbatim achieves two things:
An md5 hash only achieves the second. |
|
It's not a good idea because the arguments can get really long and might contain unusual characters (for a file name). I understand it's convenient, but it doesn't justify the potential headaches. |
Let that become a problem when it becomes a problem. I was sanitizing the filename previously. |
|
Copying the relevant code chunk here, for convenience: $append = array( date( 'Y-m-d' ) );
foreach( array_keys( $args ) as $arg_key ) {
if ( $defaults[$arg_key] <> $args[$arg_key] && 'post__in' != $arg_key )
$append[]= "$arg_key-" . (string) $args[$arg_key];
}
$file_name_base = sanitize_file_name( $sitename . 'wordpress.' . implode( ".", $append ) );Still not sold; it would be cleaner to allow the user to specify an "ID" for a batch of export files. For example: which would generate: Or even allow them control of the entire filename format: |
|
I guess my beef with the old code is that 1) the filenames generated by default are too dynamic and 2) you can't change the default. |
|
I am cool with adding actions and filters, I almost haven't thought how it will be extended, so I almost haven't added actions or filters. |
|
Added 'wp_export_new_file' hook: 743092d Suggestions for better name and/or better placement (while achieving similar functionality) welcome. |
|
Guys, I'm going to merge this pretty much as-is. My hunch is that people will be a lot more likely to submit incremental improvements once they see that the code is relatively clean. |
The current code that implements
wp exportis a mess, because the WordPress export code is a mess.@nb proposed a proper export API (he says it's already being used on wordpress.com).
Ticket: http://core.trac.wordpress.org/ticket/22435
Diff: nb/WordPress@master...export-api
If we namespace it properly, we can start using it before it lands in Core.
Tasks:
--verboseflagVerboseExportWriterclass with action insideWP_Export_Split_Files_Writerexport_wpaction again?