Last active
August 29, 2015 14:19
-
-
Save pierrejoye/c33338677f89159f696d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/include/pear-database.php b/include/pear-database.php | |
index 105603c..5ee9c31 100644 | |
--- a/include/pear-database.php | |
+++ b/include/pear-database.php | |
@@ -1869,8 +1869,7 @@ class release | |
require_once "HTTP.php"; | |
$package_id = package::info($package, 'packageid', true); | |
- | |
- if (!$package_id) { | |
+ if (!$package_id) { | |
$package_id = $dbh->getOne('SELECT package_id FROM package_aliases WHERE alias_name=' . $dbh->quoteSmart($package)); | |
if (!$package_id) { | |
return PEAR::raiseError("release download:: package '".htmlspecialchars($package). | |
@@ -1883,11 +1882,13 @@ class release | |
} | |
if ($file !== null) { | |
+ $basename = substr($file, 0, -4); | |
if (substr($file, -4) == '.tar') { | |
- $file = substr($file, 0, -4) . '.tgz'; | |
+ $file = $basename . '.tgz'; | |
$uncompress = true; | |
} | |
- $row = $dbh->getRow("SELECT `fullpath`, `release`, `id` FROM files ". | |
+ | |
+ $row = $dbh->getRow("SELECT `fullpath`, `release`, `id` FROM files ". | |
"WHERE UPPER(basename) = ?", array(strtoupper($file)), | |
DB_FETCHMODE_ASSOC); | |
if (PEAR::isError($row)) { | |
@@ -1898,7 +1899,6 @@ class release | |
$path = $row['fullpath']; | |
$log_release = $row['release']; | |
$log_file = $row['id']; | |
- $basename = $file; | |
} elseif ($version == null) { | |
// Get the most recent version | |
$row = $dbh->getRow("SELECT id FROM releases ". | |
@@ -1945,14 +1945,20 @@ class release | |
if (empty($path) || (!@is_file(PEAR_TARBALL_DIR . '/' . $basename) && !@is_file($path))) { | |
return PEAR::raiseError("release download:: no version information found"); | |
} | |
+ $basename = substr($file, 0, -4); | |
+ | |
} | |
- if (isset($path)) { | |
+ if ($uncompress) { | |
+ $path = PEAR_TARBALL_DIR . '/' . $basename .= '.tar'; | |
+ } else { | |
+ $path = PEAR_TARBALL_DIR . '/' . $basename .= '.tgz'; | |
+ } | |
+ | |
+ if (isset($path)) { | |
if (!isset($log_release)) { | |
$log_release = $release_id; | |
} | |
- | |
- release::logDownload($package_id, $log_release, $log_file); | |
- | |
+ release::logDownload($package_id, $log_release, $log_file); | |
header('Content-Disposition: attachment;filename=' . $basename); | |
header('Content-type: application/octet-stream'); | |
header('X-Sendfile: ' . '/local/www/sites/pecl.php.net/public_html/packages/' . $basename); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment