예제 #1
0
<?php

/**
 * Create table
 * @param string $model 
 * @param boolean $drop 
 */
$model_list = [];
if (empty($model)) {
    foreach (\ebi\Dt::classes(\ebi\Dao::class) as $class_info) {
        $model_list[] = \ebi\Util::get_class_name($class_info['class']);
    }
} else {
    $model_list[] = \ebi\Util::get_class_name($model);
}
foreach ($model_list as $m) {
    if ($drop === true) {
        call_user_func([$m, 'drop_table']);
        \cmdman\Std::println('dropped ' . $m);
    }
    call_user_func([$m, 'create_table']);
    \cmdman\Std::println('created ' . $m);
}
예제 #2
0
파일: check.php 프로젝트: tokushima/ebi
    } catch (\ebi\exception\ConnectionException $e) {
        $failure['db']++;
        \cmdman\Std::println_danger(' ' . $class_name . ' Failure, ' . $e->getMessage());
    } catch (\Exception $e) {
        $failure['db']++;
        \cmdman\Std::println_warning(' ' . $class_name . ' Failure, ' . $e->getMessage());
    }
}
\cmdman\Std::println();
\cmdman\Std::println_info('Entry:');
foreach (\ebi\Util::ls(getcwd()) as $f) {
    $src = file_get_contents($f->getPathname());
    if (strpos($src, '\\ebi\\Flow::app(') !== false) {
        $map = \ebi\Flow::get_map($f->getPathname());
        $entry = str_replace(getcwd(), '', $f->getPathname());
        foreach ($map['patterns'] as $p) {
            if (array_key_exists('action', $p) && is_string($p['action'])) {
                try {
                    list($c, $m) = explode('::', $p['action']);
                    $mr = new \ReflectionMethod(\ebi\Util::get_class_name($c), $m);
                    \cmdman\Std::println_success($entry . ' ' . $p['name'] . ' OK');
                } catch (\ReflectionException $e) {
                    $failure['entry']++;
                    \cmdman\Std::println_danger($entry . ' ' . $p['name'] . ' Failure');
                }
            }
        }
    }
}
\cmdman\Std::println();
\cmdman\Std::println_danger('Failure: ' . (!empty($failure['db']) ? 'Database(' . $failure['db'] . ') ' : '') . (!empty($failure['entry']) ? 'Entry(' . $failure['entry'] . ') ' : ''));