예제 #1
0
 public static function removeDir($dir)
 {
     if (!is_dir($dir)) {
         throw new InvalidArgumentException("{$dir} must be a directory");
     }
     if (is_dir($dir)) {
         $objects = scandir($dir);
         foreach ($objects as $object) {
             if ($object != "." && $object != "..") {
                 if (filetype($dir . "/" . $object) == "dir") {
                     EIcmsHelper::removeDir($dir . "/" . $object);
                 } else {
                     unlink($dir . "/" . $object);
                 }
             }
         }
         reset($objects);
         rmdir($dir);
     }
 }
 /**
  * @Route("wp-cleanup", name="_wp-cleanup")
  */
 public function cleanup(Request $request)
 {
     $session = $request->getSession();
     $userDir = $session->get('user_folder');
     $response = new JsonResponse();
     EIcmsHelper::deleteDatabase($session->get('dbName'));
     EIcmsHelper::removeDir(EIconfig::$coreDirectoryPath . $userDir);
     $response->setData(array('action' => 'Cleaning up', 'status' => 'success'));
     return $response;
 }