From 9755d15f5235071a4f4d101e9d77a87a5b427ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 1 Oct 2019 17:51:44 +0200 Subject: [PATCH] work on migration script --- .../install/mysql/migration/10.0.0-11.0.0.sql | 2 +- .../mysql/tables/llx_c_socialnetworks.sql | 2 +- htdocs/install/upgrade2.php | 70 +++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index a7aeaf4b6ea..4f0cd4d39a9 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -203,7 +203,7 @@ create table llx_c_socialnetworks code varchar(100), label varchar(150), url text, - icon varchar(15), + icon varchar(20), active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_socialnetworks.sql b/htdocs/install/mysql/tables/llx_c_socialnetworks.sql index 44741a2704f..b2d0b44c371 100644 --- a/htdocs/install/mysql/tables/llx_c_socialnetworks.sql +++ b/htdocs/install/mysql/tables/llx_c_socialnetworks.sql @@ -22,6 +22,6 @@ create table llx_c_socialnetworks code varchar(100), label varchar(150), url text, - icon varchar(15), + icon varchar(20), active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 24d73da5485..c2b12b23d43 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -448,6 +448,16 @@ if (! GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'a { migrate_user_photospath(); } + + // Scripts for 11.0 + $afterversionarray=explode('.', '10.0.9'); + $beforeversionarray=explode('.', '11.0.9'); + if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + migrate_users_socialnetworks(); + migrate_members_socialnetworks(); + migrate_contacts_socialnetworks(); + migrate_thirdparties_socialnetworks(); + } } // Code executed only if migration is LAST ONE. Must always be done. @@ -4925,3 +4935,63 @@ On les corrige: update llx_facture set paye=1, fk_statut=2 where close_code is null and rowid in (...) */ + +/** + * Migrate users fields facebook and co to socialnetworks + * + * @return void + */ +function migrate_users_socialnetworks() +{ + global $db, $langs; + + print ''; + + print ''.$langs->trans('MigrationUsersSocialNetworks')."
\n"; + print ''; +} + +/** + * Migrate members fields facebook and co to socialnetworks + * + * @return void + */ +function migrate_members_socialnetworks() +{ + global $db, $langs; + + print ''; + + print ''.$langs->trans('MigrationMembersSocialNetworks')."
\n"; + print ''; +} + +/** + * Migrate contacts fields facebook and co to socialnetworks + * + * @return void + */ +function migrate_contacts_socialnetworks() +{ + global $db, $langs; + + print ''; + + print ''.$langs->trans('MigrationContactsSocialNetworks')."
\n"; + print ''; +} + +/** + * Migrate thirdpartie fields facebook and co to socialnetworks + * + * @return void + */ +function migrate_thirdparties_socialnetworks() +{ + global $db, $langs; + + print ''; + + print ''.$langs->trans('MigrationThirdpartiesSocialNetworks')."
\n"; + print ''; +}