On Tue, Dec 12, 2006 at 07:05:51AM -0500, Kevin Johnson wrote: > I guess I am confused at some of what is being suggested. I had > recommend just removing the dependency on Image_graph and was told it was a > "half-assed" idea? And if you remove the dependance, why would you remove > the link? Change the error message on base_graph_common.php > to reflect the needed PEAR install and you will be done.
I have uploaded a new version with these changes. For reference, this is the patch I have included: a- removes the links to the graphic pages from the main page b- changes base_graph_common.php so it checks for the existence of Image::Graph *and* Image::Color (they are independent PEAR modules, both should be checked and not just one of them) through a new function (FindGraphingLib()). c- If both are present proceed, all well and good. d- If one of them is not produce an error message I believe that b) is appropiate to do upstream (it's not sufficient to just check for Image::Graph since if a user installs that module and not Image::Color [1] graphing is broken. If b) is applied then you can reuse most of the content in d) (all save for the Debian-specific messages related to bug reports and licenses). Regards Javier [1] Happens at least for Debian users that install the 'php-image-graph' package, since there is no (for license issues) a 'php-image-color' package.
#! /bin/sh /usr/share/dpatch/dpatch-run ## remove_php_image_graph.dpatch by <[EMAIL PROTECTED]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Remove php image graph dependancies --- base-1.2.7.orig/base_main.php 2006-12-12 20:21:38.000000000 +0100 +++ base-1.2.7/base_main.php 2006-12-12 20:22:51.000000000 +0100 @@ -318,7 +318,6 @@ </div></td></tr> <tr><td align="center" valign="top"> <B><A HREF="base_qry_main.php?new=1"><?php echo _SEARCH; ?></A></B><br> -<B><A HREF="base_graph_main.php"><?php echo _GALERTD; ?></A></B><br> <A HREF="base_stat_time.php"><?php echo _GALERTDT; ?></A><br><br> <?php DBLink(); ?> </td></tr></table> --- base-1.2.7.orig/base_graph_common.php 2006-12-12 20:24:12.000000000 +0100 +++ base-1.2.7/base_graph_common.php 2006-12-12 21:19:34.000000000 +0100 @@ -25,6 +25,21 @@ // Some colors to be used in graphs. $named_colors = array('aliceblue','antiquewhite','aqua','aquamarine','azure','beige','bisque','black','blanchedalmond','blue','blueviolet','brown','burlywood','cadetblue','chartreuse','chocolate','coral','cornflowerblue','cornsilk','crimson','cyan','darkblue','darkcyan','darkgoldenrod','darkdray','darkgreen','darkhaki','darkorange','darkolivegreen','darkmagenta','darkorchid','darkred','darksalmon','darkseagreen','darkviolet','deeppink','deepskyblue','dimgray','dodgerblue','firebrick','floralwhite','forestgreen','fuchsia','gainsboro','ghostwhite','gold','goldenrod','gray','green','greenyellow','indianred','indigo','ivory'); +function FindGraphingLib($libfile) +{ + $found = false; + // Will search in Path + $paths = explode(PATH_SEPARATOR, ini_get('include_path')); + foreach ($paths as $path) { + $fullpath = $path . DIRECTORY_SEPARATOR . $libfile; + if (file_exists($fullpath)) { + $found = true; + break; + } + } + return $found; +} + function VerifyGraphingLib() { GLOBAL $debug_mode; @@ -41,30 +56,32 @@ } // We have to locate Image/Graph.php -- Alejandro - $file = "Image/Graph.php"; - $found = false; - // Will search in Path - $paths = explode(PATH_SEPARATOR, ini_get('include_path')); - foreach ($paths as $path) { - $fullpath = $path . DIRECTORY_SEPARATOR . $file; - if (file_exists($fullpath)) { - $found = true; - break; - } - } - - if ( $found ) { + // We have to locate Image/Color.php too -- Javier + if ( FindGraphingLib("Image/Graph.php") && FindGraphingLib("Image/Color.php") ) { // Cool, file was found, so you have Image_Graph installed. -- Alejandro - include($file); + include("Image/Graph.php"); return true; } else { // Sorry dude, you haven't finished your home work. -- Alejandro - echo "<P><B>Error loading the Graphing library: </B>". - "<P>Check your Pear::Image_Graph installation!". - "<P>". - "Image_Graph can be found here:". - "at <A HREF=\"http://pear.veggerby.dk/\">http://pear.veggerby.dk/</A>. Without this ". - "library no graphing operations can be performed."; + echo "<P><B>Error loading the Graphing libraries: </B>". + "<P>You have to manually install Pear::Image_Graph and Pear::Image_Color if you want graphics. ". + "In Debian it is not sufficient to install the php-image-graph package ". + "since, due to license issues ". + "(see <a href=\"http://bugs.debian.org/401797\">Bug #401797</a> and <a href=\"http://bugs.debian.org/402406\">Bug #402406</a>) ". + "the Image_Color functionality is not available and will not be ". + "available until the PEAR modules change their license.". + "<P>A workaround is available: you can install the ". + "pear modules manually with: <tt>pear install php-image-color</tt> and ". + "<tt>pear install php-image-graph</tt>.". + "If you do this, however, the modules will not be handled in Debian's ". + "package management system.". + "<p>Image_Graph can be found here:". + "at <A HREF=\"http://pear.veggerby.dk/\">http://pear.veggerby.dk/</A>.". + "or at <A HREF=\"http://http://pear.php.net/package/Image_Graph/\">http://pear.php.net/package/Image_Graph/</A>.". + "<p>Image_Color can be found here:". + "at <A HREF=\"http://http://pear.php.net/package/Image_Color/\">http://pear.php.net/package/Image_Color/</A>.". + "<p>Without these ". + "libraries no graphing operations can be performed."; die();
signature.asc
Description: Digital signature