2021-04-24 05:54:56 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class InitAPI
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function handleInitTasks($task, $request)
|
|
|
|
{
|
2021-06-25 23:53:37 +02:00
|
|
|
//check if a site config already exists. if it does, deny set up request
|
|
|
|
//restore to previous version of site while a config exists is only accessible
|
|
|
|
//through settings.
|
|
|
|
|
|
|
|
if (Setup::status()) {
|
|
|
|
$result = ["type" => "blogInitFail", "message" => "Site already set up"];
|
|
|
|
} else {
|
|
|
|
switch ($task) {
|
|
|
|
case "init":
|
|
|
|
$result = Setup::init($request);
|
|
|
|
break;
|
|
|
|
case "restore":
|
|
|
|
$result = Setup::restore($request);
|
|
|
|
break;
|
|
|
|
}
|
2021-04-24 05:54:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|