english/libraries/joomla/installer/installer.php
/**
	 * Copyfiles
	 *
	 * Copy files from source directory to the target directory
	 *
	 * @param	array $files array with filenames
	 * @param	boolean $overwrite True if existing files can be replaced
	 *
	 * @return	boolean True on success
	 * @since	11.1
	 */
Copyfiles
Copy files from source directory to the target directory

@param       array $files array with filenames
@param       boolean $overwrite True if existing files can be replaced

@return      boolean True on success
@since       11.1
Copyfiles Copy files from source directory to the target directory @param array $files array with filenames @param boolean $overwrite True if existing files can be replaced @return boolean True on success @since 11 . 1
public function copyFiles($files, $overwrite=null)
	{
		if (is_null($overwrite) || !is_bool($overwrite)) {
			$overwrite = $this->_overwrite;
		}
		if (is_array($files) && count($files) > 0) {
			foreach ($files as $file)
			{
				$filesource	= JPath::clean($file['src']);
				$filedest	= JPath::clean($file['dest']);
				$filetype	= array_key_exists('type', $file) ? $file['type'] : 'file';
				if (!file_exists($filesource)) {
					JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_NO_FILE', $filesource));
					return false;
				}
				else if (($exists = file_exists($filedest)) && !$overwrite) {
					if ($this->getPath('manifest') == $filesource) {
						continue;
					}
					JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_FILE_EXISTS', $filedest));
					return false;
				}
				else {
					if ($filetype == 'folder') {
						if (!(JFolder::copy($filesource, $filedest, null, $overwrite)))
						{
							JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_FAIL_COPY_FOLDER', $filesource, $filedest));
							return false;
						}
						$step = array ('type' => 'folder', 'path' => $filedest);
					}
					else {
						if (!(JFile::copy($filesource, $filedest,null))) {
							JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_FAIL_COPY_FILE', $filesource, $filedest));
							return false;
						}
						$step = array ('type' => 'file', 'path' => $filedest);
					}
					if (!$exists) {
						$this->_stepStack[] = $step;
					}
				}
			}
		}
		else {
			return false;
		}
		return count($files);
	}
public function copyFiles ( $ files , $ overwrite = null ) { if ( is_null ( $ overwrite ) || ! is_bool ( $ overwrite ) ) { $ overwrite = $ this -> _overwrite ; } if ( is_array ( $ files ) && count ( $ files ) > 0 ) { foreach ( $ files as $ file ) { $ filesource = JPath :: clean ( $ file [ 'src' ] ) ; $ filedest = JPath :: clean ( $ file [ 'dest' ] ) ; $ filetype = array_key_exists ( 'type' , $ file ) ? $ file [ 'type' ] : 'file' ; if ( ! file_exists ( $ filesource ) ) { JError :: raiseWarning ( 1 , JText :: sprintf ( 'JLIB_INSTALLER_ERROR_NO_FILE' , $ filesource ) ) ; return false ; } else if ( ( $ exists = file_exists ( $ filedest ) ) && ! $ overwrite ) { if ( $ this -> getPath ( 'manifest' ) == $ filesource ) { continue ; } JError :: raiseWarning ( 1 , JText :: sprintf ( 'JLIB_INSTALLER_ERROR_FILE_EXISTS' , $ filedest ) ) ; return false ; } else { if ( $ filetype == 'folder' ) { if ( ! ( JFolder :: copy ( $ filesource , $ filedest , null , $ overwrite ) ) ) { JError :: raiseWarning ( 1 , JText :: sprintf ( 'JLIB_INSTALLER_ERROR_FAIL_COPY_FOLDER' , $ filesource , $ filedest ) ) ; return false ; } $ step = array ( 'type' => 'folder' , 'path' => $ filedest ) ; } else { if ( ! ( JFile :: copy ( $ filesource , $ filedest , null ) ) ) { JError :: raiseWarning ( 1 , JText :: sprintf ( 'JLIB_INSTALLER_ERROR_FAIL_COPY_FILE' , $ filesource , $ filedest ) ) ; return false ; } $ step = array ( 'type' => 'file' , 'path' => $ filedest ) ; } if ( ! $ exists ) { $ this -> _stepStack [ ] = $ step ; } } } } else { return false ; } return count ( $ files ) ; }
Copyfiles
 Copy files from source directory to the target directory
Copyfiles Copy files from source directory to the target directory
// To allow for manual override on the overwriting flag, we check to see if // the $overwrite flag was set and is a boolean value.  If not, use the object // allowOverwrite flag. /*
		 * $files must be an array of filenames.  Verify that it is an array with
		 * at least one file to copy.
		 */ // Get the source and destination paths /*
					 * The source file does not exist.  Nothing to copy so set an error
					 * and return false.
					 */ // It's okay if the manifest already exists // The destination file already exists and the overwrite flag is false. // Set an error and return false. // Copy the folder or file to the new location. /*
					 * Since we copied a file/folder, we want to add it to the installation step stack so that
					 * in case we have to roll back the installation we can remove the files copied.
					 */ // The $files variable was either not an array or an empty array