Back to InstallerHelper class

Method cleanupInstall

public static bool
cleanupInstall
(mixed $package, mixed $resultdir)
Clean up temporary uploaded package and unpacked extension
Parameters
  • string $package Path to the uploaded package file
  • string $resultdir Path to the unpacked extension
Returns
  • bool True on success
Since
  • 3.1

Method cleanupInstall - Source code

/**
 * Clean up temporary uploaded package and unpacked extension
 *
 * @param   string  $package    Path to the uploaded package file
 * @param   string  $resultdir  Path to the unpacked extension
 *
 * @return  boolean  True on success
 *
 * @since   3.1
 */
public static function cleanupInstall($package, $resultdir)
{
    // Does the unpacked extension directory exist?
    if ($resultdir && is_dir($resultdir)) {
        Folder::delete($resultdir);
    }
    // Is the package file a valid file?
    if (is_file($package)) {
        File::delete($package);
    } elseif (is_file(Path::clean(Factory::getApplication()->get('tmp_path') . '/' . $package))) {
        // It might also be just a base filename
        File::delete(Path::clean(Factory::getApplication()->get('tmp_path') . '/' . $package));
    }
}