public function __construct($path = null, Context $ctx = null) { if ($this->isObjectResource($path, self::TYPE_DB)) { $db = $path; } else { $previous = ini_set('track_errors', '1'); $db = @grn_db_open_or_create($ctx ? $ctx->getResource() : null, $path); ini_set('track_errors', $previous); if (!$db) { throw new Exception($php_errormsg); } } parent::__construct($db); $this->activate(); }