예제 #1
0
 public static function log($sText)
 {
     SetupPage::log($sText);
 }
 /**
  * Helper to recursively cleanup a directory
  */
 public static function tidydir($dir)
 {
     if (strlen(trim($dir)) == 0 || $dir == '/' || $dir == '\\') {
         throw new Exception("Attempting to delete directory: '{$dir}'");
     }
     $aFiles = scandir($dir);
     // Warning glob('.*') does not seem to return the broken symbolic links, thus leaving a non-empty directory
     if ($aFiles !== false) {
         foreach ($aFiles as $file) {
             if ($file != '.' && $file != '..') {
                 if (is_dir($dir . '/' . $file)) {
                     self::tidydir($dir . '/' . $file);
                     rmdir($dir . '/' . $file);
                 } else {
                     if (!unlink($dir . '/' . $file)) {
                         SetupPage::log("Warning - FAILED to remove file '{$dir}/{$file}'");
                     } else {
                         if (file_exists($dir . '/' . $file)) {
                             SetupPage::log("Warning - FAILED to remove file '{$dir}/.{$file}'");
                         }
                     }
                 }
             }
         }
     }
 }
 protected function LogError($sMsg)
 {
     SetupPage::log('Error - ' . $sMsg);
 }