/**
 * Returns package names available for the file location
 * 
 * If the file is inside plugin directory only frankenstyle name for this plugin is returned
 * Otherwise returns list of available core packages
 *
 * @param local_moodlecheck_file $file
 * @return array
 */
function local_moodlecheck_package_names(local_moodlecheck_file $file)
{
    // Check if $file is inside any plugin directory
    foreach (local_moodlecheck_get_plugins() as $pluginfullname => $dir) {
        if ($file->is_in_dir($dir)) {
            return array($pluginfullname);
        }
    }
    // If not return list of core packages
    static $corepackages = array();
    if (empty($corepackages)) {
        $coresubsystems = get_core_subsystems();
        foreach ($coresubsystems as $key => $val) {
            $corepackages[] = 'core_' . $key;
        }
    }
    return $corepackages;
}