+2012-09-27 Christian Weiske <cweiske@bogo>
+
+ * Fix bug #22: Edited pastes not in "recently created"
+
2012-09-27 Christian Weiske <cweiske@cweiske.de>
* Release of version 0.3.0
* Fix bug #10: error when nothing submitted [cweiske]
* Fix bug #11: do not index edit, delete and tool pages [cweiske]
+* Fix bug #22: Edited pastes not in "recently created" [cweiske]
* Implement request #5: Add OpenID authentication [jnovack]
* Implement request #9: autodetect file type [cweiske]
* Implement request #12: DOAP and rel="vcs-git" support [cweiske]
'description' => $repo->getDescription(),
'tstamp' => gmdate('c', time()),
);
+ if ($crdate == null) {
+ $crdate = $this->getCrDate($repo);
+ }
if ($crdate !== null) {
$repoData['crdate'] = gmdate('c', $crdate);
}
+
$r->setBody(json_encode((object)$repoData));
$r->send();
}
}
+ /**
+ * When updating the repository, we don't have a creation date.
+ * We need to keep it, but elasticsearch does not have a simple way
+ * to update some fields only (without using a custom script).
+ *
+ * @return integer Unix timestamp
+ */
+ protected function getCrDate(Repository $repo)
+ {
+ $r = new Database_Adapter_Elasticsearch_HTTPRequest(
+ $this->searchInstance . 'repo/' . $repo->id,
+ \HTTP_Request2::METHOD_GET
+ );
+ $json = json_decode($r->send()->getBody());
+
+ if (!isset($json->_source->crdate)) {
+ return null;
+ }
+
+ return strtotime($json->_source->crdate);
+ }
+
public function deleteAllRepos()
{
$r = new Database_Adapter_Elasticsearch_HTTPRequest(