/** * Remove the file structure(s) associated with a plugin * * @param string $type plugin name * @return boolean true on success, false on fail * @since glFusion v1.3.0 * */ function PLG_remove($pi_name) { global $_CONF; $p = array(); $p['admin'] = $_CONF['path_html'] . 'admin/plugins/' . $pi_name; $p['public'] = $_CONF['path_html'] . $pi_name; $p['private'] = $_CONF['path'] . 'plugins/' . $pi_name; foreach ($p as $location => $path) { if (is_dir($path)) { COM_errorLog("Removing {$location} files ..."); if (!COM_recursiveDelete($path)) { return false; } } } return true; }
function COM_recursiveDelete($path) { if (is_file($path)) { if ($COM_VERBOSE) { COM_errorLog("COM_recursiveDelete(file): {$path}"); } return @unlink($path); } elseif (is_dir($path)) { $scan = glob(rtrim($path, '/') . '/*'); foreach ($scan as $index => $file) { COM_recursiveDelete($file); } if ($COM_VERBOSE) { COM_errorLog("COM_recursiveDelete(dir): {$path}"); } return @rmdir($path); } }