Capitalizes some log messages.

This commit is contained in:
mateuswetah 2021-11-01 10:52:50 -03:00
parent 209d92e099
commit ccf772b133
1 changed files with 12 additions and 12 deletions

View File

@ -141,10 +141,10 @@ class Bulk_Edit_Process extends Generic_Process {
$params['control_metadata'] = $this->get_id(); $params['control_metadata'] = $this->get_id();
$this->save_options($params); $this->save_options($params);
} elseif ($params['control_metadata'] === true) { } elseif ($params['control_metadata'] === true) {
$this->add_log( __('bulk edit control metadata has already been created', 'tainacan') ); $this->add_log( __('Bulk edit control metadata has already been created', 'tainacan') );
return false; return false;
} elseif( is_numeric($params['control_metadata']) && $params['control_metadata'] != $this->get_id() ) { } elseif( is_numeric($params['control_metadata']) && $params['control_metadata'] != $this->get_id() ) {
$this->add_log( sprintf( __( 'waiting creating bulk edit control metadata by process ID: "%d"', 'tainacan' ), $params['control_metadata'] ) ); $this->add_log( sprintf( __( 'Waiting creating bulk edit control metadata by process ID: "%d"', 'tainacan' ), $params['control_metadata'] ) );
return true; return true;
} }
@ -171,11 +171,11 @@ class Bulk_Edit_Process extends Generic_Process {
if(!$item_query->have_posts() ) { if(!$item_query->have_posts() ) {
$params['control_metadata'] = true; $params['control_metadata'] = true;
$this->save_options($params); $this->save_options($params);
$this->add_log( __('bulk edit control metadata created', 'tainacan') ); $this->add_log( __('Bulk edit control metadata created', 'tainacan') );
return false; return false;
} }
$item_id = $item_query->get_posts()[0]; $item_id = $item_query->get_posts()[0];
$this->add_log( sprintf( __( 'creating bulk edit control metadata for item: "%d"', 'tainacan' ), $item_id ) ); $this->add_log( sprintf( __( 'Creating bulk edit control metadata for item: "%d"', 'tainacan' ), $item_id ) );
add_post_meta($item_id, $this->meta_key, $this->get_group_id()); add_post_meta($item_id, $this->meta_key, $this->get_group_id());
return $count; return $count;
} elseif (isset($params['items_ids']) && is_array($params['items_ids'])) { } elseif (isset($params['items_ids']) && is_array($params['items_ids'])) {
@ -183,18 +183,18 @@ class Bulk_Edit_Process extends Generic_Process {
$count = $this->get_in_step_count(); $count = $this->get_in_step_count();
if( isset($items_ids[$count]) ) { if( isset($items_ids[$count]) ) {
$this->add_log( sprintf( __( 'creating bulk edit control metadata for item: "%d"', 'tainacan' ), $items_ids[$count] ) ); $this->add_log( sprintf( __( 'Creating bulk edit control metadata for item: "%d"', 'tainacan' ), $items_ids[$count] ) );
add_post_meta($items_ids[$count++], $this->meta_key, $this->get_group_id()); add_post_meta($items_ids[$count++], $this->meta_key, $this->get_group_id());
return $count; return $count;
} else { } else {
$params['control_metadata'] = true; $params['control_metadata'] = true;
$this->save_options($params); $this->save_options($params);
$this->add_log( __('bulk edit control metadata created', 'tainacan') ); $this->add_log( __('Bulk edit control metadata created', 'tainacan') );
return false; return false;
} }
} }
$this->add_error_log(__('wrong parameter on add bulk edit control metadata', 'tainacan')); $this->add_error_log(__('Wrong parameter on add bulk edit control metadata', 'tainacan'));
$this->abort(); $this->abort();
return false; return false;
} }
@ -241,7 +241,7 @@ class Bulk_Edit_Process extends Generic_Process {
return false; return false;
} }
$this->add_log( sprintf( __('bulk edit has process the item ID: "%d"', 'tainacan'), $item->get_id() ) ); $this->add_log( sprintf( __('Bulk edit has process the item ID: "%d"', 'tainacan'), $item->get_id() ) );
$add_steps = $this->$method($item); $add_steps = $this->$method($item);
if ( is_int($add_steps) ) { if ( is_int($add_steps) ) {
$count = $count + $add_steps; $count = $count + $add_steps;
@ -252,7 +252,7 @@ class Bulk_Edit_Process extends Generic_Process {
public function finished() { public function finished() {
$total = $this->get_transient('total_process') == null ? 0 : $this->get_transient('total_process'); $total = $this->get_transient('total_process') == null ? 0 : $this->get_transient('total_process');
$this->add_log('finished'); $this->add_log('finished');
$this->add_log( sprintf( __('total items processed: %d', 'tainacan'), $total ) ); $this->add_log( sprintf( __('Total items processed: %d', 'tainacan'), $total ) );
} }
private function save_item_metadata(\Tainacan\Entities\Item_Metadata_Entity $item_metadata, \Tainacan\Entities\Item $item) { private function save_item_metadata(\Tainacan\Entities\Item_Metadata_Entity $item_metadata, \Tainacan\Entities\Item $item) {
@ -472,7 +472,7 @@ class Bulk_Edit_Process extends Generic_Process {
private function trash_items(\Tainacan\Entities\Item $item) { private function trash_items(\Tainacan\Entities\Item $item) {
if ( !$this->items_repository->trash($item) ) { if ( !$this->items_repository->trash($item) ) {
$this->add_error_log( sprintf( __('error on send to trash, item ID: "%d"', 'tainacan'), $item->get_id() ) ); $this->add_error_log( sprintf( __('Error on send to trash, item ID: "%d"', 'tainacan'), $item->get_id() ) );
return false; return false;
} }
return true; return true;
@ -480,7 +480,7 @@ class Bulk_Edit_Process extends Generic_Process {
private function untrash_items(\Tainacan\Entities\Item $item) { private function untrash_items(\Tainacan\Entities\Item $item) {
if ( !wp_untrash_post( $item->get_id() ) ) { if ( !wp_untrash_post( $item->get_id() ) ) {
$this->add_error_log( sprintf( __('error on untrash, item ID: "%d"', 'tainacan'), $item->get_id() ) ); $this->add_error_log( sprintf( __('Error on untrash, item ID: "%d"', 'tainacan'), $item->get_id() ) );
return false; return false;
} }
return true; return true;
@ -526,7 +526,7 @@ class Bulk_Edit_Process extends Generic_Process {
$value = $this->bulk_edit_data['value']; $value = $this->bulk_edit_data['value'];
if ( ! in_array( $value, array( 'open', 'closed' ) ) ) { if ( ! in_array( $value, array( 'open', 'closed' ) ) ) {
$this->add_error_log( __( "the status of comments must be 'open' or 'closed'", 'tainacan' ) ); $this->add_error_log( __( "The status of comments must be 'open' or 'closed'", 'tainacan' ) );
return false; return false;
} }