Convert accent from html to utf8 when migrating
This commit is contained in:
parent
d30b6d6f7b
commit
a4dd36d1bc
|
@ -84,10 +84,8 @@ CREATE TABLE IF NOT EXISTS `' . Utils::table('poll') . '` (
|
||||||
}
|
}
|
||||||
|
|
||||||
private function migrateFromSondageToPoll(\PDO $pdo) {
|
private function migrateFromSondageToPoll(\PDO $pdo) {
|
||||||
$pdo->exec('
|
$select = $pdo->query('
|
||||||
INSERT INTO `' . Utils::table('poll') . '`
|
SELECT
|
||||||
(`id`, `admin_id`, `title`, `description`, `admin_name`, `admin_mail`, `creation_date`, `end_date`, `format`, `editable`, `receiveNewVotes`, `active`)
|
|
||||||
SELECT
|
|
||||||
`id_sondage`,
|
`id_sondage`,
|
||||||
`id_sondage_admin`,
|
`id_sondage_admin`,
|
||||||
`titre`,
|
`titre`,
|
||||||
|
@ -105,6 +103,28 @@ INSERT INTO `' . Utils::table('poll') . '`
|
||||||
WHEN \'-\' THEN 0
|
WHEN \'-\' THEN 0
|
||||||
ELSE 1 END AS `active`
|
ELSE 1 END AS `active`
|
||||||
FROM sondage');
|
FROM sondage');
|
||||||
|
|
||||||
|
$insert = $pdo->prepare('
|
||||||
|
INSERT INTO `' . Utils::table('poll') . '`
|
||||||
|
(`id`, `admin_id`, `title`, `description`, `admin_name`, `admin_mail`, `creation_date`, `end_date`, `format`, `editable`, `receiveNewVotes`, `active`)
|
||||||
|
VALUE (?,?,?,?,?,?,?,?,?,?,?,?)');
|
||||||
|
|
||||||
|
while ($row = $select->fetch(\PDO::FETCH_OBJ)) {
|
||||||
|
$insert->execute([
|
||||||
|
$row->id_sondage,
|
||||||
|
$row->id_sondage_admin,
|
||||||
|
html_entity_decode($row->titre),
|
||||||
|
html_entity_decode($row->commentaires),
|
||||||
|
html_entity_decode($row->nom_admin),
|
||||||
|
html_entity_decode($row->mail_admin),
|
||||||
|
$row->date_creation,
|
||||||
|
$row->date_fin,
|
||||||
|
$row->format,
|
||||||
|
$row->editable,
|
||||||
|
$row->mailsonde,
|
||||||
|
$row->active
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createSlotTable(\PDO $pdo) {
|
private function createSlotTable(\PDO $pdo) {
|
||||||
|
@ -152,14 +172,24 @@ CREATE TABLE IF NOT EXISTS `' . Utils::table('comment') . '` (
|
||||||
}
|
}
|
||||||
|
|
||||||
private function migrateFromCommentsToComment(\PDO $pdo) {
|
private function migrateFromCommentsToComment(\PDO $pdo) {
|
||||||
$pdo->exec('
|
$select = $pdo->query('
|
||||||
INSERT INTO `' . Utils::table('comment') . '`
|
SELECT
|
||||||
(`poll_id`, `name`, `comment`)
|
|
||||||
SELECT
|
|
||||||
`id_sondage`,
|
`id_sondage`,
|
||||||
`usercomment`,
|
`usercomment`,
|
||||||
`comment`
|
`comment`
|
||||||
FROM `comments`');
|
FROM `comments`');
|
||||||
|
|
||||||
|
$insert = $pdo->prepare('
|
||||||
|
INSERT INTO `' . Utils::table('comment') . '` (`poll_id`, `name`, `comment`)
|
||||||
|
VALUE (?,?,?)');
|
||||||
|
|
||||||
|
while ($row = $select->fetch(\PDO::FETCH_OBJ)) {
|
||||||
|
$insert->execute([
|
||||||
|
$row->id_sondage,
|
||||||
|
html_entity_decode($row->usercomment),
|
||||||
|
html_entity_decode($row->comment)
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createVoteTable(\PDO $pdo) {
|
private function createVoteTable(\PDO $pdo) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user