com web/php: Add a rough EOL page, per the Internals discussion. Copy editing welcome!: eol.php include/branches.inc

From: Date: Thu, 02 Aug 2012 06:31:31 +0000
Subject: com web/php: Add a rough EOL page, per the Internals discussion. Copy editing welcome!: eol.php include/branches.inc
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-14033@lists.php.net to get a copy of this message
Commit: 87df5451edb9b5a408dc0b275bf3c59ad8211f03 Author: Adam Harvey <aharvey@php.net> Thu, 2 Aug 2012 14:31:31 +0800 Parents: 157d01e6644f4e43dd05febac87591a9a782599f Branches: master Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=87df5451edb9b5a408dc0b275bf3c59ad8211f03 Log: Add a rough EOL page, per the Internals discussion. Copy editing welcome! I haven't linked this from anywhere yet, pending further discussion. Changed paths: A eol.php A include/branches.inc Diff: diff --git a/eol.php b/eol.php new file mode 100644 index 0000000..b3d0a5b --- /dev/null +++ b/eol.php @@ -0,0 +1,60 @@ +<?php +$_SERVER['BASE_PAGE'] = 'eol.php'; + +include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; +include_once $_SERVER['DOCUMENT_ROOT'] . '/include/branches.inc'; + +// Notes for specific branches can be added here, and will appear in the table. +$BRANCH_NOTES = array( + '4.4' => 'Has known remote code execution vulnerabilities.', +); + +site_header('Unsupported Branches'); +?> + +<h1>Unsupported Branches</h1> + +<p> + This page lists the end of life date for each unsupported branch of PHP. If + you are using these releases, you are strongly urged to upgrade to + <a href="/downloads">a current version</a>, as using older versions may + expose you to security vulnerabilities and bugs that have been fixed in + more recent versions of PHP. +</p> + +<table class="standard"> + <thead> + <tr> + <th>Branch</th> + <th colspan="2">Date</th> + <th>Last Release</th> + <th>Notes</th> + </tr> + </thead> + <tbody> + <?php foreach (get_eol_branches() as $major => $branches): ?> + <?php foreach ($branches as $branch => $detail): ?> + <tr> + <td><?php echo htmlspecialchars($branch); ?></td> + <td> + <?php echo date('j M Y', $detail['date']); ?> + </td> + <td> + <?php echo number_format($ago = floor((time() - $detail['date']) / 86400)); ?> + day<?php echo ($ago != 1 ? 's' : ''); ?> ago + </td> + <td> + <a href="/releases/#<?php echo htmlspecialchars($detail['version']); ?>"> + <?php echo htmlspecialchars($detail['version']); ?> + </a> + </td> + <td> + <?php echo isset($BRANCH_NOTES[$branch]) ? $BRANCH_NOTES[$branch] : ''; ?> + </td> + </tr> + <?php endforeach; ?> + <?php endforeach; ?> + </tbody> +</table> + +<?php site_footer(); ?> diff --git a/include/branches.inc b/include/branches.inc new file mode 100644 index 0000000..e62e51b --- /dev/null +++ b/include/branches.inc @@ -0,0 +1,47 @@ +<?php +include_once $_SERVER['DOCUMENT_ROOT'] . '/include/releases.inc'; +include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc'; + +function version_number_to_branch($version) { + $parts = explode('.', $version); + if (count($parts) > 1) { + return "$parts[0].$parts[1]"; + } +} + +function get_eol_branches() { + $branches = array(); + + // Gather the last release on each branch into a convenient array. + foreach ($GLOBALS['OLDRELEASES'] as $major => $releases) { + foreach ($releases as $version => $release) { + if ($branch = version_number_to_branch($version)) { + if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) { + $branches[$major][$branch] = array( + 'date' => strtotime($release['date']), + 'version' => $version, + ); + } + } + } + } + + /* Exclude releases from active branches, where active is defined as "in + * the $RELEASES array". */ + foreach ($GLOBALS['RELEASES'] as $major => $releases) { + foreach ($releases as $version => $release) { + if ($branch = version_number_to_branch($version)) { + if (isset($branches[$major][$branch])) { + unset($branches[$major][$branch]); + } + } + } + } + + krsort($branches); + foreach ($branches as $major => $branch) { + krsort($branch); + } + + return $branches; +}

« previous php.webmaster (#14033) next »