Line 4... |
Line 4... |
4 |
/**
|
4 |
/**
|
5 |
* Migration des utilisateurs vers wordpress
|
5 |
* Migration des utilisateurs vers wordpress
|
6 |
*
|
6 |
*
|
7 |
* Description : classe permettant de migrer les profils de l'annuaire vers les profils wordpress
|
7 |
* Description : classe permettant de migrer les profils de l'annuaire vers les profils wordpress
|
8 |
* Utilisation : php cli.php migrationwp -a tous
|
8 |
* Utilisation : php cli.php migrationwp -a tous
|
- |
|
9 |
* /usr/local/bin/php -d memory_limit=4000M cli.php migrationwp -a tous
|
9 |
* vérifier le nom de la base et le préfixe des tables définis dans $basewp
|
10 |
* vérifier le nom de la base et le préfixe des tables définis dans $basewp
|
10 |
*
|
11 |
*
|
11 |
//Auteur original :
|
12 |
//Auteur original :
|
12 |
* @author Aurélien PERONNET <jpm@tela-botanica.org>
|
13 |
* @author Aurélien PERONNET <jpm@tela-botanica.org>
|
13 |
* @copyright Tela-Botanica 1999-2014
|
14 |
* @copyright Tela-Botanica 1999-2014
|
14 |
* @licence GPL v3 & CeCILL v2
|
15 |
* @licence GPL v3 & CeCILL v2
|
15 |
* @version $Id$
|
16 |
* @version $Id$
|
16 |
*/
|
17 |
*/
|
Line 17... |
Line 18... |
17 |
|
18 |
|
18 |
class Migrationwp extends Script {
|
19 |
class Migrationwp extends Script {
|
- |
|
20 |
private $basewp = "wordpress.site_";
|
Line 19... |
Line 21... |
19 |
private $basewp = "wordpress.wp_";
|
21 |
private $table = "site_";
|
20 |
|
22 |
|
21 |
public function executer() {
|
23 |
public function executer() {
|
22 |
$this->bdd = new Bdd();
|
24 |
$this->bdd = new Bdd();
|
Line 31... |
Line 33... |
31 |
|
33 |
|
32 |
switch($cmd) {
|
34 |
switch($cmd) {
|
33 |
case "tous":
|
35 |
case "tous":
|
34 |
$retour = $this->migrerUtilisateur();
|
36 |
$retour = $this->migrerUtilisateur();
|
35 |
$retour = $this->migrerUtilisateurMeta();
|
37 |
$retour = $this->migrerUtilisateurMeta();
|
36 |
//$retour = $this->migrerUtilisateurProfil();
|
38 |
$retour = $this->migrerUtilisateurProfil();
|
37 |
$retour = $this->migrerUtilisateurActivite();
|
39 |
$retour = $this->migrerUtilisateurActivite();
|
38 |
break;
|
40 |
break;
|
39 |
case "utilisateur": //liste wordpress
|
41 |
case "utilisateur": //liste wordpress
|
40 |
$retour = $this->migrerUtilisateur();
|
42 |
$retour = $this->migrerUtilisateur();
|
Line 46... |
Line 48... |
46 |
$retour = $this->migrerUtilisateurProfil();
|
48 |
$retour = $this->migrerUtilisateurProfil();
|
47 |
break;
|
49 |
break;
|
48 |
case "activite": // obligatoire pour affichage
|
50 |
case "activite": // obligatoire pour affichage
|
49 |
$retour = $this->migrerUtilisateurActivite();
|
51 |
$retour = $this->migrerUtilisateurActivite();
|
50 |
break;
|
52 |
break;
|
- |
|
53 |
case "actualiteTout" :
|
- |
|
54 |
$retour = $this->migrerUtilisateurActualites();
|
- |
|
55 |
$retour .= $this->migrerUtilisateurActualitesRubrique();
|
- |
|
56 |
$retour .= $this->migrerUtilisateurActualitesCommentaire();
|
- |
|
57 |
break;
|
- |
|
58 |
case "actualite" :
|
- |
|
59 |
$retour = $this->migrerUtilisateurActualites();
|
- |
|
60 |
break;
|
- |
|
61 |
case "actualiteRubrique" :
|
- |
|
62 |
$retour = $this->migrerUtilisateurActualitesRubrique();
|
- |
|
63 |
break;
|
- |
|
64 |
case "actualiteComm" :
|
- |
|
65 |
$retour = $this->migrerUtilisateurActualitesCommentaire();
|
- |
|
66 |
break;
|
51 |
default: break;
|
67 |
default: break;
|
52 |
}
|
68 |
}
|
Line 53... |
Line 69... |
53 |
|
69 |
|
54 |
if($this->mode_verbeux) {
|
70 |
if($this->mode_verbeux) {
|
55 |
// echo pour que bash capte la sortie et stocke dans le log
|
71 |
// echo pour que bash capte la sortie et stocke dans le log
|
56 |
//echo 'Identifiants des mails traites : '.implode(',', $retour)."--";
|
72 |
//echo 'Identifiants des mails traites : '.implode(',', $retour)."--";
|
57 |
}
|
73 |
}
|
Line 58... |
Line 74... |
58 |
}
|
74 |
}
|
59 |
|
75 |
|
60 |
private function migrerUtilisateur() {
|
76 |
private function migrerUtilisateur() {
|
61 |
$requete = "INSERT INTO ".$this->basewp.".`users`
|
77 |
$requete = "INSERT INTO ".$this->basewp."users
|
- |
|
78 |
(`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_status`, `display_name`)
|
62 |
(`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_status`, `display_name`)
|
79 |
SELECT `U_ID`, `U_MAIL`, `U_PASSWD`,concat(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(lower(concat(`U_SURNAME`,'-',`U_NAME`,'-')),' ',''),'\'',''),'é','e'),'è','e'),'ï','i'),'ü','u'),'ø',''),'œ','oe'),'ë','e'),'ç','c'),cast(`U_ID` as char)),
|
63 |
SELECT `U_ID`, `U_MAIL`, `U_PASSWD`, `U_SURNAME`, `U_MAIL` as mail, `U_WEB`, `U_DATE`, '0', concat(`U_NAME`,' ',`U_SURNAME`) FROM tela_prod_v4.`annuaire_tela`";
|
80 |
`U_MAIL` as mail, '' as user_url, `U_DATE`, '0', concat(`U_SURNAME`,' ',`U_NAME`) FROM tela_prod_v4.`annuaire_tela`";
|
64 |
$retour = $this->bdd->executer($requete);
|
81 |
$retour = $this->bdd->executer($requete);
|
65 |
echo 'Il y a '.count($retour).' utilisateurs migrés '."--";
|
82 |
echo 'Il y a '.count($retour).' utilisateurs migrés '."--";
|
Line 66... |
Line -... |
66 |
return $retour;
|
- |
|
- |
|
83 |
return $retour;
|
67 |
}
|
84 |
}
|
68 |
|
85 |
|
69 |
|
86 |
|
70 |
|
87 |
//TODO encoder nick/first/last name pour '
|
71 |
private function migrerUtilisateurMeta() {
|
88 |
private function migrerUtilisateurMeta() {
|
- |
|
89 |
$retour = array();
|
72 |
$retour = array();
|
90 |
$requete = "SELECT `U_ID`, `U_NAME`, `U_SURNAME` FROM `annuaire_tela`;";
|
73 |
$requete = "SELECT `U_ID`, `U_NAME`, `U_SURNAME`, amv_valeur FROM `annuaire_tela` left join annu_meta_valeurs on amv_cle_ligne = U_ID WHERE `amv_ce_colonne` =99;";
|
91 |
$utilisateurs = $this->bdd->recupererTous($requete);
|
74 |
$utilisateurs = $this->bdd->recupererTous($requete);
|
- |
|
75 |
foreach ($utilisateurs as $utilisateur) {
|
92 |
foreach ($utilisateurs as $utilisateur) {
|
76 |
$requete_insert = "INSERT INTO ".$this->basewp.".`usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES
|
93 |
// _access est pour définir les catégories d'articles que l'utilisateur pourra écrire
|
77 |
({$utilisateur['U_ID']}, 'last_activity', '2016-05-18 15:38:18'),
|
94 |
$requete_insert = "INSERT INTO ".$this->basewp."usermeta (`user_id`, `meta_key`, `meta_value`) VALUES
|
78 |
({$utilisateur['U_ID']}, 'nickname', '{$utilisateur['amv_valeur']}'),
|
95 |
({$utilisateur['U_ID']}, 'last_activity', '2016-05-18 15:38:18'),
|
79 |
({$utilisateur['U_ID']}, 'first_name', '{$utilisateur['U_SURNAME']}'),
|
96 |
({$utilisateur['U_ID']}, 'first_name', {$this->bdd->proteger($utilisateur['U_SURNAME'])}),
|
80 |
({$utilisateur['U_ID']}, 'last_name', '{$utilisateur['U_NAME']}'),
|
97 |
({$utilisateur['U_ID']}, 'last_name', {$this->bdd->proteger($utilisateur['U_NAME'])}),
|
81 |
({$utilisateur['U_ID']}, 'description', ''),
|
98 |
({$utilisateur['U_ID']}, 'description', ''),
|
82 |
({$utilisateur['U_ID']}, 'rich_editing', 'true'),
|
99 |
({$utilisateur['U_ID']}, 'rich_editing', 'true'),
|
83 |
({$utilisateur['U_ID']}, 'comment_shortcuts', 'false'),
|
100 |
({$utilisateur['U_ID']}, 'comment_shortcuts', 'false'),
|
84 |
({$utilisateur['U_ID']}, 'admin_color', 'fresh'),
|
101 |
({$utilisateur['U_ID']}, 'admin_color', 'fresh'),
|
85 |
({$utilisateur['U_ID']}, 'use_ssl', '0'),
|
102 |
({$utilisateur['U_ID']}, 'use_ssl', '0'),
|
86 |
({$utilisateur['U_ID']}, 'show_admin_bar_front', 'true'),
|
103 |
({$utilisateur['U_ID']}, 'show_admin_bar_front', 'true'),
|
87 |
({$utilisateur['U_ID']}, 'wp_capabilities', 'a:1:{s:11:\"contributor\";b:1;}'),
|
104 |
({$utilisateur['U_ID']}, '".$this->basewp."capabilities', 'a:1:{s:11:\"contributor\";b:1;}'),
|
88 |
({$utilisateur['U_ID']}, 'wp_user_level', '1'),
|
105 |
({$utilisateur['U_ID']}, '".$this->basewp."user_level', '1'),
|
89 |
({$utilisateur['U_ID']}, 'dismissed_wp_pointers', ''),
|
106 |
({$utilisateur['U_ID']}, 'dismissed_wp_pointers', ''),
|
90 |
({$utilisateur['U_ID']}, 'wp_dashboard_quick_press_last_post_id', '63'),
|
107 |
({$utilisateur['U_ID']}, 'wp_dashboard_quick_press_last_post_id', '63'),
|
91 |
({$utilisateur['U_ID']}, '_restrict_media', '1'),
|
108 |
({$utilisateur['U_ID']}, '_restrict_media', '1'),
|
92 |
({$utilisateur['U_ID']}, '_access', 'a:1:{i:0;s:2:\"25\";}'),
|
109 |
({$utilisateur['U_ID']}, '_access', 'a:4:{i:0;s:1:\"2\";i:1;s:1:\"5\";i:2;s:1:\"6\";i:3;s:1:\"7\";}'),
|
93 |
({$utilisateur['U_ID']}, 'bp_xprofile_visibility_levels', 'a:12:{i:1;s:6:\'public\';i:60;s:6:\'public\';i:61;s:6:\'public\';i:49;s:6:\'public\';i:55;s:6:\'public\';i:48;s:6:\'public\';i:62;s:6:\'public\';i:63;s:6:\'public\';i:68;s:6:\'public\';i:76;s:6:\'public\';i:120;s:6:\'public\';i:81;s:6:\'public\';}');";
|
110 |
({$utilisateur['U_ID']}, 'bp_xprofile_visibility_levels', 'a:12:{i:1;s:6:\"public\";i:60;s:6:\'public\';i:61;s:6:\'public\';i:49;s:6:\'public\';i:55;s:6:\'public\';i:48;s:6:\'public\';i:62;s:6:\'public\';i:63;s:6:\'public\';i:68;s:6:\'public\';i:76;s:6:\'public\';i:120;s:6:\'public\';i:81;s:6:\'public\';}');";
|
94 |
$retour[] = $this->bdd->executer($requete_insert);
|
111 |
$retour[] = $this->bdd->executer($requete_insert);
|
Line 102... |
Line 119... |
102 |
private function migrerUtilisateurActivite() {
|
119 |
private function migrerUtilisateurActivite() {
|
103 |
$retour = array();
|
120 |
$retour = array();
|
104 |
$requete = "SELECT `U_ID`, `U_NAME`, `U_SURNAME` FROM `annuaire_tela`;";
|
121 |
$requete = "SELECT `U_ID`, `U_NAME`, `U_SURNAME` FROM `annuaire_tela`;";
|
105 |
$utilisateurs = $this->bdd->recupererTous($requete);
|
122 |
$utilisateurs = $this->bdd->recupererTous($requete);
|
106 |
foreach ($utilisateurs as $utilisateur) {
|
123 |
foreach ($utilisateurs as $utilisateur) {
|
107 |
$requete_insert = "INSERT INTO `wordpress`.`bp_activity`
|
124 |
$requete_insert = "INSERT INTO ".$this->basewp."bp_activity
|
108 |
(`id`, `user_id`, `component`, `type`, `action`, `content`, `primary_link`, `item_id`, `secondary_item_id`, `date_recorded`, `hide_sitewide`, `mptt_left`, `mptt_right`, `is_spam`)
|
125 |
(`id`, `user_id`, `component`, `type`, `action`, `content`, `primary_link`, `item_id`, `secondary_item_id`, `date_recorded`, `hide_sitewide`, `mptt_left`, `mptt_right`, `is_spam`)
|
109 |
VALUES (NULL, {$utilisateur['U_ID']}, 'members', 'last_activity', '', '', '', '0', NULL, '2016-05-19 15:06:16', '0', '0', '0', '0');";
|
126 |
VALUES (NULL, {$utilisateur['U_ID']}, 'members', 'last_activity', '', '', '', '0', NULL, '2016-05-19 15:06:16', '0', '0', '0', '0');";
|
110 |
$retour[] = $this->bdd->executer($requete_insert);
|
127 |
$retour[] = $this->bdd->executer($requete_insert);
|
111 |
}
|
128 |
}
|
112 |
// echo pour que bash capte la sortie et stocke dans le log
|
129 |
// echo pour que bash capte la sortie et stocke dans le log
|
Line 114... |
Line 131... |
114 |
//print_r($utilisateurs);
|
131 |
//print_r($utilisateurs);
|
115 |
return $retour;
|
132 |
return $retour;
|
116 |
}
|
133 |
}
|
Line 117... |
Line 134... |
117 |
|
134 |
|
- |
|
135 |
private function migrerUtilisateurProfil() {
|
- |
|
136 |
$retour = array();
|
- |
|
137 |
$requete = "SELECT `U_ID`, `U_NAME`, `U_SURNAME`, U_WEB, `U_CITY`, `U_COUNTRY`, pays, `U_NIV`, `LABEL_NIV` FROM `annuaire_tela`
|
- |
|
138 |
left join (select `amo_nom` as pays, `amo_abreviation` FROM `annu_meta_ontologie` WHERE `amo_ce_parent` = 1074) liste_pays on `amo_abreviation` = `U_COUNTRY`
|
- |
|
139 |
LEFT JOIN `annuaire_LABEL_NIV` ON `ID_LABEL_NIV` = `U_NIV`;";
|
- |
|
140 |
$utilisateurs = $this->bdd->recupererTous($requete);
|
- |
|
141 |
$requete_supp = "SELECT * FROM `annu_meta_valeurs` WHERE `amv_ce_colonne` in (2,137, 99, 125) and (amv_valeur != '' and amv_valeur != 0)";
|
- |
|
142 |
$infos_supp = $this->bdd->recupererTous($requete_supp);
|
- |
|
143 |
$codes_langues = array("30842"=>"Anglais",
|
- |
|
144 |
"30843"=>"Allemand",
|
- |
|
145 |
"30844"=>"Italien",
|
- |
|
146 |
"30845"=>"Espagnol",
|
- |
|
147 |
"30846"=>"Arabe",
|
- |
|
148 |
"30847"=>"Chinois",
|
- |
|
149 |
"30848"=>"Russe");
|
- |
|
150 |
foreach ($infos_supp as $infos) {
|
- |
|
151 |
if ($infos['amv_ce_colonne'] == 2) {
|
- |
|
152 |
//exemple a:3:{i:0;s:7:"Anglais";i:1;s:8:"Espagnol";i:2;s:7:"Italien";}
|
- |
|
153 |
$langues = explode(";;", $infos['amv_valeur']);
|
- |
|
154 |
$valeur = "a:".count($langues).':{';
|
- |
|
155 |
foreach ($langues as $n=>$langue) {
|
- |
|
156 |
$valeur .= 'i:'.$n.';s:'.strlen($codes_langues[$langue]).':"'.$codes_langues[$langue].'";';
|
- |
|
157 |
}
|
- |
|
158 |
$valeur .='}';
|
- |
|
159 |
$supp[$infos['amv_cle_ligne']][$infos['amv_ce_colonne']] = $valeur;
|
- |
|
160 |
} else {
|
- |
|
161 |
$supp[$infos['amv_cle_ligne']][$infos['amv_ce_colonne']] = $infos['amv_valeur'];
|
- |
|
162 |
}
|
- |
|
163 |
}
|
- |
|
164 |
|
- |
|
165 |
$correspondance_categories = array("99"=>"1",
|
- |
|
166 |
"137"=>"2",
|
- |
|
167 |
"125"=>"11",
|
- |
|
168 |
"2"=>"13");
|
- |
|
169 |
foreach ($utilisateurs as $utilisateur) {
|
- |
|
170 |
$requete_insert = "INSERT INTO ".$this->basewp."bp_xprofile_data (`field_id`, `user_id`, `value`, `last_updated`) VALUES
|
- |
|
171 |
('3', {$utilisateur['U_ID']}, {$this->bdd->proteger($utilisateur['pays'])}, '2016-05-19 15:06:16'),
|
- |
|
172 |
('4', {$utilisateur['U_ID']}, {$this->bdd->proteger($utilisateur['U_CITY'])}, '2016-05-19 15:06:16'),
|
- |
|
173 |
('9', {$utilisateur['U_ID']}, {$this->bdd->proteger($utilisateur['U_NAME'])}, '2016-05-19 15:06:16'),
|
- |
|
174 |
('10', {$utilisateur['U_ID']}, {$this->bdd->proteger($utilisateur['U_SURNAME'])}, '2016-05-19 15:06:16'),
|
- |
|
175 |
('12', {$utilisateur['U_ID']}, {$this->bdd->proteger($utilisateur['LABEL_NIV'])}, '2016-05-19 15:06:16'),
|
- |
|
176 |
('21', {$utilisateur['U_ID']}, {$this->bdd->proteger($utilisateur['U_WEB'])}, '2016-05-19 15:06:16')";
|
- |
|
177 |
if (isset($supp[$utilisateur['U_ID']])) {
|
- |
|
178 |
foreach ($supp[$utilisateur['U_ID']] as $num=>$val){
|
- |
|
179 |
$requete_insert .= ",({$correspondance_categories[$num]}, {$utilisateur['U_ID']}, {$this->bdd->proteger($val)}, '2016-05-19 15:06:16')";
|
- |
|
180 |
}
|
- |
|
181 |
}
|
- |
|
182 |
$requete_insert .= ";";
|
- |
|
183 |
$retour[] = $this->bdd->executer($requete_insert);
|
- |
|
184 |
}
|
- |
|
185 |
return $retour;
|
- |
|
186 |
}
|
- |
|
187 |
|
- |
|
188 |
private function migrerActualites() {
|
- |
|
189 |
$retour = array();
|
- |
|
190 |
/*INSERT INTO `wp4_posts`
|
118 |
private function migrerUtilisateurProfil() {
|
191 |
SELECT spip_articles.`id_article` as ID, `id_auteur` as post_author, `date` as post_date, `date` as post_date_gmt,
|
- |
|
192 |
replace(replace(replace(replace(replace(replace(replace(replace(replace(convert( convert( texte USING latin1 ) USING utf8 ),'{{{{',''), '}}}}', '<!--more-->'), '{{{','<h2>'), '}}}', '</h2>'), '{{', '<strong>'), '}}', '</strong>'), '{', '<em>'), '}', '</em>'), '_ ', '') as post_content,
|
119 |
$requete = "UPDATE annu_donnees_temp SET adt_statut = '".self::STATUT_EN_TRAITEMENT."', adt_date_debut_traitement = NOW() ".
|
193 |
`titre` as post_title, "" as post_excerpt, replace(replace(replace(replace(replace(`statut`,'poubelle', 'trash'),'publie', 'publish'), 'prepa', 'private'), 'prop', 'pending'), 'refuse', 'trash') as post_status, "open" as comment_status, "open" as ping_status, "" as post_password, spip_articles.`id_article` as post_name, "" as to_ping, "" as pinged, `date_modif` as post_modified,`date_modif` as post_modified_gmt, "" as post_content_filtered, "" as post_parent,
|
- |
|
194 |
concat("http://tela-botanica.net/wpsite/actu",spip_articles.`id_article`) as guid, "0" as menu_order, "post" as post_type, "" as post_mime_type, "" as comment_count FROM tela_prod_spip_actu.`spip_articles` left join tela_prod_spip_actu.spip_auteurs_articles on spip_auteurs_articles.`id_article` = spip_articles.`id_article` WHERE id_rubrique in (22,54,70,30,19,51)
|
- |
|
195 |
*/
|
120 |
"WHERE adt_statut = '".self::STATUT_A_TRAITER."' ";
|
196 |
$requete = "SELECT spip_articles.`id_article` as ID, `id_auteur` as post_author, `date` as post_date, `date` as post_date_gmt,
|
121 |
$maj = $this->bdd->executer($requete);
|
197 |
replace(replace(replace(replace(replace(replace(replace(replace(replace(convert( convert( texte USING latin1 ) USING utf8 ),'{{{{',''), '}}}}', '<!--more-->'), '{{{','<h2>'), '}}}', '</h2>'), '{{', '<strong>'), '}}', '</strong>'), '{', '<em>'), '}', '</em>'), '_ ', '') as post_content,
|
122 |
// echo pour que bash capte la sortie et stocke dans le log
|
198 |
`titre` as post_title, \"\" as post_excerpt, replace(replace(replace(replace(replace(`statut`,'poubelle', 'trash'),'publie', 'publish'), 'prepa', 'private'), 'prop', 'pending'), 'refuse', 'trash') as post_status, \"open\" as comment_status, \"open\" as ping_status, \"\" as post_password, spip_articles.`id_article` as post_name, \"\" as to_ping, \"\" as pinged, `date_modif` as post_modified,`date_modif` as post_modified_gmt, \"\" as post_content_filtered, \"\" as post_parent,
|
- |
|
199 |
concat(\"http://tela-botanica.net/wpsite/actu\",spip_articles.`id_article`) as guid, \"0\" as menu_order, \"post\" as post_type, \"\" as post_mime_type, \"\" as comment_count FROM tela_prod_spip_actu.`spip_articles` left join tela_prod_spip_actu.spip_auteurs_articles on spip_auteurs_articles.`id_article` = spip_articles.`id_article` WHERE id_rubrique in (22,54,70,30,19,51)";
|
- |
|
200 |
$articles = $this->bdd->recupererTous($requete);
|
- |
|
201 |
$requete_doc = "SELECT d.`id_document`, `fichier`, `id_article` FROM `spip_documents` d left join spip_documents_articles da on da.`id_document` = d.`id_document`";
|
- |
|
202 |
$documents = $this->bdd->recupererTous($requete_doc);
|
- |
|
203 |
foreach ($documents as $doc) {
|
- |
|
204 |
$doc_loc[$doc['id_document']] = $doc['fichier'];
|
- |
|
205 |
}
|
- |
|
206 |
foreach ($articles as $article) {
|
- |
|
207 |
$article['post_content'] = preg_replace("\[(.*)->(.*)\]", '<a href="\2" target="_blank">\1</a>', $article['post_content']);
|
- |
|
208 |
//$images = preg_grep("\<img([0-9]*)\|[a-z]*\>", $article['post_content']);
|
- |
|
209 |
$article['post_content'] = preg_replace("\<img([0-9]*)\|[a-z]*\>", '<img src="'.$doc_loc['${1}'].'" />', $article['post_content']);
|
- |
|
210 |
$insert[] = "(".implode($article, ', ').")";
|
- |
|
211 |
}
|
- |
|
212 |
$requete_insert = "INSERT INTO `wp4_posts` VALUES ".implode($insert, ', ').";";
|
- |
|
213 |
$retour[] = $this->bdd->executer($requete_insert);
|
- |
|
214 |
echo 'Il y a '.count($retour).' actualités migrées '."--";
|
- |
|
215 |
return $retour;
|
- |
|
216 |
}
|
- |
|
217 |
|
- |
|
218 |
private function migrerActualitesRubrique() {
|
- |
|
219 |
$requete = "INSERT INTO ".$this->basewp."term_relationships`(`object_id`, `term_taxonomy_id`)
|
- |
|
220 |
SELECT `id_article`, replace(replace(replace(replace(replace(replace(`id_rubrique`, 22, 20), 54, 21), 30, 23), 19, 24), 51, 25), 70, 22)
|
- |
|
221 |
FROM `spip_articles` WHERE id_rubrique in (22,54,70,30,19,51)";
|
- |
|
222 |
|
- |
|
223 |
$retour = $this->bdd->executer($requete);
|
- |
|
224 |
echo 'Il y a '.count($retour).' actualités migrées '."--";
|
- |
|
225 |
return $retour;
|
- |
|
226 |
}
|
- |
|
227 |
|
123 |
echo $maj.' mails ont été mis en traitement '."--";
|
228 |
private function migrerActualitesCommentaires() {
|
- |
|
229 |
$requete = "INSERT INTO ".$this->basewp.'comments`(`comment_ID`, `comment_post_ID`, `comment_author`, `comment_author_email`, `comment_author_url`, `comment_author_IP`, `comment_date`, `comment_date_gmt`, `comment_content`, `comment_karma`, `comment_approved`, `comment_agent`, `comment_type`, `comment_parent`, `user_id`)
|
- |
|
230 |
SELECT `id_forum` , `id_article` , `auteur` , `email_auteur` , "" AS url, `ip` , `date_heure` , `date_heure` AS gmt, `texte` , "0" AS karma, replace(`statut`, "publie", "1") , "" AS agent, "" AS
|
- |
|
231 |
TYPE , `id_parent` , `id_auteur`
|
- |
|
232 |
FROM tela_prod_spip_actu.`spip_forum`
|
- |
|
233 |
WHERE id_article in (SELECT `id_article` FROM tela_prod_spip_actu.`spip_articles` WHERE id_rubrique in (22,54,70,30,19,51))';
|
- |
|
234 |
|
- |
|
235 |
$retour = $this->bdd->executer($requete);
|
- |
|
236 |
echo 'Il y a '.count($retour).' actualités migrées '."--";
|
- |
|
237 |
return $retour;
|
- |
|
238 |
}
|
- |
|
239 |
|
- |
|
240 |
private function migrerActualitesLogo() {
|
- |
|
241 |
$requete = "INSERT INTO ".$this->basewp."term_relationships`(`object_id`, `term_taxonomy_id`)
|
- |
|
242 |
SELECT `id_article`, replace(replace(replace(replace(replace(replace(`id_rubrique`, 22, 20), 54, 21), 30, 23), 19, 24), 51, 25), 70, 22)
|
- |
|
243 |
FROM `spip_articles` WHERE id_rubrique in (22,54,70,30,19,51)";
|
- |
|
244 |
|
- |
|
245 |
$retour = $this->bdd->executer($requete);
|
- |
|
246 |
echo 'Il y a '.count($retour).' actualités migrées '."--";
|
124 |
return ($maj !== false);
|
247 |
return $retour;
|
Line 125... |
Line 248... |
125 |
}
|
248 |
}
|
126 |
|
- |
|
127 |
}
|
249 |
|
- |
|
250 |
}
|