if (!empty($default)) { foreach ($default as $key => $v) { if (empty($shard[$key])) { $shard[$key] = $v; } } } $new_shards[$shard_name] = $shard; } $shards = $new_shards; $shards['config'] = array_merge($config_default, $shards['config']); return $shards; } $params = array(); echo "* Reading config\n"; $shards = get_shards($params); if (empty($shards['config'])) { die("SETUP FAILED: You must have a [config] entry in the .ini file.\n"); } $config = $shards['config']; unset($shards['config']); if (empty($config['schema_name'])) { echo "NOTICE: a schema_name was not specified in the [config] section of your .ini file. Using shard_query as the default\n"; $config['schema_name'] = 'shard_query'; } if (empty($config['mapper'])) { die("SETUP FAILED: you must specify a mapper type in the [config] section. Specify mapper=\"none\" if you do not want to use a mapper\n"); } echo " -- There are " . count($shards) . " shards in this configuration (and one configuration database)\n"; echo "* Verifying config database\n"; $dal = SimpleDAL::factory($config);
function get_defaults($params) { return get_shards($params, true); }