Skip to content

Commit

Permalink
fix: class "DUP_Logs" not found
Browse files Browse the repository at this point in the history
- reported by James Morris on support thread
  • Loading branch information
flydev-fr committed Mar 26, 2023
1 parent f622abe commit 8417f03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Classes/ClientAmazonS3.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace ProcessWire;

use Aws\S3\S3Client;

class AmazonS3Client
Expand Down Expand Up @@ -252,4 +254,4 @@ public function __construct($message = null, $code = 0, Exception $previous = nu
DUP_Logs::log("AmazonS3: " . $message);
parent::__construct($message, $code, $previous);
}
}
}
6 changes: 3 additions & 3 deletions Duplicator.module
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ class Duplicator extends WireData implements Module, ConfigurableModule
throw new WireException("AmazonS3 SDK not installed.");
}

$amazonaws = new \AmazonS3Client();
$amazonaws = new AmazonS3Client();
$amazonaws->setAccessKey($this->awsAccessKey);
$amazonaws->setSecretKey($this->awsSecretKey);
$amazonaws->setRegion($this->awsRegion);
Expand All @@ -766,7 +766,7 @@ class Duplicator extends WireData implements Module, ConfigurableModule
$amazonaws->upload($package['zipfile'], $packageName, $this->awsSubDir);
//if($url === null) throw new AmazonS3ClientException("AmazonS3: An error occured while uploading package <{$packageName}>");
$amazonaws->deleteOldBackups($this->maxPackages, $this->deadline);
} catch (\AmazonS3ClientException $ex) {
} catch (AmazonS3ClientException $ex) {
DUP_Logs::log("[AmazonS3] error: " . $ex->getMessage(), 'warning');
}
}
Expand Down Expand Up @@ -1788,7 +1788,7 @@ class Duplicator extends WireData implements Module, ConfigurableModule
$fs->append($fsgd);

// AMAZON
if (!class_exists('AmazonS3Client')) {
if (!class_exists('\Aws\S3\S3Client')) {
$skip = true;
}
$description = ($skip == false) ? $disabled = '' : __("The required SDK is not installed. You can download it [here](https://github.com/flydev-fr/duplicator-amazon-s3) or install it with [Composer](https://getcomposer.org/doc/00-intro.md). Run **composer require aws/aws-sdk-php**");
Expand Down
4 changes: 2 additions & 2 deletions ProcessDuplicator.module
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ class ProcessDuplicator extends Process
// AmazonS3
if ($this->dupmod->useAmazonS3 == 1) {
try {
$amazonaws = new \AmazonS3Client();
$amazonaws = new AmazonS3Client();
$amazonaws->setAccessKey($this->dupmod->awsAccessKey);
$amazonaws->setSecretKey($this->dupmod->awsSecretKey);
$amazonaws->setRegion($this->dupmod->awsRegion);
Expand Down Expand Up @@ -485,7 +485,7 @@ class ProcessDuplicator extends Process
array_push($rows, $data);
}
}
} catch (\AmazonS3ClientException $ex) {
} catch (AmazonS3ClientException $ex) {
DUP_Logs::log("AmazonS3 error: " . $ex->getMessage(), 'error');
}
}
Expand Down

0 comments on commit 8417f03

Please sign in to comment.