Fehlerhafte Objekte "IsBroken"

Hallo,

ich nutze immer noch dieses Script, erhalte jetzt aber in IPS 4.0 eine Fehlermeldung.

Undefined index: IsBroken

Muss ich IsBroken ersetzen und wenn ja durch was?

<?php
// -----------------------------------------------------------------------------
// WebFront-freundliche HTML-Ausgabe aller defekten Instanzen, Skripte und Links
// -----------------------------------------------------------------------------

$ContentVariableID = 12345;    // Variablen-ID zur Speicherung der Meldung.
                               // Wert 0 führt zur direkten Ausgabe.

// -----------------------------------------------------------------------------

$content = '';

$instanceStatusCodes = array(
    100 => 'module base status',
    101 => 'module is being created',
    102 => 'module created and running',
    103 => 'module is being deleted',
    104 => 'module is not beeing used',
    200 => 'instance error',
    201 => 'instance could not be created'
);

$errorCount = 0;

$ids = IPS_GetInstanceList();
foreach ($ids as $id)
{
    $instance = IPS_GetInstance($id);
    if ($instance['InstanceStatus'] > 103)
    {
        if ($errorCount == 0)
        {
            $content .= '<b>Defekte Instanzen:</b><br />'."
";
        }
        $errorCount++;
        $content .= '<span style="color: '.($instance['InstanceStatus'] >= 200 ? 'red' : 'grey').';">#'.$id.': '.IPS_GetLocation($id).': '.$instanceStatusCodes[$instance['InstanceStatus']].'</span><br />'."
";
    }
}

if ($errorCount > 0)
{
    $content .= '<br />'."
";
    $errorCount = 0;
}
$ids = IPS_GetScriptList();
foreach ($ids as $id)
{
    $script = IPS_GetScript($id);
    if ($script['IsBroken'])
    {
        if ($errorCount == 0)
        {
            $content .= '<b>Defekte Skripte:</b><br />'."
";
        }
        $errorCount++;
        $content .= '<span style="color: red;">#'.$id.': '.IPS_GetLocation($id).'</span><br />'."
";
    }
}

if ($errorCount > 0)
{
    $content .= '<br />'."
";
    $errorCount = 0;
}
$ids = IPS_GetLinkList();
foreach ($ids as $id)
{
    $link = IPS_GetLink($id);
    if (!IPS_ObjectExists($link['LinkChildID']))
    {
        if ($errorCount == 0)
        {
            $content .= '<b>Defekte Links:</b><br />'."
";
        }
        $errorCount++;
        $content .= '<span style="color: red;">#'.$id.': '.IPS_GetLocation($id).'</span><br />'."
";
    }
}

$printContent = true;

if (IPS_VariableExists((int)$ContentVariableID))
{
    $variable = IPS_GetVariable($ContentVariableID);
    if ($variable['VariableValue']['ValueType'] === 3)
    {
        $printContent = false;
        SetValueString($ContentVariableID, $content);
    }
}

if ($printContent)
{
    echo $content;
}
?>

Steht alles in der Migration zur 4.0 in der Doku :smiley:

Kleinere Änderung bei IPS_GetScript (ScriptIsBroken anstatt IsBroken, ScriptExecuted anstatt LastExecute

Michael

Danke, auch für den Hinweis auf die Doku :o