Hello!

I went ahead and added a feature I've wanted for a long time which is "output errors to the screen".

I created branch in the project, but can't seem to push code to drupal.org!

Patch Pending.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jon Pugh created an issue. See original summary.

Jon Pugh’s picture

FileSize
0 bytes
Jon Pugh’s picture

FileSize
5.74 KB

Oops!

Jon Pugh’s picture

Posted an actual patch.

This patch also improves hook_node_load() to be more Drupal 7-ish:

function hosting_logs_node_load($nodes, $types) {
-  foreach ($nodes as $node) {
-    if ($node->type == 'site') {
-      if (!(isset($node->logs_enabled) && isset($node->logs_available))) {
-        $result = db_query('SELECT h.logs_enabled, h.logs_available, h.site_nid FROM {hosting_logs} h WHERE h.site_nid = :site_nid',
-          array(':site_nid' => $node->nid)
-        );
-        while ($data = $result->fetchObject()) {
-          $node->logs_enabled = $data->logs_enabled;
-          $node->logs_available = $data->logs_available;
-        }
-      }
-      if (!(isset($node->logs_enabled) && isset($node->logs_available))) {
-        $fields = array(
-          'logs_enabled' => FALSE,
-          'logs_available' => FALSE,
-          'site_nid' => $node->nid,
-        );
-        drupal_write_record('hosting_logs', $fields);
-        $node->logs_enabled = FALSE;
-        $node->logs_available = FALSE;
-      }
-    }
+  // Only operate on sites.
+  if (!in_array('site', $types)) {
+    return;
+  }
+
+  // Load all hosting_logs data where site_nid is in our nodes to load.
+  $result = db_query('SELECT * FROM {hosting_logs} WHERE site_nid IN(:nids)', array(
+    ':nids' => array_keys($nodes)
+  ));
+  foreach ($result as $record) {
+    $nodes[$record->site_nid]->logs_enabled = $record->logs_enabled;
+    $nodes[$record->site_nid]->logs_available = $record->logs_available;
+    $nodes[$record->site_nid]->logs_visible = $record->logs_visible;
   }
 }
helmo’s picture

Status: Needs review » Needs work

*edit* sorry, wrong issue ...

helmo’s picture

Status: Needs work » Needs review

wrong issue.

  • helmo committed a45cb3c on authored by Jon Pugh
    Issue #2657830 by Jon Pugh: Output errors to screen
    

  • helmo committed 723530c on 7.x-3.x
    Issue #2657830: Extra whitespace for readability
    
helmo’s picture

Status: Needs review » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.