Feature #16323 » typo3_fileIntegrityCheckWithSupportOfDirectReferences.patch
typo3_src-4.2.2/t3lib/class.t3lib_admin.php 2008-10-29 15:41:39.000000000 +0100 | ||
---|---|---|
*/
|
||
function testFileRefs () {
|
||
$output=Array();
|
||
|
||
// handle direct references with upload folder setting (workaround)
|
||
$newCheckFileRefs = array();
|
||
reset($this->checkFileRefs);
|
||
foreach ($this->checkFileRefs as $folder => $files) {
|
||
// only direct references without a folder setting
|
||
if ($folder !== '') {
|
||
$newCheckFileRefs[$folder] = $files;
|
||
continue;
|
||
}
|
||
foreach ($files as $file => $references) {
|
||
// direct file refernces have often many references (removes occurences in the moreReferences section of the result array)
|
||
if ($references > 1) {
|
||
$references = 1;
|
||
}
|
||
// the directory must be empty (prevents checking of the root directory)
|
||
$directory = dirname($file);
|
||
if ($directory !== '') {
|
||
$newCheckFileRefs[$directory][basename($file)] = $references;
|
||
}
|
||
}
|
||
}
|
||
$this->checkFileRefs = $newCheckFileRefs;
|
||
while(list($folder,$fileArr)=each($this->checkFileRefs)) {
|
||
$path = PATH_site.$folder;
|
||
if (@is_dir($path)) {
|
||
... | ... | |
}
|
||
unset($fileArr[$entry]);
|
||
} else {
|
||
if (!strstr($entry,'index.htm')) {
|
||
// contains workaround for direct references
|
||
if (!strstr($entry,'index.htm') && !preg_match('/^fileadmin/', $folder)) {
|
||
$output['noReferences'][] = Array($path,$entry);
|
||
}
|
||
}
|
||
... | ... | |
reset($fileArr);
|
||
$tempCounter=0;
|
||
while(list($file,)=each($fileArr)) {
|
||
// workaround for direct file references
|
||
if (preg_match('/^fileadmin/', $folder)) {
|
||
$file = $folder . '/' . $file;
|
||
$folder = '';
|
||
$path = substr(PATH_site, 0, strlen(PATH_site) - 1);
|
||
}
|
||
$temp = $this->whereIsFileReferenced($folder,$file);
|
||
$tempList = '';
|
||
while(list(,$inf)=each($temp)) {
|