english/libraries/joomla/installer/adapters/package.php
/**
	 * Custom install method
	 *
	 * @return  boolean  True on success
	 * @since   11.1
	 */
Custom install method
@return  boolean  True on success
@since   11.1
Custom install method @return boolean True on success @since 11 . 1
public function install()
	{
		$this->manifest = $this->parent->getManifest();
		$filter	= JFilterInput::getInstance();
		$name	= (string) $this->manifest->packagename;
		$name	= $filter->clean($name, 'cmd');
		$this->set('name', $name);
		$element = 'pkg_' . $filter->clean($this->manifest->packagename, 'cmd');
		$this->set('element', $element);
		$description = (string)$this->manifest->description;
		if ($description) {
			$this->parent->set('message', JText::_($description));
		}
		else {
			$this->parent->set('message', '');
		}
		$files = $this->manifest->files;
		$group = (string)$this->manifest->packagename;
		if (!empty($group))
		{
			$this->parent->setPath('extension_root', JPATH_ROOT . '/packages/' . implode(DS,explode('/',$group)));
		}
		else
		{
			$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_PACK', JText::_('JLIB_INSTALLER_'. strtoupper($this->route))));
			return false;
		}
		if ($folder = $files->attributes()->folder)
		{
			$source = $this->parent->getPath('source') . '/' . $folder;
		}
		else
		{
			$source = $this->parent->getPath('source');
		}
		if (count($this->manifest->files->children()))
		{
			foreach ($this->manifest->files->children() as $child)
			{
				$file = $source . '/' . $child;
				jimport('joomla.installer.helper');
				if (is_dir($file))
				{
					$package = Array();
					$package['dir'] = $file;
					$package['type'] = JInstallerHelper::detectType($file);
				}
				else {
					$package = JInstallerHelper::unpack($file);
				}
				$tmpInstaller = new JInstaller();
				if (!$tmpInstaller->install($package['dir']))
				{
					$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_ERROR_EXTENSION', JText::_('JLIB_INSTALLER_'. strtoupper($this->route)), basename($file)));
					return false;
				}
			}
		}
		else
		{
			$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES', JText::_('JLIB_INSTALLER_'. strtoupper($this->route))));
			return false;
		}
		$this->parent->parseLanguages($this->manifest->languages);
		$row = JTable::getInstance('extension');
		$eid = $row->find(Array('element'=>strtolower($this->get('element')),
						'type'=>'package'));
		if($eid) {
			$row->load($eid);
		} else {
			$row->name = $this->get('name');
			$row->type = 'package';
			$row->element = $this->get('element');
			$row->folder = '';
			$row->enabled = 1;
			$row->protected = 0;
			$row->access = 1;
			$row->client_id = 0;
			$row->custom_data = '';
			$row->params = $this->parent->getParams();
		}
		$row->manifest_cache = $this->parent->generateManifestCache();
		if (!$row->store())
		{
			$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_ROLLBACK', $row->getError()));
			return false;
		}
		$manifest = Array();
		$manifest['src'] = $this->parent->getPath('manifest');
		$manifest['dest'] = JPATH_MANIFESTS . '/packages/' . basename($this->parent->getPath('manifest'));
		if (!$this->parent->copyFiles(array($manifest), true))
		{
			$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_PACK_INSTALL_COPY_SETUP', JText::_('JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES')));
			return false;
		}
		return true;
	}
