Once again, I thought my class method deleteZip() would do the trick,
but it never deletes any .zip* file found in a directory:
[PHP]
/**
* Delete any latent ZIP files found in this album. This method is to
be inherited by all listing classes to allow for
* list-wide deletion of latent server-created ZIP files for security
purposes
*
* @access private
* @see actual_path
* @see is_class
*/
function &deleteZip() { // STATIC VOID METHOD
global $section, ${$section . 'LocationPath'} , $projectFullNam e;
$album = $_REQUEST['album'];
$locationPath = ($album) ? "${$section . 'LocationPath'}/$album" :
${$section . 'LocationPath'} ;
if (@!is_class($th is->dbAP, 'DBActionPerfor mer')) $this->dbAP =& new
DBActionPerform er(); // LOCAL INSTANTIATION UNLESS ALREADY EXISTING
if (!$_ENV['windir']) { // UNIX VERSION
$statMsg = exec("stat \"" . actual_path($lo cationPath) . "/*.zip*\"
2>&1"); // USE UNIX CHECK 'stat' FOR LOCATING ANY ZIP FILES, DO
DELETION IF AT LEAST 1 FOUND
} else { // WINDOWS VERSION
list($lsKommand , $lsRedirect) =
@array_values($ this->dbAP->getKommandOSAr ray('ls'));
$statMsg = exec("$lsKomman d \"" . actual_path($lo cationPath) .
"/*.zip*\" $lsRedirect");
}
if (@!unlink(actua l_path($locatio nPath) . '/*.zip*') &&
!preg_match('/no such file/i', $statMsg)) { // WEB SERVER CANNOT
DELETE ZIP FILES
list($removeKom mand, $removeRedirect ) =
@array_values($ this->dbAP->getKommandOSAr ray('rmdir-force'));
$msg = exec("$removeKo mmand \"" . actual_path($lo cationPath) .
"/*.zip*\" $removeRedirect "); // ALLOW FOR THE SERVER ITSELF TO
DELETE THEM
if (preg_match('/^rm:/i', $msg) || ($_ENV['windir'] && $msg))
die("$projectFu llName shut down due to security issue with
potentially damaging ZIP file in \"$locationPath \", please contact
administrator<p >Error: $msg");
}
}
[/PHP]
This is what happens:
um, sorry but there *IS* at lease 1 zip file in
/www/html/tools/app/images/doom called images_of_doom. zip that is
auto-generated and does exist when I do "ls -l" via command line,
permissions of 0644.
How do I delete it and any other ZIP file, plain and simple, I thought
this would work and it doesn't, please help
thanx
phil
but it never deletes any .zip* file found in a directory:
[PHP]
/**
* Delete any latent ZIP files found in this album. This method is to
be inherited by all listing classes to allow for
* list-wide deletion of latent server-created ZIP files for security
purposes
*
* @access private
* @see actual_path
* @see is_class
*/
function &deleteZip() { // STATIC VOID METHOD
global $section, ${$section . 'LocationPath'} , $projectFullNam e;
$album = $_REQUEST['album'];
$locationPath = ($album) ? "${$section . 'LocationPath'}/$album" :
${$section . 'LocationPath'} ;
if (@!is_class($th is->dbAP, 'DBActionPerfor mer')) $this->dbAP =& new
DBActionPerform er(); // LOCAL INSTANTIATION UNLESS ALREADY EXISTING
if (!$_ENV['windir']) { // UNIX VERSION
$statMsg = exec("stat \"" . actual_path($lo cationPath) . "/*.zip*\"
2>&1"); // USE UNIX CHECK 'stat' FOR LOCATING ANY ZIP FILES, DO
DELETION IF AT LEAST 1 FOUND
} else { // WINDOWS VERSION
list($lsKommand , $lsRedirect) =
@array_values($ this->dbAP->getKommandOSAr ray('ls'));
$statMsg = exec("$lsKomman d \"" . actual_path($lo cationPath) .
"/*.zip*\" $lsRedirect");
}
if (@!unlink(actua l_path($locatio nPath) . '/*.zip*') &&
!preg_match('/no such file/i', $statMsg)) { // WEB SERVER CANNOT
DELETE ZIP FILES
list($removeKom mand, $removeRedirect ) =
@array_values($ this->dbAP->getKommandOSAr ray('rmdir-force'));
$msg = exec("$removeKo mmand \"" . actual_path($lo cationPath) .
"/*.zip*\" $removeRedirect "); // ALLOW FOR THE SERVER ITSELF TO
DELETE THEM
if (preg_match('/^rm:/i', $msg) || ($_ENV['windir'] && $msg))
die("$projectFu llName shut down due to security issue with
potentially damaging ZIP file in \"$locationPath \", please contact
administrator<p >Error: $msg");
}
}
[/PHP]
This is what happens:
statMsg = stat: cannot stat `/www/html/tools/app/images/doom/*.zip*':
No such file or directory
No such file or directory
/www/html/tools/app/images/doom called images_of_doom. zip that is
auto-generated and does exist when I do "ls -l" via command line,
permissions of 0644.
How do I delete it and any other ZIP file, plain and simple, I thought
this would work and it doesn't, please help
thanx
phil
Comment