lychee/php/Access/Installation.php

46 lines
834 B
PHP
Raw Normal View History

2014-04-30 09:10:31 +00:00
<?php
namespace Lychee\Access;
2014-04-30 09:10:31 +00:00
use Lychee\Modules\Config;
2016-02-07 13:32:46 +00:00
use Lychee\Modules\Response;
use Lychee\Modules\Validator;
2014-04-30 09:10:31 +00:00
final class Installation extends Access {
2014-04-30 09:10:31 +00:00
public static function init($fn) {
2014-04-30 09:10:31 +00:00
switch ($fn) {
case 'Config::create': self::configCreateAction(); break;
2014-04-30 09:10:31 +00:00
// Error
default: self::initAction(); break;
2014-04-30 09:10:31 +00:00
}
return true;
}
private static function configCreateAction() {
2016-01-30 23:56:16 +00:00
Validator::required(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']), __METHOD__);
2014-04-30 09:10:31 +00:00
echo Config::create($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']);
2014-04-30 09:10:31 +00:00
}
private static function initAction() {
2015-03-06 22:29:55 +00:00
$return = array(
'status' => LYCHEE_STATUS_NOCONFIG
);
2016-02-07 13:32:46 +00:00
Response::json($return);
2015-03-06 22:29:55 +00:00
}
2014-04-30 09:10:31 +00:00
}
?>