Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/23/2017 01:30:38 AM (8 years ago)
Author:
johnjamesjacoby
Message:

Converter: Add halt setting for stopping the importer when an error occurs.

Next: implement in Converter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/settings.php

    r6573 r6600  
    568568                'title'             => esc_html__( 'Convert Users', 'bbpress' ),
    569569                'callback'          => 'bbp_converter_setting_callback_convert_users',
     570                'sanitize_callback' => 'intval',
     571                'args'              => array()
     572            ),
     573
     574            // Halt
     575            '_bbp_converter_halt' => array(
     576                'title'             => esc_html__( 'Stop on Error', 'bbpress' ),
     577                'callback'          => 'bbp_converter_setting_callback_halt',
    570578                'sanitize_callback' => 'intval',
    571579                'args'              => array()
     
    16711679
    16721680/**
     1681 * Edit Halt setting field
     1682 *
     1683 * @since 2.6.0 bbPress (r6599)
     1684 */
     1685function bbp_converter_setting_callback_halt() {
     1686?>
     1687
     1688    <input name="_bbp_converter_halt" id="_bbp_converter_halt" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_halt', false ) ); ?> />
     1689    <label for="_bbp_converter_halt"><?php esc_html_e( 'Halt the conversion if an error occurs', 'bbpress' ); ?></label>
     1690    <p class="description"><?php esc_html_e( 'This is helpful for when you want to debug problems.', 'bbpress' ); ?></p>
     1691
     1692<?php
     1693}
     1694
     1695
     1696/**
    16731697 * Edit Restart setting field
    16741698 *
     
    17271751    $step = (int) get_option( '_bbp_converter_step', 0 );
    17281752    $max  = (int) bbpress()->admin->converter->max_steps;
     1753
     1754    // Starting or continuing?
     1755    $status_text = ! empty( $step )
     1756        ? sprintf( esc_html__( 'Up next: step %s', 'bbpress' ), $step )
     1757        : esc_html__( 'Ready', 'bbpress' );
    17291758
    17301759    // Starting or continuing?
     
    17341763
    17351764    // Starting or continuing?
    1736     $status_text = ! empty( $step )
     1765    $progress_text = ! empty( $step )
    17371766        ? sprintf( esc_html__( 'Previously stopped at step %d of %d', 'bbpress' ), $step, $max )
    17381767        : esc_html__( 'Ready to go.', 'bbpress' ); ?>
     
    17701799                            <h2 class="hndle ui-sortable-handle">
    17711800                                <span><?php esc_html_e( 'Import Monitor', 'bbpress' ); ?></span>
     1801                                <span id="bbp-converter-status"><?php echo esc_html( $status_text ); ?></span>
    17721802                            </h2>
    17731803                            <div class="inside">
    1774                                 <div id="bbp-converter-timer"><?php esc_html_e( 'Timer: Stopped', 'bbpress' ); ?></div>
    17751804                                <div id="bbp-converter-message" class="bbp-converter-log">
    1776                                     <p><?php echo esc_html( $status_text ); ?></p>
     1805                                    <p><?php echo esc_html( $progress_text ); ?></p>
    17771806                                </div>
    17781807                            </div>
Note: See TracChangeset for help on using the changeset viewer.