Exemplo n.º 1
0
 function delete_demo()
 {
     $db_line = color(str_repeat('=', 80), 'N') . "\n";
     $line = color(str_repeat('-', 80), 'w') . "\n";
     echo $db_line;
     $controllers = array('events', 'tags');
     $results = array_map(function ($name) {
         return implode("\n", array_map(function ($result) {
             $count = 1;
             return color('  Delete: ', 'r') . str_replace(FCPATH, '', $result, $count);
         }, delete_controller($name, 'site')));
     }, $controllers);
     echo implode("\n", $results) . "\n" . $line;
     $cells = array('demo');
     $results = array_map(function ($name) {
         return implode("\n", array_map(function ($result) {
             $count = 1;
             return color('  Delete: ', 'r') . str_replace(FCPATH, '', $result, $count);
         }, delete_cell($name)));
     }, $cells);
     echo implode("\n", $results) . "\n" . $line;
     $models = array('event', 'attendee', 'tag', 'tag_event_map');
     $results = array_map(function ($name) {
         return implode("\n", array_map(function ($result) {
             $count = 1;
             return color('  Delete: ', 'r') . str_replace(FCPATH, '', $result, $count);
         }, delete_model($name)));
     }, $models);
     echo implode("\n", $results) . "\n" . $line;
     echo color('注意! ', 'r');
     echo implode("\n", array('Migration 並沒有刪除,請注意資料庫版本!')) . "\n";
     $results = array();
     array_push($results, "models(" . implode(', ', $models) . ")");
     array_push($results, "cells(" . implode(', ', $cells) . ")");
     array_push($results, "controllers(" . implode(', ', $controllers) . ")");
     return $results;
 }
Exemplo n.º 2
0
// php   delete   controller   controller_name   [site | admin | delay]
// php   delete   model        model_name
// php   delete   cell         cell_name
// php   delete   demo
$file = array_shift($argv);
$type = array_shift($argv);
$name = array_shift($argv);
$action = array_shift($argv);
switch ($type) {
    case 'controller':
        $results = delete_controller($name, $action);
        break;
    case 'model':
        $results = delete_model($name);
        break;
    case 'cell':
        $results = delete_cell($name);
        break;
    case 'demo':
        include 'functions/demo.php';
        $results = delete_demo();
        break;
    default:
        return console_error('指令錯誤!', '只接受 controller、model、cell、demo 三種指令。');
}
$results = array_map(function ($result) {
    $count = 1;
    return color('Delete: ', 'r') . str_replace(FCPATH, '', $result, $count);
}, $results);
array_unshift($results, '刪除成功!');
call_user_func_array('console_log', $results);