Base
This commit is contained in:
39
public/install/log_locations.php
Normal file
39
public/install/log_locations.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
include_once dirname(dirname(__DIR__)) . '/bootstrap/autoload.php';
|
||||
|
||||
$controllers = glob(config('locations.controllers') . '/*.php');
|
||||
$cnt = 0;
|
||||
$errors = 0;
|
||||
foreach ($controllers as $controller) {
|
||||
$info = pathinfo($controller);
|
||||
$name = $info['filename'];
|
||||
$controller = '' . Stringy\Stringy::create($name)->underscored();
|
||||
$class = '\\App\\Controller\\' . $name;
|
||||
$ref = new ReflectionClass($class);
|
||||
$methods = $ref->getMethods(ReflectionMethod::IS_STATIC);
|
||||
|
||||
try {
|
||||
foreach ($methods as $method) {
|
||||
$data = [
|
||||
'controller' => $controller,
|
||||
'action' => $method->name
|
||||
];
|
||||
$location = Model::factory(\Incoviba\common\Location::class)->where('controller', $controller)->where('action', $method->name)->findOne();
|
||||
if ($location !== false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$location = Model::factory(\Incoviba\common\Location::class)->create($data);
|
||||
$location->save();
|
||||
$cnt ++;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
d($e);
|
||||
$errors ++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors == 0) {
|
||||
header('Location: next_step.php?step=log_locations');
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user