当前位置: 首页>>代码示例>>PHP>>正文


PHP AEPlatform::get_default_database_driver方法代码示例

本文整理汇总了PHP中AEPlatform::get_default_database_driver方法的典型用法代码示例。如果您正苦于以下问题:PHP AEPlatform::get_default_database_driver方法的具体用法?PHP AEPlatform::get_default_database_driver怎么用?PHP AEPlatform::get_default_database_driver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AEPlatform的用法示例。


在下文中一共展示了AEPlatform::get_default_database_driver方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

	/**
	 * Returns a database connection object. It caches the created objects for future use.
	 * @param array $options Options to use when instanciating the database connection
	 * @return AEAbstractDriver
	 */
	public static function &getDatabase($options, $unset = false)
	{
		static $instances;

		if (!isset( $instances )) {
			$instances = array();
		}

		$signature = serialize( $options );

		if($unset)
		{
			if (!empty($instances[$signature]))
			{
				$db =& $instances[$signature];
				$db = null;
				unset($instances[$signature]);
			}
			$null = null;
			return $null;
		}

		if (empty($instances[$signature]))
		{
			$driver		= array_key_exists('driver', $options) 		? $options['driver']	: '';
			$select		= array_key_exists('select', $options)		? $options['select']	: true;
			$database	= array_key_exists('database', $options)	? $options['database']	: null;

			$driver = preg_replace('/[^A-Z0-9_\.-]/i', '', $driver);
			if(empty($driver))
			{
				// No driver specified; try to guess
				$default_signature = serialize( AEPlatform::get_platform_database_options() );
				if($signature == $default_signature)
				{
					$driver = AEPlatform::get_default_database_driver(true);
				}
				else
				{
					$driver = AEPlatform::get_default_database_driver(false);
				}
			}
			else
			{
				// Make sure a full driver name was given
				if(substr($driver,0,2) != 'AE') $driver = 'AEDriver'.ucfirst($driver);
			}

			$instance	= new $driver($options);

			$instances[$signature] = & $instance;
		}

		return $instances[$signature];
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:60,代码来源:database.php

示例2: __construct

	public function __construct()
	{
		// This is a directory inclusion filter.
		$this->object	= 'db';
		$this->subtype	= 'inclusion';
		$this->method	= 'direct';
		$this->filter_name = 'PlatformSitedb';

		// Add a new record for the core Joomla! database
		// Get core database options
		$options = AEPlatform::get_platform_database_options();

		$host = $options['host'];
		$port	= NULL;
		$socket	= NULL;
		$targetSlot = substr( strstr( $host, ":" ), 1 );
		if (!empty( $targetSlot )) {
			// Get the port number or socket name
			if (is_numeric( $targetSlot ))
				$port	= $targetSlot;
			else
				$socket	= $targetSlot;

			// Extract the host name only
			$host = substr( $host, 0, strlen( $host ) - (strlen( $targetSlot ) + 1) );
			// This will take care of the following notation: ":3306"
			if($host == '')
				$host = 'localhost';
		}

		// This is the format of the database inclusion filters
		$entry = array(
			'host' => $host,
			'port' => is_null($socket) ? (is_null($port) ? '' : $port) : $socket,
			'username' => $options['user'],
			'password' => $options['password'],
			'database' => $options['database'],
			'prefix' => $options['prefix'],
			'dumpFile' => 'joomla.sql',
			'driver' => AEPlatform::get_default_database_driver(true)
		);


		// We take advantage of the filter class magic to inject our custom filters
		$configuration =& AEFactory::getConfiguration();

		$this->filter_data['[SITEDB]'] = $entry;

		parent::__construct();
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:50,代码来源:sitedb.php

示例3: __construct

	/**
	 * Database object constructor
	 * @param	array	List of options used to configure the connection
	 */
	public function __construct( $options )
	{
		// Get best matching Akeeba Backup driver instance
		if(class_exists('JFactory')) {
			$this->dbo = JFactory::getDBO();
		} else {
			$driver = AEPlatform::get_default_database_driver(false);
			$this->dbo = new $driver($options);
		}

		// Propagate errors
		$this->propagateFromObject($this->dbo);

		$this->nameQuote = '`';
		parent::__construct( $options );

		$this->database = $options['database'];
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:22,代码来源:joomla.php


注:本文中的AEPlatform::get_default_database_driver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。