fix: remove dead code, update stale versions, tag-based release workflow
Dead code removed: - Module.php: remove addIPv4() method (no endpoint, feature removed per CLAUDE.md) - Curl.php: remove useCookies(), setLog() (security risk — wrote tokens to web-accessible CURL.log), head(), getHeadersData() — all unused - module.css: remove .vf-button, .vf-button-small (never referenced in DOM) - module.css: remove vestigial #vf-data-server-traffic-sep rule - module.css: merge duplicate #vf-server-info-error declarations - publish-release.yml: remove dead version.json generation step (nothing reads it) Fixes: - AdminHTML.php: update stale cache version strings 20260207 → 20260319 - hooks.php: update stale keygen.js version string - hooks.php: remove unused `use WHMCS\User\User` import - ConfigureService.php: remove unused `use JsonException` import - module.css: fix .vf-os-details class selector → #vf-os-details ID selector - client.php + admin.php: reuse existing $vf instead of new Module() - Module.php: use Cache::forget() instead of forgetPattern() for known key (forgetPattern is a no-op on filesystem cache fallback) Workflow: - Rewrite publish-release.yml: tag-based triggers only (no automatic releases) - Triggers on push of v* tags, creates GitHub release with auto-generated notes - Uses softprops/action-gh-release@v2 — compatible with both Gitea and GitHub Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -35,8 +35,8 @@ EOT;
|
||||
{
|
||||
$systemUrl = htmlspecialchars($systemUrl, ENT_QUOTES, 'UTF-8');
|
||||
return <<<EOT
|
||||
<link href="${systemUrl}modules/servers/VirtFusionDirect/templates/css/module.css?v=20260207" rel="stylesheet">
|
||||
<script src="${systemUrl}modules/servers/VirtFusionDirect/templates/js/module.js?v=20260207"></script>
|
||||
<link href="${systemUrl}modules/servers/VirtFusionDirect/templates/css/module.css?v=20260319" rel="stylesheet">
|
||||
<script src="${systemUrl}modules/servers/VirtFusionDirect/templates/js/module.js?v=20260319"></script>
|
||||
<div id="vf-loader" class="vf-loader">
|
||||
<div id="vf-loading"></div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace WHMCS\Module\Server\VirtFusionDirect;
|
||||
|
||||
use JsonException;
|
||||
use WHMCS\Database\Capsule as DB;
|
||||
use WHMCS\User\User;
|
||||
|
||||
|
||||
@@ -24,23 +24,6 @@ class Curl
|
||||
$this->ch = curl_init();
|
||||
}
|
||||
|
||||
public function useCookies()
|
||||
{
|
||||
$cookiesFile = tempnam(sys_get_temp_dir(), 'virtfusion_cookies');
|
||||
$this->defaultOptions[CURLOPT_COOKIEFILE] = $cookiesFile;
|
||||
$this->defaultOptions[CURLOPT_COOKIEJAR] = $cookiesFile;
|
||||
}
|
||||
|
||||
public function setLog()
|
||||
{
|
||||
$log = fopen(__DIR__ . '/CURL.log', 'a');
|
||||
if ($log) {
|
||||
fwrite($log, str_repeat('=', 80) . PHP_EOL);
|
||||
$this->addOption(CURLOPT_STDERR, $log);
|
||||
$this->addOption(CURLOPT_VERBOSE, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
@@ -166,15 +149,6 @@ class Curl
|
||||
return $this->send('POST', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $url
|
||||
* @return bool|string|void
|
||||
*/
|
||||
public function head($url = null)
|
||||
{
|
||||
return $this->send('HEAD', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param false $param
|
||||
* @return mixed|null
|
||||
@@ -202,16 +176,4 @@ class Curl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param false $param
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getHeadersData($param = false)
|
||||
{
|
||||
if ($param) {
|
||||
return $this->getDataItem('data', $param);
|
||||
}
|
||||
|
||||
return $this->data['data'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ class Module
|
||||
|
||||
$httpCode = $ctx['request']->getRequestInfo('http_code');
|
||||
if ($httpCode == 200 || $httpCode == 201) {
|
||||
Cache::forgetPattern('backups:' . $ctx['serverId']);
|
||||
Cache::forget('backups:' . $ctx['serverId']);
|
||||
return json_decode($data) ?: (object) ['success' => true];
|
||||
}
|
||||
return false;
|
||||
@@ -348,31 +348,6 @@ class Module
|
||||
return false;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// IP Address Management
|
||||
// =========================================================================
|
||||
|
||||
/**
|
||||
* Add an IPv4 address to a server.
|
||||
*
|
||||
* @param int $serviceID
|
||||
* @return object|false
|
||||
*/
|
||||
public function addIPv4($serviceID)
|
||||
{
|
||||
$ctx = $this->resolveServiceContext($serviceID);
|
||||
if (!$ctx) return false;
|
||||
|
||||
$data = $ctx['request']->post($ctx['cp']['url'] . '/servers/' . $ctx['serverId'] . '/ipv4');
|
||||
Log::insert(__FUNCTION__, $ctx['request']->getRequestInfo(), $data);
|
||||
|
||||
$httpCode = $ctx['request']->getRequestInfo('http_code');
|
||||
if ($httpCode == 200 || $httpCode == 201) {
|
||||
return json_decode($data) ?: (object) ['success' => true];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Backup Management
|
||||
// =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user