BxSEMigData.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup SocialEngineMigration SocialEngine Migration
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. define('BX_SEMIG_SUCCESSFUL', 1);
  12. define('BX_SEMIG_FAILED', 0);
  13. class BxSEMigData
  14. {
  15. protected $_oMainModule;
  16. protected $_seDb;
  17. protected $_sPrefix;
  18. protected $_oDb;
  19. protected $_sEnginePrefix = 'engine4_';
  20. protected $_iTransferred = 0;
  21. public function BxSEMigData(&$oMainModule, &$seDb)
  22. {
  23. $this -> _sPrefix = $oMainModule -> _aModule['db_prefix'];
  24. $this -> _oMainModule = $oMainModule;
  25. $this -> _seDb = $seDb;
  26. $this -> _oDb = $this -> _oMainModule -> _oDb;
  27. $this -> _sEnginePrefix = $this -> _oMainModule -> _oConfig -> getEngineVersionPrefix();
  28. }
  29. /**
  30. * Performs Migration Data
  31. * @return boolean
  32. */
  33. public function runMigration(){
  34. $this -> setResultStatus(_t('_bx_se_migration_define_migration_method'));
  35. return BX_SEMIG_FAILED;
  36. }
  37. /**
  38. * Gets total records for transferring
  39. * @return boolean
  40. */
  41. public function getTotalRecords(){
  42. $this -> setResultStatus(_t('_bx_se_migration_define_total_method'));
  43. return BX_SEMIG_FAILED;
  44. }
  45. /**
  46. * Set Migration Status
  47. * @param string $sStatus message
  48. */
  49. protected function setResultStatus($sStatus){
  50. $sQuery = $this -> _oDb -> prepare("UPDATE `{$this -> _sPrefix}transfers` SET `status_text` = ? WHERE `module` = ? ", $sStatus, $this -> _oMainModule -> sProcessedModule);
  51. $this -> _oDb -> query($sQuery);
  52. }
  53. /**
  54. * Returns content id of transferred Social Engine's member
  55. * @param int $iSEId social engine's profile ID
  56. * @return Integer
  57. */
  58. protected function getContentId($iSEId){
  59. $sQuery = $this -> _oDb -> prepare("SELECT `p`.`content_id` FROM `sys_accounts` AS `a`
  60. LEFT JOIN `sys_profiles` AS `p` ON `a`.`id` = `p`.`account_id`
  61. WHERE `se_id` = ? AND `p`.`type` = 'bx_persons' LIMIT 1", $iSEId);
  62. return $this -> _oDb -> getOne($sQuery);
  63. }
  64. }
  65. /** @} */