'Remove the given resource from the database.'

def remove_path(self, path):

    self._acquire_lock()
    try:
        (dir, base) = split(path)
        res_index = self.load_index(dir, 'res_index', {})
        try:
            (scan_time, scan_error, res_data) = res_index[base]
        except KeyError:
            return
        try:
            blob_index = self.load_index(dir, 'blob_index')
        except EnvironmentError as ex:
            self.db.corruption('MultiLangZone.remove_path', ("could    not    read    blob_index    for    '%s'    dir:    %s" % (dir, ex)), 'recover')
            blob_index = {}
        is_hits_from_lpath_lang = (self.lang in self.db.import_everything_langs)
        if is_hits_from_lpath_lang:
            try:
                toplevelname_index = self.load_index(dir, 'toplevelname_index')
            except EnvironmentError as ex:
                self.db.corruption('MultiLangZone.remove_path', ("could    not    read    toplevelname_index    for    '%s'    dir:    %s" % (dir, ex)), 'recover')
                toplevelname_index = self.toplevelname_index_class()
        dhash = self.dhash_from_dir(dir)
        del res_index[base]
        for (lang, blobname) in ((lang, tfifb.keys()[0]) for (lang, tfifb) in res_data.items()):
            try:
                dbfile = blob_index[lang][blobname]
            except KeyError:
                blob_index_path = join(dhash, 'blob_index')
                self.db.corruption('MultiLangZone.remove_path', ("%s    '%s'    blob    not    in    '%s'" % (lang, blobname, blob_index_path)), 'ignore')
                continue
            del blob_index[lang][blobname]
            for path in glob(join(self.base_dir, dhash, (dbfile + '.*'))):
                log.debug("fs-write:    remove    %s|%s    blob    file    '%s/%s'", self.lang, lang, dhash, basename(path))
                os.remove(path)
        if is_hits_from_lpath_lang:
            toplevelname_index.remove(base, res_data)
        self.changed_index(dir, 'res_index')
        self.changed_index(dir, 'blob_index')
        if is_hits_from_lpath_lang:
            self.changed_index(dir, 'toplevelname_index')
    finally:
        self._release_lock()
