Actions

API16

JInstaller/parseQueries

From Joomla! Documentation

< API16:JInstaller
Revision as of 22:00, 13 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
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

Backward compatible Method to parse through a queries element of the installation manifest file and take appropriate action.

[<! removed edit link to red link >]

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

Syntax

parseQueries($element)
Parameter Name Default Value Description
$element $element The xml node to process

Returns

mixed Number of queries processed or False on error

Defined in

libraries/joomla/installer/installer.php

Importing

jimport( 'joomla.installer.installer' );

Source Body

public function parseQueries($element)
{
        // Get the database connector object
        $db = & $this->_db;
 
        if (!($element instanceof JXMLElement) || ! count($element->children()))
        {
                // Either the tag does not exist or has no children therefore we return zero files processed.
                return 0;
        }
 
        // Get the array of query nodes to process
        $queries = $element->children();
        if (count($queries) == 0)
        {
                // No queries to process
                return 0;
        }
 
        // Process each query in the $queries array (children of $tagName).
        foreach ($queries as $query)
        {
                $db->setQuery($query->data());
                if (!$db->query())
                {
                        JError::raiseWarning(1, 'JInstaller::install: '.JText::_('SQL_ERROR')." ".$db->stderr(true));
                        return false;
                }
        }
        return (int) count($queries);
}

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

Examples

<CodeExamplesForm />