We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 7c84c355 authored by Brion Vibber's avatar Brion Vibber

Notice::getAsTimestamp() static function to look up the timestamp for a given...

Notice::getAsTimestamp() static function to look up the timestamp for a given notice, even if it's been deleted. To be used for converting since_id/max_id processing to use timestamp sorting internally.
parent 0e7a2838
......@@ -1978,4 +1978,26 @@ class Notice extends Memcached_DataObject
$d = new DateTime($dateStr, new DateTimeZone('UTC'));
return $d->format(DATE_W3C);
}
/**
* Look up the creation timestamp for a given notice ID, even
* if it's been deleted.
*
* @param int $id
* @return mixed string recorded creation timestamp, or false if can't be found
*/
public static function getAsTimestamp($id)
{
$notice = Notice::staticGet('id', $id);
if ($notice) {
return $notice->created;
} else {
$deleted = Deleted_notice::staticGet('id', $id);
if ($deleted) {
return $deleted->created;
} else {
return false;
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment