From 7c5d1bd139fbcdaadce0315034996319717ccb35 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Sun, 11 Sep 2011 17:46:15 -0400
Subject: [PATCH] =?UTF-8?q?-=20Patch=20#1260162=20by=20michaellenahan,=20B?=
 =?UTF-8?q?=C3=A8s:=20hook=5Ffile=5Finsert()=20doc=20has=20no=20function?=
 =?UTF-8?q?=20body.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 modules/system/system.api.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 44c4ab1d6e27..52350f9b9339 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -2627,17 +2627,21 @@ function hook_file_presave($file) {
 /**
  * Respond to a file being added.
  *
- * This hook is called before a file has been added to the database. The hook
+ * This hook is called after a file has been added to the database. The hook
  * doesn't distinguish between files created as a result of a copy or those
  * created by an upload.
  *
  * @param $file
- *   The file that is about to be saved.
+ *   The file that has been added.
  *
  * @see file_save()
  */
 function hook_file_insert($file) {
-
+  // Add a message to the log, if the file is a jpg
+  $validate = file_validate_extensions($file, 'jpg');
+  if (empty($validate)) {
+    watchdog('file', 'A jpg has been added.');
+  }
 }
 
 /**
-- 
GitLab