Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
fix(zip-extension): update in using zip_open()
Browse files Browse the repository at this point in the history
  • Loading branch information
tulsi91 authored and KaiSchwarz-cnic committed Jan 16, 2020
1 parent 6d47944 commit 8c3df85
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions backend/PendingDomainListPDO.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,26 @@ public function import()
}

if (function_exists('zip_open')) {
$handle = zip_open($path .'pending_delete_list_tmp.zip#pending_delete_domain_list.csv');
$zip = zip_open($path .'pending_delete_list_tmp.zip');
//ref: https://www.php.net/manual/en/ref.zip.php
while ($zip_entry = zip_read($zip)) {
//open the entry
if (zip_entry_open($zip, $zip_entry, "r")) {
//the name of the file to save on the disk
$file_name = $path.zip_entry_name($zip_entry);
//get the content of the zip entry
$fstream = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
file_put_contents($file_name, $fstream);
//set the rights
chmod($file_name, 0777);
//close the entry
zip_entry_close($zip_entry);
}
}
//close the zip-file
zip_close($zip);

$handle = fopen($path .'pending_delete_domain_list.csv', 'r');
} else {
$handle = fopen('zip://'. $path .'pending_delete_list_tmp.zip#pending_delete_domain_list.csv', 'r');
}
Expand Down Expand Up @@ -209,12 +228,8 @@ public function import()
} catch (PDOException $ex) {
}
$this->instance->commit();

if (function_exists('zip_open')) {
zip_close($handle);
} else {
fclose($handle);
}

fclose($handle);
}

//delete domains with drop_date in the past
Expand Down

0 comments on commit 8c3df85

Please sign in to comment.