english/libraries/joomla/installer/adapters/template.php
/**
	 * Discover_install
	 * Perform an install for a discovered extension
	 *
	 * @return boolean
	 * @since 11.1
	 */
Discover_install
Perform an install for a discovered extension


Discover_install Perform an install for a discovered extension
function discover_install()
	{
		$client = JApplicationHelper::getClientInfo($this->parent->extension->client_id);
		$manifestPath = $client->path . '/templates/' . $this->parent->extension->element . '/templateDetails.xml';
		$this->parent->manifest = $this->parent->isManifest($manifestPath);
		$description = (string)$this->parent->manifest->description;
		if ($description) {
			$this->parent->set('message', JText::_($description));
		}
		else {
			$this->parent->set('message', '');
		}
		$this->parent->setPath('manifest', $manifestPath);
		$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
		$this->parent->extension->manifest_cache = json_encode($manifest_details);
		$this->parent->extension->state = 0;
		$this->parent->extension->name = $manifest_details['name'];
		$this->parent->extension->enabled = 1;
		$data = new JObject();
		foreach ($manifest_details as $key => $value)
		{
			$data->set($key, $value);
		}
		$this->parent->extension->params = $this->parent->getParams();
		if ($this->parent->extension->store()) {
			$db = $this->parent->getDbo();
			$query = $db->getQuery(true);
			$query->insert('#__template_styles');
			$query->set('template='.$db->Quote($this->parent->extension->name));
			$query->set('client_id='.$db->Quote($this->parent->extension->client_id));
			$query->set('home=0');
			$query->set('title='.$db->Quote(JText::sprintf('JLIB_INSTALLER_DEFAULT_STYLE', $this->parent->extension->name)));
			$query->set('params='.$db->Quote($this->parent->extension->params));
			$db->setQuery($query);
			$db->query();
			return $this->parent->extension->get('extension_id');
		}
		else {
			JError::raiseWarning(101, JText::_('JLIB_INSTALLER_ERROR_TPL_DISCOVER_STORE_DETAILS'));
			return false;
		}
	}
function discover_install ( ) { $ client = JApplicationHelper :: getClientInfo ( $ this -> parent -> extension -> client_id ) ; $ manifestPath = $ client -> path . '/templates/' . $ this -> parent -> extension -> element . '/templateDetails.xml' ; $ this -> parent -> manifest = $ this -> parent -> isManifest ( $ manifestPath ) ; $ description = ( string ) $ this -> parent -> manifest -> description ; if ( $ description ) { $ this -> parent -> set ( 'message' , JText :: _ ( $ description ) ) ; } else { $ this -> parent -> set ( 'message' , '' ) ; } $ this -> parent -> setPath ( 'manifest' , $ manifestPath ) ; $ manifest_details = JApplicationHelper :: parseXMLInstallFile ( $ this -> parent -> getPath ( 'manifest' ) ) ; $ this -> parent -> extension -> manifest_cache = json_encode ( $ manifest_details ) ; $ this -> parent -> extension -> state = 0 ; $ this -> parent -> extension -> name = $ manifest_details [ 'name' ] ; $ this -> parent -> extension -> enabled = 1 ; $ data = new JObject ( ) ; foreach ( $ manifest_details as $ key => $ value ) { $ data -> set ( $ key , $ value ) ; } $ this -> parent -> extension -> params = $ this -> parent -> getParams ( ) ; if ( $ this -> parent -> extension -> store ( ) ) { $ db = $ this -> parent -> getDbo ( ) ; $ query = $ db -> getQuery ( true ) ; $ query -> insert ( '#__template_styles' ) ; $ query -> set ( 'template=' . $ db -> Quote ( $ this -> parent -> extension -> name ) ) ; $ query -> set ( 'client_id=' . $ db -> Quote ( $ this -> parent -> extension -> client_id ) ) ; $ query -> set ( 'home=0' ) ; $ query -> set ( 'title=' . $ db -> Quote ( JText :: sprintf ( 'JLIB_INSTALLER_DEFAULT_STYLE' , $ this -> parent -> extension -> name ) ) ) ; $ query -> set ( 'params=' . $ db -> Quote ( $ this -> parent -> extension -> params ) ) ; $ db -> setQuery ( $ query ) ; $ db -> query ( ) ; return $ this -> parent -> extension -> get ( 'extension_id' ) ; } else { JError :: raiseWarning ( 101 , JText :: _ ( 'JLIB_INSTALLER_ERROR_TPL_DISCOVER_STORE_DETAILS' ) ) ; return false ; } }
Discover_install
 Perform an install for a discovered extension
Discover_install Perform an install for a discovered extension
// Templates are one of the easiest // If its not in the extensions table we just add it //insert record in #__template_styles