Feature #16323 » typo3_fileIntegrityCheckWithSupportOfDirectReferences.patch

Administrator Admin, 2008-10-29 15:47

View differences:

typo3_src-4.2.2/t3lib/class.t3lib_admin.php 2008-10-29 15:41:39.000000000 +0100
582 582
	 */
583 583
	function testFileRefs ()	{
584 584
		$output=Array();
585
	
586
		// handle direct references with upload folder setting (workaround)
587
		$newCheckFileRefs = array();
585 588
		reset($this->checkFileRefs);
589
		foreach ($this->checkFileRefs as $folder => $files) {
590
			// only direct references without a folder setting
591
			if ($folder !== '') {
592
				$newCheckFileRefs[$folder] = $files;
593
				continue;
594
			}
595

  
596
			foreach ($files as $file => $references) {
597

  
598
				// direct file refernces have often many references (removes occurences in the moreReferences section of the result array)
599
				if ($references > 1) {
600
					$references = 1;
601
				}
602

  
603
				// the directory must be empty (prevents checking of the root directory)
604
				$directory = dirname($file);
605
				if ($directory !== '') {
606
					$newCheckFileRefs[$directory][basename($file)] = $references;
607
				}
608
			}
609
		}
610
		$this->checkFileRefs = $newCheckFileRefs;
611

  
586 612
		while(list($folder,$fileArr)=each($this->checkFileRefs))	{
587 613
			$path = PATH_site.$folder;
588 614
			if (@is_dir($path))	{
......
600 626
							}
601 627
							unset($fileArr[$entry]);
602 628
						} else {
603
							if (!strstr($entry,'index.htm'))	{
629
							// contains workaround for direct references
630
							if (!strstr($entry,'index.htm') && !preg_match('/^fileadmin/', $folder)) {
604 631
								$output['noReferences'][] = Array($path,$entry);
605 632
							}
606 633
						}
......
610 637
				reset($fileArr);
611 638
				$tempCounter=0;
612 639
				while(list($file,)=each($fileArr))	{
640
					// workaround for direct file references
641
					if (preg_match('/^fileadmin/', $folder)) {
642
						$file = $folder . '/' . $file;
643
						$folder = '';
644
						$path = substr(PATH_site, 0, strlen(PATH_site) - 1);
645
					}
646

  
613 647
					$temp = $this->whereIsFileReferenced($folder,$file);
614 648
					$tempList = '';
615 649
					while(list(,$inf)=each($temp))	{
(8-8/15)