/** * get list of extensions (all type) that installed on your sites * (The result will be storaged into the '_updateExtensions' property of object). * - this list will be collected from many tables * - the field 'extKey' will be used to identify extension, * it is got from different information (depend on extension type) * * @param (int) $limitstart * @param (int) $limit * @param (array) $lists - other params */ function _loadExtensions($limitstart = 0, $limit = 20, $lists = array()) { // Initialise variables. $app = JFactory::getApplication('administrator'); $type = JRequest::getVar('type', '') != '' ? JRequest::getVar('type') : $lists['extionsion_type']; $sFilter = $this->_getFilterExtensions(); $db = JFactory::getDbo(); $query = "\r\r\n\t\t\t\tSELECT \r\r\n\t\t\t\t\t`type`, `element` AS extKey,\r\r\n\t\t\t\t\textension_id AS id, name, params, protected, `state` AS enabled, \r\r\n\t\t\t\t\telement, client_id, folder \r\r\n\t\t\t\tFROM #__extensions \r\r\n\t\t\t\tWHERE (`type` = " . $db->Quote($type) . " OR '' = " . $db->Quote($type) . ")\r\r\n\t\t\t\tAND `element` NOT LIKE '%jaupdater.%'\r\r\n\t\t\t\t{$sFilter}\r\r\n\t\t\t\tGROUP BY extension_id\r\r\n\t\t\t\tORDER BY `type`, `name`\r\r\n\t\t\t\tLIMIT {$limitstart}, {$limit}"; //echo nl2br($query); //die($query); $db->setQuery($query); $rows = $db->loadObjectList(); $this->_updateExtensions = array(); $aSettings = $this->getListExtensionSettings(); $services = jaGetListServices(); $helper = new JaextmanagerHelper($aSettings, $services); foreach ($rows as $obj) { if (($obj2 = $helper->loadExtension($obj, $obj->type)) !== false) { $this->_updateExtensions[] = $obj2; } } }
function _loadExtensions($limitstart = 0, $limit = 20, $lists = array()) { global $mainframe, $option; $type = JRequest::getVar('type', '') != '' ? JRequest::getVar('type') : $lists['extionsion_type']; $aFilter = $this->_getFilterExtensions(); $db =& JFactory::getDBO(); $aUnion = array(); $aUnion['component'] = "\n\t\t\t\tSELECT \n\t\t\t\t\t'component' AS `type`, `option` AS extKey,\n\t\t\t\t\tid, name, params, iscore, enabled, \n\t\t\t\t\t`option`, '' AS module, '' AS element, '0' AS client_id, '' AS folder \n\t\t\t\tFROM #__components \n\t\t\t\t{$aFilter['com']} \n\t\t\t\tGROUP BY `option`\n\t\t\t\t"; $aUnion['module'] = "\n\t\t\t\tSELECT \n\t\t\t\t\t'module' AS `type`, module AS extKey,\n\t\t\t\t\tid, title AS name, params, iscore, published AS enabled, \n\t\t\t\t\t'' AS `option`, module, '' AS element, client_id, '' AS folder \n\t\t\t\tFROM #__modules \n\t\t\t\t{$aFilter['mod']} \n\t\t\t\tGROUP BY `module`\n\t\t\t\t"; $aUnion['plugin'] = "\n\t\t\t\tSELECT \n\t\t\t\t\t'plugin' AS `type`, element AS extKey,\n\t\t\t\t\tid, name, params, iscore, published AS enabled, \n\t\t\t\t\t'' AS `option`, '' AS module, element, '0' AS client_id, folder \n\t\t\t\tFROM #__plugins \n\t\t\t\t{$aFilter['plg']} \n\t\t\t\t"; /** * do not group plugin, because some plugin have same name but difference from group * Ex: K2 have three 3 plugin with same name * GROUP BY `element` */ $aUnion['template'] = "\n\t\t\t\tSELECT \n\t\t\t\t\t'template' AS `type`, template AS extKey,\n\t\t\t\t\ttemplate AS id, template AS name, '' AS params, '0' AS iscore, '1' AS enabled, \n\t\t\t\t\t'' AS `option`, '' AS module, '' AS element, client_id, '' AS folder \n\t\t\t\tFROM #__templates_menu \n\t\t\t\t{$aFilter['tpl']} \n\t\t\t\tGROUP BY `template`\n\t\t\t\t"; if (array_key_exists($type, $aUnion)) { $query = $aUnion[$type]; } else { $query = implode(" UNION ", $aUnion); } $query .= "\n\t\t\t\tORDER BY iscore, name\n\t\t\t\tLIMIT {$limitstart}, {$limit}"; $db->setQuery($query); $rows = $db->loadObjectList(); $this->_updateExtensions = array(); $params = $this->getComponentParams(); $services = jaGetListServices(); $helper = new JaextmanagerHelper($params, $services); foreach ($rows as $obj) { if (($obj = $helper->loadExtension($obj, $obj->type)) !== false) { $this->_updateExtensions[] = $obj; } } }