log IDs of things

This commit is contained in:
Shish 2013-08-30 00:19:38 +01:00
parent 7c140680b7
commit 07304861f3
6 changed files with 12 additions and 11 deletions

View File

@ -243,7 +243,7 @@ class Image {
global $database;
if($owner->id != $this->owner_id) {
$database->execute("UPDATE images SET owner_id=:owner_id WHERE id=:id", array("owner_id"=>$owner->id, "id"=>$this->id));
log_info("core_image", "Owner for Image #{$this->id} set to {$owner->name}");
log_info("core_image", "Owner for Image #{$this->id} set to {$owner->name}", false, array("image_id" => $this->id));
}
}
@ -417,7 +417,7 @@ class Image {
if(empty($new_source)) $new_source = null;
if($new_source != $old_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)");
log_info("core_image", "Source for Image #{$this->id} set to: $new_source (was $old_source)", false, array("image_id" => $this->id));
}
}
@ -437,7 +437,7 @@ class Image {
$sln = str_replace('"', "", $sln);
if(bool_escape($sln) !== $this->locked) {
$database->execute("UPDATE images SET locked=:yn WHERE id=:id", array("yn"=>$sln, "id"=>$this->id));
log_info("core_image", "Setting Image #{$this->id} lock to: $ln");
log_info("core_image", "Setting Image #{$this->id} lock to: $ln", false, array("image_id" => $this->id));
}
}
@ -502,7 +502,7 @@ class Image {
array("tag"=>$tag));
}
log_info("core_image", "Tags for Image #{$this->id} set to: ".implode(" ", $tags));
log_info("core_image", "Tags for Image #{$this->id} set to: ".implode(" ", $tags), false, array("image_id" => $this->id));
$database->cache->delete("image-{$this->id}-tags");
}
}
@ -514,7 +514,7 @@ class Image {
global $database;
$this->delete_tags_from_image();
$database->execute("DELETE FROM images WHERE id=:id", array("id"=>$this->id));
log_info("core_image", 'Deleted Image #'.$this->id.' ('.$this->hash.')');
log_info("core_image", 'Deleted Image #'.$this->id.' ('.$this->hash.')', false, array("image_id" => $this->id));
unlink($this->get_image_filename());
unlink($this->get_thumb_filename());
@ -525,7 +525,7 @@ class Image {
* It DOES NOT remove anything from the database.
*/
public function remove_image_only() {
log_info("core_image", 'Removed Image File ('.$this->hash.')');
log_info("core_image", 'Removed Image File ('.$this->hash.')', false, array("image_id" => $this->id));
@unlink($this->get_image_filename());
@unlink($this->get_thumb_filename());
}

View File

@ -546,7 +546,7 @@ class CommentList extends Extension {
$snippet = substr($comment, 0, 100);
$snippet = str_replace("\n", " ", $snippet);
$snippet = str_replace("\r", " ", $snippet);
log_info("comment", "Comment #$cid added to Image #$image_id: $snippet");
log_info("comment", "Comment #$cid added to Image #$image_id: $snippet", false, array("image_id"=>$image_id, "comment_id"=>$cid));
}
}
// }}}

View File

@ -163,6 +163,7 @@ class Index extends Extension {
$page_number = $event->get_page_number();
$page_size = $event->get_page_size();
try {
#log_debug("index", "Search for ".implode(" ", $search_terms), false, array("terms"=>$search_terms));
$total_pages = Image::count_pages($search_terms);
if(SPEED_HAX && count($search_terms) == 0 && ($page_number < 10)) { // extra caching for the first few post/list pages
$images = $database->cache->get("post-list-$page_number");

View File

@ -174,7 +174,7 @@ class NumericScore extends Extension {
public function onNumericScoreSet(NumericScoreSetEvent $event) {
global $user;
log_debug("numeric_score", "Rated Image #{$event->image_id} as {$event->score}", true);
log_debug("numeric_score", "Rated Image #{$event->image_id} as {$event->score}", true, array("image_id"=>$event->image_id));
$this->add_vote($event->image_id, $user->id, $event->score);
}

View File

@ -74,7 +74,7 @@ class ReportImage extends Extension {
public function onAddReportedImage(AddReportedImageEvent $event) {
global $database;
log_info("report_image", "Adding report of Image #{$event->image_id} with reason '{$event->reason}'");
log_info("report_image", "Adding report of Image #{$event->image_id} with reason '{$event->reason}'", false, array("image_id" => $event->image_id));
$database->Execute(
"INSERT INTO image_reports(image_id, reporter_id, reason)
VALUES (?, ?, ?)",

View File

@ -331,10 +331,10 @@ class Tag_History extends Extension {
if(empty($old_tags)) {
/* no old tags, so we are probably adding the image for the first time */
log_debug("tag_history", "adding new tag history: [$new_tags]");
log_debug("tag_history", "adding new tag history: [$new_tags]", false, array("image_id" => $image->id));
}
else {
log_debug("tag_history", "adding tag history: [$old_tags] -> [$new_tags]");
log_debug("tag_history", "adding tag history: [$old_tags] -> [$new_tags]", false, array("image_id" => $image->id));
}
$allowed = $config->get_int("history_limit");