english/libraries/joomla/installer/installer.php
/**
	 * Compares two "files" entries to find deleted files/folders
	 *
	 * @param array $old_files An array of JXMLElement objects that are the old files
	 * @param array $new_files An array of JXMLElement objects that are the new files
	 *
	 * @return array An array with the delete files and folders in findDeletedFiles[files] and findDeletedFiles[folders] resepctively
	 */
Compares two "files" entries to find deleted files/folders
@param array $old_files An array of JXMLElement objects that are the old files
@param array $new_files An array of JXMLElement objects that are the new files

@return array An array with the delete files and folders in findDeletedFiles[files] and findDeletedFiles[folders] resepctively
Compares two " files " entries to find deleted files / folders @param array $old_files An array of JXMLElement objects that are the old files @param array $new_files An array of JXMLElement objects that are the new files @return array An array with the delete files and folders in findDeletedFiles [ files ] and findDeletedFiles [ folders ] resepctively
public function findDeletedFiles($old_files, $new_files)
	{
		$files = Array();
		$folders = Array();
		$containers = Array();
		$files_deleted = Array();
		$folders_deleted = Array();
		foreach ($new_files as $file)
		{
			switch($file->getName())
			{
				case 'folder':
					$folders[] = (string)$file; 
					break;
				case 'file':
				default:
					$files[] = (string)$file;
					$container_parts = explode('/',dirname((string)$file));
					$container = '';
					foreach ($container_parts as $part)
					{
						if (!empty($container)) $container .= '/';
						$container .= $part; 
						if (!in_array($container, $containers)) $containers[] = $container; 
					}
					break;
			}
		}
		foreach ($old_files as $file)
		{
			switch($file->getName())
			{
				case 'folder':
					if (!in_array((string)$file, $folders))
					{
						if (!in_array((string)$file, $containers)) {
							$folders_deleted[] = (string)$file;
						}
					}
					break;
				case 'file':
				default:
					if (!in_array((string)$file, $files))
					{
						if (!in_array(dirname((string)$file), $folders)) {
							$files_deleted[] = (string)$file; 
						}
					}
					break;
			}
		}
		return Array('files'=>$files_deleted, 'folders'=>$folders_deleted);
	}
public function findDeletedFiles ( $ old_files , $ new_files ) { $ files = Array ( ) ; $ folders = Array ( ) ; $ containers = Array ( ) ; $ files_deleted = Array ( ) ; $ folders_deleted = Array ( ) ; foreach ( $ new_files as $ file ) { switch ( $ file -> getName ( ) ) { case 'folder' : $ folders [ ] = ( string ) $ file ; break ; case 'file' : default : $ files [ ] = ( string ) $ file ; $ container_parts = explode ( '/' , dirname ( ( string ) $ file ) ) ; $ container = '' ; foreach ( $ container_parts as $ part ) { if ( ! empty ( $ container ) ) $ container .= '/' ; $ container .= $ part ; if ( ! in_array ( $ container , $ containers ) ) $ containers [ ] = $ container ; } break ; } } foreach ( $ old_files as $ file ) { switch ( $ file -> getName ( ) ) { case 'folder' : if ( ! in_array ( ( string ) $ file , $ folders ) ) { if ( ! in_array ( ( string ) $ file , $ containers ) ) { $ folders_deleted [ ] = ( string ) $ file ; } } break ; case 'file' : default : if ( ! in_array ( ( string ) $ file , $ files ) ) { if ( ! in_array ( dirname ( ( string ) $ file ) , $ folders ) ) { $ files_deleted [ ] = ( string ) $ file ; } } break ; } } return Array ( 'files' => $ files_deleted , 'folders' => $ folders_deleted ) ; }
Compares two "files" entries to find deleted files/folders
 @param array $old_files An array of JXMLElement objects that are the old files
 @param array $new_files An array of JXMLElement objects that are the new files
Compares two " files " entries to find deleted files / folders @param array $old_files An array of JXMLElement objects that are the old files @param array $new_files An array of JXMLElement objects that are the new files
// The magic find deleted files function! // The files that are new // The folders that are new // The folders of the files that are new // A list of files to delete // A list of folders to delete // add any folders to the list // Add any files to the list // Now handle the folder part of the file to ensure we get any containers // Break up the parts of the directory // Make sure this is clean and empty // Iterate through each part // Add a slash if its not empty // append the folder part // add the container if it doesn't already exist // See whether the folder exists in the new list // Check if the folder exists as a container in the new list // If it's not in the new list or a container then delete it // look if the file exists in the new list // look if the file is now potentially in a folder // not in a folder, doesn't exist, wipe it out!