svn: /web/php/trunk/ download-docs.php

From: Date: Wed, 23 Feb 2011 01:06:51 +0000
Subject: svn: /web/php/trunk/ download-docs.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-10563@lists.php.net to get a copy of this message
philip Wed, 23 Feb 2011 01:06:51 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=308575 Log: - Enabled the new enhanced chm format (chm with user notes) - This script now bases format type on 'formatname' instead of 'extension' as we now have two .chm files - This script needs refactoring, and caching Changed paths: U web/php/trunk/download-docs.php Modified: web/php/trunk/download-docs.php =================================================================== --- web/php/trunk/download-docs.php 2011-02-22 22:58:48 UTC (rev 308574) +++ web/php/trunk/download-docs.php 2011-02-23 01:06:51 UTC (rev 308575) @@ -54,6 +54,7 @@ # "Many PDF files" => "pdf.tar.gz", # "PDF" => "pdf", "HTML Help file" => "chm", + "HTML Help file (with user notes)" => "chm", ); ?> @@ -95,6 +96,7 @@ <?php $files = array(); $found_formats = array(); +$filepath = $filename = ''; // Go through all possible manual languages foreach ($LANGUAGES as $langcode => $language) { @@ -105,31 +107,34 @@ // Go through all possible manual formats foreach ($formats as $formatname => $extension) { - // Actual filename of the file - $actual_file = $_SERVER['DOCUMENT_ROOT'] . - "/distributions/manual/php_manual_$langcode.$extension"; + $filepath = $_SERVER['DOCUMENT_ROOT'] . '/distributions/manual/'; + if ($formatname === 'HTML Help file (with user notes)') { + $filename = "php_enhanced_$langcode.$extension"; + } else { + $filename = "php_manual_$langcode.$extension"; + } + $filepath .= $filename; + // File named after the language and format exists - if (file_exists($actual_file)) { + if (file_exists($filepath)) { // Mirror selection download URL - $link_to = "/get/php_manual_$langcode.$extension/from/a/mirror"; + $link_to = "/get/$filename/from/a/mirror"; // Try to get size and changed date - $size = @filesize($actual_file); - $changed = @filemtime($actual_file); + $size = @filesize($filepath); + $changed = @filemtime($filepath); // Size available, collect information if ($size !== FALSE) { - $files[$langcode][$extension] = array( + $files[$langcode][$formatname] = array( $link_to, (int) ($size/1024), date("j M Y", $changed), $extension ); - if (!in_array($extension, array_keys($found_formats))) { - $found_formats[$formatname] = $extension; - } + $found_formats[$formatname] = 1; } } } @@ -165,7 +170,7 @@ // Print out the name of the formats foreach ($formats as $formatname => $extension) { - if (!in_array($extension, array_values($found_formats))) { continue; } + if (!isset($found_formats[$formatname])) { continue; } echo " <th valign=\"bottom\">$formatname</th>\n"; } @@ -189,15 +194,14 @@ foreach ($formats as $formatname => $extension) { // Skip if no file found - if (!in_array($extension, array_values($found_formats))) { continue; } + if (!isset($found_formats[$formatname])) { continue; } echo "<td align=\"center\"$cellclass>"; - - if (!isset($lang_files[$extension])) { + if (!isset($lang_files[$formatname])) { echo "&nbsp;"; } else { - $fileinfo = $lang_files[$extension]; + $fileinfo = $lang_files[$formatname]; echo "<a href=\"$fileinfo[0]\""; // Only print out tooltip, if explicit information is not printed

« previous php.webmaster (#10563) next »