PD purge : ps

This commit is contained in:
VE10-Sanjeev 2022-10-15 17:27:03 +05:30
parent fdd0ab7738
commit 4ffc2537c8

View File

@ -945,15 +945,16 @@ class Data_Dump_Controller extends REST_Controller
for ($m = 0; $m < count($docs_dtls); $m++) {
log_message('ERROR', "Document " . $docs_dtls[$m]['pd_document_name']);
$docname = $docs_dtls[$m]['pd_document_name'];
$destination_path = $this->external_path . "/pd_reports/" . $pdid . "/" . $docname;
if (file_exists($destination_path)) {
unlink($destination_path);
}else{
mkdir($destination_path, 0777);
$destination_path = $this->external_path . "/pd_reports/" . $pdid;
$files = glob($destination_path.'/*');
foreach($files as $file) {
if(is_file($file))
// Delete the given file
unlink($file);
}
$bucketname = LENDER_BUCKET_NAME_PREFIX . $pdlenid;
$key = 'pd' . $pdid . '/' . $docname;
$key = 'pd' . $pdid . '/*';
$s3result = $this->aws_s3->deleteSingleObjFromBucket($bucketname, $key);
if (is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) {
log_message('ERROR', "s3result " . $s3result['@metadata']['statusCode']);