diff --git a/composer.json b/composer.json index 5ac5d16..322349c 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ } ], "require": { + "drupal/core": "^8.8 || ^9", "ml/json-ld": "^1.1", "mtdowling/jmespath.php":"^2.5", "swaggest/json-schema":"^0.12.25", diff --git a/src/Event/StrawberryfieldCrudEvent.php b/src/Event/StrawberryfieldCrudEvent.php index 3969c05..6874224 100644 --- a/src/Event/StrawberryfieldCrudEvent.php +++ b/src/Event/StrawberryfieldCrudEvent.php @@ -40,7 +40,7 @@ class StrawberryfieldCrudEvent extends Event { * @var array * */ - private $processedby; + private $processedby = []; /** * Construct a new entity event. diff --git a/src/Form/keyNameProviderEntityDeleteForm.php b/src/Form/keyNameProviderEntityDeleteForm.php index 320d922..bd8ebc3 100644 --- a/src/Form/keyNameProviderEntityDeleteForm.php +++ b/src/Form/keyNameProviderEntityDeleteForm.php @@ -37,8 +37,7 @@ public function getConfirmText() { */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->entity->delete(); - - drupal_set_message( + $this->messenger()->addMessage( $this->t('content @type: deleted @label.', [ '@type' => $this->entity->bundle(), diff --git a/src/Plugin/DataType/StrawberryValuesViaJmesPathFromJson.php b/src/Plugin/DataType/StrawberryValuesViaJmesPathFromJson.php index 08f304a..b9d615d 100644 --- a/src/Plugin/DataType/StrawberryValuesViaJmesPathFromJson.php +++ b/src/Plugin/DataType/StrawberryValuesViaJmesPathFromJson.php @@ -61,7 +61,7 @@ public function process($langcode = NULL) $jmespath_array = array_map('trim', explode(',', $jmespaths)); $jmespath_result = []; foreach ($jmespath_array as $jmespath) { - $jmespath_result[] = $item->searchPath($jmespath,FALSE); + $jmespath_result[] = $item->searchPath(trim($jmespath),FALSE); } $jmespath_result_to_expose = []; diff --git a/src/Plugin/Field/FieldType/StrawberryFieldFileComputedItem.php b/src/Plugin/Field/FieldType/StrawberryFieldFileComputedItem.php index 3f542a3..7af2ffb 100644 --- a/src/Plugin/Field/FieldType/StrawberryFieldFileComputedItem.php +++ b/src/Plugin/Field/FieldType/StrawberryFieldFileComputedItem.php @@ -93,7 +93,7 @@ public static function defaultStorageSettings() { 'target_type' => 'file', 'display_field' => FALSE, 'display_default' => FALSE, - 'uri_scheme' => file_default_scheme(), + 'uri_scheme' => \Drupal::config('system.file')->get('default_scheme') ] + parent::defaultStorageSettings(); } diff --git a/src/Plugin/StrawberryfieldKeyNameProviderInterface.php b/src/Plugin/StrawberryfieldKeyNameProviderInterface.php index 58a68aa..c0761ab 100644 --- a/src/Plugin/StrawberryfieldKeyNameProviderInterface.php +++ b/src/Plugin/StrawberryfieldKeyNameProviderInterface.php @@ -9,7 +9,8 @@ namespace Drupal\strawberryfield\Plugin; use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Core\Plugin\PluginWithFormsInterface; -use Drupal\Component\Plugin\ConfigurablePluginInterface; +use Drupal\Component\Plugin\ConfigurableInterface; +use Drupal\Component\Plugin\DependentPluginInterface; /** * Defines and Interface for StrawberryfieldKeyNameProvider Plugins @@ -18,7 +19,7 @@ * * @package Drupal\strawberryfield\Plugin */ -interface StrawberryfieldKeyNameProviderInterface extends PluginInspectionInterface, PluginWithFormsInterface, ConfigurablePluginInterface{ +interface StrawberryfieldKeyNameProviderInterface extends PluginInspectionInterface, PluginWithFormsInterface, ConfigurableInterface, DependentPluginInterface{ /** diff --git a/src/StrawberryfieldFilePersisterService.php b/src/StrawberryfieldFilePersisterService.php index eeda7b1..503a7e1 100644 --- a/src/StrawberryfieldFilePersisterService.php +++ b/src/StrawberryfieldFilePersisterService.php @@ -228,9 +228,9 @@ public function getDestinationUri( $current_uri, PATHINFO_EXTENSION ); - $file_parts['destination_scheme'] = $this->fileSystem->uriScheme( - $file->getFileUri() - ); + $file_parts['destination_scheme'] = $this->streamWrapperManager + ->getScheme($current_uri); + list($file_parts['destination_filetype'],) = explode( '/', $file->getMimeType() @@ -1024,13 +1024,13 @@ public function getBaseFileMetadata(FileInterface $file) { $output_exif = ''; $output_fido = ''; $result_exif = exec( - $exif_exec_path . ' -json -q -a -gps:all -Common "-gps*" -xmp:all -ImageWidth -ImageHeight -Canon -Nikon-AllDates -pdf:all -ee -MIMEType ' . escapeshellcmd($templocation), + $exif_exec_path . ' -json -q -a -gps:all -Common "-gps*" -xmp:all -ImageWidth -ImageHeight -Canon -Nikon-AllDates -pdf:all -ee -MIMEType ' . escapeshellarg($templocation), $output_exif, $status_exif ); $result_fido = exec( - $fido_exec_path . ' ' . escapeshellcmd($templocation), + $fido_exec_path . ' ' . escapeshellarg($templocation), $output_fido, $status_fido ); diff --git a/strawberryfield.info.yml b/strawberryfield.info.yml index fa8b73e..80d1a27 100644 --- a/strawberryfield.info.yml +++ b/strawberryfield.info.yml @@ -2,10 +2,9 @@ name: Strawberry Field description: Creates a field type that stores JSON and makes it available to other Drupal modules. package: Archipelago type: module -core: 8.x +core_version_requirement: ^8.8 || ^9 php: 7.1 dependencies: - - 'drupal:system (>= 8.7)' - 'drupal:user' - 'drupal:field' - 'drupal:serialization' diff --git a/strawberryfield.module b/strawberryfield.module index 356f2ad..da1cea8 100644 --- a/strawberryfield.module +++ b/strawberryfield.module @@ -32,11 +32,12 @@ function strawberryfield_node_presave(ContentEntityInterface $entity) { // When benchmark is enabled a simple but effective report will be found in the reports/logs if ($config->get('benchmark')) { $bench = TRUE; + $start_time = microtime(true); } // Introducing our newest development, the processing time stats! // Starting on PHP 7.3 we should use hrtime for docker and VMS. // https://www.php.net/manual/en/function.microtime.php - $start_time = microtime(true); + //@TODO make bench simply an Event Method! That way we can measure every //Event by calling it and for new ones. Etc. @@ -49,16 +50,21 @@ function strawberryfield_node_presave(ContentEntityInterface $entity) { if ($bench) { $end_time = microtime(TRUE); // Removed bsuc - $time = round($end_time, $start_time, 4); + $time = round($end_time - $start_time, 4); $max_memory = memory_get_peak_usage(TRUE); - $events = implode("\n\r",$event->getProcessedBy()); + $events = ''; + foreach($event->getProcessedBy() as $event_info) { + $success = $event_info['success']? 'Successful' : 'Failure'; + $events .= '