|
a/Allura/allura/model/session.py |
|
b/Allura/allura/model/session.py |
|
... |
|
... |
58 |
def after_flush(self, obj=None):
|
58 |
def after_flush(self, obj=None):
|
59 |
"Update artifact references, and add/update this artifact to solr"
|
59 |
"Update artifact references, and add/update this artifact to solr"
|
60 |
if not getattr(self.session, 'disable_artifact_index', False):
|
60 |
if not getattr(self.session, 'disable_artifact_index', False):
|
61 |
from .artifact import ArtifactLink
|
61 |
from .artifact import ArtifactLink
|
62 |
from .stats import CPA
|
62 |
from .stats import CPA
|
63 |
if self.objects_deleted:
|
63 |
from .index import IndexOp, ArtifactReference
|
64 |
search.remove_artifacts(self.objects_deleted)
|
|
|
65 |
for obj in self.objects_deleted:
|
64 |
for obj in self.objects_deleted:
|
66 |
ArtifactLink.remove(obj)
|
65 |
IndexOp.del_op(obj)
|
67 |
to_update = self.objects_added + self.objects_modified
|
66 |
for obj in self.objects_added + self.objects_modified:
|
68 |
if to_update:
|
67 |
ArtifactReference.from_artifact(obj)
|
69 |
search.add_artifacts(to_update)
|
68 |
IndexOp.add_op(obj)
|
70 |
for obj in to_update:
|
|
|
71 |
try:
|
|
|
72 |
ArtifactLink.add(obj)
|
|
|
73 |
except:
|
|
|
74 |
log.exception('Error adding ArtifactLink for %s', obj)
|
|
|
75 |
session(ArtifactLink).flush()
|
69 |
session(ArtifactLink).flush()
|
76 |
for obj in self.objects_added:
|
70 |
for obj in self.objects_added:
|
77 |
CPA.post('create', obj)
|
71 |
CPA.post('create', obj)
|
78 |
for obj in self.objects_modified:
|
72 |
for obj in self.objects_modified:
|
79 |
CPA.post('modify', obj)
|
73 |
CPA.post('modify', obj)
|