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 . "'");
     }
 }
 public static function managePluginsThemesResponseProcessor($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 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);
 }
 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'");
     }
 }
 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);
 }
 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);
         }
     }
 }