Browse Source

php cleanup

pull/793/head
Eli Zoller 4 years ago
parent
commit
9a16c4373b
  1. 14
      src/Flysystem/Adapter/FedoraAdapter.php

14
src/Flysystem/Adapter/FedoraAdapter.php

@ -11,7 +11,7 @@ use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Response; use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\StreamWrapper; use GuzzleHttp\Psr7\StreamWrapper;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface; use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
use \DateTime; use DateTime;
/** /**
* Fedora adapter for Flysystem. * Fedora adapter for Flysystem.
@ -251,19 +251,19 @@ class FedoraAdapter implements AdapterInterface {
*/ */
public function write($path, $contents, Config $config) { public function write($path, $contents, Config $config) {
\Drupal::logger('flysystem adapter')->info('in write for flysystem'); \Drupal::logger('flysystem adapter')->info('in write for flysystem');
if ($this->has($path)){ if ($this->has($path)) {
\Drupal::logger('flysystem adapter')->info('in write for flysystem and already exists in fedora'); \Drupal::logger('flysystem adapter')->info('in write for flysystem and already exists in fedora');
$fedora_url = $path; $fedora_url = $path;
$headers = []; $headers = [];
$date = new DateTime(); $date = new DateTime();
$timestamp = $date->format("D, d M Y H:i:s O"); $timestamp = $date->format("D, d M Y H:i:s O");
// create version in Fedora. // Create version in Fedora.
try { try {
\Drupal::logger('flysystem')->info('right before make version ' . $status); \Drupal::logger('flysystem')->info('right before make version ' . $fedora_url);
$response = $this->fedora->createVersion( $response = $this->fedora->createVersion(
$fedora_url, $fedora_url,
$timestamp, $timestamp,
null, NULL,
$headers $headers
); );
$status = $response->getStatusCode(); $status = $response->getStatusCode();
@ -277,8 +277,8 @@ class FedoraAdapter implements AdapterInterface {
} }
// Return the response from Fedora. // Return the response from Fedora.
\Drupal::logger('flysystem')->info('past making a version with status ' . $status); \Drupal::logger('flysystem')->info('past making a version with status ' . $status);
// return $response; }
} catch (Exception $e) { catch (\Exception $e) {
\Drupal::logger('flysystem')->error('Caught exception when creating version: ', $e->getMessage(), "\n"); \Drupal::logger('flysystem')->error('Caught exception when creating version: ', $e->getMessage(), "\n");
} }
} }

Loading…
Cancel
Save