API16

JInstaller/findManifest

From Joomla! Documentation

< API16:JInstaller
Revision as of 21:59, 13 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Tries to find the package manifest file

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

findManifest()


Returns[edit]

boolean True on success, False on error

Defined in[edit]

libraries/joomla/installer/installer.php

Importing[edit]

jimport( 'joomla.installer.installer' );

Source Body[edit]

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;
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

<CodeExamplesForm />