public function extract($archive) { $destination =
$this->pluginDir;
if (!
is_writable($destination)) { throw new Exception(sprintf('Destination directory "%s" is not writable',
$destination));
} $prefix =
$this->
getPluginPrefix($archive);
$this->
validatePluginZip($prefix,
$archive);
$this->
validatePluginRequirements($prefix,
$archive);
$oldFile =
$this->
findOldFile($prefix);
$backupFile =
$this->
createBackupFile($oldFile);
try { $archive->
extractTo($destination);
if ($backupFile !== false
) { $this->filesystem->
remove($backupFile);
}