Fix LIVEAPI error: initialize Cpanel::LiveAPI in .live.cgi files

cPanel's live engine requires .live.cgi files to create a
Cpanel::LiveAPI connection. Without it, the engine cannot
establish communication with the CGI subprocess.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shuki
2026-03-05 01:59:53 +02:00
parent 065f83d691
commit af46c76e62
2 changed files with 7 additions and 0 deletions

View File

@@ -14,9 +14,11 @@ BEGIN {
unshift @INC, "$base/lib"; unshift @INC, "$base/lib";
} }
use Cpanel::LiveAPI ();
use Cpanel::AdminBin::Call (); use Cpanel::AdminBin::Call ();
use GnizaCPanel::UI; use GnizaCPanel::UI;
my $cpanel = Cpanel::LiveAPI->new();
print "Content-Type: text/html\r\n\r\n"; print "Content-Type: text/html\r\n\r\n";
# Get allowed remotes via AdminBin # Get allowed remotes via AdminBin
@@ -28,6 +30,7 @@ print GnizaCPanel::UI::page_header('gniza Restore');
if (!@remotes) { if (!@remotes) {
print qq{<div class="alert alert-info mb-4">No backup remotes are available for restore. Please contact your server administrator.</div>\n}; print qq{<div class="alert alert-info mb-4">No backup remotes are available for restore. Please contact your server administrator.</div>\n};
print GnizaCPanel::UI::page_footer(); print GnizaCPanel::UI::page_footer();
$cpanel->end();
exit; exit;
} }
@@ -103,3 +106,4 @@ for my $cat (@categories) {
print qq{</div>\n}; print qq{</div>\n};
print GnizaCPanel::UI::page_footer(); print GnizaCPanel::UI::page_footer();
$cpanel->end();

View File

@@ -14,10 +14,13 @@ BEGIN {
unshift @INC, "$base/lib"; unshift @INC, "$base/lib";
} }
use Cpanel::LiveAPI ();
use Cpanel::AdminBin::Call (); use Cpanel::AdminBin::Call ();
use Cpanel::Form (); use Cpanel::Form ();
use GnizaCPanel::UI; use GnizaCPanel::UI;
my $cpanel = Cpanel::LiveAPI->new();
END { $cpanel->end() if $cpanel }
my $form = Cpanel::Form::parseform(); my $form = Cpanel::Form::parseform();
my $method = $ENV{'REQUEST_METHOD'} // 'GET'; my $method = $ENV{'REQUEST_METHOD'} // 'GET';
my $step = $form->{'step'} // '1'; my $step = $form->{'step'} // '1';