public static function doRestore($params) { $config = $params->get('config'); $clean = $params->get('clean'); try { $return = Configuration::doRestore($data, $clean); } catch (Exception $e) { throw new RpcException($e->getMessage(), -31001); } return $return; }
private function restore($file, $clean) { $jobs = @file_get_contents($file); if ($jobs === false) { throw new ShellException("Unable to read source file"); } $decoded = @json_decode($jobs, true); if ($decoded === false) { throw new ShellException("Invalid source file"); } $data = base64_encode(serialize($decoded)); try { $count = SourceConfiguration::doRestore($data, $clean); } catch (DatabaseException $de) { throw $de; } catch (ShellException $se) { throw $se; } return $count . " job(s) imported" . ($clean ? ", database cleaned." : "."); }