com web/windows: Fix bug #77542 Latest releases not working downloads directory: docroot/listing.php include/config.php include/listing.php
| From: | Anatol Belski | Date: | Wed, 30 Jan 2019 11:11:17 +0000 |
| Subject: | com web/windows: Fix bug #77542 Latest releases not working downloads directory: docroot/listing.php include/config.php include/listing.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-27730@lists.php.net to get a copy of this message | ||
Commit: be611654442bc7c96814e2a65345ec08e88ca5ef
Author: Anatol Belski <ab@php.net> Wed, 30 Jan 2019 12:09:52 +0100
Parents: c2c3383b2fafb03ec7bf4f7fcfd25fc8874cc9d1
Branches: master
Link: http://git.php.net/?p=web/windows.git;a=commitdiff;h=be611654442bc7c96814e2a65345ec08e88ca5ef
Log:
Fix bug #77542 Latest releases not working downloads directory
Bugs:
https://bugs.php.net/77542
Changed paths:
M docroot/listing.php
M include/config.php
M include/listing.php
Diff:
diff --git a/docroot/listing.php b/docroot/listing.php
index 72f4aec..bb63d14 100644
--- a/docroot/listing.php
+++ b/docroot/listing.php
@@ -1,12 +1,16 @@
<?php
-$snaps = false;
+include __DIR__ . '/../include/config.php';
+
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'releases';
+$nmode = MODE_RELEASE;
+
switch ($mode) {
case 'qa':
$dir_to_parse = 'downloads/qa';
$title_page = 'Binaries and sources QA Releases';
+ $nmode = MODE_QA;
break;
/* The snapshot page is currently gets generated. listing2.php seems
to be quite outdated, so we just redirect to the correct snapshot page
@@ -18,7 +22,7 @@ switch ($mode) {
exit();
$dir_to_parse = 'downloads/snaps';
$title_page = 'Binaries and sources Snapshots';
- $snaps = true;
+ $nmode = MODE_SNAP;
break;
case 'releases':
default:
@@ -26,13 +30,12 @@ switch ($mode) {
$title_page = 'Binaries and sources Releases';
}
-include __DIR__ . '/../include/config.php';
include __DIR__ . '/../include/listing.php';
$baseurl = '/' . $dir_to_parse . '/';
-$versions = generate_listing($dir_to_parse, $snaps);
+$versions = generate_listing($dir_to_parse, $nmode);
$major_order = array('7.3', '7.2', '7.1', '7.0',
'5.6');
$minor_order = array(
'5.6' => array(
diff --git a/include/config.php b/include/config.php
index 19164e1..a6bfbc2 100644
--- a/include/config.php
+++ b/include/config.php
@@ -1,10 +1,14 @@
-<?php
-define('APP_PATH', 'C:/domains/windows.php.net/');
-define('SNAPS_DIR', APP_PATH . 'docroot/downloads/snaps/');
-define('RELEASES_DIR', APP_PATH . 'docroot/downloads/releases/');
-define('QA_DIR', APP_PATH . 'docroot/downloads/qa/');
-define('DATA_DIR', APP_PATH . '/data/');
-define('LIB_DIR', APP_PATH . '/include/');
-define('TPL_PATH', APP_PATH . '/templates/');
-define('DOCROOT', APP_PATH . '/docroot');
-define('SNAPS_URL', '/downloads/snaps/');
+<?php
+define('APP_PATH', 'C:/domains/windows.php.net/');
+define('SNAPS_DIR', APP_PATH . 'docroot/downloads/snaps/');
+define('RELEASES_DIR', APP_PATH . 'docroot/downloads/releases/');
+define('QA_DIR', APP_PATH . 'docroot/downloads/qa/');
+define('DATA_DIR', APP_PATH . '/data/');
+define('LIB_DIR', APP_PATH . '/include/');
+define('TPL_PATH', APP_PATH . '/templates/');
+define('DOCROOT', APP_PATH . '/docroot');
+define('SNAPS_URL', '/downloads/snaps/');
+
+define('MODE_RELEASE', 0);
+define('MODE_SNAP', 1);
+define('MODE_QA', 2);
diff --git a/include/listing.php b/include/listing.php
index 4c63b12..ffa41a4 100644
--- a/include/listing.php
+++ b/include/listing.php
@@ -85,7 +85,7 @@ function parse_file_name($v)
);
}
-function generate_listing($path, $snaps = false) {
+function generate_listing($path, $nmode) {
if (file_exists($path . '/cache.info')) {
include $path . '/cache.info';
return $releases;
@@ -104,7 +104,7 @@ function generate_listing($path, $snaps = false) {
$sha256sums = processSha256Sums($path);
foreach ($versions as $file) {
$file_ori = $file;
- if ($snaps) {
+ if (MODE_SNAP === $nmode) {
$file = readlink($file);
}
$datetime_str = substr($file, strlen($file) - 16, 12);
@@ -133,7 +133,7 @@ function generate_listing($path, $snaps = false) {
'sha256' => $sha256sums[strtolower($file_ori)]
);
$compile = $configure = $buildconf = false;
- if ($snaps) {
+ if (MODE_SNAP === $nmode) {
$debug_pack = 'php-debug-pack-' . $elms['version_short'] .
($elms['nts'] ? '-' . $elms['nts'] : '') .
'-win32' . ($elms['ts'] ? '-' . $elms['vc'] . '-'
. $elms['arch'] . '-latest' : '') . '.zip';
$installer = 'php-' . $elms['version_short'] . ($elms['nts'] ?
'-' . $elms['nts'] : '') . '-win32' . ($elms['ts']
? '-' . $elms['vc'] . '-' . $elms['arch'] .
'-latest' : '') . '.msi';
$testpack = 'php-test-pack-' . $elms['version_short'] .
'-latest.zip';
@@ -182,7 +182,7 @@ function generate_listing($path, $snaps = false) {
}
- if ($snaps) {
+ if (MODE_SNAP === $nmode) {
if ($buildconf) {
$releases[$version_short][$key]['buildconf'] = $buildconf;
}
@@ -205,8 +205,10 @@ function generate_listing($path, $snaps = false) {
rename($tmp_name, 'cache.info');
chdir($old_cwd);
- generate_web_config($releases);
- generate_latest_releases_html($releases);
+ if (MODE_RELEASE === $nmode) {
+ generate_web_config($releases);
+ generate_latest_releases_html($releases);
+ }
return $releases;
}