예제 #1
0
function elgg_solr_delete_annotation($event, $type, $annotation)
{
    if (!$annotation instanceof ElggAnnotation) {
        return true;
    }
    if ($annotation->name != 'generic_comment') {
        return true;
    }
    elgg_solr_defer_annotation_delete($annotation->id);
    return true;
}
예제 #2
0
/**
 * Delete annotation event
 *
 * @param string         $event      "delete"
 * @param string         $type       "annotation"
 * @param ElggAnnotation $annotation Annotation
 * @return void
 */
function elgg_solr_annotation_delete($event, $type, $annotation)
{
    if (!$annotation instanceof ElggAnnotation) {
        return;
    }
    if ($GLOBALS['shutdown_flag']) {
        $client = elgg_solr_get_client();
        $query = $client->createUpdate();
        $query->addDeleteById('annotation:' . $annotation->id);
        $query->addCommit();
        try {
            $client->update($query);
        } catch (Exception $exc) {
            elgg_get_site_entity()->annotate('elgg_solr_delete_cache', 'annotation:' . $annotation->id, ACCESS_PUBLIC);
            elgg_solr_debug_log($exc->getMessage());
        }
    } else {
        elgg_solr_defer_annotation_delete($annotation->id);
    }
}