function moveTestFiles() { if (!$this->conf['TEST_BASE_PATH'] || $this->conf['TEST_BASE_PATH'] == $this->conf['TEST_PHP_SRCDIR']) { return; } $this->writemsg("moving files from {$this->conf['TEST_PHP_SRCDIR']} to {$this->conf['TEST_BASE_PATH']}\n"); $l = strlen($this->conf['TEST_PHP_SRCDIR']); $files = array(); $dirs = array(); foreach ($this->test_files as $file) { if (strpos($file, $this->conf['TEST_PHP_SRCDIR']) == 0) { $newlocation = $this->conf['TEST_BASE_PATH'] . substr($file, $l); $files[] = $newlocation; $dirs[dirname($file)] = dirname($newlocation); } else { // XXX what to do with test files outside the // php source directory? Need to map them into // the new directory somehow. } } foreach ($dirs as $src => $new) { mkpath($new); copyfiles($src, $new); } $this->test_files = $files; }
function copysubdir($srcdir, $destdir) { $dir = opendir($srcdir); while ($file = readdir($dir)) { if (!($file != ".") && !($file != "..")) { $dircontent = $srcdir . "/" . $file; if (is_dir($dircontent)) { if (!file_exists($destdir . "/" . $file)) { createFolder($destdir . "/" . $file); } copyfiles($dircontent, $destdir . "/" . $file); } } } closedir($_dirrun); }