lychee/php/Access/Installation.php

45 lines
795 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;
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() {
Validator::required(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']));
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
);
echo json_encode($return);
}
2014-04-30 09:10:31 +00:00
}
?>