/**
  * replacing gallery in wikitext (saving changes)
  * @author Marooned
  */
 public static function saveGalleryData()
 {
     global $wgRequest;
     wfProfileIn(__METHOD__);
     $hash = $wgRequest->getVal('hash');
     $wikitext = $wgRequest->getVal('wikitext');
     $starttime = $wgRequest->getVal('starttime');
     $result = WikiaPhotoGalleryHelper::saveGalleryDataByHash($hash, $wikitext, $starttime);
     wfProfileOut(__METHOD__);
     // return JSON as HTML - decode it JS-side
     return json_encode($result);
 }