API16

Difference between revisions of "JInstaller/findManifest"

From Joomla! Documentation

< API16:JInstaller
m (removing red link to edit, no existant pages)
m (preparing for archive only)
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
Tries to find the package manifest file
 
Tries to find the package manifest file
  
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
  
 
<! removed transcluded page call, red link never existed >
 
<! removed transcluded page call, red link never existed >
Line 70: Line 68:
 
</source>
 
</source>
  
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
 
<! removed transcluded page call, red link never existed >
 
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n
 
  category=findManifest
 
  category=findManifest
 
  category=JInstaller
 
  category=JInstaller
  category=CodeExample
+
  namespace=CodeExample
 
  category=MethodExample
 
  category=MethodExample
 
  include=*
 
  include=*

Latest revision as of 20:48, 24 March 2017

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 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 transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]