39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?php
|
|
use Aws\S3\S3Client;
|
|
|
|
class MyS3Wrapper {
|
|
private $client;
|
|
|
|
public function __construct(array $config) {
|
|
$this->client = new S3Client($config);
|
|
}
|
|
|
|
public function deleteObject(array $params) {
|
|
global $database, $user, $admin;
|
|
|
|
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
|
/*$caller = $trace[1];
|
|
$file = $caller['file'] ?? 'unknown file';
|
|
$line = $caller['line'] ?? 'unknown line';
|
|
$function = $caller['function'] ?? 'unknown function';/*/
|
|
$text="";
|
|
foreach ($trace as $i => $frame) {
|
|
$file = $frame['file'] ?? '[internal]';
|
|
$line = $frame['line'] ?? '?';
|
|
$func = $frame['function'] ?? '[unknown]';
|
|
$class = $frame['class'] ?? '';
|
|
$type = $frame['type'] ?? '';
|
|
|
|
$text.="[".$i."] ".$file.":".$line." - ".$class.$type.$func."()\r\n";
|
|
}
|
|
|
|
|
|
|
|
$database->database_query("INSERT INTO bateworldcom_wall.file_deletions SET user_id='".$user->user_info["user_id"]."', admin_id='".$admin->admin_info["admin_id"]."', time='".time()."', file='".$database->database_real_escape_string(var_export($params, true))."', notes='".$database->database_real_escape_string($text)."'");
|
|
|
|
$result = $this->client->deleteObject($params);
|
|
|
|
|
|
return $result;
|
|
}
|
|
} |