Keep UUID when edit

This commit is contained in:
Diego 2017-04-27 10:06:07 +02:00
parent a28a02164c
commit 75645ce8ac
1 changed files with 9 additions and 5 deletions

View File

@ -116,7 +116,9 @@ class dbPosts extends dbJSON
$key = $this->generateKey($args['slug']); $key = $this->generateKey($args['slug']);
// Generate UUID // Generate UUID
if( empty($args['uuid']) ) {
$args['uuid'] = md5(time().DOMAIN); $args['uuid'] = md5(time().DOMAIN);
}
// The user is always who is loggued // The user is always who is loggued
$args['username'] = Session::get('username'); $args['username'] = Session::get('username');
@ -206,11 +208,13 @@ class dbPosts extends dbJSON
public function edit($args) public function edit($args)
{ {
if( $this->delete($args['key']) ) {
// Modified date // Modified date
$args['dateModified'] = Date::current(DB_DATE_FORMAT); $args['dateModified'] = Date::current(DB_DATE_FORMAT);
// Keep UUID
$args['uuid'] = $this->uuid();
if( $this->delete($args['key']) ) {
return $this->add($args); return $this->add($args);
} }