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


PHP AEPlatform::get_platform_database_options方法代码示例

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


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

	/**
	 * Returns a database connection object. It's an alias of AECoreDatabase::getDatabase()
	 * @param array $options Options to use when instanciating the database connection
	 * @return AEAbstractDriver
	 */
	public static function unsetDatabase($options = null)
	{
		if(is_null($options))
		{
			$options = AEPlatform::get_platform_database_options();
		}
		$db =& AECoreDatabase::getDatabase($options);
		$db->close();
		AECoreDatabase::unsetDatabase($options);
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:15,代码来源:factory.php

示例4: apply_obsolete_quotas

	/**
	 * Keeps a maximum number of "obsolete" records
	 */
	private function apply_obsolete_quotas()
	{
		$this->setStep('Applying quota limit on obsolete backup records');
		$this->setSubstep('');
		$registry =& AEFactory::getConfiguration();
		$limit = $registry->get('akeeba.quota.obsolete_quota', 0);
		$limit = (int)$limit;

		if($limit <= 0) return;

		$db =& AEFactory::getDatabase( AEPlatform::get_platform_database_options() );
		$query = 'SELECT `id` FROM #__ak_stats WHERE `status` = \'complete\' AND `filesexist` = 0 ORDER BY `id` DESC LIMIT '.$limit.',100000';
		$db->setQuery($query);
		$array = $db->loadResultArray();

		if(empty($array)) return;

		$ids = implode(',', $array);

		$query = "DELETE FROM #__ak_stats WHERE ".$db->nameQuote('id')." IN ($ids)";
		$db->setQuery($query);
		$db->query();
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:26,代码来源:finalization.php


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