示例#1
0
                install_cmd = '/usr/local/pythonz/pythons/'+mybackendversion+'/bin/pip install --user -r requirements.txt'
                terminal_call(install_cmd, 'Installing Python project dependencies','Python project dependencies install complete!','', mydocroot)
                terminal_call('','','If the install failed, run the following command in your shell to proceed with manual installation: <kbd>export PATH="/usr/local/pythonz/pythons/'+mybackendversion+'/bin:$PATH";cd '+mydocroot+';pip install --user -r requirements.txt</kbd>')
                print_success('Python project dependencies install complete!')
            else:
                print_error('PIP command not found!')

        else:
            terminal_call('','','requirements.txt not found for <kbd>PYTHON</kbd> project. Specify project dependencies in: '+mydocroot+'/requirements.txt')
            print_error('requirements.txt not found!')

    elif mybackend == 'PHP':

        if os.path.isfile(mydocroot+'/composer.json'):
            if os.path.isfile('/opt/cpanel/composer/bin/composer'):
                install_cmd = '/usr/local/bin/php -d allow_url_fopen=1 -d detect_unicode=0 /opt/cpanel/composer/bin/composer install'
                terminal_call(install_cmd, 'Installing PHP project dependencies','PHP project dependencies install complete!','', mydocroot)
                terminal_call('','','If the install failed, run the following command in your shell to proceed with manual installation: <kbd>export PATH="$PATH:/opt/cpanel/composer/bin";cd '+mydocroot+';/usr/local/bin/php -d allow_url_fopen=1 -d detect_unicode=0 /opt/cpanel/composer/bin/composer install</kbd>','',mydocroot)
                print_success('PHP project dependencies install complete!')
            else:
                print_error('Composer command not found!')

        else:
            terminal_call('','','composer.json not found for <kbd>PHP</kbd> project. Specify project dependencies in: '+mydocroot+'/composer.json')
            print_error('composer.json not found!')

else:
    print_forbidden()

print_simple_footer()
示例#2
0
form = cgi.FieldStorage()

print_simple_header()

if form.getvalue('domain') and form.getvalue('thesubdir'):
    # Get the domain name from form data
    mydomain = form.getvalue('domain')
    thesubdir = form.getvalue('thesubdir')
    profileyaml = installation_path + "/domain-data/" + mydomain
    if os.path.isfile(profileyaml):
        # Get all config settings from the domains domain-data config file
        with open(profileyaml, 'r') as profileyaml_data_stream:
            yaml_parsed_profileyaml = yaml.safe_load(profileyaml_data_stream)
        subdir_apps_dict = yaml_parsed_profileyaml.get('subdir_apps')
        if thesubdir in subdir_apps_dict.keys():
            del subdir_apps_dict[thesubdir]
        else:
            commoninclude.print_error('The SubDir is not configured')
        yaml_parsed_profileyaml['subdir_apps'] = subdir_apps_dict
        with open(profileyaml, 'w') as yaml_file:
            yaml.dump(yaml_parsed_profileyaml,
                      yaml_file,
                      default_flow_style=False)
        commoninclude.print_success('Successfully removed sub-directory')
    else:
        commoninclude.print_error('domain-data file i/o error')
else:
    commoninclude.print_forbidden()

print_simple_footer()