From f8bd8e7ad235ee25a385e0595de95f6e3d8f5d97 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 10 Dec 2018 06:28:35 +0000 Subject: [PATCH] added coderepomodel.php left out at the previous commit --- codepot/src/codepot/models/coderepomodel.php | 54 ++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 codepot/src/codepot/models/coderepomodel.php diff --git a/codepot/src/codepot/models/coderepomodel.php b/codepot/src/codepot/models/coderepomodel.php new file mode 100644 index 00000000..ce6e25d8 --- /dev/null +++ b/codepot/src/codepot/models/coderepomodel.php @@ -0,0 +1,54 @@ +errmsg = $errmsg; + } + + function getErrorMessage () + { + return $this->errmsg; + } + + function clearErrorMessage () + { + return $this->errmsg; + } + + function _scandir ($dir) + { + $files = array (); + + $dh = opendir($dir); + while (false !== ($filename = readdir($dh))) + { + $files[] = $filename; + } + closedir ($dh); + + return $files; + } + + function deleteDirectory($dir) + { + if (is_link($dir)) return @unlink($dir); + if (!file_exists($dir)) return TRUE; + if (!is_dir($dir)) return @unlink($dir); + + foreach ($this->_scandir($dir) as $item) + { + if ($item == '.' || $item == '..') continue; + if ($this->deleteDirectory($dir . "/" . $item) === FALSE) + { + chmod($dir . "/" . $item, 0777); + if ($this->deleteDirectory($dir . "/" . $item) === FALSE) return FALSE; + }; + } + + return rmdir($dir); + } +}