コード例 #1
1
 /**
  * Method to get the list of database options.
  *
  * This method produces a drop down list of available databases supported
  * by JDatabaseDriver classes that are also supported by the application.
  *
  * @return  array  The field option objects.
  *
  * @since   11.3
  * @see     JDatabaseDriver::getConnectors()
  */
 protected function getOptions()
 {
     // This gets the connectors available in the platform and supported by the server.
     $available = JDatabaseDriver::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] = JText::_(ucfirst($support));
             }
         }
     } else {
         foreach ($available as $support) {
             $options[$support] = JText::_(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;
 }
コード例 #2
0
 /**
  * Tests the JDatabaseDriver::getConnectors method.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function testGetConnectors()
 {
     $this->assertContains('sqlite', $this->db->getConnectors(), 'The getConnectors method should return an array with Sqlite as an available option.');
 }
コード例 #3
0
ファイル: setup.php プロジェクト: educakanchay/kanchay
 /**
  * Gets PHP options.
  *
  * @return	array  Array of PHP config options
  *
  * @since   3.1
  */
 public function getPhpOptions()
 {
     $options = array();
     // Check the PHP Version.
     $option = new stdClass();
     $option->label = JText::_('INSTL_PHP_VERSION') . ' >= 5.3.10';
     $option->state = version_compare(PHP_VERSION, '5.3.10', '>=');
     $option->notice = null;
     $options[] = $option;
     // Check for magic quotes gpc.
     $option = new stdClass();
     $option->label = JText::_('INSTL_MAGIC_QUOTES_GPC');
     $option->state = ini_get('magic_quotes_gpc') == false;
     $option->notice = null;
     $options[] = $option;
     // Check for register globals.
     $option = new stdClass();
     $option->label = JText::_('INSTL_REGISTER_GLOBALS');
     $option->state = ini_get('register_globals') == false;
     $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 = JDatabaseDriver::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 writable.
     $writable = is_writable(JPATH_CONFIGURATION . '/configuration.php') || !file_exists(JPATH_CONFIGURATION . '/configuration.php') && is_writable(JPATH_ROOT);
     $option = new stdClass();
     $option->label = JText::sprintf('INSTL_WRITABLE', 'configuration.php');
     $option->state = $writable;
     $option->notice = $option->state ? null : JText::_('INSTL_NOTICEYOUCANSTILLINSTALL');
     $options[] = $option;
     return $options;
 }
コード例 #4
0
ファイル: database.php プロジェクト: GitIPFire/Homeworks
	/**
	 * Get a list of available database connectors.  The list will only be populated with connectors that both
	 * the class exists and the static test method returns true.  This gives us the ability to have a multitude
	 * of connector classes that are self-aware as to whether or not they are able to be used on a given system.
	 *
	 * @return  array  An array of available database connectors.
	 *
	 * @since   11.1
	 * @deprecated  13.1
	 */
	public static function getConnectors()
	{
		JLog::add('JDatabase::getConnectors() is deprecated, use JDatabaseDriver::getConnectors() instead.', JLog::WARNING, 'deprecated');

		return JDatabaseDriver::getConnectors();
	}
コード例 #5
0
ファイル: database.php プロジェクト: n3t/joomla-platform
 /**
  * Get a list of available database connectors.  The list will only be populated with connectors that both
  * the class exists and the static test method returns true.  This gives us the ability to have a multitude
  * of connector classes that are self-aware as to whether or not they are able to be used on a given system.
  *
  * @return  array  An array of available database connectors.
  *
  * @since   11.1
  * @deprecated  13.1
  */
 public static function getConnectors()
 {
     // Deprecation warning.
     JLog::add('JDatabase::getConnectors() is deprecated, use JDatabaseDriver::getConnectors() instead.', JLog::NOTICE, 'deprecated');
     return JDatabaseDriver::getConnectors();
 }