english/libraries/joomla/installer/helper.php
/**
	 * Unpacks a file and verifies it as a Joomla element package
	 * Supports .gz .tar .tar.gz and .zip
	 *
	 * @param   string   $p_filename The uploaded package filename or install directory
	 *
	 * @return  array    Two elements - extractdir and packagefile
	 * @since   11.1
	 */
Unpacks a file and verifies it as a Joomla element package
Supports .gz .tar .tar.gz and .zip

@param   string   $p_filename The uploaded package filename or install directory

@return  array    Two elements - extractdir and packagefile
@since   11.1
Unpacks a file and verifies it as a Joomla element package Supports . gz . tar . tar . gz and . zip @param string $p_filename The uploaded package filename or install directory @return array Two elements - extractdir and packagefile @since 11 . 1
public static function unpack($p_filename)
	{
		$archivename = $p_filename;
		$tmpdir = uniqid('install_');
		$extractdir = JPath::clean(dirname($p_filename) . '/' . $tmpdir);
		$archivename = JPath::clean($archivename);
		$result = JArchive::extract($archivename, $extractdir);
		if ($result === false) {
			return false;
		}
		$retval['extractdir'] = $extractdir;
		$retval['packagefile'] = $archivename;
		$dirList = array_merge(JFolder::files($extractdir, ''), JFolder::folders($extractdir, ''));
		if (count($dirList) == 1)
		{
			if (JFolder::exists($extractdir . '/' . $dirList[0]))
			{
				$extractdir = JPath::clean($extractdir . '/' . $dirList[0]);
			}
		}
		$retval['dir'] = $extractdir;
		if ($retval['type'] = self::detectType($extractdir)) {
			return $retval;
		}
		else {
			return false;
		}
	}
public static function unpack ( $ p_filename ) { $ archivename = $ p_filename ; $ tmpdir = uniqid ( 'install_' ) ; $ extractdir = JPath :: clean ( dirname ( $ p_filename ) . '/' . $ tmpdir ) ; $ archivename = JPath :: clean ( $ archivename ) ; $ result = JArchive :: extract ( $ archivename , $ extractdir ) ; if ( $ result === false ) { return false ; } $ retval [ 'extractdir' ] = $ extractdir ; $ retval [ 'packagefile' ] = $ archivename ; $ dirList = array_merge ( JFolder :: files ( $ extractdir , '' ) , JFolder :: folders ( $ extractdir , '' ) ) ; if ( count ( $ dirList ) == 1 ) { if ( JFolder :: exists ( $ extractdir . '/' . $ dirList [ 0 ] ) ) { $ extractdir = JPath :: clean ( $ extractdir . '/' . $ dirList [ 0 ] ) ; } } $ retval [ 'dir' ] = $ extractdir ; if ( $ retval [ 'type' ] = self :: detectType ( $ extractdir ) ) { return $ retval ; } else { return false ; } }
Unpacks a file and verifies it as a Joomla element package
 Supports .gz .tar .tar.gz and .zip
Unpacks a file and verifies it as a Joomla element package Supports . gz . tar . tar . gz and . zip
// Path to the archive // Temporary folder to extract the archive into // Clean the paths to use for archive extraction // Do the unpacking of the archive /*
		 * Let's set the extraction directory and package file in the result array so we can
		 * cleanup everything properly later on.
		 */ /*
		 * Try to find the correct install directory.  In case the package is inside a
		 * subdirectory detect this and set the install directory to the correct path.
		 *
		 * List all the items in the installation directory.  If there is only one, and
		 * it is a folder, then we will set that folder to be the installation folder.
		 */ /*
		 * We have found the install directory so lets set it and then move on
		 * to detecting the extension type.
		 */ /*
		 * Get the extension type and return the directory/type array on success or
		 * false on fail.
		 */