JInstallerModule/discover
From Joomla! Documentation
< API16:JInstallerModule
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]
Custom discover method
<! removed transcluded page call, red link never existed >
Syntax[edit]
discover()
Returns[edit]
array(JExtension) list of extensions available
Defined in[edit]
libraries/joomla/installer/adapters/module.php
Importing[edit]
jimport( 'joomla.installer.adapters.module' );
Source Body[edit]
function discover()
{
$results = Array();
$site_list = JFolder::folders(JPATH_SITE.DS.'modules');
$admin_list = JFolder::folders(JPATH_ADMINISTRATOR.DS.'modules');
$site_info = JApplicationHelper::getClientInfo('site', true);
$admin_info = JApplicationHelper::getClientInfo('administrator', true);
foreach ($site_list as $module)
{
$extension = &JTable::getInstance('extension');
$extension->set('type', 'module');
$extension->set('client_id', $site_info->id);
$extension->set('element', $module);
$extension->set('name', $module);
$extension->set('state', -1);
$results[] = clone $extension;
}
foreach ($admin_list as $module)
{
$extension = &JTable::getInstance('extension');
$extension->set('type', 'module');
$extension->set('client_id', $admin_info->id);
$extension->set('element', $module);
$extension->set('name', $module);
$extension->set('state', -1);
$results[] = clone $extension;
}
return $results;
}
<! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]