/**
  * restore video after swapping or keeping it
  * @requestParam string videoTitle
  * @requestParam string newTitle
  * @requestParam integer currentPage
  * @responseParam string result [ok/error]
  * @responseParam string msg - result message
  * @responseParam string html
  * @responseParam integer totalVideos - total videos with suggestions
  * @responseParam string redirect - redirect url
  */
 public function restoreVideo()
 {
     $videoTitle = $this->request->getVal('videoTitle', '');
     $currentPage = $this->getVal('currentPage', 1);
     $sort = 'recent';
     // set default value for response params
     $this->setDefaultParams();
     // validate action
     $response = $this->sendRequest('LicensedVideoSwapSpecial', 'validateAction', array('videoTitle' => $videoTitle));
     $msg = $response->getVal('msg', '');
     if (!empty($msg)) {
         $this->result = 'error';
         $this->msg = $msg;
     }
     $file = WikiaFileHelper::getVideoFileFromTitle($videoTitle, true);
     // check if file exists
     if (empty($file)) {
         $this->result = 'error';
         $this->msg = wfMessage('videohandler-error-video-no-exist')->text();
         return;
     }
     $helper = new LicensedVideoSwapHelper();
     // get the LVS status of this file page
     $articleId = $videoTitle->getArticleID();
     $pageStatusInfo = $helper->getPageStatusInfo($articleId);
     if (empty($pageStatusInfo['status'])) {
         $this->result = 'error';
         $this->msg = wfMessage('lvs-error-invalid-page-status')->text();
         return;
     }
     if ($helper->isStatusSwapExact($pageStatusInfo['status'])) {
         $status = $helper->undeletePage($videoTitle, true);
         if (!$status->isOK()) {
             $this->html = '';
             $this->result = 'error';
             $this->msg = $status->getMessage();
             return;
         }
     } else {
         if ($helper->isStatusSwapNorm($pageStatusInfo['status'])) {
             $newTitle = $this->request->getVal('newTitle', '');
             /** @var WikiPage $article */
             $article = Article::newFromID($videoTitle->getArticleID());
             $redirect = $article->getRedirectTarget();
             if ($article->isRedirect() && !empty($redirect) && $redirect->getDBKey() == $newTitle) {
                 $status = $helper->undeletePage($videoTitle);
                 if (!$status->isOK()) {
                     $this->result = 'error';
                     $this->msg = $status->getMessage();
                     return;
                 }
                 $result = $helper->removeRedirectLink($article);
                 if (!$result->isOK()) {
                     $this->result = 'error';
                     $this->msg = $result->getMessage();
                     return;
                 }
             }
         }
     }
     // clear the LVS status of this file page
     $helper->clearPageStatus($articleId);
     // delete the LVS status info of this file page
     $helper->deletePageStatusInfo($articleId);
     // add log for undo swapping video only
     if (!$helper->isStatusKeep($pageStatusInfo['status'])) {
         $reason = wfMessage('lvs-log-restore', $file->getTitle()->getText())->text();
         $helper->addLog($file->getTitle(), 'licensedvideoswap_restore', $reason);
     }
     // clear cache for total videos
     $helper->invalidateCacheTotalVideos();
     // get video list
     $useMaster = true;
     $videoList = $helper->getRegularVideoList($sort, $currentPage, $useMaster);
     // get total videos with suggestions
     $this->totalVideos = $helper->getUnswappedVideoTotal($useMaster);
     if (empty($videoList)) {
         $this->redirect = $helper->getRedirectUrl($currentPage, $sort);
     } else {
         $this->html = $this->app->renderView('LicensedVideoSwapSpecial', 'row', array('videoList' => $videoList));
         $this->html .= $helper->getPagination($this->totalVideos, $currentPage, $sort);
     }
     $this->result = 'ok';
     $this->msg = wfMessage('lvs-restore-video-success')->text();
 }