Fix old stat() code and support stat_mode
This commit is contained in:
29
Yuba.php
29
Yuba.php
@@ -435,18 +435,25 @@ foreach ($files as $splFileInfo) {
|
||||
|
||||
}
|
||||
|
||||
// capture stat before values change
|
||||
// Collect file stat()
|
||||
|
||||
if ($p['stat_mode']) {
|
||||
|
||||
$sty[$i] = statToArray(shell_exec("stat -s ".$shellpath." 2>&1"));
|
||||
|
||||
if ($p['stat_mode'] > 1 && $splFileInfo->getType() != "link") {
|
||||
|
||||
// capture stat values for postflight comparison
|
||||
$stx[$i] = array($splFileInfo->getATime(), $splFileInfo->getMTime(), $splFileInfo->getCTime());
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$sty[$i] = "bypass";
|
||||
|
||||
if ($splFileInfo->getType() != "link") {
|
||||
$stx[$i] = array( $splFileInfo->getATime(),
|
||||
$splFileInfo->getMTime(),
|
||||
$splFileInfo->getCTime() );
|
||||
}
|
||||
|
||||
$sty[$i] = statToArray(shell_exec("stat -s ".$shellpath." 2>&1"));
|
||||
|
||||
//$sty[$i] = "bypass";
|
||||
|
||||
// Check file can be read
|
||||
|
||||
if ($realpath && !is_readable($realpath)) {
|
||||
@@ -1168,13 +1175,13 @@ foreach ($files as $splFileInfo) {
|
||||
|
||||
// Double check stat for file against pre-run value
|
||||
|
||||
if ($p['verify_stat'] && $type != "link") {
|
||||
if ($p['stat_mode'] > 1 && $type != "link") {
|
||||
|
||||
$restat = statToArray(shell_exec("stat -s ".$shellpath." 2>&1"));
|
||||
|
||||
$message = array();
|
||||
if ($sty[$j]['st_atime'] != $restat['st_atime']) {
|
||||
if ($p['fixatimes'] && $type != "link" && is_writable($pathname)) {
|
||||
if ($p['stat_mode'] == 3 && is_writable($pathname)) {
|
||||
exec("touch -at `date -r ".$sty[$j]['st_atime']." +%Y%m%d%H%M.%S` ".$shellpath." 2>&1");
|
||||
$message[] = "atime (fix)";
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user