Skip to content

Commit

Permalink
v1.4 - Fix bugs with auto cleanup of files.
Browse files Browse the repository at this point in the history
-v1.4.
-Fix bugs with auto-cleanup of files.
  • Loading branch information
zelon88 authored Oct 25, 2018
1 parent 53cfe03 commit 06a644a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 32 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
COMMIT 10/24/2018
v1.4 - Fix bugs with auto cleanup of files.

-v1.4.
-Fix bugs with auto-cleanup of files.

--------------------
COMMIT 9/25/2018
v1.3 - Fix typos in comments.

Expand Down
53 changes: 22 additions & 31 deletions scanCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

// / -----------------------------------------------------------------------------------
// / The following code sets the global variables for the session.
$HRScanVersion = 'v1.3';
$HRScanVersion = 'v1.4';
$versions = 'PHP-AV App v3.8 | Virus Definition v4.7, 8/19/2018';
$Date = date("m_d_y");
$Time = date("F j, Y, g:i a");
Expand Down Expand Up @@ -151,38 +151,29 @@ function cleanFiles($path) {

// / -----------------------------------------------------------------------------------
// / The following code will clean up old files.
if (file_exists($ScanDir)) {
$DFiles = scandir($ScanDir);
if (file_exists($ScanTemp)) {
$DFiles = array_diff(scandir($ScanTemp), array('..', '.'));
$now = time();
foreach ($DFiles as $DFile) {
if ($DFile == 'index.html' or in_array($DFile, $defaultApps)) continue;
if (($now - fileTime($ScanDir.'/'.$DFile)) > ($Delete_Threshold * 60)) { // Time to keep files.
if (is_file($DFile)) {
chmod ($DFile, 0755);
if (file_exists($ScanDir.'/'.$DFile)) unlink($ScanDir.'/'.$DFile);
$txt = ('OP-Act: Cleaned '.$ScanDir.'/'.$DFile.' on '.$Time.'.');
$MAKELogFile = file_put_contents($LogFile, $txt.PHP_EOL, FILE_APPEND); }
if (is_dir($DFile)) {
$CleanDir = $ScanDir.'/'.$DFile;
chmod ($CleanDir, 0755);
cleanFiles($CleanDir); }
cleanFiles($ScanDir); } } }
if (file_exists($ScanTemp)) {
$DFiles = scandir($ScanTemp);
foreach ($DFiles as $DFile) {
if (in_array($DFile, $defaultApps)) continue;
$DFilePath = $ScanTemp.'/'.$DFile;
if ($DFilePath == $ScanTemp.'/index.html') continue;
if ($now - fileTime($DFilePath) > ($Delete_Threshold * 60)) { // Time to keep files.
if (is_dir($DFilePath)) {
@chmod ($DFilePath, 0755);
cleanFiles($DFilePath);
if (is_dir_empty($DFilePath)) @rmdir($DFilePath); } } } }
if (file_exists($ScanLoc)) {
$DFiles = array_diff(scandir($ScanLoc), array('..', '.'));
$now = time();
foreach ($DFiles as $DFile) {
if ($DFile == 'index.html' or in_array($DFile, $defaultApps)) continue;
if (($now - fileTime($ScanTemp.'/'.$DFile)) > ($Delete_Threshold * 60)) { // Time to keep files.
if (is_file($DFile)) {
chmod ($DFile, 0755);
if (file_exists($ScanTemp.'/'.$DFile)) unlink($ScanTemp.'/'.$DFile);
$txt = ('OP-Act: Cleaned '.$ScanTemp.'/'.$DFile.' on '.$Time.'.');
$MAKELogFile = file_put_contents($LogFile, $txt.PHP_EOL, FILE_APPEND); }
if (is_dir($DFile)) {
$CleanDir = $ScanTemp.'/'.$DFile;
chmod ($CleanDir, 0755);
cleanFiles($CleanDir); }
cleanFiles($ScanTemp); } } }
foreach ($DFiles as $DFile) {
if (in_array($DFile, $defaultApps)) continue;
$DFilePath = $ScanLoc.'/'.$DFile;
if ($now - fileTime($DFilePath) > ($Delete_Threshold * 60)) { // Time to keep files.
if (is_dir($DFilePath)) {
@chmod ($DFilePath, 0755);
cleanFiles($DFilePath);
if (is_dir_empty($DFilePath)) @rmdir($DFilePath); } } } }
// / -----------------------------------------------------------------------------------

// / -----------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion versionInfo.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
// / This file contains the current HRScan2 version for auto-update purposes.

$Version = 'v1.3';
$Version = 'v1.4';

0 comments on commit 06a644a

Please sign in to comment.