Skip to content

Commit

Permalink
Update hook for missing entity
Browse files Browse the repository at this point in the history
@giancarlobi for you friend
  • Loading branch information
DiegoPino committed Dec 15, 2020
1 parent 4c54c94 commit 91ccc23
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/Plugin/QueueWorker/AbstractPostProcessorQueueWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,13 @@ abstract class AbstractPostProcessorQueueWorker extends QueueWorkerBase implemen
* @param array $configuration
* @param string $plugin_id
* @param mixed $plugin_definition
* @param \Drupal\Core\Entity\EntityTypeManager $entity_field_manager
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* @param \Drupal\strawberry_runners\Plugin\StrawberryRunnersPostProcessorPluginManager $strawberry_runner_processor_plugin_manager
* @param \Drupal\Core\File\FileSystemInterface $file_system
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
* @param \Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value
* @param \Psr\Log\LoggerInterface $logger
* @param \Drupal\search_api\ParseMode\ParseModePluginManager $parse_mode_manager
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, StrawberryRunnersPostProcessorPluginManager $strawberry_runner_processor_plugin_manager, FileSystemInterface $file_system, StreamWrapperManagerInterface $stream_wrapper_manager, KeyValueFactoryInterface $key_value, LoggerInterface $logger, ParseModePluginManager $parse_mode_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ protected function hOCRtoMiniOCR($output, $pageid) {
// NOTE: floats are in the form of .1 so we need to remove the first 0.
if (count($coos)) {
$miniocr->startElement("p");
$miniocr->writeAttribute("xml:id", $pageid);
$miniocr->writeAttribute("xml:id", 'sequence_'.$pageid);
$miniocr->writeAttribute("wh", ltrim($pwidth, 0) . " " . ltrim($pheight, 0));
$miniocr->startElement("b");
$page->registerXPathNamespace('ns', 'http://www.w3.org/1999/xhtml');
Expand Down
16 changes: 15 additions & 1 deletion strawberry_runners.install
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
*
* @see 'https://www.drupal.org/node/3034742'
*/
function strawberry_runners_update_8100() {
function strawberry_runners_update_8001() {
\Drupal::entityDefinitionUpdateManager()->installEntityType(new ConfigEntityType([
'id' => 'strawberry_runners_postprocessor',
'label' => new TranslatableMarkup('Strawberry Runners Post Processor Configuration'),
Expand All @@ -34,3 +34,17 @@ function strawberry_runners_update_8100() {
],
]));
}
/**
* Update 8002 - Create AMI Set entity.
*/
function strawberry_runners_update_8002() {

if(!db_table_exists('runneritem_entity')) {
\Drupal::entityTypeManager()->clearCachedDefinitions();
\Drupal::entityDefinitionUpdateManager()
->installEntityType(\Drupal::entityTypeManager()->getDefinition('runneritem_entity'));
}
else {
return 'runner item entity already exists';
}
}

0 comments on commit 91ccc23

Please sign in to comment.