<?
namespace WebSlon;
ini_set(«xdebug.overload_var_dump», «off»);
echo «<pre>»;
$lastModFiles = new LastModify();
$time_start = microtime(true);
$res = $lastModFiles->getFiles();
var_dump($res);
$time_end = microtime(true);
echo $time_end — $time_start;
class LastModify {
public $fileMask;
public $skipDirs;
public $rootdir;
public $lastModifyMinutes;
public $modifyFiles;
public function __construct() {
$this->fileMask = «.php»;
$this->skipDirs = [«bitrix», «upload», «local»];
$this->rootdir = rtrim($_SERVER[«DOCUMENT_ROOT»],«/»);
$this->lastModifyMinutes = 24*60;
}
public function getFiles() {
$curdir = dir($this->rootdir);
$this->modifyFiles .= str_replace($this->rootdir, «», $this->getDirFiles($this->rootdir, true));
while($dir = $curdir->read()) {
if ($dir == ‘.’||$dir == ‘..’||in_array($dir, $this->skipDirs)||!is_dir($this->rootdir.‘/’. $dir)) {
continue;
}
$res = $this->getDirFiles($this->rootdir.‘/’. $dir);
if(!empty($res)){
$this->modifyFiles .= str_replace($this->rootdir, «», $res);
}
}
return $this->modifyFiles;
}
public function getDirFiles($dir, $noRecursive=false) {
$maxdepth = $noRecursive ? ‘ -maxdepth 1’ : »;
// -newermt «2019-11-02 00:00» можно вместо минут указывать дату, тут посмотреть как удобнее
$command = ‘find ‘.$dir.‘/’.$maxdepth.‘ -type f -name «*.php» -mmin -‘.$this->lastModifyMinutes;
$res = shell_exec($command);
return $res;
}
}