/** * Method to get the list of database options. * * This method produces a drop down list of available databases supported * by JDatabase drivers that are also supported by the application. * * @return array The field option objects. * * @since 11.3 * @see JDatabase */ protected function getOptions() { // Initialize variables. // This gets the connectors available in the platform and supported by the server. $available = JDatabase::getConnectors(); /** * This gets the list of database types supported by the application. * This should be entered in the form definition as a comma separated list. * If no supported databases are listed, it is assumed all available databases * are supported. */ $supported = $this->element['supported']; if (!empty($supported)) { $supported = explode(',', $supported); foreach ($supported as $support) { if (in_array($support, $available)) { $options[$support] = ucfirst($support); } } } else { foreach ($available as $support) { $options[$support] = ucfirst($support); } } // This will come into play if an application is installed that requires // a database that is not available on the server. if (empty($options)) { $options[''] = JText::_('JNONE'); } return $options; }
/** * Gets PHP options. * * @return array * @since 1.6 */ public function getPhpOptions() { // Initialise variables. $options = array(); // Check the PHP Version. $option = new stdClass(); $option->label = JText::_('INSTL_PHP_VERSION') . ' >= 5.2.4'; $option->state = version_compare(PHP_VERSION, '5.2.4', '>='); $option->notice = null; $options[] = $option; // Check for zlib support. $option = new stdClass(); $option->label = JText::_('INSTL_ZLIB_COMPRESSION_SUPPORT'); $option->state = extension_loaded('zlib'); $option->notice = null; $options[] = $option; // Check for XML support. $option = new stdClass(); $option->label = JText::_('INSTL_XML_SUPPORT'); $option->state = extension_loaded('xml'); $option->notice = null; $options[] = $option; // Check for database support. // We are satisfied if there is at least one database driver available. $available = JDatabase::getConnectors(); $option = new stdClass(); $option->label = JText::_('INSTL_DATABASE_SUPPORT'); $option->label .= '<br />(' . implode(', ', $available) . ')'; $option->state = count($available); $option->notice = null; $options[] = $option; // Check for mbstring options. if (extension_loaded('mbstring')) { // Check for default MB language. $option = new stdClass(); $option->label = JText::_('INSTL_MB_LANGUAGE_IS_DEFAULT'); $option->state = strtolower(ini_get('mbstring.language')) == 'neutral'; $option->notice = $option->state ? null : JText::_('INSTL_NOTICEMBLANGNOTDEFAULT'); $options[] = $option; // Check for MB function overload. $option = new stdClass(); $option->label = JText::_('INSTL_MB_STRING_OVERLOAD_OFF'); $option->state = ini_get('mbstring.func_overload') == 0; $option->notice = $option->state ? null : JText::_('INSTL_NOTICEMBSTRINGOVERLOAD'); $options[] = $option; } // Check for a missing native parse_ini_file implementation $option = new stdClass(); $option->label = JText::_('INSTL_PARSE_INI_FILE_AVAILABLE'); $option->state = $this->getIniParserAvailability(); $option->notice = null; $options[] = $option; // Check for missing native json_encode / json_decode support $option = new stdClass(); $option->label = JText::_('INSTL_JSON_SUPPORT_AVAILABLE'); $option->state = function_exists('json_encode') && function_exists('json_decode'); $option->notice = null; $options[] = $option; // Check for configuration file writeable. $option = new stdClass(); $option->label = 'configuration.php ' . JText::_('INSTL_WRITABLE'); $option->state = is_writable('../configuration.php') || !file_exists('../configuration.php') && is_writable('../'); $option->notice = $option->state ? null : JText::_('INSTL_NOTICEYOUCANSTILLINSTALL'); $options[] = $option; return $options; }