Permalink
Browse files

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

-v1.4.
-Fix bugs with auto-cleanup of files.
  • Loading branch information...
zelon88 committed Oct 25, 2018
1 parent 53cfe03 commit 06a644aa65d91a989260c1c19f68db2583cf9cee
Showing with 30 additions and 32 deletions.
  1. +7 −0 CHANGELOG.txt
  2. +22 −31 scanCore.php
  3. +1 −1 versionInfo.php
@@ -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.
@@ -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");
@@ -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); } } } }
// / -----------------------------------------------------------------------------------
// / -----------------------------------------------------------------------------------
@@ -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.