14 if (!defined(
'IN_PEEL')) {
36 if(substr($path,-1) !=
"/"){
37 $this->_path = $path.
"/";
41 $this->_getFileList();
51 if (!is_readable($file)) {
56 foreach ($file as $line) {
57 $temp = explode(
' ', $line);
58 $hashes[trim($temp[1])] = $temp[0];
63 foreach($this->_tree as $key => $value){
64 if(!array_key_exists($key, $hashes)) {
65 $modifies[] = $this->_getFileStats($key,
'added');
69 foreach($hashes as $key => $value){
70 if(!array_key_exists($key, $this->_tree)) {
71 $modifies[] = $this->_reportFileMissing($key);
75 foreach($this->_tree as $key => $value){
76 if(array_key_exists($key, $hashes)) {
77 if($value != $hashes[$key]){
78 $modifies[] = $this->_getFileStats($key,
'modified');
94 $file = date(
'YmdHis').
".md5";
97 foreach ($this->_tree as $key => $value){
98 $hashes .= $value.
" ".$key.
"\n";
100 return file_put_contents($file, $hashes);
109 private function _getFileList($path = null){
116 $root = opendir($path);
117 while($entry = readdir($root)) {
118 if ($entry !=
"." && $entry !=
".." && !in_array($entry, array(
'JShield',
'cache',
'upload',
'compile',
'installation',
'sessions'))) {
119 if (is_dir($path.$entry)){
120 $this->_getFileList($path.$entry.
"/");
122 $this->_tree[str_replace($this->_path,
"",$path.$entry)] = md5_file($path.$entry);
135 private function _getFileStats($file,$stat){
136 if(is_readable($this->_path.$file)) {
137 $mdata = stat($this->_path.$file);
144 'lastAccess' => date(
'Y-m-d H:i:s',$mdata[8]),
145 'lastModification' => date(
'Y-m-d H:i:s',$mdata[9])
155 private function _reportFileMissing($file){
162 'lastAccess' => null,
163 'lastModification' => null
__construct($path)
Prepara la ruta para iniciar la comprobacion.
getMD5Hashes($file=null)
Genera un archivo con las firmas md5 de los archivos del directorio dado.
checkMD5Hashes($file)
Verifica las firmas MD5 de los archivos y los cruza con los del archivo dado para ver diferencias...