BxBaseModGeneralInstaller.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup BaseGeneral Base classes for modules
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolStudioInstaller');
  12. bx_import('BxDolImageTranscoder');
  13. bx_import('BxDolService');
  14. class BxBaseModGeneralInstaller extends BxDolStudioInstaller
  15. {
  16. protected $_aTranscoders = array ();
  17. protected $_bUpdateTimeline = false;
  18. function __construct($aConfig)
  19. {
  20. parent::__construct($aConfig);
  21. }
  22. function enable($aParams)
  23. {
  24. $aResult = parent::enable($aParams);
  25. if (!$aResult['result']) // proces further only in case of successful enable
  26. return $aResult;
  27. BxDolImageTranscoder::registerHandlersArray($this->_aTranscoders);
  28. if ($this->_bUpdateTimeline && BxDolRequest::serviceExists('timeline', 'add_handlers'))
  29. BxDolService::call('timeline', 'add_handlers', array($this->_aConfig['home_uri']));
  30. return $aResult;
  31. }
  32. function disable($aParams)
  33. {
  34. if ($this->_bUpdateTimeline && BxDolRequest::serviceExists('timeline', 'delete_handlers'))
  35. BxDolService::call('timeline', 'delete_handlers', array($this->_aConfig['home_uri']));
  36. BxDolImageTranscoder::unregisterHandlersArray($this->_aTranscoders);
  37. $aResult = parent::disable($aParams);
  38. if (!$aResult['result']) // we need to register it back if disabling failed
  39. BxDolImageTranscoder::registerHandlersArray($this->_aTranscoders);
  40. return $aResult;
  41. }
  42. function install($aParams, $bEnable = false)
  43. {
  44. return parent::install($aParams, $bEnable);
  45. }
  46. function uninstall($aParams, $bDisable = false)
  47. {
  48. return parent::uninstall($aParams, $bDisable);
  49. }
  50. }
  51. /** @} */