english/administrator/components/com_installer/models/update.php
/**
	 * Handles the actual update installation.
	 *
	 * @param	JUpdate	An update definition
	 * @return	boolean	Result of install
	 * @since	1.6
	 */
Handles the actual update installation.
@param       JUpdate An update definition
@return      boolean Result of install
@since       1.6
Handles the actual update installation . @param JUpdate An update definition @return boolean Result of install @since 1 . 6
private function install($update)
	{
		$app = JFactory::getApplication();
		if (isset($update->get('downloadurl')->_data)) {
			$url = $update->downloadurl->_data;
		} else {
			JError::raiseWarning('', JText::_('COM_INSTALLER_INVALID_EXTENSION_UPDATE'));
			return false;
		}
		jimport('joomla.installer.helper');
		$p_file = JInstallerHelper::downloadPackage($url);
				if (!$p_file) {
			JError::raiseWarning('', JText::sprintf('COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED', $url));
			return false;
		}
		$config		= JFactory::getConfig();
		$tmp_dest	= $config->get('tmp_path');
		$package	= JInstallerHelper::unpack($tmp_dest . '/' . $p_file);
		$installer	= JInstaller::getInstance();
		$update->set('type', $package['type']);
		if (!$installer->update($package['dir'])) {
			$msg = JText::sprintf('COM_INSTALLER_MSG_UPDATE_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_'.strtoupper($package['type'])));
			$result = false;
		} else {
			$msg = JText::sprintf('COM_INSTALLER_MSG_UPDATE_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_'.strtoupper($package['type'])));
			$result = true;
		}
		$this->type = $package['type'];
		$app->enqueueMessage($msg);
		$this->setState('name', $installer->get('name'));
		$this->setState('result', $result);
		$app->setUserState('com_installer.message', $installer->message);
		$app->setUserState('com_installer.extension_message', $installer->get('extension_message'));
		if (!is_file($package['packagefile'])) {
			$config = JFactory::getConfig();
			$package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
		}
		JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
		return $result;
	}
private function install ( $ update ) { $ app = JFactory :: getApplication ( ) ; if ( isset ( $ update -> get ( 'downloadurl' ) -> _data ) ) { $ url = $ update -> downloadurl -> _data ; } else { JError :: raiseWarning ( '' , JText :: _ ( 'COM_INSTALLER_INVALID_EXTENSION_UPDATE' ) ) ; return false ; } jimport ( 'joomla.installer.helper' ) ; $ p_file = JInstallerHelper :: downloadPackage ( $ url ) ; if ( ! $ p_file ) { JError :: raiseWarning ( '' , JText :: sprintf ( 'COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED' , $ url ) ) ; return false ; } $ config = JFactory :: getConfig ( ) ; $ tmp_dest = $ config -> get ( 'tmp_path' ) ; $ package = JInstallerHelper :: unpack ( $ tmp_dest . '/' . $ p_file ) ; $ installer = JInstaller :: getInstance ( ) ; $ update -> set ( 'type' , $ package [ 'type' ] ) ; if ( ! $ installer -> update ( $ package [ 'dir' ] ) ) { $ msg = JText :: sprintf ( 'COM_INSTALLER_MSG_UPDATE_ERROR' , JText :: _ ( 'COM_INSTALLER_TYPE_TYPE_' . strtoupper ( $ package [ 'type' ] ) ) ) ; $ result = false ; } else { $ msg = JText :: sprintf ( 'COM_INSTALLER_MSG_UPDATE_SUCCESS' , JText :: _ ( 'COM_INSTALLER_TYPE_TYPE_' . strtoupper ( $ package [ 'type' ] ) ) ) ; $ result = true ; } $ this -> type = $ package [ 'type' ] ; $ app -> enqueueMessage ( $ msg ) ; $ this -> setState ( 'name' , $ installer -> get ( 'name' ) ) ; $ this -> setState ( 'result' , $ result ) ; $ app -> setUserState ( 'com_installer.message' , $ installer -> message ) ; $ app -> setUserState ( 'com_installer.extension_message' , $ installer -> get ( 'extension_message' ) ) ; if ( ! is_file ( $ package [ 'packagefile' ] ) ) { $ config = JFactory :: getConfig ( ) ; $ package [ 'packagefile' ] = $ config -> get ( 'tmp_path' ) . '/' . $ package [ 'packagefile' ] ; } JInstallerHelper :: cleanupInstall ( $ package [ 'packagefile' ] , $ package [ 'extractdir' ] ) ; return $ result ; }
Handles the actual update installation.
Handles the actual update installation .
// Was the package downloaded?
 // Unpack the downloaded package file // Get an installer instance // Install the package // There was an error updating the package // Package updated successfully // Quick change // Set some model state values // TODO: Reconfigure this code when you have more battery life left // Cleanup the install files