|
|
|
|
@ -42,7 +42,9 @@ class Utils {
|
|
|
|
|
if (!$file) { |
|
|
|
|
$absolute_path = $fileSystem->realpath($destination_path); |
|
|
|
|
if ($absolute_path) { |
|
|
|
|
chown($absolute_path, $build_data['ownership']); |
|
|
|
|
$ownership = explode(':', $build_data['ownership']); |
|
|
|
|
chown($absolute_path, $ownership[0]); |
|
|
|
|
chgrp($absolute_path, $ownership[1]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$file = File::create([ |
|
|
|
|
@ -70,7 +72,6 @@ class Utils {
|
|
|
|
|
"field_media_of" => $nid, |
|
|
|
|
]); |
|
|
|
|
$media->save(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -79,7 +80,8 @@ class Utils {
|
|
|
|
|
public static function buildMediaBatch($build_data) { |
|
|
|
|
$source_dir = $build_data['source_dir']; |
|
|
|
|
if ($source_dir && !is_dir($source_dir)) { |
|
|
|
|
\Drupal::logger('islandora_inplace_media')->error('Source directory does not exist: @dir', ['@dir' => $source_dir]); |
|
|
|
|
\Drupal::logger('islandora_inplace_media') |
|
|
|
|
->error('Source directory does not exist: @dir', ['@dir' => $source_dir]); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
$destination = $build_data['destination_path']; |
|
|
|
|
@ -93,7 +95,7 @@ class Utils {
|
|
|
|
|
$batch = [ |
|
|
|
|
'title' => t('Processing media files...'), |
|
|
|
|
'operations' => [], |
|
|
|
|
// Static method reference. |
|
|
|
|
// Static method reference. |
|
|
|
|
'finished' => [self::class, 'finishMediaBatch'], |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
@ -112,10 +114,12 @@ class Utils {
|
|
|
|
|
*/ |
|
|
|
|
public static function finishMediaBatch($success, $results, $operations) { |
|
|
|
|
if ($success) { |
|
|
|
|
\Drupal::logger('islandora_inplace_media')->notice('Successfully processed media files.'); |
|
|
|
|
\Drupal::logger('islandora_inplace_media') |
|
|
|
|
->notice('Successfully processed media files.'); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
\Drupal::logger('islandora_inplace_media')->error('There were errors processing media files.'); |
|
|
|
|
\Drupal::logger('islandora_inplace_media') |
|
|
|
|
->error('There were errors processing media files.'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|