\!/ KyuuKazami \!/

Path : /scripts/
Upload :
Current File : //scripts/clear_cpaddon_ui_caches

#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - scripts/rebuild_available_rpm_addons_cache Copyright 2017 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;

use Whostmgr::Cpaddon::RPMSupport               ();
use Whostmgr::Cpaddon::RPMAddonCacheFileManager ();

exit run(@ARGV) unless caller;

sub run {
    my @args = @_;
    @args = grep { !/--verbose/ } @args;    # compatibility with deleted clear_cpaddon_ui_caches script
    _die_usage() if @args;

    my $available_rpms = Whostmgr::Cpaddon::RPMSupport::get_available_addons();

    Whostmgr::Cpaddon::RPMAddonCacheFileManager->save($available_rpms);

    return 0;
}

sub _die_usage {
    die <<EOU;
usage: $0

Rebuild the available RPM-based cPAddons cache at /var/cpanel/available_rpm_addons.cache
EOU
}

@KyuuKazami