$filedata = array();
                }
                foreach ($harvest as $key => $values) {
                    if ($values['required'] == true) {
                        mkdir($buildpath = $path . DIRECTORY_SEPARATOR . $values['session'], 0777, true);
                        foreach ($values['modmap'] as $key => $file) {
                            mkdir($buildpath . DIRECTORY_SEPARATOR . $file['path'], 0777, true);
                            copyfile($GLOBALS['xoops']->path($file['path'] . DIRECTORY_SEPARATOR . $file['file']), $buildpath . DIRECTORY_SEPARATOR . $file['path'] . DIRECTORY_SEPARATOR . $file['file']);
                        }
                        foreach ($values['libmap'] as $key => $file) {
                            mkdir($buildpath . DIRECTORY_SEPARATOR . 'xoops_lib' . DIRECTORY_SEPARATOR . $file['path'], 0777, true);
                            copyfile(XOOPS_PATH . $file['path'] . DIRECTORY_SEPARATOR . $file['file'], $buildpath . DIRECTORY_SEPARATOR . 'xoops_lib' . DIRECTORY_SEPARATOR . $file['path'] . DIRECTORY_SEPARATOR . $file['file']);
                        }
                        $filedata[$values['session']] = array('harvest' => $values, 'peer' => $peers['harvest'][$key]);
                    }
                }
                if (!empty($filedata)) {
                    writeRawFile($ffile, json_encode($filedata));
                } else {
                    unlink($ffile);
                }
            } else {
                XoopsCache::write(basename(dirname(dirname(__DIR__))) . '.module' . $module . '.old', $modmap, 3600 * 24 * 31 * 4);
                if ($libmap = XoopsCache::read(basename(dirname(dirname(__DIR__))) . '.xoopslib' . $module . '.delays')) {
                    XoopsCache::write(basename(dirname(dirname(__DIR__))) . '.xoopslib' . $module . '.old', $libmap, 3600 * 24 * 31 * 4);
                }
            }
        }
    }
}
return true;
 /**
  * Makes a folder and secures the folder with .htaccess
  *
  * @param string $path		folder path
  * @param string $perm		folder permissions
  * @param boolean $secure	secure the folder
  * @return boolean
  * @access public
  */
 function mkdirSecure($path = '', $perm = 0777, $secure = true)
 {
     if (!is_dir($path)) {
         mkdir($path, $perm, true);
     }
     if ($secure == true && !file_exists($path . DIRECTORY_SEPARATOR . '.htaccess')) {
         writeRawFile($path . DIRECTORY_SEPARATOR . '.htaccess', "<Files ~ \"^.*\$\">\n\tdeny from all\n</Files>");
     }
     return true;
 }