/** * Execute the command. * * @return void */ public function handle() { $lang = $this->getNameArgument(); // $target = new Dir("/storage/app/hidden_langs/" . $lang); if ($target->exists()) { $show_dir = new Dir("/resources/lang/"); $target->moveTo($show_dir); $this->info("Language " . $lang . " reenabled succesfully."); $check_dir_delete_if_empty = new Dir("/storage/app/hidden_langs"); if ($check_dir_delete_if_empty->isEmpty()) { $check_dir_delete_if_empty->delete(); $this->info("Hidden languages storage dir deleted (empty)."); } } else { $this->error("Language " . $lang . " not found."); } }
function testDeleteRecursive() { $d = new Dir("/test/delete_test_dir/"); $this->assertTrue($d->exists(), "La cartella dal eliminare non esiste!!"); $this->assertTrue($d->isEmpty(), "La cartella da popolare non e' vuota!!"); $the_dir = $d->newSubdir("the_dir"); $blabla = $the_dir->newFile("blabla.ini"); $blabla->setContent("[section]\n\nchiave=valore\n\n"); $hidden_test = $the_dir->newSubdir("hidden_test"); $htaccess = $hidden_test->newFile(".htaccess"); $htaccess->setContent("RewriteEngine on\n\n"); $prova = $hidden_test->newFile("prova.txt"); $prova->setContent("Questo e' un file con un testo di prova"); $the_dir->delete(); $this->assertFalse($the_dir->exists(), "La directory non e' stata eliminata!!"); $this->assertTrue($d->isEmpty(), "Il contenuto della cartella non e' stato rimosso completamente!!"); }