BxDolMConfig.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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 DolphinMigration Dolphin Migration
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxDolMConfig extends BxBaseModGeneralConfig
  12. {
  13. /**
  14. * @var array una modules uris, associated with migration modules names (mainly uses for Timeline migration)
  15. */
  16. public $_aModulesAliases = array(
  17. 'bx_store' => 'store',
  18. 'bx_files' => 'files',
  19. 'bx_poll' => 'polls',
  20. 'bx_events' => 'events',
  21. 'bx_groups' => 'groups',
  22. 'bx_blogs' => 'blogs',
  23. 'bx_photos' => 'photos',
  24. );
  25. /**
  26. * @var bool allows to overwrite existed members profile data
  27. */
  28. public $_bIsOverwrite = false;
  29. /**
  30. * @var bool allows to transfer photo albums even if they are empty
  31. */
  32. public $_bTransferEmpty = true;
  33. /**
  34. * @var bool allows to use members NickName instead of FullName
  35. */
  36. public $_bUseNickName = false;
  37. /**
  38. * @var integer contains default privacy value
  39. */
  40. public $_iDefaultPrivacyGroup = 3;
  41. /**
  42. * @var int interval in milliseconds for checking if the data already transferred but script still works.
  43. */
  44. public $_iCheckInterval = 60000;
  45. /**
  46. * @var array modules for transfer from Dolphin to UNA with parameters
  47. * [table_name] - (string) table from which to get data
  48. * [migration_class] - (string) class name/file name for data migration
  49. * [dependencies] - (array) list of the modules which should be migrated before transferring selected module
  50. * [plugins] - (array) list of the modules which should be installed on UNA before transferring selected module
  51. */
  52. public $_aMigrationModules = array(
  53. 'profiles' => array(
  54. 'table_name' => 'Profiles',
  55. 'migration_class' => 'BxDolMProfiles',
  56. 'dependencies' => array(
  57. ),
  58. 'plugins' => array(
  59. 'bx_persons' => 'Persons',
  60. ),
  61. ),
  62. 'profile_fields' => array(
  63. 'table_name' => 'sys_profile_fields',
  64. 'migration_class' => 'BxDolMProfilesFields',
  65. 'dependencies' => array(
  66. 'profiles',
  67. ),
  68. 'plugins' => array(
  69. 'bx_persons' => 'Persons',
  70. ),
  71. ),
  72. 'blogs' => array(
  73. 'table_name' => 'bx_blogs_posts',
  74. 'migration_class' => 'BxDolMBlogs',
  75. 'type' => 'blog',
  76. 'keywords' => 'bx_posts_meta_keywords',
  77. 'dependencies' => array(
  78. 'profiles',
  79. ),
  80. 'plugins' => array(
  81. 'bx_persons' => 'Persons',
  82. 'bx_posts' => 'Posts'
  83. ),
  84. ),
  85. 'groups' => array(
  86. 'table_name' => 'bx_groups_main',
  87. 'migration_class' => 'BxDolMGroups',
  88. 'type' => 'bx_groups',
  89. 'keywords' => 'bx_groups_meta_keywords',
  90. 'dependencies' => array(
  91. 'profiles',
  92. ),
  93. 'plugins' => array(
  94. 'bx_persons' => 'Persons',
  95. 'bx_groups' => 'Groups'
  96. ),
  97. ),
  98. 'events' => array(
  99. 'table_name' => 'bx_events_main',
  100. 'type' => 'bx_events',
  101. 'keywords' => 'bx_events_meta_keywords',
  102. 'migration_class' => 'BxDolMEvents',
  103. 'dependencies' => array(
  104. 'profiles',
  105. ),
  106. 'plugins' => array(
  107. 'bx_persons' => 'Persons',
  108. 'bx_events' => 'Events'
  109. ),
  110. ),
  111. 'photos_albums' => array(
  112. 'table_name' => 'bx_photos_main',
  113. 'table_name_albums' => 'sys_albums',
  114. 'type' => 'bx_photos',
  115. 'keywords' => 'bx_albums_meta_keywords_media',
  116. 'migration_class' => 'BxDolMPhotoAlbums',
  117. 'dependencies' => array(
  118. 'profiles',
  119. ),
  120. 'plugins' => array(
  121. 'bx_persons' => 'Persons',
  122. 'bx_albums' => 'Albums'
  123. ),
  124. ),
  125. 'photos' => array(
  126. 'table_name' => 'bx_photos_main',
  127. 'table_name_photos' => 'sys_albums',
  128. 'type' => 'bx_photos',
  129. 'keywords' => 'bx_photos_meta_keywords',
  130. 'migration_class' => 'BxDolMPhotos',
  131. 'dependencies' => array(
  132. 'profiles',
  133. ),
  134. 'plugins' => array(
  135. 'bx_persons' => 'Persons',
  136. 'bx_photos' => 'Photos'
  137. ),
  138. ),
  139. 'videos_albums' => array(
  140. 'table_name' => 'RayVideoFiles',
  141. 'table_name_albums' => 'sys_albums',
  142. 'type' => 'bx_videos',
  143. 'keywords' => 'bx_albums_meta_keywords_media',
  144. 'migration_class' => 'BxDolMVideoAlbums',
  145. 'dependencies' => array(
  146. 'profiles',
  147. ),
  148. 'plugins' => array(
  149. 'bx_persons' => 'Persons',
  150. 'bx_albums' => 'Albums'
  151. ),
  152. ),
  153. 'videos' => array(
  154. 'table_name' => 'RayVideoFiles',
  155. 'table_name_videos' => 'sys_albums',
  156. 'type' => 'bx_videos',
  157. 'keywords' => 'bx_videos_meta_keywords_media',
  158. 'migration_class' => 'BxDolMVideos',
  159. 'dependencies' => array(
  160. 'profiles',
  161. ),
  162. 'plugins' => array(
  163. 'bx_persons' => 'Persons'
  164. ),
  165. ),
  166. 'conversations' => array(
  167. 'table_name' => 'sys_messages',
  168. 'migration_class' => 'BxDolMConv',
  169. 'dependencies' => array(
  170. 'profiles',
  171. ),
  172. 'plugins' => array(
  173. 'bx_persons' => 'Persons',
  174. 'bx_convos' => 'Conversations'
  175. ),
  176. ),
  177. 'forum' => array(
  178. 'table_name' => 'bx_forum_topic',
  179. 'table_name_post' => 'bx_forum_post',
  180. 'migration_class' => 'BxDolMForum',
  181. 'dependencies' => array(
  182. 'profiles',
  183. ),
  184. 'plugins' => array(
  185. 'bx_persons' => 'Persons',
  186. 'bx_forum' => 'Discussions'
  187. ),
  188. ),
  189. 'polls' => array(
  190. 'table_name' => 'bx_poll_data',
  191. 'migration_class' => 'BxDolMPolls',
  192. 'type' => 'bx_poll',
  193. 'keywords' => 'bx_polls_meta_keywords',
  194. 'dependencies' => array(
  195. 'profiles',
  196. ),
  197. 'plugins' => array(
  198. 'bx_persons' => 'Persons',
  199. 'bx_polls' => 'Polls'
  200. ),
  201. ),
  202. 'files' => array(
  203. 'table_name' => 'bx_files_main',
  204. 'migration_class' => 'BxDolMFiles',
  205. 'type' => 'bx_files',
  206. 'keywords' => 'bx_files_meta_keywords',
  207. 'dependencies' => array(
  208. 'profiles',
  209. ),
  210. 'plugins' => array(
  211. 'bx_persons' => 'Persons',
  212. 'bx_files' => 'Files'
  213. ),
  214. ),
  215. 'store' => array(
  216. 'table_name' => 'bx_store_products',
  217. 'migration_class' => 'BxDolMMarket',
  218. 'type' => 'bx_store',
  219. 'keywords' => 'bx_market_meta_keywords',
  220. 'dependencies' => array(
  221. 'profiles',
  222. ),
  223. 'plugins' => array(
  224. 'bx_persons' => 'Persons',
  225. 'bx_market' => 'Market'
  226. ),
  227. ),
  228. 'quotes' => array(
  229. 'table_name' => 'bx_quotes_units',
  230. 'migration_class' => 'BxDolMQuotes',
  231. 'plugins' => array(
  232. 'bx_quoteofday' => 'Quotes'
  233. ),
  234. ),
  235. 'shoutbox' => array(
  236. 'table_name' => 'bx_shoutbox_messages',
  237. 'migration_class' => 'BxDolMShoutBox',
  238. 'dependencies' => array(
  239. 'profiles',
  240. ),
  241. 'plugins' => array(
  242. 'bx_persons' => 'Persons',
  243. 'bx_messenger' => 'Jot Messenger'
  244. ),
  245. ),
  246. 'simple_messenger' => array(
  247. 'table_name' => 'bx_simple_messenger_messages',
  248. 'migration_class' => 'BxDolMSimpleMessenger',
  249. 'dependencies' => array(
  250. 'profiles',
  251. ),
  252. 'plugins' => array(
  253. 'bx_persons' => 'Persons',
  254. 'bx_messenger' => 'Jot Messenger'
  255. ),
  256. ),
  257. 'chat' => array(
  258. 'table_name' => 'RayChatHistory',
  259. 'migration_class' => 'BxDolMChat',
  260. 'dependencies' => array(
  261. 'profiles',
  262. ),
  263. 'plugins' => array(
  264. 'bx_persons' => 'Persons',
  265. 'bx_messenger' => 'Jot Messenger'
  266. ),
  267. ),
  268. 'timeline' => array(
  269. 'table_name' => 'bx_wall_events',
  270. 'migration_class' => 'BxDolMTimeline',
  271. 'dependencies' => array
  272. (
  273. 'profiles',
  274. ),
  275. 'plugins' => array
  276. (
  277. 'bx_persons' => 'Persons',
  278. 'bx_timeline' => 'Timeline'
  279. ),
  280. ),
  281. 'membership_levels' => array(
  282. 'table_name' => 'sys_acl_levels',
  283. 'migration_class' => 'BxDolMMemLevels',
  284. 'dependencies' => array(
  285. 'profiles',
  286. ),
  287. 'plugins' => array(
  288. 'bx_acl' => 'Paid Levels'
  289. ),
  290. )
  291. );
  292. public function __construct($aModule)
  293. {
  294. $this -> _bIsOverwrite = getParam('bx_dolphin_migration_overwrite');
  295. $this -> _bTransferEmpty = getParam('bx_dolphin_migration_empty_albums');
  296. $this -> _bUseNickName = getParam('bx_dolphin_migration_use_nickname');
  297. $this -> _iDefaultPrivacyGroup = (int)getParam('bx_dolphin_migration_default_privacy');
  298. $this -> _bMediaModulesContent = getParam('bx_dolphin_migration_media_modules') == 'on';
  299. if ($this->_bMediaModulesContent){
  300. if ((int)BxDolModuleQuery::getInstance()->isEnabled('photos'))
  301. unset($this->_aMigrationModules['photos_albums']);
  302. else
  303. unset($this->_aMigrationModules['photos']);
  304. if ((int)BxDolModuleQuery::getInstance()->isEnabled('videos'))
  305. unset($this->_aMigrationModules['videos_albums']);
  306. else
  307. unset($this->_aMigrationModules['videos']);
  308. }
  309. else
  310. {
  311. unset($this->_aMigrationModules['photos']);
  312. unset($this->_aMigrationModules['videos']);
  313. }
  314. parent::__construct($aModule);
  315. }
  316. }
  317. /** @} */