00001 <?php
00030 class ControllerDestroyer implements DestroyerInterface
00031 {
00040 public static function execute($name, $params)
00041 {
00042 $path = APP_PATH . 'controllers/';
00043 if(isset($params['module']) && $params['module']) {
00044 $path .= "{$params['module']}/";
00045 }
00046
00047 $controller = Util::camelcase($name);
00048 $scontroller = Util::smallcase($name);
00052 $file = $path . "{$scontroller}_controller.php";
00053
00054 echo "\r\n-- Eliminando controller: $controller\r\n$file\r\n";
00055
00056 if(!unlink($file)) {
00057 throw new KumbiaException("No se ha logrado eliminar el archivo $file");
00058 }
00059
00060 $path = APP_PATH . 'views/';
00061 if(isset($params['module']) && $params['module']) {
00062 $path .= "{$params['module']}/";
00063 }
00064 $path .= Util::smallcase($name) . '/';
00065
00066 echo "\r\n-- Eliminando directorio:\r\n$path\r\n";
00067
00068 if(!Util::removeDir($path)) {
00069 throw new KumbiaException("No se ha logrado eliminar el directorio $path");
00070 }
00071
00072 return true;
00073 }
00074 }