diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-01-04 11:03:15 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-01-04 11:03:15 +0000 |
commit | 8a636465767fc47f37a0768d45b86ca53a722085 (patch) | |
tree | 85d014902b87d9a695358fae16b64726b882b5f4 /modules | |
parent | 7a6b8e3d3cc26d242b3c7cbb2eaf252d69b8192f (diff) | |
download | brdo-8a636465767fc47f37a0768d45b86ca53a722085.tar.gz brdo-8a636465767fc47f37a0768d45b86ca53a722085.tar.bz2 |
- Added an extra parameter to watchdog() which lets you specifiy an "action"
or "operation" link.
- Made the main page of the administration section show an overview of all
watchdog entries with such action link.
- Fixed typo in PostgreSQL database scheme.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/comment.module | 6 | ||||
-rw-r--r-- | modules/comment/comment.module | 6 | ||||
-rw-r--r-- | modules/node.module | 4 | ||||
-rw-r--r-- | modules/node/node.module | 4 | ||||
-rw-r--r-- | modules/user.module | 16 | ||||
-rw-r--r-- | modules/user/user.module | 16 | ||||
-rw-r--r-- | modules/watchdog.module | 8 | ||||
-rw-r--r-- | modules/watchdog/watchdog.module | 8 |
8 files changed, 26 insertions, 42 deletions
diff --git a/modules/comment.module b/modules/comment.module index b4f1971ec..8ac83dde8 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -201,7 +201,7 @@ function comment_post($edit) { */ $edit["subject"] = strip_tags($edit["subject"]); - + if ($edit["subject"] == "") { $edit["subject"] = substr(strip_tags($edit["comment"]), 0, 29); } @@ -249,7 +249,7 @@ function comment_post($edit) { ** Add entry to the watchdog log: */ - watchdog("special", "comment: updated '". $edit["subject"] ."'"); + watchdog("special", "comment: updated '". $edit["subject"] ."'", l(t("view comment"), array("id" => $edit["nid"], "cid" => $edit["cid"]))); } else { /* @@ -282,7 +282,7 @@ function comment_post($edit) { ** Add entry to the watchdog log: */ - watchdog("special", "comment: added '". $edit["subject"] ."'"); + watchdog("special", "comment: added '". $edit["subject"] ."'", l(t("view comment"), array("id" => $edit["nid"], "cid" => $edit["cid"]))); } /* diff --git a/modules/comment/comment.module b/modules/comment/comment.module index b4f1971ec..8ac83dde8 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -201,7 +201,7 @@ function comment_post($edit) { */ $edit["subject"] = strip_tags($edit["subject"]); - + if ($edit["subject"] == "") { $edit["subject"] = substr(strip_tags($edit["comment"]), 0, 29); } @@ -249,7 +249,7 @@ function comment_post($edit) { ** Add entry to the watchdog log: */ - watchdog("special", "comment: updated '". $edit["subject"] ."'"); + watchdog("special", "comment: updated '". $edit["subject"] ."'", l(t("view comment"), array("id" => $edit["nid"], "cid" => $edit["cid"]))); } else { /* @@ -282,7 +282,7 @@ function comment_post($edit) { ** Add entry to the watchdog log: */ - watchdog("special", "comment: added '". $edit["subject"] ."'"); + watchdog("special", "comment: added '". $edit["subject"] ."'", l(t("view comment"), array("id" => $edit["nid"], "cid" => $edit["cid"]))); } /* diff --git a/modules/node.module b/modules/node.module index 56dbd2d2e..f9ea17b38 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1085,7 +1085,7 @@ function node_submit($node) { taxonomy_node_save($nid, $node->taxonomy); } - watchdog("special", "$node->type: updated '$node->title'"); + watchdog("special", "$node->type: updated '$node->title'", l("view post", array("id" => $node->nid))); $output = t("The node has been updated."); } } @@ -1127,7 +1127,7 @@ function node_submit($node) { taxonomy_node_save($nid, $node->taxonomy); } - watchdog("special", "$node->type: added '$node->title'"); + watchdog("special", "$node->type: added '$node->title'", l("view post", array("id" => $nid))); $output = t("Thanks for your submission."); } } diff --git a/modules/node/node.module b/modules/node/node.module index 56dbd2d2e..f9ea17b38 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1085,7 +1085,7 @@ function node_submit($node) { taxonomy_node_save($nid, $node->taxonomy); } - watchdog("special", "$node->type: updated '$node->title'"); + watchdog("special", "$node->type: updated '$node->title'", l("view post", array("id" => $node->nid))); $output = t("The node has been updated."); } } @@ -1127,7 +1127,7 @@ function node_submit($node) { taxonomy_node_save($nid, $node->taxonomy); } - watchdog("special", "$node->type: added '$node->title'"); + watchdog("special", "$node->type: added '$node->title'", l("view post", array("id" => $nid))); $output = t("Thanks for your submission."); } } diff --git a/modules/user.module b/modules/user.module index 1f1493385..a788b1dc1 100644 --- a/modules/user.module +++ b/modules/user.module @@ -532,7 +532,7 @@ function user_login($edit = array(), $msg = "") { if (!$user && $server && $result = user_get_authmaps("$name@$server")) { if (module_invoke(key($result), "auth", $name, $pass, $server)) { $user = user_external_load("$name@$server"); - watchdog("user", "external load: $name@$server, module: " . key($result)); + watchdog("user", "external load: $name@$server, module: ". key($result)); } else { $error = t("Invalid password for %s.", array("%s" => "<i>$name@$server</i>")); @@ -548,8 +548,8 @@ function user_login($edit = array(), $msg = "") { if (module_hook($module, "auth")) { if (module_invoke($module, "auth", $name, $pass, $server)) { if (variable_get("user_register", 1) == 1 && !user_load(array("name" => "$name@$server"))) { //register this new user - watchdog("user", "new user: $name@$server ($module ID)"); $user = user_save("", array("name" => "$name@$server", "pass" => user_password(), "init" => "$name@$server", "status" => 1, "authname_$module" => "$name@$server", "rid" => _user_authenticated_id())); + watchdog("user", "new user: $name@$server ($module ID)", la("edit user", array("mod" => "user", "op" => "edit", "id" => $user->uid))); break; } } @@ -788,7 +788,7 @@ function user_register($edit = array()) { // TODO: is this necessary? Won't session_write replicate this? unset($edit["session"]); $account = user_save("", array_merge(array("name" => $edit["name"], "pass" => $pass, "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "rating" => 0, "status" => (variable_get("user_register", 1) == 1 ? 1 : 0)), $data)); - watchdog("user", "new user: '". $edit["name"] ."' <". $edit["mail"] .">"); + watchdog("user", "new user: '". $edit["name"] ."' <". $edit["mail"] .">", la("edit user", array("mod" => "user", "op" => "edit", "id" => $account->uid))); $variables = array("%username" => $edit["name"], "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => path_uri(1), "%mailto" => $edit["mail"], "%date" => format_date(time())); @@ -1134,7 +1134,6 @@ function user_admin_create($edit = array()) { } if ($success) { - watchdog("user", "new user: '". $edit["name"] ."' <". $edit["mail"] .">"); user_save("", array("name" => $edit["name"], "pass" => $edit["pass"], "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "status" => 1)); @@ -1719,16 +1718,13 @@ function user_help_devel_da() { // Since Blogger doesn't return a properly formed FaultCode, we just search for the string 'fault'. if ($result && !stristr($result->serialize(), "fault")) { - // watchdog("user", "Success Blogger Auth. Response: " . $result->serialize()); return 1; } else if ($result) { - // watchdog("user", "Blogger Auth failure. Response was " . $result->serialize()); return 0; } else { - // watchdog("user", "Blogger Auth failure. Could not connect."); return 0; } }</pre> @@ -1778,15 +1774,12 @@ function user_help_devel_da() { to the user.module if your registration database has become inoperable or unreachable.</p> <pre> if ($result && !stristr($result->serialize(), "fault")) { - // watchdog("user", "Success Blogger auth. Response was " . $result->serialize()); return 1; } else if ($result) { - // watchdog("user", "Blogger auth failure. Response was " . $result->serialize()); return 0; } else { - // watchdog("user", "Blogger auth failure. Could not connect.");<br> return 0; } </pre> @@ -1796,8 +1789,7 @@ function user_help_devel_da() { testing for all cases. In the case of Blogger, we search for the string 'fault' in the response. If that string is present, or there is no repsonse, our function returns FALSE. Otherwise, Blogger has returned valid data to our method request - and we return TRUE. There are several watchdog() calls here which are commented - out. These are useful for debugging, so I've left them in the code as comments. + and we return TRUE. </p> <pre>function blogger_page() { global $theme; diff --git a/modules/user/user.module b/modules/user/user.module index 1f1493385..a788b1dc1 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -532,7 +532,7 @@ function user_login($edit = array(), $msg = "") { if (!$user && $server && $result = user_get_authmaps("$name@$server")) { if (module_invoke(key($result), "auth", $name, $pass, $server)) { $user = user_external_load("$name@$server"); - watchdog("user", "external load: $name@$server, module: " . key($result)); + watchdog("user", "external load: $name@$server, module: ". key($result)); } else { $error = t("Invalid password for %s.", array("%s" => "<i>$name@$server</i>")); @@ -548,8 +548,8 @@ function user_login($edit = array(), $msg = "") { if (module_hook($module, "auth")) { if (module_invoke($module, "auth", $name, $pass, $server)) { if (variable_get("user_register", 1) == 1 && !user_load(array("name" => "$name@$server"))) { //register this new user - watchdog("user", "new user: $name@$server ($module ID)"); $user = user_save("", array("name" => "$name@$server", "pass" => user_password(), "init" => "$name@$server", "status" => 1, "authname_$module" => "$name@$server", "rid" => _user_authenticated_id())); + watchdog("user", "new user: $name@$server ($module ID)", la("edit user", array("mod" => "user", "op" => "edit", "id" => $user->uid))); break; } } @@ -788,7 +788,7 @@ function user_register($edit = array()) { // TODO: is this necessary? Won't session_write replicate this? unset($edit["session"]); $account = user_save("", array_merge(array("name" => $edit["name"], "pass" => $pass, "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "rating" => 0, "status" => (variable_get("user_register", 1) == 1 ? 1 : 0)), $data)); - watchdog("user", "new user: '". $edit["name"] ."' <". $edit["mail"] .">"); + watchdog("user", "new user: '". $edit["name"] ."' <". $edit["mail"] .">", la("edit user", array("mod" => "user", "op" => "edit", "id" => $account->uid))); $variables = array("%username" => $edit["name"], "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => path_uri(1), "%mailto" => $edit["mail"], "%date" => format_date(time())); @@ -1134,7 +1134,6 @@ function user_admin_create($edit = array()) { } if ($success) { - watchdog("user", "new user: '". $edit["name"] ."' <". $edit["mail"] .">"); user_save("", array("name" => $edit["name"], "pass" => $edit["pass"], "init" => $edit["mail"], "mail" => $edit["mail"], "rid" => _user_authenticated_id(), "status" => 1)); @@ -1719,16 +1718,13 @@ function user_help_devel_da() { // Since Blogger doesn't return a properly formed FaultCode, we just search for the string 'fault'. if ($result && !stristr($result->serialize(), "fault")) { - // watchdog("user", "Success Blogger Auth. Response: " . $result->serialize()); return 1; } else if ($result) { - // watchdog("user", "Blogger Auth failure. Response was " . $result->serialize()); return 0; } else { - // watchdog("user", "Blogger Auth failure. Could not connect."); return 0; } }</pre> @@ -1778,15 +1774,12 @@ function user_help_devel_da() { to the user.module if your registration database has become inoperable or unreachable.</p> <pre> if ($result && !stristr($result->serialize(), "fault")) { - // watchdog("user", "Success Blogger auth. Response was " . $result->serialize()); return 1; } else if ($result) { - // watchdog("user", "Blogger auth failure. Response was " . $result->serialize()); return 0; } else { - // watchdog("user", "Blogger auth failure. Could not connect.");<br> return 0; } </pre> @@ -1796,8 +1789,7 @@ function user_help_devel_da() { testing for all cases. In the case of Blogger, we search for the string 'fault' in the response. If that string is present, or there is no repsonse, our function returns FALSE. Otherwise, Blogger has returned valid data to our method request - and we return TRUE. There are several watchdog() calls here which are commented - out. These are useful for debugging, so I've left them in the code as comments. + and we return TRUE. </p> <pre>function blogger_page() { global $theme; diff --git a/modules/watchdog.module b/modules/watchdog.module index 396351953..eeabdd453 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -43,16 +43,16 @@ function watchdog_cron() { } function watchdog_overview($type) { - $color = array(user => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C"); - $query = array(user => "WHERE type = 'user'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'"); + $color = array("user" => "#FFEEAA", "message" => "#FFFFFF", "special" => "#A49FFF", "warning" => "#FFAA22", "httpd" => "#99DD99", "error" => "#EE4C4C"); + $query = array("user" => "WHERE type = 'user'", "regular" => "WHERE type = 'message'", "special" => "WHERE type = 'special'", "warning" => "WHERE type = 'warning'", "error" => "WHERE type = 'error'", "httpd" => "WHERE type = 'httpd'", "actions" => "WHERE link != ''"); $result = pager_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY w.timestamp DESC", 100); $output .= "<table>"; - $output .= " <tr><th>" . t("date") . "</th><th>" . t("message") . "</th><th>" . t("user") . "</th><th>" . t("operations") . "</th></tr>"; + $output .= " <tr><th>" . t("date") . "</th><th>" . t("event") . "</th><th>" . t("user") . "</th><th colspan=\"2\">" . t("operations") . "</th></tr>"; while ($watchdog = db_fetch_object($result)) { if ($background = $color[$watchdog->type]) { - $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">". la(t("details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid)) ."</td></tr>"; + $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">$watchdog->link</td><td align=\"center\">". la(t("view details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid)) ."</td></tr>"; } } diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index 396351953..eeabdd453 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -43,16 +43,16 @@ function watchdog_cron() { } function watchdog_overview($type) { - $color = array(user => "#FFEEAA", message => "#FFFFFF", special => "#A49FFF", warning => "#FFAA22", httpd => "#99DD99", error => "#EE4C4C"); - $query = array(user => "WHERE type = 'user'", regular => "WHERE type = 'message'", special => "WHERE type = 'special'", warning => "WHERE type = 'warning'", error => "WHERE type = 'error'", httpd => "WHERE type = 'httpd'"); + $color = array("user" => "#FFEEAA", "message" => "#FFFFFF", "special" => "#A49FFF", "warning" => "#FFAA22", "httpd" => "#99DD99", "error" => "#EE4C4C"); + $query = array("user" => "WHERE type = 'user'", "regular" => "WHERE type = 'message'", "special" => "WHERE type = 'special'", "warning" => "WHERE type = 'warning'", "error" => "WHERE type = 'error'", "httpd" => "WHERE type = 'httpd'", "actions" => "WHERE link != ''"); $result = pager_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid ". ($type ? $query[$type] : "") ." ORDER BY w.timestamp DESC", 100); $output .= "<table>"; - $output .= " <tr><th>" . t("date") . "</th><th>" . t("message") . "</th><th>" . t("user") . "</th><th>" . t("operations") . "</th></tr>"; + $output .= " <tr><th>" . t("date") . "</th><th>" . t("event") . "</th><th>" . t("user") . "</th><th colspan=\"2\">" . t("operations") . "</th></tr>"; while ($watchdog = db_fetch_object($result)) { if ($background = $color[$watchdog->type]) { - $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">". la(t("details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid)) ."</td></tr>"; + $output .= " <tr bgcolor=\"$background\"><td nowrap=\"nowrap\">". format_date($watchdog->timestamp, "small") ."</td><td>". substr(strip_tags($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">$watchdog->link</td><td align=\"center\">". la(t("view details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid)) ."</td></tr>"; } } |