'table', 'fields' => array( 'Job ID', 'Name' ), 'field' => NULL ); $items = array(); $formatter = new WP_CLI\Formatter( $formatter_args ); $jobids = BackWPup_Option::get_job_ids(); foreach ($jobids as $jobid ) { $items[] = array( 'Job ID' => $jobid, 'Name' => BackWPup_Option::get( $jobid, 'name' ) ); } $formatter->display_items( $items ); } /** * See Status of a working job * * @param $args * @param $assoc_args */ public function working( $args, $assoc_args ) { $job_object = BackWPup_Job::get_working_data(); if ( ! is_object( $job_object ) ) { WP_CLI::error( __( 'No job running', 'backwpup' ) ); } $formatter_args = array( 'format' => 'table', 'fields' => array( 'JobID', 'Name', 'Warnings', 'Errors', 'On Step', 'Done', ), 'field' => NULL ); $formatter = new WP_CLI\Formatter( $formatter_args ); $items = array(); $items[] = array( 'JobID' => $job_object->job[ 'jobid' ], 'Name' => $job_object->job[ 'name' ], 'Warnings' => $job_object->warnings, 'Errors' => $job_object->errors, 'On Step' => $job_object->steps_data[ $job_object->step_working ][ 'NAME' ], 'Done' => $job_object->step_percent . ' / ' . $job_object->substep_percent, 'Last message' => str_replace( '…', '...', strip_tags( $job_object->lastmsg ) ) ); $formatter->display_items( $items ); WP_CLI::log( 'Last Message: ' . str_replace( '…', '...', strip_tags( $job_object->lastmsg ) ) ); } }