get_tools(); return array_keys( $tools ); } /** * Update saved errors for a tool. * * @param mixed $item * * @return bool */ protected function upgrade_item( $item ) { global $as3cf; if ( empty( $item ) || ! is_string( $item ) ) { // We really don't want to this upgrade to fail, // broken notices can still be dismissed, so just move on. return true; } $tools_manager = Tools_Manager::get_instance( $as3cf ); $tools = $tools_manager->get_tools(); if ( ! empty( $tools[ $item ] ) ) { /** @var Tool $tool */ $tool = $tools[ $item ]; $errors = $tool->get_errors(); $new_errors = array(); if ( ! empty( $errors ) ) { foreach ( $errors as $blog_id => $blog ) { foreach ( $blog as $attachment_id => $messages ) { $new_errors[] = (object) array( 'blog_id' => $blog_id, 'source_type' => 'media-library', 'source_id' => $attachment_id, 'messages' => (array) $messages, ); } } $tool->update_errors( $new_errors ); } } return true; } }