Closed (fixed)
Project:
Hostmaster (Aegir)
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2013 at 20:37 UTC
Updated:
7 Feb 2013 at 22:56 UTC
I don't know is a new problem or not. I couldn't find in issues.
The problem is:
With the last code of 6-1.x-dev I try access to node/add/site but I get this error:
PHP Fatal error: Call to a member function has_port() on a non-object in /var/aegir/hostmaster-6.x-1.9/profiles/hostmaster/modules/hosting/site/hosting_site.module on line 160
The code of the problem is this:
function _hosting_site_url($node) {
$schema = 'http';
$port = null;
$url = strtolower(trim($node->title));
$platform = node_load($node->platform);
$server = node_load($platform->web_server);
if ($server->services['http']->has_port()) {
$port = $server->services['http']->port;
if ($port == 80) {
$port = null;
}
}
If is a new node $node->platform is empty and then $server is null instead object. I think that is need add the next condition:
if ($server && $server->services['http']->has_port()) {
Comments
Comment #1
anarcat commentedWe could add such a check, it would be a good idea. But then what do we do with it? it wouldn't resolve your issue, which is that your database seems to be inconsistent... Normally, each site node has a platform associated to it, and everything falls into place from there. Why would this function be called before the site is properly formed is beyond me. I see only two instances of this being called in core:
http://api.aegirproject.org/api/Hostmaster/modules--hosting--site--hosti...
Both of which should apply only after the node was created. How did you manage to generate this error?
Comment #2
fastangel commentedYes I had problem with database inconsistent.
Comment #3
anarcat commented