Source for file HarmoniVersionRequirement.class.php

Documentation is available at HarmoniVersionRequirement.class.php

  1. <?php
  2. /**
  3. * @package polyphony.startupcheck
  4. *
  5. * @copyright Copyright &copy; 2005, Middlebury College
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  7. *
  8. * @version $Id: HarmoniVersionRequirement.class.php,v 1.7 2007/09/19 14:04:50 adamfranco Exp $
  9. */
  10.  
  11. /**
  12. * This {@link StartupRequirement} checks to make sure we are running a certain version of Harmoni, or newer.
  13. *
  14. * @package polyphony.startupcheck
  15. *
  16. * @copyright Copyright &copy; 2005, Middlebury College
  17. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  18. *
  19. * @version $Id: HarmoniVersionRequirement.class.php,v 1.7 2007/09/19 14:04:50 adamfranco Exp $
  20. */
  21. class HarmoniVersionRequirement extends StartupRequirement {
  22.  
  23. var $_harmoni;
  24. var $_version;
  25. var $_versionStr;
  26. /**
  27. * Constructor
  28. * @param ref object $harmoni A reference to a {$link Harmoni} object.
  29. * @param string $version The harmoni version string, ie, "1.5.2".
  30. */
  31. function HarmoniVersionRequirement($harmoni, $version) {
  32.  
  33. $this->_harmoni =$harmoni;
  34. $this->_versionStr = $harmoni->getVersionStr($version);
  35. // let's convert the string into its numeric counterpart.
  36. $this->_version = $harmoni->getVersionNumber($version);
  37. }
  38. /**
  39. * Checks the environment and returns a status value. Return value is one of STARTUP_STATUS_* defines.
  40. * @access public
  41. * @return integer
  42. */
  43. function getStatus()
  44. {
  45. $harmoniVer = $this->_harmoni->getVersionNumber();
  46. $harmoniVerStr = $this->_harmoni->getVersionStr();
  47. debug::output("HarmoniVersionRequirement - checking to make sure Harmoni (currently $harmoniVer) is greater than ".$this->_version,7,"StartupCheck");
  48. if ($this->_version <= $harmoniVer) {
  49. // everything's OK!
  50. return STARTUP_STATUS_OK;
  51. } else {
  52. // we got trouble
  53. StartupCheck::error(
  54. sprintf(
  55. dgettext("polyphony","HarmoniVersionRequirement - program execution could not proceed. I must be running under the Harmoni framework version <i>%s</i> or newer. However, we detected you only have version <i>%s</i> installed."),
  56. $this->_versionStr,
  57. $harmoniVerStr
  58. )
  59. );
  60. return STARTUP_STATUS_ERROR;
  61. }
  62. }
  63. /**
  64. * Returns this requirement's display name.
  65. * @access public
  66. * @return string
  67. */
  68. function getDisplayName()
  69. {
  70. return dgettext("polyphony","Harmoni Version Check")." &gt;= ".$this->_versionStr;
  71. }
  72. /**
  73. * Returns a {@link Wizard} object containing fields for user input to complete installation process.
  74. * @access public
  75. * @return ref object
  76. */
  77. function createWizard()
  78. {
  79. $null = null;
  80. return $null;
  81. }
  82. /**
  83. * Tells the requirement class to perform its update/install operation. If user input is required, it is passed in the form of a {@link WizardStep} containing field values.
  84. * @param optional array $properties An array of {@link WizardProperty} objects corresponding to the {@link Wizard} as created by {@link createWizard()}.
  85. * @access public
  86. * @return int Returns the new status of this requirement after attempting update.
  87. */
  88. function doUpdate( $properties = null )
  89. {
  90. return STARTUP_STATUS_NOT_CHECKED;
  91. }
  92. }

Documentation generated on Wed, 19 Sep 2007 10:24:24 -0400 by phpDocumentor 1.3.0RC3