Make WordPress Core

Ticket #39275: 39275_version2.patch

File 39275_version2.patch, 3.2 KB (added by utkarshpatel, 8 years ago)

Adds additional param skip_revision for wp.customize.previewer.save. By default it will store revision.

  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 9f385a003..0664dfd42 100644
     
    43594359                         *
    43604360                         * @param {object} [args] Args.
    43614361                         * @param {string} [args.status=publish] Status.
     4362                         * @param {bool}   [args.skipRevision=true] Store Revision.
    43624363                         * @param {string} [args.date] Date, in local time in MySQL format.
    43634364                         * @param {string} [args.title] Title
    43644365                         * @returns {jQuery.promise} Promise.
     
    43724373                                        submit,
    43734374                                        modifiedWhileSaving = {},
    43744375                                        invalidSettings = [],
    4375                                         invalidControls;
     4376                                        invalidControls,
     4377                                        skipRevision = false;
    43764378
    43774379                                if ( args && args.status ) {
    43784380                                        changesetStatus = args.status;
    43794381                                }
    43804382
     4383                                if ( args && args.skipRevision ) {
     4384                                        skipRevision = args.skipRevision;
     4385                                }
     4386
    43814387                                if ( api.state( 'saving' ).get() ) {
    43824388                                        deferred.reject( 'already_saving' );
    43834389                                        deferred.promise();
     
    44264432                                         */
    44274433                                        query = $.extend( previewer.query( { excludeCustomizedSaved: false } ), {
    44284434                                                nonce: previewer.nonce.save,
    4429                                                 customize_changeset_status: changesetStatus
     4435                                                customize_changeset_status: changesetStatus,
     4436                                                skip_revision: skipRevision
    44304437                                        } );
    44314438                                        if ( args && args.date ) {
    44324439                                                query.customize_changeset_date = args.date;
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index 4ac25232f..49e7607a1 100644
    final class WP_Customize_Manager { 
    21392139                        }
    21402140                }
    21412141
     2142                $skip_revision = false;
     2143                if ( isset( $_POST['skip_revision'] ) ) {
     2144                        $skip_revision = filter_var( $_POST['skip_revision'], FILTER_VALIDATE_BOOLEAN );
     2145                }
     2146
    21422147                $r = $this->save_changeset_post( array(
    21432148                        'status' => $changeset_status,
    21442149                        'title' => $changeset_title,
    21452150                        'date_gmt' => $changeset_date_gmt,
    21462151                        'data' => $input_changeset_data,
     2152                        'skip_revision' => $skip_revision,
    21472153                ) );
    21482154                if ( is_wp_error( $r ) ) {
    21492155                        $response = array(
    final class WP_Customize_Manager { 
    22082214         *     @type string $date_gmt        Date in GMT. Optional.
    22092215         *     @type int    $user_id         ID for user who is saving the changeset. Optional, defaults to the current user ID.
    22102216         *     @type bool   $starter_content Whether the data is starter content. If false (default), then $starter_content will be cleared for any $data being saved.
     2217         *     @type bool   $skip_revision   Skip revision, default to false, Optional.
    22112218         * }
    22122219         *
    22132220         * @return array|WP_Error Returns array on success and WP_Error with array data on error.
    final class WP_Customize_Manager { 
    22222229                                'date_gmt' => null,
    22232230                                'user_id' => get_current_user_id(),
    22242231                                'starter_content' => false,
     2232                                'skip_revision' => false,
    22252233                        ),
    22262234                        $args
    22272235                );
    final class WP_Customize_Manager { 
    22682276
    22692277                // The request was made via wp.customize.previewer.save().
    22702278                $update_transactionally = (bool) $args['status'];
    2271                 $allow_revision = (bool) $args['status'];
     2279                $allow_revision = (bool) $args['skip_revision'];
    22722280
    22732281                // Amend post values with any supplied data.
    22742282                foreach ( $args['data'] as $setting_id => $setting_params ) {