PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` #!/usr/local/cpanel/3rdparty/bin/perl # cpanel - scripts/fix_pear_registry Copyright 2022 cPanel, L.L.C. # All rights reserved. # copyright@cpanel.net http://cpanel.net # This code is subject to the cPanel license. Unauthorized copying is prohibited use strict; use Cpanel::Imports; use Cpanel::Binaries (); use Cpanel::Pkgr (); use Cpanel::SafeRun::Object (); # This script is intended to clean up after the Horde and other PEAR RPMs that had # a faulty %postun. This has since been fixed, but the script is needed as a one-time # operation to repair the PEAR registry, since the %postun of the old RPM is executed # after the new RPM's %post has already run. This could be handled with a %triggerpostun, # but that would add a new element to the long-term behavior of the RPMs, which is # undesirable for this one-time cleanup measure. exit run(@ARGV) unless caller; sub run { my %report; my $pear_bin = Cpanel::Binaries::CPANEL_PHP_BIN() . '/pear'; # Don't use Cpanel::FindBin for this. It may grab the system pear, which we don't want. my $php_rpm_prefix = 'cpanel-php' . Cpanel::Binaries::get_php_version( flat => 1 ) . '*'; my @installed_pear_packages = keys( %{ Cpanel::Pkgr::installed_packages($php_rpm_prefix) } ); $report{installed} = @installed_pear_packages; for my $pkg ( sort @installed_pear_packages ) { my $xmlfile = Cpanel::Binaries::CPANEL_PHP . '/lib/pear/' . $pkg . '.xml'; if ( -f $xmlfile ) { my $package_is_registered = is_registered($pkg); if ($package_is_registered) { logger->info( locale->maketext( 'The “[_1]” package is already in the [asis,PEAR] registry.', $pkg ) ); $report{already_registered}++; next; } $report{not_already_registered}++; my @pear_args = ( qw(install --nodeps --force --register-only), $xmlfile ); my $run = Cpanel::SafeRun::Object->new( program => $pear_bin, args => \@pear_args, ); if ( $run->CHILD_ERROR || !is_registered($pkg) ) { logger->warn( locale->maketext( 'The system failed to add the [asis,PEAR] registry entry for “[_1]”: [_2]', $pkg, $run->stdout ) ); # pear errors are on stdout, and pear may exit zero without actually doing anything logger->warn("Command: $pear_bin @pear_args"); $report{failed}++; } else { print $run->stdout; logger->info( locale->maketext( 'The system added the [asis,PEAR] registry entry for “[_1]”.', $pkg ) ); $report{succeeded}++; } } else { logger->info( locale->maketext( 'The system could not find the [asis,XML] file for “[_1]”.', $pkg ) ); $report{no_xml}++; } } logger->info( locale->maketext( 'There are [numf,_1] installed [asis,PEAR] packages. Of those packages, [numf,_2] already existed in the [asis,PEAR] registry, [numf,_3] did not, and [numf,_4] did not contain an [asis,XML] file. Of the [quant,_3,package,packages] not listed in the registry, the system successfully added [numf,_5], and failed to add [numf,_6].', map { $_ || 0 } @report{qw(installed already_registered not_already_registered no_xml succeeded failed )} ) ); # We can't count on every single PEAR package to always register successfully, so only exit nonzero if something # very bad like the pear binary being missing occurred. return 0; } sub is_registered { my ($pkg) = @_; my $pear_bin = Cpanel::Binaries::THIRD_PARTY_BIN . '/pear'; return scalar grep { my $channel = $_; my @pear_args = ( qw(list -c horde), "$channel/$pkg" ); my $run = Cpanel::SafeRun::Object->new( program => $pear_bin, args => \@pear_args, ); !$run->CHILD_ERROR; } 'horde', 'pear'; }