Handle funky notice deletion cases more gracefully: if we already have a deleted_notice entry, don't freak out when we try to save it again on the second try.

This commit is contained in:
Brion Vibber 2010-05-24 07:47:15 -07:00
parent dc22ed8480
commit f7add6f25f

View File

@ -97,6 +97,10 @@ class Notice extends Memcached_DataObject
// For auditing purposes, save a record that the notice
// was deleted.
// @fixme we have some cases where things get re-run and so the
// insert fails.
$deleted = Deleted_notice::staticGet('id', $this->id);
if (!$deleted) {
$deleted = new Deleted_notice();
$deleted->id = $this->id;
@ -106,6 +110,7 @@ class Notice extends Memcached_DataObject
$deleted->deleted = common_sql_now();
$deleted->insert();
}
// Clear related records