Browse Source

Generate identifier even when db entry exists #344

Tobias Reich 9 years ago
parent
commit
275e653b1a
2 changed files with 9 additions and 0 deletions
  1. 1 0
      php/database/settings_content.sql
  2. 8 0
      php/database/update_030001.php

+ 1 - 0
php/database/settings_content.sql

@@ -14,4 +14,5 @@ VALUES
   ('medium','1'),
   ('imagick','1'),
   ('dropboxKey',''),
+  ('identifier',''),
   ('plugins','');

+ 8 - 0
php/database/update_030001.php

@@ -54,6 +54,14 @@ if ($result->num_rows===0) {
 		Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')');
 		return false;
 	}
+} else {
+	$identifier		= md5(microtime(true));
+	$query			= Database::prepare($database, "UPDATE `?` SET `value` = '?' WHERE `key` = 'identifier' LIMIT 1", array(LYCHEE_TABLE_SETTINGS, $identifier));
+	$result	= $database->query($query);
+	if (!$result) {
+		Log::error($database, 'update_030001', __LINE__, 'Could not reset public albums (' . $database->error . ')');
+		return false;
+	}
 }
 
 # Set version