Edit File by line
/home/barbar84/www/wp-conte.../plugins/worker/src/MWP/Worker
File: Exception.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
* This file is part of the ManageWP Worker plugin.
[2] Fix | Delete
*
[3] Fix | Delete
* (c) ManageWP LLC <contact@managewp.com>
[4] Fix | Delete
*
[5] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[6] Fix | Delete
* file that was distributed with this source code.
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
class MWP_Worker_Exception extends Exception
[10] Fix | Delete
{
[11] Fix | Delete
const CONNECTION_PUBLIC_KEY_EXISTS = 10001;
[12] Fix | Delete
const CONNECTION_PUBLIC_KEY_NOT_FOUND = 10010;
[13] Fix | Delete
const CONNECTION_SIGNATURE_NOT_VALID = 10011;
[14] Fix | Delete
const CONNECTION_SIGNATURE_EMPTY = 10018;
[15] Fix | Delete
const OPENSSL_ENCRYPT_ERROR = 10002;
[16] Fix | Delete
const OPENSSL_DECRYPT_ERROR = 10003;
[17] Fix | Delete
const OPENSSL_VERIFY_ERROR = 10005;
[18] Fix | Delete
const PHPSECLIB_ENCRYPT_ERROR = 10006;
[19] Fix | Delete
const PHPSECLIB_DECRYPT_ERROR = 10007;
[20] Fix | Delete
const PHPSECLIB_VERIFY_ERROR = 10009;
[21] Fix | Delete
const NONCE_FORMAT_INVALID = 10012;
[22] Fix | Delete
const NONCE_EXPIRED = 10013;
[23] Fix | Delete
const NONCE_ALREADY_USED = 10014;
[24] Fix | Delete
const AUTHENTICATION_NO_ADMIN_USER = 10015;
[25] Fix | Delete
const AUTHENTICATION_MESSAGE_ID_EMPTY = 10016;
[26] Fix | Delete
const AUTHENTICATION_PUBLIC_KEY_EMPTY = 10017;
[27] Fix | Delete
const AUTHENTICATION_INVALID_SIGNATURE = 10019;
[28] Fix | Delete
const AUTHENTICATION_INVALID_SERVICE_SIGNATURE = 10040;
[29] Fix | Delete
const ACTION_NOT_REGISTERED = 10020;
[30] Fix | Delete
const CONNECTION_PUBLIC_KEY_NOT_PROVIDED = 10021;
[31] Fix | Delete
const CONNECTION_VERIFICATION_TEST_FAILED = 10022;
[32] Fix | Delete
const PHP_EVAL_ERROR = 10023;
[33] Fix | Delete
const LEGACY_AUTHENTICATION_INVALID_SIGNATURE = 10024;
[34] Fix | Delete
const LEGACY_AUTHENTICATION_KEY_EXISTS = 10025;
[35] Fix | Delete
const AUTO_LOGIN_USERNAME_REQUIRED = 10026;
[36] Fix | Delete
const FILESYSTEM_CREDENTIALS_ERROR = 10027;
[37] Fix | Delete
const SHELL_NOT_AVAILABLE = 10028;
[38] Fix | Delete
const BACKUP_DATABASE_METHOD_NOT_AVAILABLE = 10029;
[39] Fix | Delete
const BACKUP_DATABASE_FAILED = 10030;
[40] Fix | Delete
const BACKUP_DATABASE_MISSING_TABLES = 10031;
[41] Fix | Delete
const IO_EXCEPTION = 10032;
[42] Fix | Delete
const BACKUP_DATABASE_INVALID_OUTPUT_METHOD = 10033;
[43] Fix | Delete
const PHP_EXTENSION_REQUIRED_CURL = 10034;
[44] Fix | Delete
const JSON_RESPONSE_EXCEPTION = 10035;
[45] Fix | Delete
const WORKER_RECOVERING = 10036;
[46] Fix | Delete
const WORKER_UPDATING = 10037;
[47] Fix | Delete
const WORKER_RECOVER_STARTED = 10038;
[48] Fix | Delete
const CONNECTION_INVALID_KEY = 10100;
[49] Fix | Delete
[50] Fix | Delete
const GENERAL_ERROR = 10000;
[51] Fix | Delete
[52] Fix | Delete
static $codes = array();
[53] Fix | Delete
[54] Fix | Delete
protected $errorName;
[55] Fix | Delete
[56] Fix | Delete
protected $context;
[57] Fix | Delete
[58] Fix | Delete
public function __construct($code, $message = null, array $context = array())
[59] Fix | Delete
{
[60] Fix | Delete
$this->errorName = $this->getErrorNameForCode($code);
[61] Fix | Delete
$this->context = $context;
[62] Fix | Delete
[63] Fix | Delete
if ($message === null) {
[64] Fix | Delete
$message = sprintf('Error [%d]: %s', $code, $this->errorName);
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
parent::__construct($message, $code);
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
private function getErrorNameForCode($code)
[71] Fix | Delete
{
[72] Fix | Delete
if (count(self::$codes) === 0) {
[73] Fix | Delete
$reflectionClass = new ReflectionClass(__CLASS__);
[74] Fix | Delete
self::$codes = array_flip($reflectionClass->getConstants());
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
if (array_key_exists($code, self::$codes)) {
[78] Fix | Delete
return self::$codes[$code];
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
return self::GENERAL_ERROR;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* @return string
[86] Fix | Delete
*/
[87] Fix | Delete
public function getErrorName()
[88] Fix | Delete
{
[89] Fix | Delete
return $this->errorName;
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
/**
[93] Fix | Delete
* @return array
[94] Fix | Delete
*/
[95] Fix | Delete
public function getContext()
[96] Fix | Delete
{
[97] Fix | Delete
return $this->context;
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function