1212 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1313 */
1414
15+ use \XoopsModules \Tdmcreate \Common ;
16+
1517/**
1618 * Class Migrate synchronize existing tables with target schema
1719 *
2123 * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
2224 * @link https://xoops.org
2325 */
26+
2427class Migrate extends \Xmf \Database \Migrate
2528{
2629 private $ renameTables ;
2730
2831 /**
2932 * Migrate constructor.
33+ * @param Common\Configurator $configurator
3034 * @throws \RuntimeException
3135 * @throws \InvalidArgumentException
3236 */
33- public function __construct ()
37+ public function __construct (Common \ Configurator $ configurator = null )
3438 {
35- require_once dirname (dirname (__DIR__ )) . '/include/config.php ' ;
36- $ config = getConfig ();
37- $ this ->renameTables = $ config ->renameTables ;
39+ if (null !== $ configurator ) {
40+ $ this ->renameTables = $ configurator ->renameTables ;
3841
39- $ moduleDirName = basename (dirname (dirname (__DIR__ )));
40- parent ::__construct ($ moduleDirName );
42+ $ moduleDirName = basename (dirname (dirname (__DIR__ )));
43+ parent ::__construct ($ moduleDirName );
44+ }
4145 }
4246
4347 /**
@@ -80,8 +84,8 @@ private function moveDoColumns()
8084 {
8185 $ tableName = 'newbb_posts_text ' ;
8286 $ srcTableName = 'newbb_posts ' ;
83- if (false !== $ this ->tableHandler ->useTable ($ tableName )
84- && false !== $ this ->tableHandler ->useTable ($ srcTableName )) {
87+ if ($ this ->tableHandler ->useTable ($ tableName )
88+ && $ this ->tableHandler ->useTable ($ srcTableName )) {
8589 $ attributes = $ this ->tableHandler ->getColumnAttributes ($ tableName , 'dohtml ' );
8690 if (false === $ attributes ) {
8791 $ this ->synchronizeTable ($ tableName );
@@ -102,12 +106,14 @@ private function moveDoColumns()
102106 */
103107 protected function preSyncActions ()
104108 {
109+ /*
105110 // change 'bb' table prefix to 'newbb'
106111 $this->changePrefix();
107112 // columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point
108113 $this->moveDoColumns();
109114 // Convert IP address columns from int to readable varchar(45) for IPv6
110115 $this->convertIPAddresses('newbb_posts', 'poster_ip');
111116 $this->convertIPAddresses('newbb_report', 'reporter_ip');
117+ */
112118 }
113119}
0 commit comments