Default to 101 as highest CTID when no containers exist yet.

feature/node-rewrite
Sven Slootweg 12 years ago
parent b631d67fbf
commit 62b2b400e2

@ -61,8 +61,8 @@ function first_unused_ctid()
$highest = 101;
/* Collect all known CTIDs and keep track of the highest CTID. */
$result = $database->CachedQuery("SELECT `InternalId` FROM containers WHERE `VirtualizationType` = 1", array(), 0);
if($result = $database->CachedQuery("SELECT `InternalId` FROM containers WHERE `VirtualizationType` = 1", array(), 0))
{
foreach($result->data as $row)
{
$id = filter_var($row['InternalId'] ,FILTER_VALIDATE_INT);
@ -77,6 +77,7 @@ function first_unused_ctid()
}
}
}
}
/* Generate a list of all possible CTIDs between 101 and the highest CTID, and find
* all possible CTIDs that do not exist in the known CTID list. We use array_merge

Loading…
Cancel
Save