PEAR_Frontend_Gtk2
[ class tree: PEAR_Frontend_Gtk2 ] [ index: PEAR_Frontend_Gtk2 ] [ all elements ]

Source for file Checks.php

Documentation is available at Checks.php

  1. <?php
  2. /**
  3. *   Some checks before the application is started.
  4. *   That should ensure optimal user experience.
  5. *
  6. *   @author Christian Weiske <cweiske@php.net>
  7. */
  8.  
  9. //Check PHP version
  10. if (version_compare('5.1.0dev'phpversion()'>')) {
  11.     echo "You need at least PHP 5.1.0 to run that program\r\n";
  12.     exit(1);
  13. }
  14.  
  15. //Check PHP-Gtk version
  16. try {
  17.     $ext = new ReflectionExtension("php-gtk");
  18. catch (ReflectionException $e{
  19.     echo "You need to install PHP-Gtk2\r\n";
  20.     exit(2);
  21. }
  22. if (version_compare('2.0.0'$ext->getVersion()) < 0{
  23.     echo "You need at least PHP-Gtk version 2.0\r\n";
  24.     exit(2);
  25. }
  26.  
  27. //Do we have Glade? (was a problem on some php-gtk1 windows installations)
  28. if (!class_exists('gladexml')) {
  29.     echo "The GladeXML class is not available, but required.\r\n";
  30.     $dialog = new GtkMessageDialog(
  31.         null,//parent
  32.         0,
  33.         Gtk::MESSAGE_ERROR,
  34.         Gtk::BUTTONS_OK,
  35.         'The GladeXML class is not available, but required.'
  36.     );
  37.     $dialog->run();
  38.     $dialog->destroy();
  39.     exit(3);
  40. }
  41.  
  42. //PEAR cache directory
  43. require_once 'PEAR/Config.php';
  44. $config     = PEAR_Config::singleton();
  45. $cachedir   $config->get('cache_dir');
  46. if (!file_exists($cachedir)) {
  47.     //Try to create the directory - if that fails, no problem:
  48.     //the error message is thrown in the next if-block
  49.     @mkdir($cachedir0777true);
  50. }
  51. if (!is_writable($cachedir)) {
  52.     $message 'The PEAR cache directory "' $cachedir '" is NOT writable!' "\r\n"
  53.         . 'It is highly recommended that you make it writable before using the'
  54.         . ' graphical installer.';
  55.     echo $message "\r\n";
  56.     $dialog = new GtkMessageDialog(
  57.         null,//parent
  58.         0,
  59.         Gtk::MESSAGE_WARNING,
  60.         Gtk::BUTTONS_NONE,
  61.         $message
  62.     );
  63.     $dialog->add_button('Close and fix it'0);
  64.     $dialog->add_button('Continue the program'1);
  65.     $answer $dialog->run();
  66.     $dialog->destroy();
  67.     if ($answer == 0{
  68.         exit(4);
  69.     }
  70. }
  71.  
  72. ?>

Documentation generated on Mon, 11 Mar 2019 15:46:46 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.