Summary: The NameSilo module doesn't implement bulkCheckAvailability(), so Blesta falls back to calling checkAvailability() individually per TLD in a rapid loop. Searching with 5 TLDs = 5 separate API calls with no delay. NameSilo's API rate-limits this and returns "Misuse of API" on most requests.
Root Cause: order_type_domain.php checks for bulkCheckAvailability() on the module (line ~479). Since it doesn't exist on the NameSilo module, it falls back to a per-domain loop (line ~509-522), firing rapid sequential calls to checkRegisterAvailability.
Fix: Add a bulkCheckAvailability() method that sends all domains comma-separated in a single API call. NameSilo's checkRegisterAvailability endpoint natively supports this (?domains=example.com,example.net,example.org). Their own WHMCS module already does it this way.
Affected file: components/modules/namesilo/namesilo.php — missing bulkCheckAvailability() method.
Affected Version: NameSilo (ver 3.5.1)
Blesta Version: 5.13.5 & PHP: 8.3
Patch instructions for quick solutions:
File: components/modules/namesilo/namesilo.php
Find this function (~line 3237):
public function checkAvailability($domain, $module_row_id = null)
{
$row = $this->getModuleRow($module_row_id);
$api = $this->getApi($row->meta->user, $row->meta->key, $row->meta->sandbox == 'true');
$domains = new NamesiloDomains($api);
$result = $domains->check(['domains' => $domain]);
$this->processResponse($api, $result);
if ((self::$codes[$result->status()][1] ?? 'fail') == 'fail') {
return false;
}
$responseXML = $result->responseXML();
$xpath_result = $responseXML->xpath("//available/domain[text()='" . $domain . "']");
if (empty($xpath_result)) {
// The domain was not in the available element, its not available.
return false;
}
$attributes = $xpath_result[0]->attributes();
if (isset($attributes->premium) && $attributes->premium == "1") {
$this->Input->setErrors(
['availability' => ['premium' => Language::_('Namesilo.!error.premium_domain', true, $domain)]]
);
return false;
}
return true;
}
Replace with:
public function checkAvailability($domain, $module_row_id = null)
{
$result = $this->bulkCheckAvailability([$domain], $module_row_id);
return $result[$domain] ?? false;
}
/**
-
Checks the availability of multiple domain names at once using a single API call.
-
Fixes "Misuse of API" error caused by rapid sequential calls per TLD.
-
@param array $domains A list of domain names to check
-
@param int $module_row_id The ID of the module row to fetch for the current module
-
@return array An associative array of domain => boolean (true if available)
*/
public function bulkCheckAvailability($domains, $module_row_id = null)
{
$row = $this->getModuleRow($module_row_id);
$api = $this->getApi($row->meta->user, $row->meta->key, $row->meta->sandbox == 'true');
$availability = array_fill_keys($domains, false);
// NameSilo API accepts comma-separated domains in a single call
$domainList = implode(',', $domains);
$domainsApi = new NamesiloDomains($api);
$result = $domainsApi->check(['domains' => $domainList]);
$this->processResponse($api, $result);
if ((self::$codes[$result->status()][1] ?? 'fail') == 'fail') {
return $availability;
}
$responseXML = $result->responseXML();
foreach ($domains as $domain) {
$xpath_result = $responseXML->xpath("//available/domain[text()='" . $domain . "']");
if (empty($xpath_result)) {
continue;
}
$attributes = $xpath_result[0]->attributes();
if (isset($attributes->premium) && $attributes->premium == "1") {
continue;
}
$availability[$domain] = true;
}
return $availability;
}
What this does: Blesta already looks for bulkCheckAvailability() on registrar modules. Without it, it fires one API call per TLD (5 TLDs = 5 rapid calls = rate limited). This patch sends all domains comma-separated in one API call, matching how NameSilo's own WHMCS module works. No other files need changes.
Summary: The NameSilo module doesn't implement bulkCheckAvailability(), so Blesta falls back to calling checkAvailability() individually per TLD in a rapid loop. Searching with 5 TLDs = 5 separate API calls with no delay. NameSilo's API rate-limits this and returns "Misuse of API" on most requests.
Root Cause: order_type_domain.php checks for bulkCheckAvailability() on the module (line ~479). Since it doesn't exist on the NameSilo module, it falls back to a per-domain loop (line ~509-522), firing rapid sequential calls to checkRegisterAvailability.
Fix: Add a bulkCheckAvailability() method that sends all domains comma-separated in a single API call. NameSilo's checkRegisterAvailability endpoint natively supports this (?domains=example.com,example.net,example.org). Their own WHMCS module already does it this way.
Affected file: components/modules/namesilo/namesilo.php — missing bulkCheckAvailability() method.
Affected Version: NameSilo (ver 3.5.1)
Blesta Version: 5.13.5 & PHP: 8.3
Patch instructions for quick solutions:
File: components/modules/namesilo/namesilo.php
Find this function (~line 3237):
public function checkAvailability($domain, $module_row_id = null)
{
$row = $this->getModuleRow($module_row_id);
$api = $this->getApi($row->meta->user, $row->meta->key, $row->meta->sandbox == 'true');
}
Replace with:
public function checkAvailability($domain, $module_row_id = null)
{
$result = $this->bulkCheckAvailability([$domain], $module_row_id);
}
/**
Checks the availability of multiple domain names at once using a single API call.
Fixes "Misuse of API" error caused by rapid sequential calls per TLD.
@param array $domains A list of domain names to check
@param int $module_row_id The ID of the module row to fetch for the current module
@return array An associative array of domain => boolean (true if available)
*/
public function bulkCheckAvailability($domains, $module_row_id = null)
{
$row = $this->getModuleRow($module_row_id);
$api = $this->getApi($row->meta->user, $row->meta->key, $row->meta->sandbox == 'true');
$availability = array_fill_keys($domains, false);
// NameSilo API accepts comma-separated domains in a single call
$domainList = implode(',', $domains);
$domainsApi = new NamesiloDomains($api);
$result = $domainsApi->check(['domains' => $domainList]);
$this->processResponse($api, $result);
if ((self::$codes[$result->status()][1] ?? 'fail') == 'fail') {
return $availability;
}
$responseXML = $result->responseXML();
foreach ($domains as $domain) {
$xpath_result = $responseXML->xpath("//available/domain[text()='" . $domain . "']");
}
return $availability;
}
What this does: Blesta already looks for bulkCheckAvailability() on registrar modules. Without it, it fires one API call per TLD (5 TLDs = 5 rapid calls = rate limited). This patch sends all domains comma-separated in one API call, matching how NameSilo's own WHMCS module works. No other files need changes.