log old source in event log when changing source

This commit is contained in:
Shish 2013-05-07 09:13:03 +01:00
parent 44e9714d88
commit 7701758959

View File

@ -411,12 +411,13 @@ class Image {
/** /**
* Set the image's source URL * Set the image's source URL
*/ */
public function set_source(/*string*/ $source) { public function set_source(/*string*/ $new_source) {
global $database; global $database;
if(empty($source)) $source = null; $old_source = $this->source;
if($source != $this->source) { if(empty($new_source)) $new_source = null;
$database->execute("UPDATE images SET source=:source WHERE id=:id", array("source"=>$source, "id"=>$this->id)); if($new_source != $old_source) {
log_info("core-image", "Source for Image #{$this->id} set to: ".$source); $database->execute("UPDATE images SET source=:source WHERE id=:id", array("source"=>$new_source, "id"=>$this->id));
log_info("core-image", "Source for Image #{$this->id} set to: $new_source (was $old_source)");
} }
} }