From Joomla! Documentation

< API16:JInstallerFile

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.


function used to populate files and folder list

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




boolean none

Defined in



jimport( 'joomla.installer.adapters.file' );

Source Body

private function populateFilesAndFolderList()

        // Initialise variable
        $this->folderList = array();
        $this->fileList = array();

        // Get fileset
        $eFileset = $this->manifest->fileset->files;

        // Set root folder names
        $packagePath = $this->parent->getPath('source');
        $jRootPath = JPath::clean(JPATH_ROOT);

        // loop through all elements and get list of files and folders
        foreach ($this->manifest->fileset->files as $eFiles)
                // Check if the element is files element
                $folder = (string)$eFiles->attributes()->folder;
                $target = (string)$eFiles->attributes()->target;

                //Split folder names into array to get folder names. This will
                // help in creating folders
                $arrList = split("/|\\/", $target);

                $folderName = $jRootPath;
                foreach ($arrList as $dir)
                        if(empty($dir)) continue ;

                        $folderName .= DS.$dir;
                        // Check if folder exists, if not then add to the array for folder creation
                        if (!JFolder::exists($folderName)) {
                                array_push($this->folderList, $folderName);

                //Create folder path
                $sourceFolder = empty($folder)?$packagePath:$packagePath.DS.$folder;
                $targetFolder = empty($target)?$jRootPath:$jRootPath.DS.$target;

                //Check if source folder exists
                if (! JFolder::exists($sourceFolder)) {
                        JError::raiseWarning(1, JText::_('Files').' '.JText::_('Install').': '.JText::_('Failed to find source directory').': "'.$sourceFolder.'"');
                        // if installation fails, rollback
                        return false;

                // Check if all children exists
                if (count($eFiles->children()))
                        // loop through all filenames elements
                        foreach ($eFiles->children() as $eFileName)
                                $path['src'] = $sourceFolder.DS.$eFileName;
                                $path['dest'] = $targetFolder.DS.$eFileName;
                                $path['type'] = 'file';
                                if ($eFileName->getName() == 'folder') {
                                        $folderName = $targetFolder.DS.$eFileName;
                                        array_push($this->folderList, $folderName);
                                        $path['type'] = 'folder';

                                array_push($this->fileList, $path);
                } else {
                        $files = JFolder::files($sourceFolder);
                        foreach ($files as $file) {
                                $path['src'] = $sourceFolder.DS.$file;
                                $path['dest'] = $targetFolder.DS.$file;

                                array_push($this->fileList, $path);


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


Code Examples