All pastes #1419788 Raw Edit

Someone

public php v1 · immutable
#1419788 ·published 2009-05-11 22:08 UTC
rendered paste body
<?php   function rchmod($parent, $dmod, $fmod) {         if (is_dir($parent)) {                 $old = umask(0000);                 chmod($parent, $dmod);                 umask($old);                 if ($handle = opendir($parent)) {                         while (($file = readdir($handle)) !== false) {                           if ($file === "." or $file === "..") {                                         continue;                                 } elseif (is_dir($parent . '/' . $file)) {                     rchmod($parent . '/' . $file, $dmod, $fmod);                                 } else {                                         $old = umask(0000);                                         chmod($parent . '/' . $file, $fmod);                                     umask($old);                                 }                         }                         closedir($handle);            }         } else {                 $old = umask(0000);                 chmod($parent, $fmod);                 umask($old);         }    }    function delete_directory($dirname) {        if (is_dir($dirname))            $dir_handle = opendir($dirname);        if (!$dir_handle)            return false;        while($file = readdir($dir_handle)) {            if ($file != "." && $file != "..") {                if (!is_dir($dirname."/".$file))                    unlink($dirname."/".$file);                else                    delete_directory($dirname.'/'.$file);                      }        }        closedir($dir_handle);        rmdir($dirname);        return true;    }    rchmod("drupal-6.10", 0777, 0666);    delete_directory("drupal-6.10");?>