This file is indexed.

/usr/share/php/kohana3.1/modules/database/classes/kohana/config/database.php is in libkohana3.1-mod-database-php 3.1.5-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
<?php defined('SYSPATH') OR die('No direct script access.');
/**
 * Database-based configuration loader.
 *
 * Schema for configuration table:
 *
 *     group_name    varchar(128)
 *     config_key    varchar(128)
 *     config_value  text
 *     primary key   (group_name, config_key)
 *
 * @package    Kohana/Database
 * @category   Configuration
 * @author     Kohana Team
 * @copyright  (c) 2009 Kohana Team
 * @license    http://kohanaphp.com/license
 */
class Kohana_Config_Database extends Config_Reader {

	protected $_database_instance;

	protected $_database_table = 'config';

	public function __construct(array $config = NULL)
	{
		if (isset($config['instance']))
		{
			$this->_database_instance = $config['instance'];
		}
		elseif ($this->_database_instance === NULL)
		{
			$this->_database_instance = Database::$default;
		}

		if (isset($config['table']))
		{
			$this->_database_table = $config['table'];
		}

		parent::__construct();
	}

	/**
	 * Query the configuration table for all values for this group and
	 * unserialize each of the values.
	 *
	 * @param   string  $group   group name
	 * @param   array   $config  configuration array
	 * @return  $this   clone of the current object
	 */
	public function load($group, array $config = NULL)
	{
		if ($config === NULL AND $group !== 'database')
		{
			// Load all of the configuration values for this group
			$query = DB::select('config_key', 'config_value')
				->from($this->_database_table)
				->where('group_name', '=', $group)
				->execute($this->_database_instance);

			if (count($query) > 0)
			{
				// Unserialize the configuration values
				$config = array_map('unserialize', $query->as_array('config_key', 'config_value'));
			}
		}

		return parent::load($group, $config);
	}

	/**
	 * Overload setting offsets to insert or update the database values as
	 * changes occur.
	 *
	 * @param   string   $key    array key
	 * @param   mixed    $value  new value
	 * @return  mixed
	 */
	public function offsetSet($key, $value)
	{
		if ( ! $this->offsetExists($key))
		{
			// Insert a new value
			DB::insert($this->_database_table, array('group_name', 'config_key', 'config_value'))
				->values(array($this->_configuration_group, $key, serialize($value)))
				->execute($this->_database_instance);
		}
		elseif ($this->offsetGet($key) !== $value)
		{
			// Update the value
			DB::update($this->_database_table)
				->value('config_value', serialize($value))
				->where('group_name', '=', $this->_configuration_group)
				->where('config_key', '=', $key)
				->execute($this->_database_instance);
		}

		return parent::offsetSet($key, $value);
	}

} // End Kohana_Config_Database