$historyAdditionalData[] = array('uniqueName' => 'backupTest', 'detailedAction' => 'Backup Test'); foreach ($siteIDs as $siteID) { $siteData = getSiteData($siteID); $PRP = array(); $PRP['requestAction'] = $requestAction; $PRP['siteData'] = $siteData; $PRP['type'] = $type; $PRP['action'] = $action; $PRP['events'] = $events; $PRP['historyAdditionalData'] = $historyAdditionalData; $PRP['doNotExecute'] = false; $PRP['directExecute'] = true; $PRP['doNotShowUser'] = true; prepareRequestAndAddHistory($PRP); } } public static function backupTestResponseProcessor($historyID, $responseData) { responseDirectErrorHandler($historyID, $responseData); if (!empty($responseData['success']['error'])) { DB::update("?:history_additional_data", array('status' => 'error', 'errorMsg' => $responseData['error_data']), "historyID='" . $historyID . "'"); } elseif (!empty($responseData['success'])) { $historyData = DB::getRow("?:history", "type, actionID, siteID", "historyID='" . $historyID . "'"); $siteID = $historyData['siteID']; DB::update("?:sites", array('siteTechinicalInfo' => serialize($responseData['success']), 'infoLastUpdate' => date("Y-m-d H:i:s")), "siteID='" . $siteID . "'"); DB::update("?:history_additional_data", array('status' => 'success'), "historyID='" . $historyID . "'"); } } } manageClients::addClass('manageClientsSites');
if (!empty($responseData['success']['error'])) { DB::update("?:history_additional_data", array('status' => 'error', 'errorMsg' => $responseData['success']['error'], 'error' => $responseData['success']['error_code']), "historyID='" . $historyID . "'"); return false; } $type = DB::getField("?:history", "type", "historyID='" . $historyID . "'"); $siteID = DB::getField("?:history", "siteID", "historyID='" . $historyID . "'"); $successUniqueName = array(); $pluginsThemes = $responseData['success'][$type]; if (!empty($pluginsThemes)) { foreach ($pluginsThemes as $name => $status) { if ($status == 'OK') { $successUniqueName[] = $name; } else { if (!empty($status['error'])) { if ($status['error'] == 'The plugin generated unexpected output.') { //This was replicated from wordpress 3.8.3 $successUniqueName[] = $name; } else { DB::update("?:history_additional_data", array('status' => 'error', 'errorMsg' => $status['error'], 'error' => $status['error_code']), "historyID='" . $historyID . "' AND uniqueName = '" . $name . "'"); } } } } DB::update("?:history_additional_data", array('status' => 'success'), "historyID='" . $historyID . "' AND uniqueName IN ('" . implode("', '", $successUniqueName) . "')"); } $allParams = array('action' => 'getStats', 'args' => array('siteIDs' => array($siteID), 'extras' => array('sendAfterAllLoad' => false, 'doNotShowUser' => true))); panelRequestManager::handler($allParams); } } manageClients::addClass('manageClientsPluginsThemes');
$requestAction = 'get_cookie'; $requestParams = array(); $historyAdditionalData[] = array('uniqueName' => 'getCookie', 'detailedAction' => 'get'); $PRP = array(); $PRP['requestAction'] = $requestAction; $PRP['requestParams'] = $requestParams; $PRP['siteData'] = $siteData; $PRP['type'] = $type; $PRP['action'] = $action; $PRP['events'] = 1; $PRP['historyAdditionalData'] = $historyAdditionalData; $PRP['doNotExecute'] = false; $PRP['directExecute'] = true; $PRP['sendAfterAllLoad'] = false; $PRP['exitOnComplete'] = false; $PRP['doNotShowUser'] = true; $historyID = prepareRequestAndAddHistory($PRP); return $historyID; } public static function getCookieResponseProcessor($historyID, $responseData) { responseDirectErrorHandler($historyID, $responseData); if (!empty($responseData) && is_array($responseData) && $responseData['success'] === true) { DB::update("?:history_additional_data", array('status' => 'success'), "historyID='" . $historyID . "' AND uniqueName = 'getCookie'"); } else { DB::update("?:history_additional_data", array('status' => 'error', 'errorMsg' => 'An Unknown error occurred.', 'error' => 'unknown_error_while_getcookie'), "historyID='" . $historyID . "' AND uniqueName = 'getCookie'"); } } } manageClients::addClass('manageClientsFetch');
// 'select' => 'historyID', // 'where' => "parentHistoryID = ".$params['resultID']." AND status IN('completed', 'error', 'netError') ORDER BY ID DESC LIMIT 1"); // /*'where' => "type IN('backup', 'scheduleBackup') AND action IN('multiCallNow, 'now', 'multiCallRunTask', 'runTask') AND status IN('success', 'error', 'netError')");*/ // //'where' => "status NOT IN('multiCallWaiting')"); // $PRP['runCondition'] = serialize($runCondition); // $PRP['status'] = 'scheduled'; // } prepareRequestAndAddHistory($PRP); } } public static function removeBackupResponseProcessor($historyID, $responseData) { responseDirectErrorHandler($historyID, $responseData); if (empty($responseData['success'])) { return false; } if (!empty($responseData['success']['error'])) { DB::update("?:history_additional_data", array('status' => 'error', 'errorMsg' => $responseData['success']['error'], 'error' => $responseData['success']['error_code']), "historyID='" . $historyID . "'"); return; } if (!empty($responseData['success'])) { DB::update("?:history_additional_data", array('status' => 'success'), "historyID='" . $historyID . "'"); } //---------------------------post process------------------------> $siteID = DB::getField("?:history", "siteID", "historyID='" . $historyID . "'"); $allParams = array('action' => 'getStats', 'args' => array('siteIDs' => array($siteID), 'extras' => array('sendAfterAllLoad' => false, 'doNotShowUser' => true))); panelRequestManager::handler($allParams); } } manageClients::addClass('manageClientsBackup');
$PRP['requestParams'] = $requestParams; $PRP['siteData'] = $siteData; $PRP['type'] = $type; $PRP['action'] = $action; $PRP['events'] = $events; $PRP['historyAdditionalData'] = $historyAdditionalData; $PRP['sendAfterAllLoad'] = true; prepareRequestAndAddHistory($PRP); } } } public static function updateClientResponseProcessor($historyID, $responseData) { responseDirectErrorHandler($historyID, $responseData); if (empty($responseData['success'])) { return false; } foreach ($responseData['success'] as $key => $value) { DB::update("?:history_additional_data", array('status' => $key, 'errorMsg' => $value), "historyID='" . $historyID . "' AND uniqueName = 'clientPlugin'"); if ($key == 'success') { //---------------------------callback process------------------------> $siteID = DB::getField("?:history", "siteID", "historyID='" . $historyID . "'"); // 'directExecute'=>true for client plugin update notification $allParams = array('action' => 'getStats', 'args' => array('siteIDs' => array($siteID), 'extras' => array('sendAfterAllLoad' => false, 'directExecute' => true, 'doNotShowUser' => true))); panelRequestManager::handler($allParams); } } } } manageClients::addClass('manageClientsUpdate');