API16:JInstaller/findManifest
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Tries to find the package manifest file
Description:JInstaller/findManifest
Syntax
findManifest()
Returns
boolean True on success, False on error
Defined in
libraries/joomla/installer/installer.php
Importing
jimport( 'joomla.installer.installer' );
Source Body
public function findManifest() { // Get an array of all the xml files from the installation directory $xmlfiles = JFolder::files($this->getPath('source'), '.xml$', 1, true); // If at least one xml file exists if (!empty($xmlfiles)) { foreach ($xmlfiles as $file) { // Is it a valid joomla installation manifest file? $manifest = $this->isManifest($file); if (!is_null($manifest)) { // If the root method attribute is set to upgrade, allow file overwrite if ((string)$manifest->attributes()->method == 'upgrade') { $this->_upgrade = true; $this->_overwrite = true; } // If the overwrite option is set, allow file overwriting if ((string)$manifest->attributes()->overwrite == 'true') { $this->_overwrite = true; } // Set the manifest object and path $this->manifest = $manifest; $this->setPath('manifest', $file); // Set the installation source path to that of the manifest file $this->setPath('source', dirname($file)); return true; } } // None of the xml files found were valid install files JError::raiseWarning(1, 'JInstaller::install: '.JText::_('ERRORNOTFINDJOOMLAXMLSETUPFILE')); return false; } else { // No xml files were found in the install folder JError::raiseWarning(1, 'JInstaller::install: '.JText::_('ERRORXMLSETUP')); return false; } }
[Edit See Also] SeeAlso:JInstaller/findManifest
Examples
<CodeExamplesForm />
