static function inmemory_open() { $r = inmemory_open(); return is_resource($r) ? new XapianWritableDatabase($r) : $r; }
static function inmemory_open() { $r = inmemory_open(); if (is_resource($r)) { $c = 'Xapian' . substr(get_resource_type($r), strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3); if (class_exists($c)) { return new $c($r); } return new XapianWritableDatabase($r); } return $r; }
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * USA */ # Test the version number reporting functions give plausible results. $v = xapian_major_version() . '.' . xapian_minor_version() . '.' . xapian_revision(); $v2 = xapian_version_string(); if ($v != $v2) { print "Unexpected version output ({$v} != {$v2})\n"; exit(1); } $db = inmemory_open(); $db2 = inmemory_open(); function my_errhandler($type, $str) { global $last_exception; if ($type == E_WARNING) { $last_exception = $str; } } $old_errhandler = set_error_handler("my_errhandler"); # Check PHP4 handling of Xapian::DocNotFoundError $old_error_reporting = error_reporting(); if ($old_error_reporting & E_WARNING) { error_reporting($old_error_reporting ^ E_WARNING); } $doc2 = $db->get_document(2); if ($doc2 != null) {