depot v2
This commit is contained in:
241
src/schedule-2.0/scripts/migration/migration.php
Normal file
241
src/schedule-2.0/scripts/migration/migration.php
Normal file
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
|
||||
include("mysql.php");
|
||||
|
||||
$regenuser = true;
|
||||
|
||||
function writeligne($ligne) {
|
||||
echo $ligne."\n";
|
||||
|
||||
}
|
||||
|
||||
function purge($table) {
|
||||
global $bddnew;
|
||||
|
||||
writeligne("$table");
|
||||
$q="DELETE FROM $table";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute();
|
||||
}
|
||||
|
||||
// Test de la connexion à la base
|
||||
try{
|
||||
global $bdd01;
|
||||
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
|
||||
$pdo_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8";
|
||||
$bddold = new PDO("mysql:host=".$dbhost.";dbname=scheduleold",$dblogin,$dbpassword,$pdo_options);
|
||||
}
|
||||
catch (Exception $e){
|
||||
echo "Erreur connection bdd old = ".$dbhost." ".$dblogin." ".$dbpassword."\n";
|
||||
die();
|
||||
}
|
||||
|
||||
// Test de la connexion à la base
|
||||
try{
|
||||
global $bdd01;
|
||||
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
|
||||
$pdo_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8";
|
||||
$bddnew = new PDO("mysql:host=".$dbhost.";dbname=schedule",$dblogin,$dbpassword,$pdo_options);
|
||||
}
|
||||
catch (Exception $e){
|
||||
echo "Erreur connection bdd new\n";
|
||||
die();
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("MIGRATION");
|
||||
|
||||
writeligne("");
|
||||
writeligne("Purge des Tables Scheudle");
|
||||
|
||||
Purge("event");
|
||||
Purge("penalty");
|
||||
Purge("task");
|
||||
Purge("offer");
|
||||
Purge("project");
|
||||
Purge("userjob");
|
||||
|
||||
Purge("user");
|
||||
Purge("service");
|
||||
Purge("nature");
|
||||
Purge("customer");
|
||||
Purge("breakday");
|
||||
Purge("job");
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Customer");
|
||||
$q="SELECT * FROM schedule_customer";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["customer_name"]);
|
||||
$q="INSERT IGNORE INTO customer (id, name, keypass) VALUES (?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["customer_id"],$row["customer_name"],$row["customer_key"]]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Nature");
|
||||
$q="SELECT * FROM schedule_nature";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["nature_name"]);
|
||||
$q="INSERT IGNORE INTO nature (id, name, isvacation) VALUES (?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["nature_id"],$row["nature_name"],false]);
|
||||
}
|
||||
writeligne("Congés");
|
||||
$q="INSERT IGNORE INTO nature (id, name, isvacation) VALUES (?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([-200,"Congés",true]);
|
||||
|
||||
writeligne("Temps Partiel");
|
||||
$q="INSERT IGNORE INTO nature (id, name, isvacation) VALUES (?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([-190,"Temps Partiel",true]);
|
||||
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Service");
|
||||
$q="SELECT * FROM schedule_service";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["service_name"]);
|
||||
$q="INSERT IGNORE INTO service (id, name) VALUES (?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["service_id"],$row["service_name"]]);
|
||||
}
|
||||
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération User");
|
||||
$q="SELECT * FROM schedule_user WHERE user_login!='system'";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
|
||||
writeligne($row["user_login"]);
|
||||
$q="INSERT IGNORE INTO user (id, username, firstname, lastname, email, service_id, apikey, password) VALUES (?,?,?,?,?,?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["user_id"],$row["user_login"],$row["user_firstname"],$row["user_lastname"],$row["user_email"],$row["user_service"],$row["user_login"],"nopassword" ]);
|
||||
|
||||
$output = shell_exec('/var/www/html/schedule/bin/console app:setPassword '.$row["user_login"].' '.$row["user_login"]);
|
||||
|
||||
if($row["user_login"]=="afornerot") $roles='ROLE_ADMIN,ROLE_USER';
|
||||
else {
|
||||
switch($row["user_profil"]) {
|
||||
case 1: $roles='ROLE_ADMIN'; break;
|
||||
case 2: $roles='ROLE_VALIDATOR,ROLE_MASTER,ROLE_USER'; break;
|
||||
case 50: $roles='ROLE_USER'; break;
|
||||
case 99: $roles='ROLE_VISITOR'; break;
|
||||
default: $roles='ROLE_VISITOR'; break;
|
||||
}
|
||||
}
|
||||
$output = shell_exec('/var/www/html/schedule/bin/console app:setRoles '.$row["user_login"].' '.$roles);
|
||||
}
|
||||
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Project");
|
||||
$q="SELECT * FROM schedule_project";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["project_name"]);
|
||||
$q="INSERT IGNORE INTO project (id, name, active, service_id, customer_id ) VALUES (?,?,?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["project_id"],$row["project_name"],$row["project_actif"],$row["project_service"],$row["project_customer"] ]);
|
||||
}
|
||||
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Offer");
|
||||
$q="SELECT * FROM schedule_order";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["order_name"]);
|
||||
$q="INSERT IGNORE INTO offer (id, name, ref, quantity, pu, validate, active, project_id ) VALUES (?,?,?,?,?,?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["order_id"],$row["order_name"],$row["order_ref"],$row["order_quantity"],$row["order_pu"],$row["order_validate"],$row["order_actif"],$row["order_project"] ]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Task");
|
||||
$q="SELECT * FROM schedule_task";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["task_name"]);
|
||||
$nature=$row["task_nature"];
|
||||
if($row["task_id"]<=-70) $nature=-200;
|
||||
if($row["task_id"]==-85 || $row["task_id"]==-70) $nature=-190;
|
||||
$q="INSERT IGNORE INTO task (id, name, color, quantity, validate, project_id, nature_id ) VALUES (?,?,?,?,?,?,?)";
|
||||
$quantity=($row["task_quantity"]==0?null:$row["task_quantity"]);
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["task_id"],$row["task_name"],"#".$row["task_color"],$quantity,$row["task_validate"],$row["task_project"],$nature ]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Event");
|
||||
$q="SELECT * FROM schedule_event";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["event_id"]);
|
||||
$q="INSERT IGNORE INTO event (id, description, start, end, allday, duration, validate, validateholiday, task_id, user_id ) VALUES (?,?,?,?,?,?,?,?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["event_id"],$row["event_description"],$row["event_start"],$row["event_end"],$row["event_allday"],$row["event_duration"],$row["event_validate"],$row["event_validate"],$row["event_task"],$row["event_user"] ]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Penalty");
|
||||
$q="SELECT * FROM schedule_penalty";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["penalty_id"]);
|
||||
$q="INSERT IGNORE INTO penalty (id, description, start, end, allday, duration, validate, task_id, user_id ) VALUES (?,?,?,?,?,?,?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["penalty_id"],$row["penalty_description"],$row["penalty_start"],$row["penalty_end"],$row["penalty_allday"],$row["penalty_duration"],$row["penalty_validate"],$row["penalty_task"],$row["penalty_user"] ]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Breakday");
|
||||
$q="SELECT * FROM schedule_breakday";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["breakday_id"]);
|
||||
$q="INSERT IGNORE INTO breakday (id, start, end ) VALUES (?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["breakday_id"],$row["breakday_start"],$row["breakday_end"] ]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération Job");
|
||||
$q="SELECT * FROM schedule_job";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["job_id"]);
|
||||
$q="INSERT IGNORE INTO job (id, name, type ) VALUES (?,?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["job_id"],$row["job_name"],$row["type"] ]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("== Récupération UserJob");
|
||||
$q="SELECT * FROM schedule_user_jobs WHERE project_id=-100";
|
||||
$queryold=$bddold->prepare($q);
|
||||
$queryold->execute();
|
||||
while($row=$queryold->fetch()) {
|
||||
writeligne($row["user_job_id"]);
|
||||
$q="INSERT IGNORE INTO userjob (user, job ) VALUES (?,?)";
|
||||
$query=$bddnew->prepare($q);
|
||||
$query->execute([$row["user_id"],$row["job_id"] ]);
|
||||
}
|
||||
|
||||
echo "\n\n";
|
4
src/schedule-2.0/scripts/migration/migration.sh
Executable file
4
src/schedule-2.0/scripts/migration/migration.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
php /var/www/html/schedule/scripts/migration/migration.php
|
||||
|
@@ -0,0 +1,41 @@
|
||||
<html>
|
||||
<style>
|
||||
body{
|
||||
font-family: Arial, Hevletica, Sans-serif;
|
||||
}
|
||||
|
||||
img {
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 55px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #2176ad;
|
||||
font-weight: 700;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<center>
|
||||
<img src="/ninegate/bundles/cadolescore/themes/transnum/transnum-logo.png"><br>
|
||||
<h1>TRANSNUM</h1>
|
||||
|
||||
Votre portail Transnum a changé d'adresse.<br><br>
|
||||
Veuillez suivre ce lien pour atteindre votre nouvel espace collaboratif.<br>
|
||||
<a href="/ninegate">https://transnum-portail.ac-dijon.fr</a><br><br>
|
||||
|
||||
<em>Pensez à modifier votre favoris</em><br>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
// Redirection vers la mire d'authentification
|
||||
setTimeout(function(){
|
||||
window.location.href="/ninegate";
|
||||
}, 6000);
|
||||
<script>
|
||||
</html>
|
67
src/schedule-2.0/scripts/migration/migration/install.sh
Executable file
67
src/schedule-2.0/scripts/migration/migration/install.sh
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Installer Ninegate = apt get install eole-ninegate
|
||||
echo " == Installation de ninegate"
|
||||
apt-get install eole-ninegate ninegate-apps --reinstall
|
||||
|
||||
# Recharger les dicos
|
||||
echo " == Recharger les dicos"
|
||||
python -c "from creole.reconfigure import templates;templates()" > /dev/null
|
||||
|
||||
# Désactiver draaf
|
||||
echo " == Désactiver eole-draaf"
|
||||
CreoleSet activer_draaf non > /dev/null 2>&1
|
||||
if [ -f "/var/www/html/eportail/local/config/external.php" ]
|
||||
then
|
||||
mv /var/www/html/eportail/local/config/external.php /root/migration/backup/eportail-external.php
|
||||
fi
|
||||
|
||||
cp -f /root/migration/ldap.php /var/www/html/eportail/local/config/ldap.php
|
||||
|
||||
# Activer Ninegate
|
||||
echo " == Activer ninegate"
|
||||
CreoleSet activer_ninegate oui > /dev/null 2>&1
|
||||
CreoleSet ninegate_masteridentity SQL > /dev/null 2>&1
|
||||
CreoleSet ninegate_mode_auth CAS > /dev/null 2>&1
|
||||
|
||||
CreoleSet ninegate_syncldap oui > /dev/null 2>&1
|
||||
CreoleSet ninegate_pwdadmin cadoles > /dev/null 2>&1
|
||||
CreoleSet ninegate_organization draaf > /dev/null 2>&1
|
||||
CreoleSet ninegate_niveau01branche services > /dev/null 2>&1
|
||||
CreoleSet ninegate_niveau02branche establishments > /dev/null 2>&1
|
||||
CreoleSet ninegate_niveau01name DRAAF > /dev/null 2>&1
|
||||
CreoleSet ninegate_niveau01siren 130007107 > /dev/null 2>&1
|
||||
|
||||
CreoleSet ninegate_niveau01label Département > /dev/null 2>&1
|
||||
CreoleSet ninegate_niveau01labels Départements > /dev/null 2>&1
|
||||
CreoleSet ninegate_niveau02view oui > /dev/null 2>&1
|
||||
CreoleSet ninegate_niveau02label Localisation > /dev/null 2>&1
|
||||
CreoleSet ninegate_niveau02labels Localisations > /dev/null 2>&1
|
||||
|
||||
CreoleSet ninegate_moderegistration byadmin > /dev/null 2>&1
|
||||
|
||||
CreoleSet ninegate_noreply noreply@ac-dijon.fr > /dev/null 2>&1
|
||||
CreoleSet ninegate_smtphost smtp.ac-dijon.fr > /dev/null 2>&1
|
||||
CreoleSet ninegate_smtpport 25 > /dev/null 2>&1
|
||||
CreoleSet ninegate_smtpencryption null > /dev/null 2>&1
|
||||
CreoleSet ninegate_smtpauthmode null > /dev/null 2>&1
|
||||
|
||||
# Désactiver cron ninegate
|
||||
CreoleSet ninegate_activate_cron non > /dev/null 2>&1
|
||||
|
||||
# Nettoyage eole-draaf
|
||||
echo " == Nettoyage eole-draaf"
|
||||
rm -rf /usr/share/eole/postservice/90-draaf
|
||||
if [ -d "/var/www/html/draaf" ]
|
||||
then
|
||||
mv /var/www/html/draaf /root/migration/backup/
|
||||
fi
|
||||
|
||||
# Reconfigure
|
||||
echo " == genconfig = configurez ninegate"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
6
src/schedule-2.0/scripts/migration/migration/ldap.php
Normal file
6
src/schedule-2.0/scripts/migration/migration/ldap.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?
|
||||
|
||||
$config['LDAPwriterdn'] = "";
|
||||
$config['LDAPwriterpw'] = "";
|
||||
|
||||
?>
|
356
src/schedule-2.0/scripts/migration/migration/migration.php
Normal file
356
src/schedule-2.0/scripts/migration/migration/migration.php
Normal file
@@ -0,0 +1,356 @@
|
||||
<?php
|
||||
|
||||
include("mysql.php");
|
||||
|
||||
$regenuser = true;
|
||||
|
||||
function writeligne($ligne) {
|
||||
echo $ligne."\n";
|
||||
|
||||
}
|
||||
|
||||
function purge($table) {
|
||||
global $bddnine01;
|
||||
|
||||
writeligne("$table");
|
||||
$q="DELETE FROM $table";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute();
|
||||
}
|
||||
|
||||
function findicon($icon) {
|
||||
global $bddnine01;
|
||||
|
||||
$q="SELECT * FROM icon WHERE label=?";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$icon]);
|
||||
if($row=$query->fetch())
|
||||
return $row["id"];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function matchicon($imgid) {
|
||||
global $bddeportail01;
|
||||
|
||||
$q="SELECT * FROM env_icon WHERE icon_id=?";
|
||||
$query=$bddeportail01->prepare($q);
|
||||
$query->execute([$imgid]);
|
||||
if($row=$query->fetch()) {
|
||||
switch($row["icon_url"]) {
|
||||
case "00-envole107.png" : return findicon("uploads/icon/icon_crossroads.png"); break;
|
||||
case "00-taskfreak.png" : return findicon("uploads/icon/icon_gear.png"); break;
|
||||
case "00-envole027.png" : return findicon("uploads/icon/icon_stack.png"); break;
|
||||
case "00-envole007.png" : return findicon("uploads/icon/icon_calendar.png"); break;
|
||||
case "00-envole006.png" : return findicon("uploads/icon/icon_calendar.png"); break;
|
||||
case "00-ethercalc.png" : return findicon("uploads/icon/icon_browser.png"); break;
|
||||
case "00-envole050.png" : return findicon("uploads/icon/icon_clipboard.png"); break;
|
||||
case "00-envole029.png" : return findicon("uploads/icon/icon_check.png"); break;
|
||||
case "00-opensondage.png" : return findicon("uploads/icon/icon_clipboard.png"); break;
|
||||
case "00-envole002.jpg" : return findicon("uploads/icon/icon_traffic.png"); break;
|
||||
case "00-envole004.png" : return findicon("uploads/icon/icon_booklet.png"); break;
|
||||
case "00-envole093.png" : return findicon("uploads/icon/icon_star.png"); break;
|
||||
case "00-envole154.png" : return findicon("uploads/icon/icon_microphone.png"); break;
|
||||
case "00-phpldapadmin.png" : return findicon("uploads/icon/icon_users.png"); break;
|
||||
case "00-envole129.png" : return findicon("uploads/icon/icon_brightness.png"); break;
|
||||
case "00-url.jpg" : return findicon("uploads/icon/icon_globe.png"); break;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Test de la connexion à la base
|
||||
try{
|
||||
global $bdd01;
|
||||
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
|
||||
$pdo_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8";
|
||||
$bdddraaf01 = new PDO("mysql:host=".$dbhost.";dbname=draaf",$dblogin,$dbpassword,$pdo_options);
|
||||
}
|
||||
catch (Exception $e){
|
||||
echo "Erreur connection bdd";
|
||||
die();
|
||||
}
|
||||
|
||||
// Test de la connexion à la base
|
||||
try{
|
||||
global $bdd01;
|
||||
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
|
||||
$pdo_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8";
|
||||
$bddnine01 = new PDO("mysql:host=".$dbhost.";dbname=ninegate",$dblogin,$dbpassword,$pdo_options);
|
||||
}
|
||||
catch (Exception $e){
|
||||
echo "Erreur connection bdd";
|
||||
die();
|
||||
}
|
||||
|
||||
// Test de la connexion à la base
|
||||
try{
|
||||
global $bdd01;
|
||||
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
|
||||
$pdo_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES utf8";
|
||||
$bddeportail01 = new PDO("mysql:host=".$dbhost.";dbname=eportail",$dblogin,$dbpassword,$pdo_options);
|
||||
}
|
||||
catch (Exception $e){
|
||||
echo "Erreur connection bdd";
|
||||
die();
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("MIGRATION");
|
||||
|
||||
writeligne("");
|
||||
writeligne("Purge des Tables Ninegate");
|
||||
|
||||
Purge("alertgroupe");
|
||||
Purge("alert");
|
||||
Purge("alertcategory");
|
||||
|
||||
Purge("blogarticle");
|
||||
Purge("bloggroupe");
|
||||
Purge("blogwriter");
|
||||
Purge("blog");
|
||||
|
||||
Purge("bookmark");
|
||||
|
||||
Purge("calendareventgroupe");
|
||||
Purge("calendarevent");
|
||||
|
||||
Purge("calendargroupe");
|
||||
Purge("calendar");
|
||||
|
||||
Purge("fluxgroupe");
|
||||
Purge("flux");
|
||||
|
||||
Purge("itemniveau01");
|
||||
Purge("itemgroupe");
|
||||
Purge("item");
|
||||
Purge("itemcategory");
|
||||
|
||||
|
||||
Purge("noticeuser");
|
||||
Purge("notice");
|
||||
Purge("slide");
|
||||
|
||||
Purge("pagewidget");
|
||||
Purge("pagegroupe");
|
||||
Purge("page");
|
||||
|
||||
if($regenuser) {
|
||||
Purge("usergroupe");
|
||||
Purge("usermodo");
|
||||
|
||||
Purge("registration");
|
||||
Purge("user");
|
||||
Purge("niveau02");
|
||||
Purge("niveau01");
|
||||
|
||||
Purge("groupe");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if($regenuser) {
|
||||
|
||||
writeligne("");
|
||||
writeligne("Récupération Liste Blanche");
|
||||
$q="SELECT * FROM whitelist";
|
||||
$querydraaf=$bdddraaf01->prepare($q);
|
||||
$querydraaf->execute();
|
||||
while($row=$querydraaf->fetch()) {
|
||||
writeligne($row["label"]);
|
||||
$q="INSERT IGNORE INTO whitelist (id, label) VALUES (?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$row["id"],$row["label"]]);
|
||||
}
|
||||
|
||||
|
||||
writeligne("");
|
||||
writeligne("Récupération Niveau 01");
|
||||
$q="SELECT * FROM service";
|
||||
$querydraaf=$bdddraaf01->prepare($q);
|
||||
$querydraaf->execute();
|
||||
while($row=$querydraaf->fetch()) {
|
||||
writeligne($row["label"]);
|
||||
$q="INSERT IGNORE INTO niveau01 (id, label, siren,showsubappname) VALUES (?,?,?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$showsubappname=($row["label"]!="Autres");
|
||||
$query->execute([$row["id"],$row["label"],$row["siren"],$showsubappname]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("Récupération Niveau 02");
|
||||
$q="SELECT * FROM establishment";
|
||||
$querydraaf=$bdddraaf01->prepare($q);
|
||||
$querydraaf->execute();
|
||||
while($row=$querydraaf->fetch()) {
|
||||
writeligne($row["label"]);
|
||||
$q="INSERT IGNORE INTO niveau02 (id, label, siret, postaladress, niveau01_id) VALUES (?,?,?,?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$row["id"],$row["label"],$row["siret"],$row["postaladress"],$row["service_id"]]);
|
||||
}
|
||||
|
||||
|
||||
writeligne("");
|
||||
writeligne("Récupération Groupe");
|
||||
$q="SELECT * FROM groupe";
|
||||
$querydraaf=$bdddraaf01->prepare($q);
|
||||
$querydraaf->execute();
|
||||
while($row=$querydraaf->fetch()) {
|
||||
writeligne($row["label"]);
|
||||
$q="INSERT IGNORE INTO groupe (id, label, fgopen, fgall, fgcancreatepage, fgcancreateblog, fgcancreatecalendar, fgtemplate, fgcanshare) VALUES (?,?,?,?,?,?,?,?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
if($row["fgall"])
|
||||
$query->execute([$row["id"],$row["label"],$row["fgopen"],$row["fgall"],1,1,1,0,0]);
|
||||
else
|
||||
$query->execute([$row["id"],$row["label"],$row["fgopen"],$row["fgall"],0,0,0,0,0]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("Récupération User");
|
||||
$q="SELECT * FROM user";
|
||||
$querydraaf=$bdddraaf01->prepare($q);
|
||||
$querydraaf->execute();
|
||||
while($row=$querydraaf->fetch()) {
|
||||
// copy de l'avatar
|
||||
if($row["avatar"]!="noavatar.png") {
|
||||
if(file_exists("/root/migration/backup/draaf/web/uploads/avatar/".$row["avatar"]))
|
||||
copy("/root/migration/backup/draaf/web/uploads/avatar/".$row["avatar"],"/var/www/html/ninegate/web/uploads/avatar/".$row["avatar"]);
|
||||
else
|
||||
$row["avatar"]="noavatar.png";
|
||||
}
|
||||
|
||||
writeligne($row["username"]);
|
||||
$q="INSERT IGNORE INTO user (id,birthcountry_id,birthplace_id,niveau01_id,niveau02_id,username,firstname,lastname,email,visible,role,authlevel,siren,siret,usualname,telephonenumber,postaladress,givensname,birthdate,gender,job,position,keyexpire,keyvalue,belongingpopulation,avatar,password,salt) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$row["email"]=$row["id"]."@noreplay.fr";
|
||||
$query->execute([$row["id"],$row["birthcountry_id"],$row["birthplace_id"],$row["service_id"],$row["establishment_id"],$row["username"],$row["firstname"],$row["lastname"],$row["email"],$row["visible"],$row["role"],$row["authlevel"],$row["siren"],$row["siret"],$row["usualname"],$row["telephonenumber"],$row["postaladress"],$row["givensname"],$row["birthdate"],$row["gender"],$row["job"],$row["position"],$row["keyexpire"],$row["keyvalue"],$row["belongingpopulation"],$row["avatar"],$row["password"],"salt"]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("Récupération User Groupe");
|
||||
$q="SELECT * FROM usergroupe";
|
||||
$querydraaf=$bdddraaf01->prepare($q);
|
||||
$querydraaf->execute();
|
||||
while($row=$querydraaf->fetch()) {
|
||||
$q="INSERT IGNORE INTO usergroupe (id, user_id, group_id) VALUES (?,?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$row["id"],$row["user_id"],$row["group_id"]]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("Récupération User Modo");
|
||||
$q="SELECT * FROM usermodo";
|
||||
$querydraaf=$bdddraaf01->prepare($q);
|
||||
$querydraaf->execute();
|
||||
while($row=$querydraaf->fetch()) {
|
||||
$q="INSERT IGNORE INTO usermodo (id, user_id, niveau01_id) VALUES (?,?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$row["id"],$row["user_id"],$row["service_id"]]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
writeligne("");
|
||||
writeligne("Récupération Item Category");
|
||||
$q="SELECT * FROM env_application_categorie";
|
||||
$queryeportail=$bddeportail01->prepare($q);
|
||||
$queryeportail->execute();
|
||||
while($row=$queryeportail->fetch()) {
|
||||
writeligne($row["application_categorie_label"]);
|
||||
$q="INSERT INTO itemcategory (id, label, roworder) VALUES (?,?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$row["application_categorie_id"],$row["application_categorie_label"],$row["application_categorie_order"]]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("Récupération Item");
|
||||
$q="SELECT * FROM env_application";
|
||||
$queryeportail=$bddeportail01->prepare($q);
|
||||
$queryeportail->execute();
|
||||
while($row=$queryeportail->fetch()) {
|
||||
// On bypasse les items liés à eportail
|
||||
$url=urldecode($row["application_url"]);
|
||||
if(strpos($url,"/eportail")!==false) continue;
|
||||
if(strpos($url,"/genconfig")!==false) continue;
|
||||
if(strpos($url,"4200/connect/")!==false) continue;
|
||||
|
||||
//index.php?view=user/calendar.php&idcalsel=1
|
||||
writeligne($row["application_label"]." = ".$url);
|
||||
|
||||
switch($row["application_open"]) {
|
||||
case 0 : $target="frame"; break;
|
||||
case 1 : $target="_blank"; break;
|
||||
default: $target="_blank"; break;
|
||||
}
|
||||
|
||||
$q="INSERT INTO item (id, category, title, subtitle, url, target, content, rowOrder, protected,color,icon_id) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$row["application_id"],$row["application_categorie"],$row["application_label"],null,$url,$target,$row["application_description"],$row["application_order"],false,$row["application_color"],matchicon($row["application_icon"])]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("Rattachement Item Role");
|
||||
$q="SELECT * FROM env_application_profil WHERE application_profil_profil=1";
|
||||
$queryeportail=$bddeportail01->prepare($q);
|
||||
$queryeportail->execute();
|
||||
while($row=$queryeportail->fetch()) {
|
||||
$q="UPDATE item SET roles=? WHERE item.id=?";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute(['a:1:{i:0;s:10:"ROLE_ADMIN";}',$row["application_profil_application"]]);
|
||||
}
|
||||
|
||||
writeligne("");
|
||||
writeligne("Rattachement Item Niveau01");
|
||||
$q="SELECT * FROM env_group, env_application_group WHERE group_name LIKE ('SERVICE = %') AND group_id=application_group_group";
|
||||
$queryeportail=$bddeportail01->prepare($q);
|
||||
$queryeportail->execute();
|
||||
while($row=$queryeportail->fetch()) {
|
||||
// Recherche de l'item
|
||||
$q="SELECT * FROM item WHERE id=?";
|
||||
$querynine=$bddnine01->prepare($q);
|
||||
$querynine->execute([$row["application_group_application"]]);
|
||||
if($rownine=$querynine->fetch()) {
|
||||
// Recherche du niveau01 DRAAF
|
||||
$niveau01=str_replace("SERVICE = ","",$row["group_name"]);
|
||||
$q="SELECT * FROM niveau01 WHERE label=?";
|
||||
$querynine=$bddnine01->prepare($q);
|
||||
$querynine->execute([$niveau01]);
|
||||
|
||||
if($rownine=$querynine->fetch()) {
|
||||
$q="INSERT INTO itemniveau01 (item, niveau01) VALUES (?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$row["application_group_application"],$rownine["id"]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
writeligne("");
|
||||
writeligne("Rattachement Item Group");
|
||||
$q="SELECT * FROM env_group, env_application_group WHERE group_name LIKE ('GROUPE = %') AND group_id=application_group_group";
|
||||
$queryeportail=$bddeportail01->prepare($q);
|
||||
$queryeportail->execute();
|
||||
while($row=$queryeportail->fetch()) {
|
||||
// Recherche de l'item
|
||||
$q="SELECT * FROM item WHERE id=?";
|
||||
$querynine=$bddnine01->prepare($q);
|
||||
$querynine->execute([$row["application_group_application"]]);
|
||||
if($rownine=$querynine->fetch()) {
|
||||
// Recherche du niveau01 DRAAF
|
||||
$niveau01=str_replace("GROUPE = ","",$row["group_name"]);
|
||||
$q="SELECT * FROM groupe WHERE label=?";
|
||||
$querynine=$bddnine01->prepare($q);
|
||||
$querynine->execute([$niveau01]);
|
||||
|
||||
if($rownine=$querynine->fetch()) {
|
||||
writeligne($rownine["label"]." ".$row["application_group_application"]);
|
||||
$q="INSERT INTO itemgroupe (item, groupe) VALUES (?,?)";
|
||||
$query=$bddnine01->prepare($q);
|
||||
$query->execute([$row["application_group_application"],$rownine["id"]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
30
src/schedule-2.0/scripts/migration/migration/migration.sh
Executable file
30
src/schedule-2.0/scripts/migration/migration/migration.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Migration draaf et eportail dans ninegate
|
||||
echo " == Migration draaf et eportail dans ninegate"
|
||||
dbhost=$(CreoleGet edb_host non)
|
||||
if [ $dbhost == "non" ]
|
||||
then
|
||||
dbhost="localhost"
|
||||
dblogin="admin"
|
||||
dbpwd="eole"
|
||||
else
|
||||
dblogin=$(CreoleGet edb_root)
|
||||
dbpwd=`more /root/.mysql`
|
||||
fi
|
||||
|
||||
echo "<?php" > /root/migration/mysql.php
|
||||
echo "\$dbhost = '$dbhost';" >> /root/migration/mysql.php
|
||||
echo "\$dblogin = '$dblogin';" >> /root/migration/mysql.php
|
||||
echo "\$dbpassword = '$dbpwd';" >> /root/migration/mysql.php
|
||||
php /root/migration/migration.php
|
||||
/usr/share/eole/postservice/90-ninegate
|
||||
|
||||
# On réactive le cron ninegate
|
||||
echo " == Activation cron ninegate"
|
||||
CreoleSet ninegate_activate_cron oui > /dev/null 2>&1
|
||||
CreoleCat -t ninegate-template.yml
|
||||
|
||||
|
||||
echo " == Synchronisation annuaire"
|
||||
php /var/www/html/ninegate/bin/console Core:Synchro false
|
4
src/schedule-2.0/scripts/migration/migration/mysql.php
Normal file
4
src/schedule-2.0/scripts/migration/migration/mysql.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$dbhost = 'localhost';
|
||||
$dblogin = 'admin';
|
||||
$dbpassword = 'eole';
|
4
src/schedule-2.0/scripts/migration/mysql.php
Normal file
4
src/schedule-2.0/scripts/migration/mysql.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$dbhost = 'localhost';
|
||||
$dblogin = 'root';
|
||||
$dbpassword = 'eole';
|
Reference in New Issue
Block a user