bulletproftlink shell
bulletproftlink shell


Server : Apache
System : Linux copper.netcy.com 2.6.32-754.27.1.el6.centos.plus.x86_64 #1 SMP Thu Jan 30 13:54:25 UTC 2020 x86_64
User : montcaro ( 581)
PHP Version : 7.4.28
Disable Function : NONE
Directory :  /scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 


Create directory:
Current File : //scripts/convert_metadata_names
#!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/convert_metadata_names            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

package scripts::convert_metadata_names;

use strict;
use warnings;
use File::Glob;
use Cpanel::Backup::Config  ();
use Cpanel::FileUtils::Path ();

# Most of this taken directly from scripts/backups_create_metadata

# get all backup dirs under the main backup
my %backup_dirs_hash;
my $bu_dirs_ar = Cpanel::Backup::Config::get_backup_dirs();
foreach my $budir ( @{$bu_dirs_ar} ) {
    foreach my $dir (
        File::Glob::bsd_glob( $budir . "/2*/accounts" ),
        File::Glob::bsd_glob( $budir . "/monthly/2*/accounts" ),
        File::Glob::bsd_glob( $budir . "/weekly/2*/accounts" ),
        File::Glob::bsd_glob( $budir . "/incremental/accounts" )
    ) {

        my ( $xdir, $accounts ) = Cpanel::FileUtils::Path::dir_and_file_from_path($dir);
        $backup_dirs_hash{$xdir} = 1;
    }
}

foreach my $dir ( sort keys %backup_dirs_hash ) {
    my @metadata_files = File::Glob::bsd_glob( $dir . "/accounts/*.meta" );
    foreach my $metadata_file (@metadata_files) {
        if ( -d $metadata_file ) {
            print "Not converting user directory with collision prone name: $metadata_file\n";
        }
        elsif ( -f $metadata_file ) {
            my $new_file = $metadata_file;
            $new_file =~ s/\.meta$/\-\=\-meta/;
            if ( -f $new_file ) {
                print "New format metadata file already exists, removing old format one to avoid leaving cruft behind\n";
                unlink $metadata_file;
            }
            else {
                print "Converting $metadata_file to $new_file\n";
                rename( $metadata_file, $new_file );
            }
        }
    }

}

1;

Spamworldpro BIBIL Mini