We run cron via scripts/drupal.sh, so SERVER_NAME doesn't not get set in $_SERVER array. However, $_SERVER['HTTP_HOST'] does get set and can be used instead. Attached patch adds an if to determine which to use.

CommentFileSizeAuthor
#2 content_retriever.patch1.34 KBomerida
content_retriever.patch733 bytesomerida

Comments

joachim’s picture

Status: Active » Needs work

Seems fair enough; just a few style fixes though.

First, could you indent the code you're wrapping with an if {} block please?

Second, Drupal coding standards have 'elseif' rather than 'else if':

+++ content_retriever.module	(working copy)
@@ -586,10 +586,17 @@
+    else if (isset($_SERVER['HTTP_HOST'])) {

Though do we need the 'if' part of that anyway? What if HTTP_HOST isn't set either? If that can't ever happen, the 'if' is redundant; if it can, then we need a final case.

Powered by Dreditor.

omerida’s picture

StatusFileSize
new1.34 KB

Attached is an updated patch with the code style changes. I also added a Warning if the domain can't be determined.

omerida’s picture

Status: Needs work » Needs review

patch attached for review in #2

joachim’s picture

Status: Needs review » Needs work

Will need a reroll now #821700: Configurable API Domain on Retriever Sites has been committed.

Also, watch for whitespace changes and other needless changes in a patch.