XML-RPC: Unify some "could not be created/updated/deleted" error messages for consistency.

Props ramiy, SergeyBiryukov.
Fixes #48883.
Built from https://develop.svn.wordpress.org/trunk@46814


git-svn-id: http://core.svn.wordpress.org/trunk@46614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-12-05 13:48:03 +00:00
parent 8d6912dd27
commit 23abf27b1a
2 changed files with 19 additions and 15 deletions

View File

@ -1637,7 +1637,11 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! $post_ID ) {
return new IXR_Error( 401, __( 'Sorry, your entry could not be posted.' ) );
if ( $update ) {
return new IXR_Error( 401, __( 'Sorry, the post could not be updated.' ) );
} else {
return new IXR_Error( 401, __( 'Sorry, the post could not be created.' ) );
}
}
return strval( $post_ID );
@ -1777,7 +1781,7 @@ class wp_xmlrpc_server extends IXR_Server {
$result = wp_delete_post( $post_id );
if ( ! $result ) {
return new IXR_Error( 500, __( 'The post cannot be deleted.' ) );
return new IXR_Error( 500, __( 'Sorry, the post could not be deleted.' ) );
}
return true;
@ -2079,7 +2083,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! $term ) {
return new IXR_Error( 500, __( 'Sorry, your term could not be created.' ) );
return new IXR_Error( 500, __( 'Sorry, the term could not be created.' ) );
}
// Add term meta.
@ -2877,7 +2881,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! $result ) {
return new IXR_Error( 500, __( 'Sorry, the user cannot be updated.' ) );
return new IXR_Error( 500, __( 'Sorry, the user could not be updated.' ) );
}
return true;
@ -3376,10 +3380,10 @@ class wp_xmlrpc_server extends IXR_Server {
if ( 'term_exists' == $cat_id->get_error_code() ) {
return (int) $cat_id->get_error_data();
} else {
return new IXR_Error( 500, __( 'Sorry, the new category failed.' ) );
return new IXR_Error( 500, __( 'Sorry, the category could not be created.' ) );
}
} elseif ( ! $cat_id ) {
return new IXR_Error( 500, __( 'Sorry, the new category failed.' ) );
return new IXR_Error( 500, __( 'Sorry, the category could not be created.' ) );
}
/**
@ -3788,7 +3792,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! $result ) {
return new IXR_Error( 500, __( 'Sorry, the comment could not be edited.' ) );
return new IXR_Error( 500, __( 'Sorry, the comment could not be updated.' ) );
}
/**
@ -4979,7 +4983,7 @@ class wp_xmlrpc_server extends IXR_Server {
* @return IXR_Error Error object.
*/
public function blogger_getTemplate( $args ) {
return new IXR_Error( 403, __( 'Sorry, that file cannot be edited.' ) );
return new IXR_Error( 403, __( 'Sorry, this method is not supported.' ) );
}
/**
@ -4992,7 +4996,7 @@ class wp_xmlrpc_server extends IXR_Server {
* @return IXR_Error Error object.
*/
public function blogger_setTemplate( $args ) {
return new IXR_Error( 403, __( 'Sorry, that file cannot be edited.' ) );
return new IXR_Error( 403, __( 'Sorry, this method is not supported.' ) );
}
/**
@ -5052,7 +5056,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! $post_ID ) {
return new IXR_Error( 500, __( 'Sorry, your entry could not be posted.' ) );
return new IXR_Error( 500, __( 'Sorry, the post could not be created.' ) );
}
$this->attach_uploads( $post_ID, $post_content );
@ -5132,7 +5136,7 @@ class wp_xmlrpc_server extends IXR_Server {
$result = wp_update_post( $postdata );
if ( ! $result ) {
return new IXR_Error( 500, __( 'For some strange yet very annoying reason, this post could not be edited.' ) );
return new IXR_Error( 500, __( 'Sorry, the post could not be updated.' ) );
}
$this->attach_uploads( $actual_post['ID'], $postdata['post_content'] );
@ -5192,7 +5196,7 @@ class wp_xmlrpc_server extends IXR_Server {
$result = wp_delete_post( $post_ID );
if ( ! $result ) {
return new IXR_Error( 500, __( 'The post cannot be deleted.' ) );
return new IXR_Error( 500, __( 'Sorry, the post could not be deleted.' ) );
}
/**
@ -5544,7 +5548,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! $post_ID ) {
return new IXR_Error( 500, __( 'Sorry, your entry could not be posted.' ) );
return new IXR_Error( 500, __( 'Sorry, the post could not be created.' ) );
}
/**
@ -5889,7 +5893,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
if ( ! $result ) {
return new IXR_Error( 500, __( 'Sorry, your entry could not be edited.' ) );
return new IXR_Error( 500, __( 'Sorry, the post could not be updated.' ) );
}
// Only posts can be sticky

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-46813';
$wp_version = '5.4-alpha-46814';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.