/** * Resets the Flexiskin preview to the last saved one defined by id via request parameter * @global String $wgScriptPath * @return String encoded result JSON string */ public function resetFlexiskin() { global $wgScriptPath; $sId = $this->getMain()->getVal('id', ''); if ($sId == "") { return FormatJson::encode(array('success' => false, 'msg' => wfMessage('bs-flexiskin-api-error-missing-param', 'id')->plain())); } $oStatus = BsFileSystemHelper::deleteFile("variables.tmp.less", "flexiskin" . DS . $sId); if (!$oStatus->isGood()) { return FormatJson::encode(array('success' => false, 'msg' => wfMessage("bs-flexiskin-reset-error", $this->getErrorMessage($oStatus))->plain())); } $oStatus = BsFileSystemHelper::deleteFile("conf.tmp.json", "flexiskin" . DS . $sId); if (!$oStatus->isGood()) { return FormatJson::encode(array('success' => false, 'msg' => wfMessage("bs-flexiskin-reset-error", $this->getErrorMessage($oStatus))->plain())); } $oResult = FormatJson::decode($this->getConfig($sId)); if (!$oResult->success) { return FormatJson::encode(array('success' => false, 'msg' => wfMessage("bs-flexiskin-reset-error", $oResult->msg)->plain())); } return FormatJson::encode(array('success' => true, 'src' => $wgScriptPath . "/index.php?flexiskin=" . $sId, 'data' => array('skinId' => $sId, 'config' => $oResult->config))); }