public function install ( ) { $ this -> manifest = $ this -> parent -> getManifest ( ) ; $ filter = JFilterInput :: getInstance ( ) ; $ name = ( string ) $ this -> manifest -> packagename ; $ name = $ filter -> clean ( $ name , 'cmd' ) ; $ this -> set ( 'name' , $ name ) ; $ element = 'pkg_' . $ filter -> clean ( $ this -> manifest -> packagename , 'cmd' ) ; $ this -> set ( 'element' , $ element ) ; $ description = ( string ) $ this -> manifest -> description ; if ( $ description ) { $ this -> parent -> set ( 'message' , JText :: _ ( $ description ) ) ; } else { $ this -> parent -> set ( 'message' , '' ) ; } $ files = $ this -> manifest -> files ; $ group = ( string ) $ this -> manifest -> packagename ; if ( ! empty ( $ group ) ) { $ this -> parent -> setPath ( 'extension_root' , JPATH_ROOT . '/packages/' . implode ( DS , explode ( '/' , $ group ) ) ) ; } else { $ this -> parent -> abort ( JText :: sprintf ( 'JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_PACK' , JText :: _ ( 'JLIB_INSTALLER_' . strtoupper ( $ this -> route ) ) ) ) ; return false ; } if ( $ folder = $ files -> attributes ( ) -> folder ) { $ source = $ this -> parent -> getPath ( 'source' ) . '/' . $ folder ; } else { $ source = $ this -> parent -> getPath ( 'source' ) ; } if ( count ( $ this -> manifest -> files -> children ( ) ) ) { foreach ( $ this -> manifest -> files -> children ( ) as $ child ) { $ file = $ source . '/' . $ child ; jimport ( 'joomla.installer.helper' ) ; if ( is_dir ( $ file ) ) { $ package = Array ( ) ; $ package [ 'dir' ] = $ file ; $ package [ 'type' ] = JInstallerHelper :: detectType ( $ file ) ; } else { $ package = JInstallerHelper :: unpack ( $ file ) ; } $ tmpInstaller = new JInstaller ( ) ; if ( ! $ tmpInstaller -> install ( $ package [ 'dir' ] ) ) { $ this -> parent -> abort ( JText :: sprintf ( 'JLIB_INSTALLER_ABORT_PACK_INSTALL_ERROR_EXTENSION' , JText :: _ ( 'JLIB_INSTALLER_' . strtoupper ( $ this -> route ) ) , basename ( $ file ) ) ) ; return false ; } } } else { $ this -> parent -> abort ( JText :: sprintf ( 'JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES' , JText :: _ ( 'JLIB_INSTALLER_' . strtoupper ( $ this -> route ) ) ) ) ; return false ; } $ this -> parent -> parseLanguages ( $ this -> manifest -> languages ) ; $ row = JTable :: getInstance ( 'extension' ) ; $ eid = $ row -> find ( Array ( 'element' => strtolower ( $ this -> get ( 'element' ) ) , 'type' => 'package' ) ) ; if ( $ eid ) { $ row -> load ( $ eid ) ; } else { $ row -> name = $ this -> get ( 'name' ) ; $ row -> type = 'package' ; $ row -> element = $ this -> get ( 'element' ) ; $ row -> folder = '' ; $ row -> enabled = 1 ; $ row -> protected = 0 ; $ row -> access = 1 ; $ row -> client_id = 0 ; $ row -> custom_data = '' ; $ row -> params = $ this -> parent -> getParams ( ) ; } $ row -> manifest_cache = $ this -> parent -> generateManifestCache ( ) ; if ( ! $ row -> store ( ) ) { $ this -> parent -> abort ( JText :: sprintf ( 'JLIB_INSTALLER_ABORT_PACK_INSTALL_ROLLBACK' , $ row -> getError ( ) ) ) ; return false ; } $ manifest = Array ( ) ; $ manifest [ 'src' ] = $ this -> parent -> getPath ( 'manifest' ) ; $ manifest [ 'dest' ] = JPATH_MANIFESTS . '/packages/' . basename ( $ this -> parent -> getPath ( 'manifest' ) ) ; if ( ! $ this -> parent -> copyFiles ( array ( $ manifest ) , true ) ) { $ this -> parent -> abort ( JText :: sprintf ( 'JLIB_INSTALLER_ABORT_PACK_INSTALL_COPY_SETUP' , JText :: _ ( 'JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES' ) ) ) ; return false ; } return true ; }
Custom install method
 @return  boolean  True on success
 @since   11.1
Custom install method @return boolean True on success @since 11 . 1
// Get the extension manifest object // Manifest Document Setup Section // Set the extensions name // Get the component description // Set the installation path // TODO: Remark this location // Filesystem Processing Section // Install all necessary files // If it's actually a directory then fill it up // If it's an archive // Parse optional tags // Extension Registration // There is no folder for modules // custom data // Update the manifest cache for the entry // Install failed, roll back changes // Finalization and Cleanup Section // Lastly, we will copy the manifest file to its appropriate place. // Install failed, rollback changes