Installation.php 829 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Lychee\Access;
  3. use Lychee\Modules\Config;
  4. use Lychee\Modules\Response;
  5. use Lychee\Modules\Validator;
  6. final class Installation extends Access {
  7. public static function init($fn) {
  8. switch ($fn) {
  9. case 'Config::create': self::configCreateAction(); break;
  10. default: self::initAction(); break;
  11. }
  12. self::fnNotFound();
  13. }
  14. private static function configCreateAction() {
  15. Validator::required(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']), __METHOD__);
  16. echo Config::create($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']);
  17. }
  18. private static function initAction() {
  19. $return = array(
  20. 'status' => LYCHEE_STATUS_NOCONFIG
  21. );
  22. Response::json($return);
  23. }
  24. }
  25. ?>