1<#4183> 2<?php 3 if (!$ilDB->tableColumnExists('il_poll', 'result_sort')) { 4 $ilDB->addTableColumn('il_poll', 'result_sort', array( 5 "type" => "integer", 6 "notnull" => true, 7 "length" => 1, 8 "default" => 0 9 )); 10 } 11?> 12<#4184> 13<?php 14 if (!$ilDB->tableColumnExists('il_poll', 'non_anon')) { 15 $ilDB->addTableColumn('il_poll', 'non_anon', array( 16 "type" => "integer", 17 "notnull" => true, 18 "length" => 1, 19 "default" => 0 20 )); 21 } 22?> 23<#4185> 24<?php 25 26if (!$ilDB->tableColumnExists('il_blog', 'abs_shorten')) { 27 $ilDB->addTableColumn( 28 'il_blog', 29 'abs_shorten', 30 array( 31 'type' => 'integer', 32 'length' => 1, 33 'notnull' => false, 34 'default' => 0 35 ) 36 ); 37} 38 39if (!$ilDB->tableColumnExists('il_blog', 'abs_shorten_len')) { 40 $ilDB->addTableColumn( 41 'il_blog', 42 'abs_shorten_len', 43 array( 44 'type' => 'integer', 45 'length' => 2, 46 'notnull' => false, 47 'default' => 0 48 ) 49 ); 50} 51 52if (!$ilDB->tableColumnExists('il_blog', 'abs_image')) { 53 $ilDB->addTableColumn( 54 'il_blog', 55 'abs_image', 56 array( 57 'type' => 'integer', 58 'length' => 1, 59 'notnull' => false, 60 'default' => 0 61 ) 62 ); 63} 64 65if (!$ilDB->tableColumnExists('il_blog', 'abs_img_width')) { 66 $ilDB->addTableColumn( 67 'il_blog', 68 'abs_img_width', 69 array( 70 'type' => 'integer', 71 'length' => 2, 72 'notnull' => false, 73 'default' => 0 74 ) 75 ); 76} 77 78if (!$ilDB->tableColumnExists('il_blog', 'abs_img_height')) { 79 $ilDB->addTableColumn( 80 'il_blog', 81 'abs_img_height', 82 array( 83 'type' => 'integer', 84 'length' => 2, 85 'notnull' => false, 86 'default' => 0 87 ) 88 ); 89} 90 91?> 92<#4186> 93<?php 94 $ilCtrlStructureReader->getStructure(); 95?> 96<#4187> 97<?php 98 99if (!$ilDB->tableExists('usr_data_multi')) { 100 $ilDB->createTable('usr_data_multi', array( 101 'usr_id' => array( 102 'type' => 'integer', 103 'length' => 4, 104 'notnull' => true, 105 'default' => 0 106 ), 107 'field_id' => array( 108 'type' => 'text', 109 'length' => 255, 110 'notnull' => true 111 ), 112 'value' => array( 113 'type' => 'text', 114 'length' => 1000, 115 'notnull' => false, 116 ) 117 )); 118} 119 120?> 121<#4188> 122<?php 123 124// #12845 125$set = $ilDB->query("SELECT od.owner, prtf.id prtf_id, pref.value public" . 126 ", MIN(acl.object_id) acl_type" . 127 " FROM usr_portfolio prtf" . 128 " JOIN object_data od ON (od.obj_id = prtf.id" . 129 " AND od.type = " . $ilDB->quote("prtf", "text") . ")" . 130 " LEFT JOIN usr_portf_acl acl ON (acl.node_id = prtf.id)" . 131 " LEFT JOIN usr_pref pref ON (pref.usr_id = od.owner" . 132 " AND pref.keyword = " . $ilDB->quote("public_profile", "text") . ")" . 133 " WHERE prtf.is_default = " . $ilDB->quote(1, "integer") . 134 " GROUP BY od.owner, prtf.id, pref.value"); 135while ($row = $ilDB->fetchAssoc($set)) { 136 $acl_type = (int) $row["acl_type"]; 137 $pref = trim($row["public"]); 138 $user_id = (int) $row["owner"]; 139 $prtf_id = (int) $row["prtf_id"]; 140 141 if (!$user_id || !$prtf_id) { // #12862 142 continue; 143 } 144 145 // portfolio is not published, remove as profile 146 if ($acl_type >= 0) { 147 $ilDB->manipulate("UPDATE usr_portfolio" . 148 " SET is_default = " . $ilDB->quote(0, "integer") . 149 " WHERE id = " . $ilDB->quote($prtf_id, "integer")); 150 $new_pref = "n"; 151 } 152 // check if portfolio sharing matches user preference 153 else { 154 // registered vs. published 155 $new_pref = ($acl_type < -1) 156 ? "g" 157 : "y"; 158 } 159 160 if ($pref) { 161 if ($pref != $new_pref) { 162 $ilDB->manipulate("UPDATE usr_pref" . 163 " SET value = " . $ilDB->quote($new_pref, "text") . 164 " WHERE usr_id = " . $ilDB->quote($user_id, "integer") . 165 " AND keyword = " . $ilDB->quote("public_profile", "text")); 166 } 167 } else { 168 $ilDB->manipulate("INSERT INTO usr_pref (usr_id, keyword, value) VALUES" . 169 " (" . $ilDB->quote($user_id, "integer") . 170 ", " . $ilDB->quote("public_profile", "text") . 171 ", " . $ilDB->quote($new_pref, "text") . ")"); 172 } 173} 174 175?> 176 177<#4189> 178<?php 179$ilDB->modifyTableColumn( 180 'object_data', 181 'title', 182 array( 183 "type" => "text", 184 "length" => 255, 185 "notnull" => false, 186 'fixed' => true 187 ) 188 ); 189?> 190 191<#4190> 192<?php 193 194$ilDB->modifyTableColumn( 195 'usr_pwassist', 196 'pwassist_id', 197 array( 198 "type" => "text", 199 "length" => 180, 200 "notnull" => true, 201 'fixed' => true 202 ) 203 ); 204?> 205 206<#4191> 207<?php 208if (!$ilDB->tableColumnExists('tst_active', 'last_finished_pass')) { 209 $ilDB->addTableColumn('tst_active', 'last_finished_pass', array( 210 'type' => 'integer', 211 'length' => 4, 212 'notnull' => false, 213 'default' => null 214 )); 215} 216?> 217 218<#4192> 219<?php 220 221if (!$ilDB->uniqueConstraintExists('tst_pass_result', array('active_fi', 'pass'))) { 222 $groupRes = $ilDB->query(" 223 SELECT COUNT(*), active_fi, pass FROM tst_pass_result GROUP BY active_fi, pass HAVING COUNT(*) > 1 224 "); 225 226 $ilSetting = new ilSetting(); 227 228 $setting = $ilSetting->get('tst_passres_dupl_del_warning', 0); 229 230 while ($groupRow = $ilDB->fetchAssoc($groupRes)) { 231 if (!$setting) { 232 $ilSetting->set('tst_passres_dupl_del_warning', 1); 233 setup_exit(" 234 235 Dear Administrator, 236 237 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 238 239 The update process has been stopped due to data security reasons. 240 A Bug has let to duplicate datasets in tst_pass_result table. 241 Duplicates have been detected in your installation. 242 243 Please have a look at: http://www.ilias.de/mantis/view.php?id=12904 244 245 You have the opportunity to review the data in question and apply 246 manual fixes on your own risk. 247 248 If you try to rerun the update process, this warning will be skipped. 249 The duplicates will be removed automatically by the criteria documented at Mantis #12904 250 251 Best regards, 252 The Test Maintainers 253 "); 254 } 255 256 $dataRes = $ilDB->queryF( 257 "SELECT * FROM tst_pass_result WHERE active_fi = %s AND pass = %s ORDER BY tstamp ASC", 258 array('integer', 'integer'), 259 array($groupRow['active_fi'], $groupRow['pass']) 260 ); 261 262 $passResults = array(); 263 $latestTimstamp = 0; 264 265 while ($dataRow = $ilDB->fetchAssoc($dataRes)) { 266 if ($latestTimstamp < $dataRow['tstamp']) { 267 $latestTimstamp = $dataRow['tstamp']; 268 $passResults = array(); 269 } 270 271 $passResults[] = $dataRow; 272 } 273 274 $bestPointsRatio = 0; 275 $bestPassResult = null; 276 277 foreach ($passResults as $passResult) { 278 if ($passResult['maxpoints'] > 0) { 279 $pointsRatio = $passResult['points'] / $passResult['maxpoints']; 280 } else { 281 $pointsRatio = 0; 282 } 283 284 if ($bestPointsRatio <= $pointsRatio) { 285 $bestPointsRatio = $pointsRatio; 286 $bestPassResult = $passResult; 287 } 288 } 289 290 $dataRes = $ilDB->manipulateF( 291 "DELETE FROM tst_pass_result WHERE active_fi = %s AND pass = %s", 292 array('integer', 'integer'), 293 array($groupRow['active_fi'], $groupRow['pass']) 294 ); 295 296 $ilDB->insert('tst_pass_result', array( 297 'active_fi' => array('integer', $bestPassResult['active_fi']), 298 'pass' => array('integer', $bestPassResult['pass']), 299 'points' => array('float', $bestPassResult['points']), 300 'maxpoints' => array('float', $bestPassResult['maxpoints']), 301 'questioncount' => array('integer', $bestPassResult['questioncount']), 302 'answeredquestions' => array('integer', $bestPassResult['answeredquestions']), 303 'workingtime' => array('integer', $bestPassResult['workingtime']), 304 'tstamp' => array('integer', $bestPassResult['tstamp']), 305 'hint_count' => array('integer', $bestPassResult['hint_count']), 306 'hint_points' => array('float', $bestPassResult['hint_points']), 307 'obligations_answered' => array('integer', $bestPassResult['obligations_answered']), 308 'exam_id' => array('text', $bestPassResult['exam_id']) 309 )); 310 } 311 312 $ilDB->addUniqueConstraint('tst_pass_result', array('active_fi', 'pass')); 313} 314 315?> 316 317<#4193> 318<?php 319if (!$ilDB->uniqueConstraintExists('tst_sequence', array('active_fi', 'pass'))) { 320 $groupRes = $ilDB->query(" 321 SELECT COUNT(*), active_fi, pass FROM tst_sequence GROUP BY active_fi, pass HAVING COUNT(*) > 1 322 "); 323 324 $ilSetting = new ilSetting(); 325 326 $setting = $ilSetting->get('tst_seq_dupl_del_warning', 0); 327 328 while ($groupRow = $ilDB->fetchAssoc($groupRes)) { 329 if (!$setting) { 330 $ilSetting->set('tst_seq_dupl_del_warning', 1); 331 setup_exit(" 332 333 Dear Administrator, 334 335 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 336 337 The update process has been stopped due to data security reasons. 338 A Bug has let to duplicate datasets in tst_sequence table. 339 Duplicates have been detected in your installation. 340 341 Please have a look at: http://www.ilias.de/mantis/view.php?id=12904 342 343 You have the opportunity to review the data in question and apply 344 manual fixes on your own risk. 345 346 If you try to rerun the update process, this warning will be skipped. 347 The duplicates will be removed automatically by the criteria documented at Mantis #12904 348 349 Best regards, 350 The Test Maintainers 351 "); 352 } 353 354 $dataRes = $ilDB->queryF( 355 "SELECT * FROM tst_sequence WHERE active_fi = %s AND pass = %s ORDER BY tstamp DESC", 356 array('integer', 'integer'), 357 array($groupRow['active_fi'], $groupRow['pass']) 358 ); 359 360 while ($dataRow = $ilDB->fetchAssoc($dataRes)) { 361 $ilDB->manipulateF( 362 "DELETE FROM tst_sequence WHERE active_fi = %s AND pass = %s", 363 array('integer', 'integer'), 364 array($groupRow['active_fi'], $groupRow['pass']) 365 ); 366 367 $ilDB->insert('tst_sequence', array( 368 'active_fi' => array('integer', $dataRow['active_fi']), 369 'pass' => array('integer', $dataRow['pass']), 370 'sequence' => array('text', $dataRow['sequence']), 371 'postponed' => array('text', $dataRow['postponed']), 372 'hidden' => array('text', $dataRow['hidden']), 373 'tstamp' => array('integer', $dataRow['tstamp']) 374 )); 375 376 break; 377 } 378 } 379 380 $ilDB->addUniqueConstraint('tst_sequence', array('active_fi', 'pass')); 381} 382?> 383 384<#4194> 385<?php 386 387 $ilDB->dropIndexByFields('cal_auth_token', array('user_id')); 388 389?> 390 391<#4195> 392<?php 393 394 if (!$ilDB->indexExistsByFields('cal_shared', array('obj_id','obj_type'))) { 395 $ilDB->addIndex('cal_shared', array('obj_id','obj_type'), 'i1'); 396 } 397?> 398<#4196> 399<?php 400 401 $ilDB->dropIndexByFields('cal_entry_responsible', array('cal_id','user_id')); 402 $ilDB->addPrimaryKey('cal_entry_responsible', array('cal_id','user_id')); 403?> 404<#4197> 405<?php 406 407 $ilDB->dropIndexByFields('cal_entry_responsible', array('cal_id')); 408 $ilDB->dropIndexByFields('cal_entry_responsible', array('user_id')); 409 410?> 411<#4198> 412<?php 413 414 $ilDB->dropIndexByFields('cal_cat_assignments', array('cal_id','cat_id')); 415 $ilDB->addPrimaryKey('cal_cat_assignments', array('cal_id','cat_id')); 416 417?> 418 419<#4199> 420<?php 421 if (!$ilDB->indexExistsByFields('cal_entries', array('last_update'))) { 422 $ilDB->addIndex('cal_entries', array('last_update'), 'i1'); 423 } 424?> 425<#4200> 426<?php 427 428 $query = 'SELECT value from settings where module = ' . $ilDB->quote('common', 'text') . 429 'AND keyword = ' . $ilDB->quote('main_tree_impl', 'text'); 430 $res = $ilDB->query($query); 431 432 $tree_impl = 'ns'; 433 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 434 $tree_impl = $row->value; 435 } 436 437 if ($tree_impl == 'mp') { 438 if (!$ilDB->indexExistsByFields('tree', array('path'))) { 439 $ilDB->dropIndexByFields('tree', array('lft')); 440 $ilDB->addIndex('tree', array('path'), 'i4'); 441 } 442 } 443?> 444<#4201> 445<?php 446 if (!$ilDB->indexExistsByFields('booking_reservation', array('user_id'))) { 447 $ilDB->addIndex('booking_reservation', array('user_id'), 'i1'); 448 } 449?> 450<#4202> 451<?php 452 if (!$ilDB->indexExistsByFields('booking_reservation', array('object_id'))) { 453 $ilDB->addIndex('booking_reservation', array('object_id'), 'i2'); 454 } 455?> 456<#4203> 457<?php 458 if (!$ilDB->indexExistsByFields('cal_entries', array('context_id'))) { 459 $ilDB->addIndex('cal_entries', array('context_id'), 'i2'); 460 } 461?> 462<#4204> 463<?php 464if (!$ilDB->tableColumnExists('il_poll', 'show_results_as')) { 465 $ilDB->addTableColumn('il_poll', 'show_results_as', array( 466 'type' => 'integer', 467 'length' => 1, 468 'notnull' => true, 469 'default' => 1 470 )); 471} 472if (!$ilDB->tableColumnExists('il_poll', 'show_comments')) { 473 $ilDB->addTableColumn('il_poll', 'show_comments', array( 474 'type' => 'integer', 475 'length' => 1, 476 'notnull' => true, 477 'default' => 0 478 )); 479} 480?> 481<#4205> 482<?php 483 484 $ilDB->modifyTableColumn( 485 'usr_data', 486 'ext_account', 487 array( 488 "type" => "text", 489 "length" => 250, 490 "notnull" => false, 491 'fixed' => false 492 ) 493 ); 494?> 495<#4206> 496 497<?php 498 499 $ilDB->modifyTableColumn( 500 'usr_session', 501 'session_id', 502 array( 503 "type" => "text", 504 "length" => 250, 505 "notnull" => true, 506 'fixed' => false 507 ) 508 ); 509?> 510<#4207> 511 <?php 512 // Get defective active-id sequences by finding active ids lower than zero. The abs of the low-pass is the count of the holes 513 // in the sequence. 514 $result = $ilDB->query('SELECT active_fi, min(pass) pass FROM tst_pass_result WHERE pass < 0 GROUP BY active_fi'); 515 $broken_sequences = array(); 516 517 while ($row = $ilDB->fetchAssoc($result)) { 518 $broken_sequences[] = array('active' => $row['active'], 'holes' => abs($row['pass'])); 519 } 520 521 $stmt_inc_pass_res = $ilDB->prepareManip('UPDATE tst_pass_result SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 522 $stmt_inc_man_fb = $ilDB->prepareManip('UPDATE tst_manual_fb SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 523 $stmt_inc_seq = $ilDB->prepareManip('UPDATE tst_sequence SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 524 $stmt_inc_sol = $ilDB->prepareManip('UPDATE tst_solutions SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 525 $stmt_inc_times = $ilDB->prepareManip('UPDATE tst_times SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 526 527 $stmt_sel_passes = $ilDB->prepare('SELECT pass FROM tst_pass_result WHERE active_fi = ? ORDER BY pass', array('integer')); 528 529 $stmt_dec_pass_res = $ilDB->prepareManip('UPDATE tst_pass_result SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 530 $stmt_dec_man_fb = $ilDB->prepareManip('UPDATE tst_manual_fb SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 531 $stmt_dec_seq = $ilDB->prepareManip('UPDATE tst_sequence SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 532 $stmt_dec_sol = $ilDB->prepareManip('UPDATE tst_solutions SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 533 $stmt_dec_times = $ilDB->prepareManip('UPDATE tst_times SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 534 535 // Iterate over affected passes 536 foreach ($broken_sequences as $broken_sequence) { 537 // Recreate the unbroken, pre-renumbering state by incrementing all passes on all affected tables for the detected broken active_fi. 538 for ($i = 1; $i <= $broken_sequence['holes']; $i++) { 539 $ilDB->execute($stmt_inc_pass_res, array($broken_sequence['active'])); 540 $ilDB->execute($stmt_inc_man_fb, array($broken_sequence['active'])); 541 $ilDB->execute($stmt_inc_seq, array($broken_sequence['active'])); 542 $ilDB->execute($stmt_inc_sol, array($broken_sequence['active'])); 543 $ilDB->execute($stmt_inc_times, array($broken_sequence['active'])); 544 } 545 546 // Detect the holes and renumber correctly on all affected tables. 547 for ($i = 1; $i <= $broken_sequence['holes']; $i++) { 548 $result = $ilDB->execute($stmt_sel_passes, array($broken_sequence['active'])); 549 $index = 0; 550 while ($row = $ilDB->fetchAssoc($result)) { 551 if ($row['pass'] == $index) { 552 $index++; 553 continue; 554 } 555 556 // Reaching here, there is a missing index, now decrement all higher passes, preserving additional holes. 557 $ilDB->execute($stmt_dec_pass_res, array($broken_sequence['active'], $index)); 558 $ilDB->execute($stmt_dec_man_fb, array($broken_sequence['active'], $index)); 559 $ilDB->execute($stmt_dec_seq, array($broken_sequence['active'], $index)); 560 $ilDB->execute($stmt_dec_sol, array($broken_sequence['active'], $index)); 561 $ilDB->execute($stmt_dec_times, array($broken_sequence['active'], $index)); 562 break; 563 // Hole detection will start over. 564 } 565 } 566 } 567 ?> 568<#4208> 569<?php 570 571if (!$ilDB->tableExists('tmp_tst_to_recalc')) { 572 $ilDB->createTable('tmp_tst_to_recalc', array( 573 'active_fi' => array( 574 'type' => 'integer', 575 'length' => 4, 576 'notnull' => true, 577 'default' => 0 578 ), 579 'pass' => array( 580 'type' => 'integer', 581 'length' => 4, 582 'notnull' => true, 583 'default' => -1 584 ) 585 )); 586 587 $ilDB->addUniqueConstraint('tmp_tst_to_recalc', array('active_fi', 'pass')); 588} 589 590$groupQuery = " 591 SELECT tst_test_result.active_fi, 592 tst_test_result.question_fi, 593 tst_test_result.pass, 594 MAX(test_result_id) keep_id 595 596 FROM tst_test_result 597 598 INNER JOIN tst_active 599 ON tst_active.active_id = tst_test_result.active_fi 600 601 INNER JOIN tst_tests 602 ON tst_tests.test_id = tst_active.test_fi 603 604 INNER JOIN object_data 605 ON object_data.obj_id = tst_tests.obj_fi 606 607 WHERE object_data.type = %s 608 609 GROUP BY tst_test_result.active_fi, 610 tst_test_result.question_fi, 611 tst_test_result.pass 612 613 HAVING COUNT(*) > 1 614 "; 615 616$numQuery = "SELECT COUNT(*) num FROM ($groupQuery) tbl"; 617$numRes = $ilDB->queryF($numQuery, array('text'), array('tst')); 618$numRow = $ilDB->fetchAssoc($numRes); 619 620$ilSetting = new ilSetting(); 621$setting = $ilSetting->get('tst_test_results_dupl_del_warn', 0); 622 623if ((int) $numRow['num'] && !(int) $setting) { 624 $ilSetting->set('tst_test_results_dupl_del_warn', 1); 625 setup_exit(" 626 627 Dear Administrator, 628 629 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 630 631 The update process has been stopped due to data security reasons. 632 A Bug has let to duplicate datasets in \"tst_test_result\" table. 633 Duplicates have been detected in your installation. 634 635 Please have a look at: http://www.ilias.de/mantis/view.php?id=8992#c27369 636 637 You have the opportunity to review the data in question and apply 638 manual fixes on your own risk. 639 If you change any data manually, make sure to also add an entry in the table \"tmp_tst_to_recalc\" 640 for each active_fi/pass combination that is involved. 641 The required re-calculation of related result aggregations won't be triggered otherwise. 642 643 If you try to rerun the update process, this warning will be skipped. 644 The remaining duplicates will be removed automatically by the criteria documented at Mantis #8992 645 646 Best regards, 647 The Test Maintainers 648 "); 649} 650 651if ((int) $numRow['num']) { 652 $groupRes = $ilDB->queryF($groupQuery, array('text'), array('tst')); 653 654 $deleteStmt = $ilDB->prepareManip( 655 "DELETE FROM tst_test_result WHERE active_fi = ? AND pass = ? AND question_fi = ? AND test_result_id != ?", 656 array('integer', 'integer', 'integer', 'integer') 657 ); 658 659 while ($groupRow = $ilDB->fetchAssoc($groupRes)) { 660 $pkCols = array( 661 'active_fi' => array('integer', $groupRow['active_fi']), 662 'pass' => array('integer', $groupRow['pass']) 663 ); 664 665 $ilDB->replace('tmp_tst_to_recalc', $pkCols, array()); 666 667 $ilDB->execute($deleteStmt, array( 668 $groupRow['active_fi'], $groupRow['pass'], $groupRow['question_fi'], $groupRow['keep_id'] 669 )); 670 } 671} 672 673?> 674<#4209> 675<?php 676 677if ($ilDB->tableExists('tmp_tst_to_recalc')) { 678 $deleteStmt = $ilDB->prepareManip( 679 "DELETE FROM tmp_tst_to_recalc WHERE active_fi = ? AND pass = ?", 680 array('integer', 'integer') 681 ); 682 683 $res = $ilDB->query(" 684 SELECT tmp_tst_to_recalc.*, 685 tst_tests.obligations_enabled, 686 tst_tests.question_set_type, 687 tst_tests.obj_fi, 688 tst_tests.pass_scoring 689 690 FROM tmp_tst_to_recalc 691 692 INNER JOIN tst_active 693 ON tst_active.active_id = tmp_tst_to_recalc.active_fi 694 695 INNER JOIN tst_tests 696 ON tst_tests.test_id = tst_active.test_fi 697 "); 698 699 require_once 'Services/Migration/DBUpdate_4209/classes/class.DBUpdateTestResultCalculator.php'; 700 701 while ($row = $ilDB->fetchAssoc($res)) { 702 DBUpdateTestResultCalculator::_updateTestPassResults( 703 $row['active_fi'], 704 $row['pass'], 705 $row['obligations_enabled'], 706 $row['question_set_type'], 707 $row['obj_fi'] 708 ); 709 710 DBUpdateTestResultCalculator::_updateTestResultCache( 711 $row['active_fi'], 712 $row['pass_scoring'] 713 ); 714 715 $ilDB->execute($deleteStmt, array($row['active_fi'], $row['pass'])); 716 } 717 718 $ilDB->dropTable('tmp_tst_to_recalc'); 719} 720 721?> 722<#4210> 723<?php 724$ilSetting = new ilSetting(); 725if ((int) $ilSetting->get('lm_qst_imap_migr_run') == 0) { 726 // get all imagemap questions in ILIAS learning modules or scorm learning modules 727 $set = $ilDB->query( 728 "SELECT pq.question_id FROM page_question pq JOIN qpl_qst_imagemap im ON (pq.question_id = im.question_fi) " . 729 " WHERE pq.page_parent_type = " . $ilDB->quote("lm", "text") . 730 " OR pq.page_parent_type = " . $ilDB->quote("sahs", "text") 731 ); 732 while ($rec = $ilDB->fetchAssoc($set)) { 733 // now cross-check against qpl_questions to ensure that this is neither a test nor a question pool question 734 $set2 = $ilDB->query( 735 "SELECT obj_fi FROM qpl_questions " . 736 " WHERE question_id = " . $ilDB->quote($rec["question_id"], "integer") 737 ); 738 if ($rec2 = $ilDB->fetchAssoc($set2)) { 739 // this should not be the case for question pool or test questions 740 if ($rec2["obj_fi"] == 0) { 741 $q = "UPDATE qpl_qst_imagemap SET " . 742 " is_multiple_choice = " . $ilDB->quote(1, "integer") . 743 " WHERE question_fi = " . $ilDB->quote($rec["question_id"], "integer"); 744 $ilDB->manipulate($q); 745 } 746 } 747 } 748 $ilSetting = new ilSetting(); 749 $setting = $ilSetting->set('lm_qst_imap_migr_run', 1); 750} 751?> 752<#4211> 753<?php 754if (!$ilDB->tableColumnExists('qpl_a_cloze', 'gap_size')) { 755 $ilDB->addTableColumn('qpl_a_cloze', 'gap_size', array( 756 'type' => 'integer', 757 'length' => 4, 758 'notnull' => true, 759 'default' => 0 760 )); 761} 762?> 763<#4212> 764<?php 765if (!$ilDB->tableColumnExists('qpl_qst_cloze', 'cloze_text')) { 766 $ilDB->addTableColumn('qpl_qst_cloze', 'cloze_text', array('type' => 'clob')); 767 768 $clean_qst_txt = $ilDB->prepareManip('UPDATE qpl_questions SET question_text = " " WHERE question_id = ?', array('integer')); 769 770 $result = $ilDB->query('SELECT question_id, question_text FROM qpl_questions WHERE question_type_fi = 3'); 771 772 /** @noinspection PhpAssignmentInConditionInspection */ 773 while ($row = $ilDB->fetchAssoc($result)) { 774 $ilDB->update( 775 'qpl_qst_cloze', 776 array( 777 'cloze_text' => array('clob', $row['question_text'] ) 778 ), 779 array( 780 'question_fi' => array('integer', $row['question_id'] ) 781 ) 782 ); 783 $ilDB->execute($clean_qst_txt, array($row['question_id'])); 784 } 785} 786?> 787<#4213> 788<?php 789$ilCtrlStructureReader->getStructure(); 790?> 791<#4214> 792<?php 793if (!$ilDB->tableColumnExists('qpl_qst_matching', 'matching_mode')) { 794 $ilDB->addTableColumn('qpl_qst_matching', 'matching_mode', array( 795 'type' => 'text', 796 'length' => 3, 797 'notnull' => false, 798 'default' => null 799 )); 800 801 $ilDB->manipulateF( 802 'UPDATE qpl_qst_matching SET matching_mode = %s', 803 array('text'), 804 array('1:1') 805 ); 806} 807 808if ($ilDB->tableColumnExists('qpl_qst_matching', 'element_height')) { 809 $ilDB->dropTableColumn('qpl_qst_matching', 'element_height'); 810} 811?> 812<#4215> 813<?php 814$ilCtrlStructureReader->getStructure(); 815?> 816<#4216> 817<?php 818// REMOVED: is done at #4220 in an abstracted way 819// Bibliographic Module: Increase the allowed text-size for attributes from 512 to 4000 820// $ilDB->query('ALTER TABLE il_bibl_attribute MODIFY value VARCHAR(4000)'); 821?> 822<#4217> 823<?php 824 /* Introduce new DataCollection features 825 - Comments on records 826 - Default sort-field & sort-order 827 */ 828 if (!$ilDB->tableColumnExists('il_dcl_table', 'default_sort_field_id')) { 829 $ilDB->addTableColumn( 830 'il_dcl_table', 831 'default_sort_field_id', 832 array( 833 'type' => 'text', 834 'length' => 16, 835 'notnull' => true, 836 'default' => '0', 837 ) 838 ); 839 } 840 if (!$ilDB->tableColumnExists('il_dcl_table', 'default_sort_field_order')) { 841 $ilDB->addTableColumn( 842 'il_dcl_table', 843 'default_sort_field_order', 844 array( 845 'type' => 'text', 846 'length' => 4, 847 'notnull' => true, 848 'default' => 'asc', 849 ) 850 ); 851 } 852 if (!$ilDB->tableColumnExists('il_dcl_table', 'public_comments')) { 853 $ilDB->addTableColumn( 854 'il_dcl_table', 855 'public_comments', 856 array( 857 'type' => 'integer', 858 'length' => 4, 859 'notnull' => true, 860 'default' => 0, 861 ) 862 ); 863 } 864?> 865<#4218> 866<?php 867if (!$ilDB->tableColumnExists('il_dcl_table', 'view_own_records_perm')) { 868 $ilDB->addTableColumn( 869 'il_dcl_table', 870 'view_own_records_perm', 871 array( 872 'type' => 'integer', 873 'length' => 4, 874 'notnull' => true, 875 'default' => 0, 876 ) 877 ); 878} 879?> 880<#4219> 881<?php 882$ilCtrlStructureReader->getStructure(); 883?> 884<#4220> 885<?php 886// Bibliographic Module: Increase the allowed text-size for attributes from 512 to 4000 887$ilDB->modifyTableColumn("il_bibl_attribute", "value", array("type" => "text", "length" => 4000)); 888?> 889<#4221> 890<?php 891 892if (!$ilDB->tableExists('adv_md_values_text')) { 893 $ilDB->renameTable('adv_md_values', 'adv_md_values_text'); 894} 895 896?> 897<#4222> 898<?php 899 900if (!$ilDB->tableExists('adv_md_values_int')) { 901 $ilDB->createTable('adv_md_values_int', array( 902 'obj_id' => array( 903 'type' => 'integer', 904 'length' => 4, 905 'notnull' => true, 906 'default' => 0 907 ), 908 'sub_type' => array( 909 'type' => 'text', 910 'length' => 10, 911 'notnull' => true, 912 'default' => "-" 913 ), 914 'sub_id' => array( 915 'type' => 'integer', 916 'length' => 4, 917 'notnull' => true, 918 'default' => 0 919 ), 920 'field_id' => array( 921 'type' => 'integer', 922 'length' => 4, 923 'notnull' => true, 924 'default' => 0 925 ), 926 'value' => array( 927 'type' => 'integer', 928 'length' => 4, 929 'notnull' => false 930 ) 931 )); 932 933 $ilDB->addPrimaryKey('adv_md_values_int', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 934} 935 936?> 937<#4223> 938<?php 939 940if (!$ilDB->tableExists('adv_md_values_float')) { 941 $ilDB->createTable('adv_md_values_float', array( 942 'obj_id' => array( 943 'type' => 'integer', 944 'length' => 4, 945 'notnull' => true, 946 'default' => 0 947 ), 948 'sub_type' => array( 949 'type' => 'text', 950 'length' => 10, 951 'notnull' => true, 952 'default' => "-" 953 ), 954 'sub_id' => array( 955 'type' => 'integer', 956 'length' => 4, 957 'notnull' => true, 958 'default' => 0 959 ), 960 'field_id' => array( 961 'type' => 'integer', 962 'length' => 4, 963 'notnull' => true, 964 'default' => 0 965 ), 966 'value' => array( 967 'type' => 'float', 968 'notnull' => false 969 ) 970 )); 971 972 $ilDB->addPrimaryKey('adv_md_values_float', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 973} 974 975?> 976<#4224> 977<?php 978 979if (!$ilDB->tableExists('adv_md_values_date')) { 980 $ilDB->createTable('adv_md_values_date', array( 981 'obj_id' => array( 982 'type' => 'integer', 983 'length' => 4, 984 'notnull' => true, 985 'default' => 0 986 ), 987 'sub_type' => array( 988 'type' => 'text', 989 'length' => 10, 990 'notnull' => true, 991 'default' => "-" 992 ), 993 'sub_id' => array( 994 'type' => 'integer', 995 'length' => 4, 996 'notnull' => true, 997 'default' => 0 998 ), 999 'field_id' => array( 1000 'type' => 'integer', 1001 'length' => 4, 1002 'notnull' => true, 1003 'default' => 0 1004 ), 1005 'value' => array( 1006 'type' => 'date', 1007 'notnull' => false 1008 ) 1009 )); 1010 1011 $ilDB->addPrimaryKey('adv_md_values_date', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 1012} 1013 1014?> 1015<#4225> 1016<?php 1017 1018if (!$ilDB->tableExists('adv_md_values_datetime')) { 1019 $ilDB->createTable('adv_md_values_datetime', array( 1020 'obj_id' => array( 1021 'type' => 'integer', 1022 'length' => 4, 1023 'notnull' => true, 1024 'default' => 0 1025 ), 1026 'sub_type' => array( 1027 'type' => 'text', 1028 'length' => 10, 1029 'notnull' => true, 1030 'default' => "-" 1031 ), 1032 'sub_id' => array( 1033 'type' => 'integer', 1034 'length' => 4, 1035 'notnull' => true, 1036 'default' => 0 1037 ), 1038 'field_id' => array( 1039 'type' => 'integer', 1040 'length' => 4, 1041 'notnull' => true, 1042 'default' => 0 1043 ), 1044 'value' => array( 1045 'type' => 'timestamp', 1046 'notnull' => false 1047 ) 1048 )); 1049 1050 $ilDB->addPrimaryKey('adv_md_values_datetime', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 1051} 1052 1053?> 1054<#4226> 1055<?php 1056 1057if (!$ilDB->tableExists('adv_md_values_location')) { 1058 $ilDB->createTable('adv_md_values_location', array( 1059 'obj_id' => array( 1060 'type' => 'integer', 1061 'length' => 4, 1062 'notnull' => true, 1063 'default' => 0 1064 ), 1065 'sub_type' => array( 1066 'type' => 'text', 1067 'length' => 10, 1068 'notnull' => true, 1069 'default' => "-" 1070 ), 1071 'sub_id' => array( 1072 'type' => 'integer', 1073 'length' => 4, 1074 'notnull' => true, 1075 'default' => 0 1076 ), 1077 'field_id' => array( 1078 'type' => 'integer', 1079 'length' => 4, 1080 'notnull' => true, 1081 'default' => 0 1082 ), 1083 'loc_lat' => array( 1084 'type' => 'float', 1085 'notnull' => false 1086 ), 1087 'loc_long' => array( 1088 'type' => 'float', 1089 'notnull' => false 1090 ), 1091 'loc_zoom' => array( 1092 'type' => 'integer', 1093 'length' => 1, 1094 'notnull' => false 1095 ) 1096 )); 1097 1098 $ilDB->addPrimaryKey('adv_md_values_location', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 1099} 1100 1101?> 1102<#4227> 1103<?php 1104 1105 if (!$ilDB->tableColumnExists('adv_md_values_location', 'disabled')) { 1106 $ilDB->addTableColumn('adv_md_values_location', 'disabled', array( 1107 "type" => "integer", 1108 "length" => 1, 1109 "notnull" => true, 1110 "default" => 0 1111 )); 1112 } 1113 if (!$ilDB->tableColumnExists('adv_md_values_datetime', 'disabled')) { 1114 $ilDB->addTableColumn('adv_md_values_datetime', 'disabled', array( 1115 "type" => "integer", 1116 "length" => 1, 1117 "notnull" => true, 1118 "default" => 0 1119 )); 1120 } 1121 if (!$ilDB->tableColumnExists('adv_md_values_date', 'disabled')) { 1122 $ilDB->addTableColumn('adv_md_values_date', 'disabled', array( 1123 "type" => "integer", 1124 "length" => 1, 1125 "notnull" => true, 1126 "default" => 0 1127 )); 1128 } 1129 if (!$ilDB->tableColumnExists('adv_md_values_float', 'disabled')) { 1130 $ilDB->addTableColumn('adv_md_values_float', 'disabled', array( 1131 "type" => "integer", 1132 "length" => 1, 1133 "notnull" => true, 1134 "default" => 0 1135 )); 1136 } 1137 if (!$ilDB->tableColumnExists('adv_md_values_int', 'disabled')) { 1138 $ilDB->addTableColumn('adv_md_values_int', 'disabled', array( 1139 "type" => "integer", 1140 "length" => 1, 1141 "notnull" => true, 1142 "default" => 0 1143 )); 1144 } 1145 1146?> 1147<#4228> 1148<?php 1149$ilCtrlStructureReader->getStructure(); 1150?> 1151<#4229> 1152<?php 1153 1154// moving date/datetime to proper adv_md-tables 1155$field_map = array(); 1156 1157$set = $ilDB->query("SELECT field_id,field_type FROM adv_mdf_definition" . 1158 " WHERE " . $ilDB->in("field_type", array(3,4), "", "integer")); 1159while ($row = $ilDB->fetchAssoc($set)) { 1160 $field_map[$row["field_id"]] = $row["field_type"]; 1161} 1162 1163if (sizeof($field_map)) { 1164 $set = $ilDB->query("SELECT * FROM adv_md_values_text" . 1165 " WHERE " . $ilDB->in("field_id", array_keys($field_map), "", "integer")); 1166 while ($row = $ilDB->fetchAssoc($set)) { 1167 if ($row["value"]) { 1168 // date 1169 if ($field_map[$row["field_id"]] == 3) { 1170 $table = "adv_md_values_date"; 1171 $value = date("Y-m-d", $row["value"]); 1172 $type = "date"; 1173 } 1174 // datetime 1175 else { 1176 $table = "adv_md_values_datetime"; 1177 $value = date("Y-m-d H:i:s", $row["value"]); 1178 $type = "timestamp"; 1179 } 1180 1181 $fields = array( 1182 "obj_id" => array("integer", $row["obj_id"]) 1183 ,"sub_type" => array("text", $row["sub_type"]) 1184 ,"sub_id" => array("integer", $row["sub_id"]) 1185 ,"field_id" => array("integer", $row["field_id"]) 1186 ,"disabled" => array("integer", $row["disabled"]) 1187 ,"value" => array($type, $value) 1188 ); 1189 1190 $ilDB->insert($table, $fields); 1191 } 1192 } 1193 1194 $ilDB->manipulate("DELETE FROM adv_md_values_text" . 1195 " WHERE " . $ilDB->in("field_id", array_keys($field_map), "", "integer")); 1196} 1197 1198?> 1199<#4230> 1200<?php 1201 1202if (!$ilDB->tableColumnExists('il_blog', 'keywords')) { 1203 $ilDB->addTableColumn('il_blog', 'keywords', array( 1204 "type" => "integer", 1205 "length" => 1, 1206 "notnull" => true, 1207 "default" => 1 1208 )); 1209 $ilDB->addTableColumn('il_blog', 'authors', array( 1210 "type" => "integer", 1211 "length" => 1, 1212 "notnull" => true, 1213 "default" => 1 1214 )); 1215 $ilDB->addTableColumn('il_blog', 'nav_mode', array( 1216 "type" => "integer", 1217 "length" => 1, 1218 "notnull" => true, 1219 "default" => 1 1220 )); 1221 $ilDB->addTableColumn('il_blog', 'nav_list_post', array( 1222 "type" => "integer", 1223 "length" => 2, 1224 "notnull" => true, 1225 "default" => 10 1226 )); 1227 $ilDB->addTableColumn('il_blog', 'nav_list_mon', array( 1228 "type" => "integer", 1229 "length" => 2, 1230 "notnull" => false, 1231 "default" => 0 1232 )); 1233 $ilDB->addTableColumn('il_blog', 'ov_post', array( 1234 "type" => "integer", 1235 "length" => 2, 1236 "notnull" => false, 1237 "default" => 0 1238 )); 1239} 1240 1241?> 1242<#4231> 1243<?php 1244 1245if (!$ilDB->tableColumnExists('il_blog', 'nav_order')) { 1246 $ilDB->addTableColumn('il_blog', 'nav_order', array( 1247 "type" => "text", 1248 "length" => 255, 1249 "notnull" => false 1250 )); 1251} 1252 1253?> 1254<#4232> 1255<?php 1256 1257if (!$ilDB->tableColumnExists('svy_svy', 'own_results_view')) { 1258 $ilDB->addTableColumn('svy_svy', 'own_results_view', array( 1259 "type" => "integer", 1260 "length" => 1, 1261 "notnull" => false, 1262 "default" => 0 1263 )); 1264} 1265if (!$ilDB->tableColumnExists('svy_svy', 'own_results_mail')) { 1266 $ilDB->addTableColumn('svy_svy', 'own_results_mail', array( 1267 "type" => "integer", 1268 "length" => 1, 1269 "notnull" => false, 1270 "default" => 0 1271 )); 1272} 1273 1274?> 1275<#4233> 1276<?php 1277 1278if (!$ilDB->tableColumnExists('exc_data', 'add_desktop')) { 1279 $ilDB->addTableColumn('exc_data', 'add_desktop', array( 1280 "type" => "integer", 1281 "length" => 1, 1282 "notnull" => true, 1283 "default" => 1 1284 )); 1285} 1286 1287?> 1288<#4234> 1289<?php 1290if (!$ilDB->tableColumnExists('tst_dyn_quest_set_cfg', 'answer_filter_enabled')) { 1291 $ilDB->addTableColumn('tst_dyn_quest_set_cfg', 'answer_filter_enabled', array( 1292 'type' => 'integer', 1293 'length' => 1, 1294 'notnull' => false, 1295 'default' => null 1296 )); 1297} 1298if (!$ilDB->tableColumnExists('tst_active', 'answerstatusfilter')) { 1299 $ilDB->addTableColumn('tst_active', 'answerstatusfilter', array( 1300 'type' => 'text', 1301 'length' => 16, 1302 'notnull' => false, 1303 'default' => null 1304 )); 1305} 1306?> 1307<#4235> 1308<?php 1309$ilCtrlStructureReader->getStructure(); 1310?> 1311<#4236> 1312<?php 1313$ilCtrlStructureReader->getStructure(); 1314?> 1315<#4237> 1316<?php 1317 1318if (!$ilDB->tableExists('pg_amd_page_list')) { 1319 $ilDB->createTable('pg_amd_page_list', array( 1320 'id' => array( 1321 'type' => 'integer', 1322 'length' => 4, 1323 'notnull' => true, 1324 'default' => 0 1325 ), 1326 'field_id' => array( 1327 'type' => 'integer', 1328 'length' => 4, 1329 'notnull' => true, 1330 'default' => 0 1331 ), 1332 'data' => array( 1333 'type' => 'text', 1334 'length' => 4000, 1335 'notnull' => false 1336 ), 1337 )); 1338 1339 $ilDB->addPrimaryKey('pg_amd_page_list', array('id', 'field_id')); 1340 $ilDB->createSequence('pg_amd_page_list'); 1341} 1342 1343?> 1344<#4238> 1345<?php 1346$ilCtrlStructureReader->getStructure(); 1347?> 1348<#4239> 1349<?php 1350$ilCtrlStructureReader->getStructure(); 1351?> 1352<#4240> 1353<?php 1354if (!$ilDB->tableColumnExists('tst_tests', 'skill_service')) { 1355 $ilDB->addTableColumn('tst_tests', 'skill_service', array( 1356 'type' => 'integer', 1357 'length' => 1, 1358 'notnull' => false, 1359 'default' => null 1360 )); 1361 1362 $ilDB->manipulateF( 1363 'UPDATE tst_tests SET skill_service = %s', 1364 array('integer'), 1365 array(0) 1366 ); 1367} 1368 1369if (!$ilDB->tableExists('tst_skl_qst_assigns')) { 1370 $ilDB->createTable('tst_skl_qst_assigns', array( 1371 'test_fi' => array( 1372 'type' => 'integer', 1373 'length' => 4, 1374 'notnull' => true, 1375 'default' => 0 1376 ), 1377 'question_fi' => array( 1378 'type' => 'integer', 1379 'length' => 4, 1380 'notnull' => true, 1381 'default' => 0 1382 ), 1383 'skill_base_fi' => array( 1384 'type' => 'integer', 1385 'length' => 4, 1386 'notnull' => true, 1387 'default' => 0 1388 ), 1389 'skill_tref_fi' => array( 1390 'type' => 'integer', 1391 'length' => 4, 1392 'notnull' => true, 1393 'default' => 0 1394 ), 1395 'skill_points' => array( 1396 'type' => 'integer', 1397 'length' => 4, 1398 'notnull' => true, 1399 'default' => 0 1400 ) 1401 )); 1402 1403 $ilDB->addPrimaryKey('tst_skl_qst_assigns', array('test_fi', 'question_fi', 'skill_base_fi', 'skill_tref_fi')); 1404} 1405 1406if (!$ilDB->tableExists('tst_skl_thresholds')) { 1407 $ilDB->createTable('tst_skl_thresholds', array( 1408 'test_fi' => array( 1409 'type' => 'integer', 1410 'length' => 4, 1411 'notnull' => true, 1412 'default' => 0 1413 ), 1414 'skill_base_fi' => array( 1415 'type' => 'integer', 1416 'length' => 4, 1417 'notnull' => true, 1418 'default' => 0 1419 ), 1420 'skill_tref_fi' => array( 1421 'type' => 'integer', 1422 'length' => 4, 1423 'notnull' => true, 1424 'default' => 0 1425 ), 1426 'skill_level_fi' => array( 1427 'type' => 'integer', 1428 'length' => 4, 1429 'notnull' => true, 1430 'default' => 0 1431 ), 1432 'threshold' => array( 1433 'type' => 'integer', 1434 'length' => 4, 1435 'notnull' => true, 1436 'default' => 0 1437 ) 1438 )); 1439 1440 $ilDB->addPrimaryKey('tst_skl_thresholds', array('test_fi', 'skill_base_fi', 'skill_tref_fi', 'skill_level_fi')); 1441} 1442 1443if (!$ilDB->tableColumnExists('tst_active', 'last_finished_pass')) { 1444 $ilDB->addTableColumn('tst_active', 'last_finished_pass', array( 1445 'type' => 'integer', 1446 'length' => 4, 1447 'notnull' => false, 1448 'default' => null 1449 )); 1450} 1451?> 1452<#4241> 1453<?php 1454if (!$ilDB->tableColumnExists('tst_tests', 'result_tax_filters')) { 1455 $ilDB->addTableColumn('tst_tests', 'result_tax_filters', array( 1456 'type' => 'text', 1457 'length' => 255, 1458 'notnull' => false, 1459 'default' => null 1460 )); 1461} 1462?> 1463<#4242> 1464<?php 1465$ilCtrlStructureReader->getStructure(); 1466?> 1467 1468<#4243> 1469<?php 1470if (!$ilDB->tableColumnExists('tst_test_rnd_qst', 'src_pool_def_fi')) { 1471 $ilDB->addTableColumn('tst_test_rnd_qst', 'src_pool_def_fi', array( 1472 'type' => 'integer', 1473 'length' => 4, 1474 'notnull' => false, 1475 'default' => null 1476 )); 1477} 1478?> 1479<#4244> 1480<?php 1481$ilCtrlStructureReader->getStructure(); 1482?> 1483 1484<#4245> 1485<?php 1486 1487if (!$ilDB->tableExists('ecs_remote_user')) { 1488 $ilDB->createTable('ecs_remote_user', array( 1489 'eru_id' => array( 1490 'type' => 'integer', 1491 'length' => 4, 1492 'notnull' => true, 1493 'default' => 0 1494 ), 1495 'sid' => array( 1496 'type' => 'integer', 1497 'length' => 4, 1498 'notnull' => true, 1499 'default' => 0 1500 ), 1501 'mid' => array( 1502 'type' => 'integer', 1503 'length' => 4, 1504 'notnull' => true, 1505 'default' => 0 1506 ), 1507 'usr_id' => array( 1508 'type' => 'integer', 1509 'length' => 4, 1510 'notnull' => true, 1511 'default' => 0 1512 ), 1513 'remote_usr_id' => array( 1514 'type' => 'integer', 1515 'length' => 4, 1516 'notnull' => true, 1517 'default' => 0 1518 ) 1519 )); 1520 $ilDB->addPrimaryKey('ecs_remote_user', array('eru_id')); 1521 $ilDB->createSequence('ecs_remote_user'); 1522} 1523?> 1524<#4246> 1525<?php 1526 1527if ($ilDB->tableExists('ecs_remote_user')) { 1528 $ilDB->dropTable('ecs_remote_user'); 1529} 1530 1531?> 1532<#4247> 1533<?php 1534if (!$ilDB->tableExists('ecs_remote_user')) { 1535 $ilDB->createTable('ecs_remote_user', array( 1536 'eru_id' => array( 1537 'type' => 'integer', 1538 'length' => 4, 1539 'notnull' => true, 1540 'default' => 0 1541 ), 1542 'sid' => array( 1543 'type' => 'integer', 1544 'length' => 4, 1545 'notnull' => true, 1546 'default' => 0 1547 ), 1548 'mid' => array( 1549 'type' => 'integer', 1550 'length' => 4, 1551 'notnull' => true, 1552 'default' => 0 1553 ), 1554 'usr_id' => array( 1555 'type' => 'integer', 1556 'length' => 4, 1557 'notnull' => true, 1558 'default' => 0 1559 ), 1560 'remote_usr_id' => array( 1561 'type' => 'text', 1562 'length' => 50, 1563 'notnull' => false, 1564 'fixed' => true 1565 ) 1566 )); 1567 $ilDB->addPrimaryKey('ecs_remote_user', array('eru_id')); 1568 $ilDB->createSequence('ecs_remote_user'); 1569} 1570?> 1571<#4248> 1572<?php 1573 1574include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 1575ilDBUpdateNewObjectType::addAdminNode('excs', 'Exercise Settings'); 1576 1577?> 1578<#4249> 1579<?php 1580 1581if ($ilDB->tableColumnExists('exc_data', 'add_desktop')) { 1582 $ilDB->dropTableColumn('exc_data', 'add_desktop'); 1583} 1584 1585?> 1586<#4250> 1587<?php 1588if (!$ilDB->tableColumnExists('tst_tests', 'show_grading_status')) { 1589 $ilDB->addTableColumn('tst_tests', 'show_grading_status', array( 1590 'type' => 'integer', 1591 'length' => 1, 1592 'notnull' => false, 1593 'default' => 0 1594 )); 1595 1596 $ilDB->queryF("UPDATE tst_tests SET show_grading_status = %s", array('integer'), array(1)); 1597} 1598 1599if (!$ilDB->tableColumnExists('tst_tests', 'show_grading_mark')) { 1600 $ilDB->addTableColumn('tst_tests', 'show_grading_mark', array( 1601 'type' => 'integer', 1602 'length' => 1, 1603 'notnull' => false, 1604 'default' => 0 1605 )); 1606 1607 $ilDB->queryF("UPDATE tst_tests SET show_grading_mark = %s", array('integer'), array(1)); 1608} 1609?> 1610<#4251> 1611<?php 1612 1613include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 1614ilDBUpdateNewObjectType::addAdminNode('taxs', 'Taxonomy Settings'); 1615 1616?> 1617<#4252> 1618<?php 1619// Datacollection: Add formula fieldtype 1620$ilDB->insert('il_dcl_datatype', array( 1621 'id' => array('integer', 11), 1622 'title' => array('text', 'formula'), 1623 'ildb_type' => array('text', 'text'), 1624 'storage_location' => array('integer', 0), 1625 'sort' => array('integer', 90), 1626 )); 1627?> 1628<#4253> 1629<?php 1630 1631if (!$ilDB->tableColumnExists('booking_settings', 'ovlimit')) { 1632 $ilDB->addTableColumn('booking_settings', 'ovlimit', array( 1633 'type' => 'integer', 1634 'length' => 1, 1635 'notnull' => false 1636 )); 1637} 1638 1639?> 1640<#4254> 1641<?php 1642if ($ilDB->tableColumnExists('qpl_qst_essay', 'keyword_relation')) { 1643 $ilDB->queryF( 1644 "UPDATE qpl_qst_essay SET keyword_relation = %s WHERE keyword_relation = %s", 1645 array('text', 'text'), 1646 array('non', 'none') 1647 ); 1648} 1649?> 1650<#4255> 1651 <?php 1652 // Datacollection: Add formula fieldtype 1653 $ilDB->insert('il_dcl_datatype_prop', array( 1654 'id' => array('integer', 12), 1655 'datatype_id' => array('integer', 11), 1656 'title' => array('text', 'expression'), 1657 'inputformat' => array('integer', 2), 1658 )); 1659?> 1660<#4256> 1661<?php 1662if (!$ilDB->tableExists('wiki_stat')) { 1663 $ilDB->createTable('wiki_stat', array( 1664 'wiki_id' => array( 1665 'type' => 'integer', 1666 'length' => 4, 1667 'notnull' => true 1668 ), 1669 'ts' => array( 1670 'type' => 'timestamp', 1671 'notnull' => true 1672 ), 1673 'num_pages' => array( 1674 'type' => 'integer', 1675 'length' => 4, 1676 'notnull' => true 1677 ), 1678 'del_pages' => array( 1679 'type' => 'integer', 1680 'length' => 4, 1681 'notnull' => true 1682 ), 1683 'avg_rating' => array( 1684 'type' => 'integer', 1685 'length' => 4, 1686 'notnull' => true 1687 ) 1688 )); 1689 1690 $ilDB->addPrimaryKey('wiki_stat', array('wiki_id', 'ts')); 1691} 1692?> 1693<#4257> 1694<?php 1695if (!$ilDB->tableExists('wiki_stat_page_user')) { 1696 $ilDB->createTable('wiki_stat_page_user', array( 1697 'wiki_id' => array( 1698 'type' => 'integer', 1699 'length' => 4, 1700 'notnull' => true 1701 ), 1702 'page_id' => array( 1703 'type' => 'integer', 1704 'length' => 4, 1705 'notnull' => true 1706 ), 1707 'user_id' => array( 1708 'type' => 'integer', 1709 'length' => 4, 1710 'notnull' => true 1711 ), 1712 'ts' => array( 1713 'type' => 'timestamp', 1714 'notnull' => true 1715 ), 1716 'changes' => array( 1717 'type' => 'integer', 1718 'length' => 4, 1719 'notnull' => true, 1720 'default' => 0 1721 ), 1722 'read_events' => array( 1723 'type' => 'integer', 1724 'length' => 4, 1725 'notnull' => true, 1726 'default' => 0 1727 ) 1728 )); 1729 1730 $ilDB->addPrimaryKey('wiki_stat_page_user', array('wiki_id', 'page_id', 'ts', 'user_id')); 1731} 1732?> 1733<#4258> 1734<?php 1735if (!$ilDB->tableExists('wiki_stat_user')) { 1736 $ilDB->createTable('wiki_stat_user', array( 1737 'wiki_id' => array( 1738 'type' => 'integer', 1739 'length' => 4, 1740 'notnull' => true 1741 ), 1742 'user_id' => array( 1743 'type' => 'integer', 1744 'length' => 4, 1745 'notnull' => true 1746 ), 1747 'ts' => array( 1748 'type' => 'timestamp', 1749 'notnull' => true 1750 ), 1751 'new_pages' => array( 1752 'type' => 'integer', 1753 'length' => 4, 1754 'notnull' => true 1755 ) 1756 )); 1757 1758 $ilDB->addPrimaryKey('wiki_stat_user', array('wiki_id', 'user_id', 'ts')); 1759} 1760?> 1761<#4259> 1762<?php 1763if (!$ilDB->tableExists('wiki_stat_page')) { 1764 $ilDB->createTable('wiki_stat_page', array( 1765 'wiki_id' => array( 1766 'type' => 'integer', 1767 'length' => 4, 1768 'notnull' => true 1769 ), 1770 'page_id' => array( 1771 'type' => 'integer', 1772 'length' => 4, 1773 'notnull' => true 1774 ), 1775 'ts' => array( 1776 'type' => 'timestamp', 1777 'notnull' => true 1778 ), 1779 'int_links' => array( 1780 'type' => 'integer', 1781 'length' => 4, 1782 'notnull' => true 1783 ), 1784 'ext_links' => array( 1785 'type' => 'integer', 1786 'length' => 4, 1787 'notnull' => true 1788 ), 1789 'footnotes' => array( 1790 'type' => 'integer', 1791 'length' => 4, 1792 'notnull' => true 1793 ), 1794 'num_ratings' => array( 1795 'type' => 'integer', 1796 'length' => 4, 1797 'notnull' => true 1798 ), 1799 'num_words' => array( 1800 'type' => 'integer', 1801 'length' => 4, 1802 'notnull' => true 1803 ), 1804 'num_chars' => array( 1805 'type' => 'integer', 1806 'length' => 8, 1807 'notnull' => true 1808 ), 1809 1810 )); 1811 1812 $ilDB->addPrimaryKey('wiki_stat_page', array('wiki_id', 'page_id', 'ts')); 1813} 1814?> 1815<#4260> 1816<?php 1817if (!$ilDB->tableColumnExists('wiki_stat_page', 'avg_rating')) { 1818 $ilDB->addTableColumn( 1819 'wiki_stat_page', 1820 'avg_rating', 1821 array( 1822 'type' => 'integer', 1823 'length' => 4, 1824 'notnull' => true 1825 ) 1826 ); 1827} 1828?> 1829<#4261> 1830<?php 1831 1832if (!$ilDB->tableColumnExists('wiki_stat', 'ts_day')) { 1833 $ilDB->addTableColumn( 1834 'wiki_stat', 1835 'ts_day', 1836 array( 1837 'type' => 'text', 1838 'length' => 10, 1839 'fixed' => true, 1840 'notnull' => false 1841 ) 1842 ); 1843 $ilDB->addTableColumn( 1844 'wiki_stat', 1845 'ts_hour', 1846 array( 1847 'type' => 'integer', 1848 'length' => 1, 1849 'notnull' => false 1850 ) 1851 ); 1852} 1853 1854if (!$ilDB->tableColumnExists('wiki_stat_page', 'ts_day')) { 1855 $ilDB->addTableColumn( 1856 'wiki_stat_page', 1857 'ts_day', 1858 array( 1859 'type' => 'text', 1860 'length' => 10, 1861 'fixed' => true, 1862 'notnull' => false 1863 ) 1864 ); 1865 $ilDB->addTableColumn( 1866 'wiki_stat_page', 1867 'ts_hour', 1868 array( 1869 'type' => 'integer', 1870 'length' => 1, 1871 'notnull' => false 1872 ) 1873 ); 1874} 1875 1876if (!$ilDB->tableColumnExists('wiki_stat_user', 'ts_day')) { 1877 $ilDB->addTableColumn( 1878 'wiki_stat_user', 1879 'ts_day', 1880 array( 1881 'type' => 'text', 1882 'length' => 10, 1883 'fixed' => true, 1884 'notnull' => false 1885 ) 1886 ); 1887 $ilDB->addTableColumn( 1888 'wiki_stat_user', 1889 'ts_hour', 1890 array( 1891 'type' => 'integer', 1892 'length' => 1, 1893 'notnull' => false 1894 ) 1895 ); 1896} 1897 1898if (!$ilDB->tableColumnExists('wiki_stat_page_user', 'ts_day')) { 1899 $ilDB->addTableColumn( 1900 'wiki_stat_page_user', 1901 'ts_day', 1902 array( 1903 'type' => 'text', 1904 'length' => 10, 1905 'fixed' => true, 1906 'notnull' => false 1907 ) 1908 ); 1909 $ilDB->addTableColumn( 1910 'wiki_stat_page_user', 1911 'ts_hour', 1912 array( 1913 'type' => 'integer', 1914 'length' => 1, 1915 'notnull' => false 1916 ) 1917 ); 1918} 1919 1920?> 1921<#4262> 1922<?php 1923 if (!$ilDB->tableExists('wiki_page_template')) { 1924 $ilDB->createTable('wiki_page_template', array( 1925 'wiki_id' => array( 1926 'type' => 'integer', 1927 'length' => 4, 1928 'notnull' => true 1929 ), 1930 'wpage_id' => array( 1931 'type' => 'integer', 1932 'length' => 4, 1933 'notnull' => true 1934 ) 1935 )); 1936 1937 $ilDB->addPrimaryKey('wiki_page_template', array('wiki_id', 'wpage_id')); 1938 } 1939?> 1940<#4263> 1941<?php 1942if (!$ilDB->tableColumnExists('wiki_page_template', 'new_pages')) { 1943 $ilDB->addTableColumn( 1944 'wiki_page_template', 1945 'new_pages', 1946 array( 1947 'type' => 'integer', 1948 'length' => 1, 1949 'notnull' => true, 1950 'default' => 0 1951 ) 1952 ); 1953 $ilDB->addTableColumn( 1954 'wiki_page_template', 1955 'add_to_page', 1956 array( 1957 'type' => 'integer', 1958 'length' => 1, 1959 'notnull' => true, 1960 'default' => 0 1961 ) 1962 ); 1963} 1964?> 1965<#4264> 1966<?php 1967if (!$ilDB->tableColumnExists('il_wiki_data', 'empty_page_templ')) { 1968 $ilDB->addTableColumn( 1969 'il_wiki_data', 1970 'empty_page_templ', 1971 array( 1972 'type' => 'integer', 1973 'length' => 1, 1974 'notnull' => true, 1975 'default' => 1 1976 ) 1977 ); 1978} 1979?> 1980<#4265> 1981<?php 1982 1983if (!$ilDB->tableColumnExists('wiki_stat_page', 'deleted')) { 1984 $ilDB->addTableColumn( 1985 'wiki_stat_page', 1986 'deleted', 1987 array( 1988 'type' => 'integer', 1989 'length' => 1, 1990 'notnull' => true, 1991 'default' => 0 1992 ) 1993 ); 1994} 1995 1996?> 1997<#4266> 1998<?php 1999 2000include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 2001 2002$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 2003if ($wiki_type_id) { 2004 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('statistics_read', 'Read Statistics', 'object', 2200); 2005 if ($new_ops_id) { 2006 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 2007 2008 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 2009 if ($src_ops_id) { 2010 ilDBUpdateNewObjectType::cloneOperation('wiki', $src_ops_id, $new_ops_id); 2011 } 2012 } 2013} 2014 2015?> 2016<#4267> 2017<?php 2018 $ilCtrlStructureReader->getStructure(); 2019?> 2020<#4268> 2021<?php 2022 $ilDB->insert('il_dcl_datatype_prop', array( 2023 'id' => array('integer', 13), 2024 'datatype_id' => array('integer', 8), 2025 'title' => array('text', 'display_action_menu'), 2026 'inputformat' => array('integer', 4), 2027 )); 2028?> 2029<#4269> 2030<?php 2031 $ilDB->modifyTableColumn( 2032 'help_map', 2033 'screen_id', 2034 array( 2035 "type" => "text", 2036 "length" => 100, 2037 "notnull" => true, 2038 'fixed' => false 2039 ) 2040 ); 2041?> 2042<#4270> 2043 <?php 2044 $ilDB->modifyTableColumn( 2045 'help_map', 2046 'screen_sub_id', 2047 array( 2048 "type" => "text", 2049 "length" => 100, 2050 "notnull" => true, 2051 'fixed' => false 2052 ) 2053 ); 2054?> 2055<#4271> 2056<?php 2057 2058$client_id = basename(CLIENT_DATA_DIR); 2059$web_path = ilUtil::getWebspaceDir() . $client_id; 2060$sec_path = $web_path . "/sec"; 2061 2062if (!file_exists($sec_path)) { 2063 ilUtil::makeDir($sec_path); 2064} 2065 2066$mods = array("ilBlog", "ilPoll", "ilPortfolio"); 2067foreach ($mods as $mod) { 2068 $mod_path = $web_path . "/" . $mod; 2069 if (file_exists($mod_path)) { 2070 $mod_sec_path = $sec_path . "/" . $mod; 2071 rename($mod_path, $mod_sec_path); 2072 } 2073} 2074 2075?> 2076<#4272> 2077<?php 2078$ilCtrlStructureReader->getStructure(); 2079?> 2080<#4273> 2081<?php 2082//$ilDB->insert('il_dcl_datatype_prop', array( 2083// 'id' => array('integer', 14), 2084// 'datatype_id' => array('integer', 2), 2085// 'title' => array('text', 'link_detail_page'), 2086// 'inputformat' => array('integer', 4), 2087//)); 2088//$ilDB->insert('il_dcl_datatype_prop', array( 2089// 'id' => array('integer', 15), 2090// 'datatype_id' => array('integer', 9), 2091// 'title' => array('text', 'link_detail_page'), 2092// 'inputformat' => array('integer', 4), 2093//)); 2094?> 2095<#4274> 2096<?php 2097 2098$ilDB->dropTable("ut_access"); // #13663 2099 2100?> 2101<#4275> 2102<?php 2103 2104if (!$ilDB->tableExists('obj_user_data_hist')) { 2105 $ilDB->createTable('obj_user_data_hist', array( 2106 'obj_id' => array( 2107 'type' => 'integer', 2108 'length' => 4, 2109 'notnull' => true 2110 ), 2111 'usr_id' => array( 2112 'type' => 'integer', 2113 'length' => 4, 2114 'notnull' => true 2115 ), 2116 'update_user' => array( 2117 'type' => 'integer', 2118 'length' => 4, 2119 'notnull' => true 2120 ), 2121 'editing_time' => array( 2122 'type' => 'timestamp', 2123 'notnull' => false 2124 ) 2125 )); 2126 $ilDB->addPrimaryKey('obj_user_data_hist', array('obj_id','usr_id')); 2127} 2128 2129?> 2130<#4276> 2131<?php 2132if (!$ilDB->tableColumnExists('frm_threads', 'avg_rating')) { 2133 $ilDB->addTableColumn( 2134 'frm_threads', 2135 'avg_rating', 2136 array( 2137 'type' => 'float', 2138 'notnull' => true, 2139 'default' => 0 2140 ) 2141 ); 2142} 2143?> 2144<#4277> 2145<?php 2146$ilCtrlStructureReader->getStructure(); 2147?> 2148<#4278> 2149<?php 2150if (!$ilDB->tableColumnExists('frm_settings', 'thread_rating')) { 2151 $ilDB->addTableColumn( 2152 'frm_settings', 2153 'thread_rating', 2154 array( 2155 'type' => 'integer', 2156 'length' => 1, 2157 'notnull' => true, 2158 'default' => 0 2159 ) 2160 ); 2161} 2162?> 2163<#4279> 2164<?php 2165if (!$ilDB->tableColumnExists('exc_assignment', 'peer_file')) { 2166 $ilDB->addTableColumn( 2167 'exc_assignment', 2168 'peer_file', 2169 array( 2170 'type' => 'integer', 2171 'length' => 1, 2172 'notnull' => false, 2173 'default' => 0 2174 ) 2175 ); 2176} 2177?> 2178<#4280> 2179<?php 2180if (!$ilDB->tableColumnExists('exc_assignment_peer', 'upload')) { 2181 $ilDB->addTableColumn( 2182 'exc_assignment_peer', 2183 'upload', 2184 array( 2185 'type' => 'text', 2186 'length' => 1000, 2187 'notnull' => false, 2188 'fixed' => false 2189 ) 2190 ); 2191} 2192?> 2193<#4281> 2194<?php 2195if (!$ilDB->tableColumnExists('exc_assignment', 'peer_prsl')) { 2196 $ilDB->addTableColumn( 2197 'exc_assignment', 2198 'peer_prsl', 2199 array( 2200 'type' => 'integer', 2201 'length' => 1, 2202 'notnull' => false, 2203 'default' => 0 2204 ) 2205 ); 2206} 2207?> 2208<#4282> 2209<?php 2210if (!$ilDB->tableColumnExists('exc_assignment', 'fb_date')) { 2211 $ilDB->addTableColumn( 2212 'exc_assignment', 2213 'fb_date', 2214 array( 2215 'type' => 'integer', 2216 'length' => 1, 2217 'notnull' => true, 2218 'default' => 1 2219 ) 2220 ); 2221} 2222?> 2223<#4283> 2224<?php 2225if (!$ilDB->tableColumnExists('container_sorting_set', 'sort_direction')) { 2226 $ilDB->addTableColumn( 2227 'container_sorting_set', 2228 'sort_direction', 2229 array( 2230 'type' => 'integer', 2231 'length' => 1, 2232 'notnull' => true, 2233 'default' => 0 2234 ) 2235 ); 2236} 2237?> 2238<#4284> 2239<?php 2240if (!$ilDB->tableExists('tst_seq_qst_checked')) { 2241 $ilDB->createTable('tst_seq_qst_checked', array( 2242 'active_fi' => array( 2243 'type' => 'integer', 2244 'length' => 4, 2245 'notnull' => true, 2246 'default' => 0 2247 ), 2248 'pass' => array( 2249 'type' => 'integer', 2250 'length' => 4, 2251 'notnull' => true, 2252 'default' => 0 2253 ), 2254 'question_fi' => array( 2255 'type' => 'integer', 2256 'length' => 4, 2257 'notnull' => true, 2258 'default' => 0 2259 ) 2260 )); 2261 2262 $ilDB->addPrimaryKey('tst_seq_qst_checked', array('active_fi','pass', 'question_fi')); 2263} 2264 2265if (!$ilDB->tableColumnExists('tst_tests', 'inst_fb_answer_fixation')) { 2266 $ilDB->addTableColumn('tst_tests', 'inst_fb_answer_fixation', array( 2267 'type' => 'integer', 2268 'length' => 1, 2269 'notnull' => false, 2270 'default' => null 2271 )); 2272} 2273?> 2274<#4285> 2275<?php 2276if (!$ilDB->tableExists('container_sorting_bl')) { 2277 $ilDB->createTable('container_sorting_bl', array( 2278 'obj_id' => array( 2279 'type' => 'integer', 2280 'length' => 4, 2281 'notnull' => true, 2282 'default' => 0 2283 ), 2284 'block_ids' => array( 2285 'type' => 'text', 2286 'length' => 4000, 2287 'notnull' => false, 2288 ) 2289 )); 2290 2291 $ilDB->addPrimaryKey('container_sorting_bl', array('obj_id')); 2292} 2293?> 2294<#4286> 2295<?php 2296$ilCtrlStructureReader->getStructure(); 2297?> 2298<#4287> 2299<?php 2300 2301include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 2302 2303$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("read_learning_progress"); 2304if (!$tgt_ops_id) { 2305 $tgt_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('read_learning_progress', 'Read Learning Progress', 'object', 2300); 2306} 2307 2308$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 2309if ($src_ops_id && 2310 $tgt_ops_id) { 2311 // see ilObjectLP 2312 $lp_types = array("crs", "grp", "fold", "lm", "htlm", "sahs", "tst", "exc", "sess"); 2313 2314 foreach ($lp_types as $lp_type) { 2315 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId($lp_type); 2316 if ($lp_type_id) { 2317 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $tgt_ops_id); 2318 ilDBUpdateNewObjectType::cloneOperation($lp_type, $src_ops_id, $tgt_ops_id); 2319 } 2320 } 2321} 2322 2323?> 2324<#4288> 2325<?php 2326$ilCtrlStructureReader->getStructure(); 2327?> 2328<#4289> 2329<?php 2330$def = array( 2331 'type' => 'integer', 2332 'length' => 1, 2333 'notnull' => true, 2334 'default' => 0 2335 ); 2336$ilDB->addTableColumn("content_object", "progr_icons", $def); 2337?> 2338<#4290> 2339<?php 2340$def = array( 2341 'type' => 'integer', 2342 'length' => 1, 2343 'notnull' => true, 2344 'default' => 0 2345 ); 2346$ilDB->addTableColumn("content_object", "store_tries", $def); 2347?> 2348<#4291> 2349<?php 2350 $query = 'DELETE FROM rbac_fa WHERE parent = ' . $ilDB->quote(0, 'integer'); 2351 $ilDB->manipulate($query); 2352 2353 2354 /*$query = 'UPDATE rbac_fa f '. 2355 'SET parent = '. 2356 '(SELECT t.parent FROM tree t where t.child = f.parent) '. 2357 'WHERE f.parent != '.$ilDB->quote(8,'integer').' '. 2358 'AND EXISTS (SELECT t.parent FROM tree t where t.child = f.parent) '; 2359 $ilDB->manipulate($query);*/ 2360 2361 global $ilLog; 2362 2363 if (!$ilDB->tableColumnExists('rbac_fa', 'old_parent')) { 2364 $ilDB->addTableColumn( 2365 'rbac_fa', 2366 'old_parent', 2367 array( 2368 "type" => "integer", 2369 "notnull" => true, 2370 "length" => 8, 2371 "default" => 0 2372 ) 2373 ); 2374 $ilLog->write("Created new temporary column: rbac_fa->old_parent"); 2375 } 2376 2377 if (!$ilDB->tableExists('rbac_fa_temp')) { 2378 $fields = array( 2379 'role_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 2380 'parent_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0) 2381 ); 2382 $ilDB->createTable('rbac_fa_temp', $fields); 2383 $ilDB->addPrimaryKey('rbac_fa_temp', array('role_id', 'parent_id')); 2384 $ilLog->write("Created new temporary table: rbac_fa_temp"); 2385 } 2386 2387 2388 $stmt = $ilDB->prepareManip("UPDATE rbac_fa SET parent = ?, old_parent = ? WHERE rol_id = ? AND parent = ?", array("integer", "integer", "integer", "integer")); 2389 $stmt2 = $ilDB->prepareManip("INSERT INTO rbac_fa_temp (role_id, parent_id) VALUES(?, ?)", array("integer", "integer")); 2390 $stmt3 = $ilDB->prepare("SELECT object_data.type FROM object_reference INNER JOIN object_data ON object_data.obj_id = object_reference.obj_id WHERE ref_id = ?", array("integer")); 2391 2392 $query = " 2393 SELECT f.*, t.parent grandparent 2394 FROM rbac_fa f 2395 INNER JOIN tree t ON t.child = f.parent 2396 LEFT JOIN rbac_fa_temp 2397 ON rbac_fa_temp.role_id = f.rol_id 2398 AND rbac_fa_temp.parent_id = old_parent 2399 WHERE f.parent != 8 AND rbac_fa_temp.role_id IS NULL 2400 ORDER BY f.rol_id, f.parent 2401 "; 2402 $res = $ilDB->query($query); 2403 2404 $handled_roles_by_parent = array(); 2405 2406 while ($row = $ilDB->fetchAssoc($res)) { 2407 $role_id = $row["rol_id"]; 2408 $parent_id = $row["parent"]; 2409 2410 if ($handled_roles_by_parent[$role_id][$parent_id]) { 2411 continue; 2412 } 2413 2414 $new_parent_id = $row['grandparent']; 2415 2416 $parent_res = $ilDB->execute($stmt3, array($parent_id)); 2417 $parent_row = $ilDB->fetchAssoc($parent_res); 2418 if ($parent_row['type'] != 'rolf') { 2419 $ilLog->write(sprintf("Parent of role with id %s is not a 'rolf' (obj_id: %s, type: %s), so skip record", $role_id, $parent_row['obj_id'], $parent_row['type'])); 2420 continue; 2421 } 2422 2423 if ($new_parent_id <= 0) { 2424 $ilLog->write(sprintf("Could not migrate record with role_id %s and parent id %s because the grandparent is 0", $role_id, $parent_id)); 2425 continue; 2426 } 2427 2428 $ilDB->execute($stmt, array($new_parent_id, $parent_id , $role_id, $parent_id)); 2429 $ilDB->execute($stmt2, array($role_id, $parent_id)); 2430 $ilLog->write(sprintf("Migrated record with role_id %s and parent id %s to parent with id %s", $role_id, $parent_id, $new_parent_id)); 2431 2432 $handled_roles_by_parent[$role_id][$parent_id] = true; 2433 } 2434 2435 if ($ilDB->tableColumnExists('rbac_fa', 'old_parent')) { 2436 $ilDB->dropTableColumn('rbac_fa', 'old_parent'); 2437 $ilLog->write("Dropped new temporary column: rbac_fa->old_parent"); 2438 } 2439 2440 if ($ilDB->tableExists('rbac_fa_temp')) { 2441 $ilDB->dropTable('rbac_fa_temp'); 2442 $ilLog->write("Dropped new temporary table: rbac_fa_temp"); 2443 } 2444?> 2445 2446<#4292> 2447<?php 2448 $query = 'DELETE FROM rbac_templates WHERE parent = ' . $ilDB->quote(0, 'integer'); 2449 $ilDB->manipulate($query); 2450 2451 /*$query = 'UPDATE rbac_templates rt '. 2452 'SET parent = '. 2453 '(SELECT t.parent FROM tree t WHERE t.child = rt.parent) '. 2454 'WHERE rt.parent != '.$ilDB->quote(8,'integer').' '. 2455 'AND EXISTS (SELECT t.parent FROM tree t WHERE t.child = rt.parent) '; 2456 $ilDB->manipulate($query);*/ 2457 2458 global $ilLog; 2459 2460 if (!$ilDB->tableColumnExists('rbac_templates', 'old_parent')) { 2461 $ilDB->addTableColumn( 2462 'rbac_templates', 2463 'old_parent', 2464 array( 2465 "type" => "integer", 2466 "notnull" => true, 2467 "length" => 8, 2468 "default" => 0 2469 ) 2470 ); 2471 $ilLog->write("Created new temporary column: rbac_templates->old_parent"); 2472 } 2473 2474 if (!$ilDB->tableExists('rbac_templates_temp')) { 2475 $fields = array( 2476 'role_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 2477 'parent_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0) 2478 ); 2479 $ilDB->createTable('rbac_templates_temp', $fields); 2480 $ilDB->addPrimaryKey('rbac_templates_temp', array('role_id', 'parent_id')); 2481 $ilLog->write("Created new temporary table: rbac_templates_temp"); 2482 } 2483 2484 2485 $stmt = $ilDB->prepareManip("UPDATE rbac_templates SET parent = ?, old_parent = ? WHERE rol_id = ? AND parent = ?", array("integer", "integer", "integer", "integer")); 2486 $stmt2 = $ilDB->prepareManip("INSERT INTO rbac_templates_temp (role_id, parent_id) VALUES(?, ?)", array("integer", "integer")); 2487 $stmt3 = $ilDB->prepare("SELECT object_data.type FROM object_reference INNER JOIN object_data ON object_data.obj_id = object_reference.obj_id WHERE ref_id = ?", array("integer")); 2488 2489 $query = " 2490 SELECT f.*, t.parent grandparent 2491 FROM rbac_templates f 2492 INNER JOIN tree t ON t.child = f.parent 2493 LEFT JOIN rbac_templates_temp 2494 ON rbac_templates_temp.role_id = f.rol_id 2495 AND rbac_templates_temp.parent_id = old_parent 2496 WHERE f.parent != 8 AND rbac_templates_temp.role_id IS NULL 2497 ORDER BY f.rol_id, f.parent 2498 "; 2499 $res = $ilDB->query($query); 2500 2501 $handled_roles_by_parent = array(); 2502 2503 while ($row = $ilDB->fetchAssoc($res)) { 2504 $role_id = $row["rol_id"]; 2505 $parent_id = $row["parent"]; 2506 2507 if ($handled_roles_by_parent[$role_id][$parent_id]) { 2508 continue; 2509 } 2510 2511 $new_parent_id = $row['grandparent']; 2512 2513 $parent_res = $ilDB->execute($stmt3, array($parent_id)); 2514 $parent_row = $ilDB->fetchAssoc($parent_res); 2515 if ($parent_row['type'] != 'rolf') { 2516 $ilLog->write(sprintf("Parent of role with id %s is not a 'rolf' (obj_id: %s, type: %s), so skip record", $role_id, $parent_row['obj_id'], $parent_row['type'])); 2517 continue; 2518 } 2519 2520 if ($new_parent_id <= 0) { 2521 $ilLog->write(sprintf("Could not migrate record with role_id %s and parent id %s because the grandparent is 0", $role_id, $parent_id)); 2522 continue; 2523 } 2524 2525 $ilDB->execute($stmt, array($new_parent_id, $parent_id , $role_id, $parent_id)); 2526 $ilDB->execute($stmt2, array($role_id, $parent_id)); 2527 $ilLog->write(sprintf("Migrated record with role_id %s and parent id %s to parent with id %s", $role_id, $parent_id, $new_parent_id)); 2528 2529 $handled_roles_by_parent[$role_id][$parent_id] = true; 2530 } 2531 2532 if ($ilDB->tableColumnExists('rbac_templates', 'old_parent')) { 2533 $ilDB->dropTableColumn('rbac_templates', 'old_parent'); 2534 $ilLog->write("Dropped new temporary column: rbac_templates->old_parent"); 2535 } 2536 2537 if ($ilDB->tableExists('rbac_templates_temp')) { 2538 $ilDB->dropTable('rbac_templates_temp'); 2539 $ilLog->write("Dropped new temporary table: rbac_templates_temp"); 2540 } 2541?> 2542<#4293> 2543<?php 2544$def = array( 2545 'type' => 'integer', 2546 'length' => 1, 2547 'notnull' => true, 2548 'default' => 0 2549 ); 2550$ilDB->addTableColumn("content_object", "restrict_forw_nav", $def); 2551?> 2552<#4294> 2553<?php 2554 2555// category taxonomy custom blocks are obsolete 2556$ilDB->manipulate("DELETE FROM il_custom_block" . 2557 " WHERE context_obj_type = " . $ilDB->quote("cat", "text") . 2558 " AND context_sub_obj_type = " . $ilDB->quote("tax", "text")); 2559 2560?> 2561<#4295> 2562<?php 2563$ilCtrlStructureReader->getStructure(); 2564?> 2565<#4296> 2566<?php 2567if (!$ilDB->tableColumnExists('container_sorting_set', 'new_items_position')) { 2568 $def = array( 2569 'type' => 'integer', 2570 'length' => 1, 2571 'notnull' => true, 2572 'default' => 1 2573 ); 2574 $ilDB->addTableColumn('container_sorting_set', 'new_items_position', $def); 2575} 2576 2577if (!$ilDB->tableColumnExists('container_sorting_set', 'new_items_order')) { 2578 $def = array( 2579 'type' => 'integer', 2580 'length' => 1, 2581 'notnull' => true, 2582 'default' => 0 2583 ); 2584 $ilDB->addTableColumn('container_sorting_set', 'new_items_order', $def); 2585} 2586?> 2587<#4297> 2588<?php 2589 $ilCtrlStructureReader->getStructure(); 2590?> 2591<#4298> 2592<?php 2593if (!$ilDB->tableExists('usr_cron_mail_reminder')) { 2594 $fields = array( 2595 'usr_id' => array( 2596 'type' => 'integer', 2597 'length' => 4, 2598 'default' => 0, 2599 'notnull' => true 2600 ), 2601 'ts' => array( 2602 'type' => 'integer', 2603 'length' => 4, 2604 'default' => 0, 2605 'notnull' => true 2606 ) 2607 ); 2608 $ilDB->createTable('usr_cron_mail_reminder', $fields); 2609 $ilDB->addPrimaryKey('usr_cron_mail_reminder', array('usr_id')); 2610} 2611?> 2612<#4299> 2613 <?php 2614 if (!$ilDB->tableExists('orgu_types')) { 2615 $fields = array( 2616 'id' => array('type' => 'integer', 'length' => 4,'notnull' => true, 'default' => 0), 2617 'default_lang' => array('type' => 'text', 'notnull' => true, 'length' => 4, 'fixed' => false), 2618 'icon' => array('type' => 'text', 'length' => 256, 'notnull' => false), 2619 'owner' => array('type' => 'integer', 'notnull' => true, 'length' => 4), 2620 'create_date' => array('type' => 'timestamp'), 2621 'last_update' => array('type' => 'timestamp'), 2622 ); 2623 $ilDB->createTable('orgu_types', $fields); 2624 $ilDB->addPrimaryKey('orgu_types', array('id')); 2625 $ilDB->createSequence('orgu_types'); 2626 } 2627 ?> 2628<#4300> 2629 <?php 2630 if (!$ilDB->tableExists('orgu_data')) { 2631 $fields = array( 2632 'orgu_id' => array('type' => 'integer', 'length' => 4,'notnull' => true, 'default' => 0), 2633 'orgu_type_id' => array('type' => 'integer', 'notnull' => false, 'length' => 4), 2634 ); 2635 $ilDB->createTable('orgu_data', $fields); 2636 $ilDB->addPrimaryKey('orgu_data', array('orgu_id')); 2637 } 2638 ?> 2639<#4301> 2640 <?php 2641 if (!$ilDB->tableExists('orgu_types_trans')) { 2642 $fields = array( 2643 'orgu_type_id' => array('type' => 'integer', 'length' => 4,'notnull' => true), 2644 'lang' => array('type' => 'text', 'notnull' => true, 'length' => 4), 2645 'member' => array('type' => 'text', 'length' => 32, 'notnull' => true), 2646 'value' => array('type' => 'text', 'length' => 4000, 'notnull' => false), 2647 ); 2648 $ilDB->createTable('orgu_types_trans', $fields); 2649 $ilDB->addPrimaryKey('orgu_types_trans', array('orgu_type_id', 'lang', 'member')); 2650 } 2651 ?> 2652<#4302> 2653 <?php 2654 $ilCtrlStructureReader->getStructure(); 2655 ?> 2656<#4303> 2657 <?php 2658 if (!$ilDB->tableExists('orgu_types_adv_md_rec')) { 2659 $fields = array( 2660 'type_id' => array('type' => 'integer', 'length' => 4,'notnull' => true), 2661 'rec_id' => array('type' => 'integer', 'notnull' => true, 'length' => 4), 2662 ); 2663 $ilDB->createTable('orgu_types_adv_md_rec', $fields); 2664 $ilDB->addPrimaryKey('orgu_types_adv_md_rec', array('type_id', 'rec_id')); 2665 } 2666 ?> 2667<#4304> 2668<?php 2669 $ilDB->modifyTableColumn( 2670 'ecs_server', 2671 'auth_pass', 2672 array( 2673 "type" => "text", 2674 "length" => 128, 2675 "notnull" => false, 2676 'fixed' => false 2677 ) 2678 ); 2679?> 2680<#4305> 2681<?php 2682 2683// #13822 2684include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 2685ilDBUpdateNewObjectType::varchar2text('exc_assignment_peer', 'pcomment'); 2686 2687?> 2688<#4306> 2689<?php 2690/** 2691 * @var $ilDB ilDB 2692 */ 2693global $ilDB; 2694 2695$ilDB->modifyTableColumn('usr_data', 'passwd', array( 2696 'type' => 'text', 2697 'length' => 80, 2698 'notnull' => false, 2699 'default' => null 2700)); 2701?> 2702<#4307> 2703<?php 2704$ilDB->manipulateF( 2705 'DELETE FROM settings WHERE keyword = %s', 2706 array('text'), 2707 array('usr_settings_export_password') 2708); 2709?> 2710<#4308> 2711<?php 2712if (!$ilDB->tableColumnExists('usr_data', 'passwd_enc_type')) { 2713 $ilDB->addTableColumn('usr_data', 'passwd_enc_type', array( 2714 'type' => 'text', 2715 'length' => 10, 2716 'notnull' => false, 2717 'default' => null 2718 )); 2719} 2720?> 2721<#4309> 2722<?php 2723// We have to handle alle users with a password. We cannot rely on the auth_mode information. 2724$ilDB->manipulateF( 2725 ' 2726 UPDATE usr_data 2727 SET passwd_enc_type = %s 2728 WHERE (SUBSTR(passwd, 1, 4) = %s OR SUBSTR(passwd, 1, 4) = %s) AND passwd IS NOT NULL 2729 ', 2730 array('text', 'text', 'text'), 2731 array('bcrypt', '$2a$', '$2y$') 2732); 2733$ilDB->manipulateF( 2734 ' 2735 UPDATE usr_data 2736 SET passwd_enc_type = %s 2737 WHERE SUBSTR(passwd, 1, 4) != %s AND SUBSTR(passwd, 1, 4) != %s AND LENGTH(passwd) = 32 AND passwd IS NOT NULL 2738 ', 2739 array('text', 'text', 'text'), 2740 array('md5', '$2a$', '$2y$') 2741); 2742?> 2743<#4310> 2744<?php 2745if (!$ilDB->tableColumnExists('usr_data', 'passwd_salt')) { 2746 $ilDB->addTableColumn('usr_data', 'passwd_salt', array( 2747 'type' => 'text', 2748 'length' => 32, 2749 'notnull' => false, 2750 'default' => null 2751 )); 2752} 2753?> 2754<#4311> 2755<?php 2756if ($ilDB->tableColumnExists('usr_data', 'i2passwd')) { 2757 $ilDB->dropTableColumn('usr_data', 'i2passwd'); 2758} 2759?> 2760<#4312> 2761<?php 2762 2763 $a_obj_id = array(); 2764 $a_scope_id = array(); 2765 $a_scope_id_one = array(); 2766 //select targetobjectiveid = cmi_gobjective.objective_id 2767 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid 2768 FROM cp_package, cp_mapinfo, cp_node 2769 WHERE cp_package.global_to_system = 0 AND cp_package.obj_id = cp_node.slm_id AND cp_node.cp_node_id = cp_mapinfo.cp_node_id 2770 GROUP BY cp_mapinfo.targetobjectiveid'); 2771 while ($data = $ilDB->fetchAssoc($res)) { 2772 $a_obj_id[] = $data['targetobjectiveid']; 2773 } 2774 //make arrays 2775 for ($i = 0;$i < count($a_obj_id);$i++) { 2776 $a_scope_id[$a_obj_id[$i]] = array(); 2777 $a_scope_id_one[$a_obj_id[$i]] = array(); 2778 } 2779 //only global_to_system=0 -> should be updated 2780 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid, cp_package.obj_id 2781 FROM cp_package, cp_mapinfo, cp_node 2782 WHERE cp_package.global_to_system = 0 AND cp_package.obj_id = cp_node.slm_id AND cp_node.cp_node_id = cp_mapinfo.cp_node_id'); 2783 while ($data = $ilDB->fetchAssoc($res)) { 2784 $a_scope_id[$data['targetobjectiveid']][] = $data['obj_id']; 2785 } 2786 //only global_to_system=1 -> should maintain 2787 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid, cp_package.obj_id 2788 FROM cp_package, cp_mapinfo, cp_node 2789 WHERE cp_package.global_to_system = 1 AND cp_package.obj_id = cp_node.slm_id AND cp_node.cp_node_id = cp_mapinfo.cp_node_id'); 2790 while ($data = $ilDB->fetchAssoc($res)) { 2791 $a_scope_id_one[$data['targetobjectiveid']][] = $data['obj_id']; 2792 } 2793 2794 //for all targetobjectiveid 2795 for ($i = 0;$i < count($a_obj_id);$i++) { 2796 $a_toupdate = array(); 2797 //get old data without correct scope_id 2798 $res = $ilDB->queryF( 2799 "SELECT * FROM cmi_gobjective WHERE scope_id = %s AND objective_id = %s", 2800 array('integer', 'text'), 2801 array(0, $a_obj_id[$i]) 2802 ); 2803 while ($data = $ilDB->fetchAssoc($res)) { 2804 $a_toupdate[] = $data; 2805 } 2806 //check specific possible scope_ids with global_to_system=0 -> a_o 2807 $a_o = $a_scope_id[$a_obj_id[$i]]; 2808 for ($z = 0; $z < count($a_o); $z++) { 2809 //for all existing entries 2810 for ($y = 0; $y < count($a_toupdate); $y++) { 2811 $a_t = $a_toupdate[$y]; 2812 //only users attempted 2813 $res = $ilDB->queryF( 2814 'SELECT user_id FROM sahs_user WHERE obj_id=%s AND user_id=%s', 2815 array('integer', 'integer'), 2816 array($a_o[$z], $a_t['user_id']) 2817 ); 2818 if ($ilDB->numRows($res)) { 2819 //check existing entry 2820 $res = $ilDB->queryF( 2821 'SELECT user_id FROM cmi_gobjective WHERE scope_id=%s AND user_id=%s AND objective_id=%s', 2822 array('integer', 'integer','text'), 2823 array($a_o[$z], $a_t['user_id'],$a_t['objective_id']) 2824 ); 2825 if (!$ilDB->numRows($res)) { 2826 $ilDB->manipulate("INSERT INTO cmi_gobjective (user_id, satisfied, measure, scope_id, status, objective_id, score_raw, score_min, score_max, progress_measure, completion_status) VALUES" 2827 . " (" . $ilDB->quote($a_t['user_id'], "integer") 2828 . ", " . $ilDB->quote($a_t['satisfied'], "text") 2829 . ", " . $ilDB->quote($a_t['measure'], "text") 2830 . ", " . $ilDB->quote($a_o[$z], "integer") 2831 . ", " . $ilDB->quote($a_t['status'], "text") 2832 . ", " . $ilDB->quote($a_t['objective_id'], "text") 2833 . ", " . $ilDB->quote($a_t['score_raw'], "text") 2834 . ", " . $ilDB->quote($a_t['score_min'], "text") 2835 . ", " . $ilDB->quote($a_t['score_max'], "text") 2836 . ", " . $ilDB->quote($a_t['progress_measure'], "text") 2837 . ", " . $ilDB->quote($a_t['completion_status'], "text") 2838 . ")"); 2839 } 2840 } 2841 } 2842 } 2843 //delete entries if global_to_system=1 is not used by any learning module 2844 if (count($a_scope_id_one[$a_obj_id[$i]]) == 0) { 2845 $ilDB->queryF( 2846 'DELETE FROM cmi_gobjective WHERE scope_id = %s AND objective_id = %s', 2847 array('integer', 'text'), 2848 array(0, $a_obj_id[$i]) 2849 ); 2850 } 2851 } 2852 2853 2854?> 2855<#4313> 2856<?php 2857if ($ilDB->tableColumnExists('exc_assignment_peer', 'upload')) { 2858 $ilDB->dropTableColumn('exc_assignment_peer', 'upload'); 2859} 2860?> 2861 2862<#4314> 2863<?php 2864 2865$res = $ilDB->queryF( 2866 "SELECT COUNT(*) cnt FROM qpl_qst_type WHERE type_tag = %s", 2867 array('text'), 2868 array('assKprimChoice') 2869); 2870 2871$row = $ilDB->fetchAssoc($res); 2872 2873if (!$row['cnt']) { 2874 $res = $ilDB->query("SELECT MAX(question_type_id) maxid FROM qpl_qst_type"); 2875 $data = $ilDB->fetchAssoc($res); 2876 $nextId = $data['maxid'] + 1; 2877 2878 $ilDB->insert('qpl_qst_type', array( 2879 'question_type_id' => array('integer', $nextId), 2880 'type_tag' => array('text', 'assKprimChoice'), 2881 'plugin' => array('integer', 0) 2882 )); 2883} 2884 2885?> 2886 2887<#4315> 2888<?php 2889 2890if (!$ilDB->tableExists('qpl_qst_kprim')) { 2891 $ilDB->createTable('qpl_qst_kprim', array( 2892 'question_fi' => array( 2893 'type' => 'integer', 2894 'length' => 4, 2895 'notnull' => true, 2896 'default' => 0 2897 ), 2898 'shuffle_answers' => array( 2899 'type' => 'integer', 2900 'length' => 1, 2901 'notnull' => true, 2902 'default' => 0 2903 ), 2904 'answer_type' => array( 2905 'type' => 'text', 2906 'length' => 16, 2907 'notnull' => true, 2908 'default' => 'singleLine' 2909 ), 2910 'thumb_size' => array( 2911 'type' => 'integer', 2912 'length' => 4, 2913 'notnull' => false, 2914 'default' => null 2915 ), 2916 'opt_label' => array( 2917 'type' => 'text', 2918 'length' => 32, 2919 'notnull' => true, 2920 'default' => 'right/wrong' 2921 ), 2922 'custom_true' => array( 2923 'type' => 'text', 2924 'length' => 255, 2925 'notnull' => false, 2926 'default' => null 2927 ), 2928 'custom_false' => array( 2929 'type' => 'text', 2930 'length' => 255, 2931 'notnull' => false, 2932 'default' => null 2933 ), 2934 'score_partsol' => array( 2935 'type' => 'integer', 2936 'length' => 1, 2937 'notnull' => true, 2938 'default' => 0 2939 ), 2940 'feedback_setting' => array( 2941 'type' => 'integer', 2942 'length' => 4, 2943 'notnull' => true, 2944 'default' => 1 2945 ) 2946 )); 2947 2948 $ilDB->addPrimaryKey('qpl_qst_kprim', array('question_fi')); 2949} 2950 2951?> 2952 2953<#4316> 2954<?php 2955 2956if (!$ilDB->tableExists('qpl_a_kprim')) { 2957 $ilDB->createTable('qpl_a_kprim', array( 2958 'question_fi' => array( 2959 'type' => 'integer', 2960 'length' => 4, 2961 'notnull' => true, 2962 'default' => 0 2963 ), 2964 'position' => array( 2965 'type' => 'integer', 2966 'length' => 4, 2967 'notnull' => true, 2968 'default' => 0 2969 ), 2970 'answertext' => array( 2971 'type' => 'text', 2972 'length' => 1000, 2973 'notnull' => false, 2974 'default' => null 2975 ), 2976 'imagefile' => array( 2977 'type' => 'text', 2978 'length' => 255, 2979 'notnull' => false, 2980 'default' => null 2981 ), 2982 'correctness' => array( 2983 'type' => 'integer', 2984 'length' => 1, 2985 'notnull' => true, 2986 'default' => 0 2987 ) 2988 )); 2989 2990 $ilDB->addPrimaryKey('qpl_a_kprim', array('question_fi', 'position')); 2991 $ilDB->addIndex('qpl_a_kprim', array('question_fi'), 'i1'); 2992} 2993?> 2994 2995<#4317> 2996<?php 2997 $ilCtrlStructureReader->getStructure(); 2998?> 2999<#4318> 3000<?php 3001 3002// #13858 3003include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 3004ilDBUpdateNewObjectType::varchar2text('rbac_log', 'data'); 3005 3006?> 3007<#4319> 3008<?php 3009 3010$ilDB->addTableColumn('page_qst_answer', 'unlocked', array( 3011 "type" => "integer", 3012 "notnull" => true, 3013 "length" => 1, 3014 "default" => 0 3015)); 3016 3017?> 3018<#4320> 3019<?php 3020/** @var ilDB $ilDB */ 3021if (!$ilDB->tableColumnExists('tst_solutions', 'step')) { 3022 $ilDB->addTableColumn('tst_solutions', 'step', array( 3023 'type' => 'integer', 3024 'length' => 4, 3025 'notnull' => false, 3026 'default' => null 3027 )); 3028} 3029?> 3030<#4321> 3031<?php 3032/** @var ilDB $ilDB */ 3033if (!$ilDB->tableColumnExists('tst_test_result', 'step')) { 3034 $ilDB->addTableColumn('tst_test_result', 'step', array( 3035 'type' => 'integer', 3036 'length' => 4, 3037 'notnull' => false, 3038 'default' => null 3039 )); 3040} 3041?> 3042 3043<#4322> 3044<?php 3045 3046 $ilDB->addTableColumn('event', 'reg_type', array( 3047 'type' => 'integer', 3048 'length' => 2, 3049 'notnull' => false, 3050 'default' => 0 3051 )); 3052 3053?> 3054 3055<#4323> 3056<?php 3057 3058 $query = 'UPDATE event set reg_type = registration'; 3059 $ilDB->manipulate($query); 3060?> 3061 3062<#4324> 3063<?php 3064 $ilDB->addTableColumn('event', 'reg_limit_users', array( 3065 'type' => 'integer', 3066 'length' => 4, 3067 'notnull' => false, 3068 'default' => 0 3069 )); 3070 3071?> 3072<#4325> 3073<?php 3074 $ilDB->addTableColumn('event', 'reg_waiting_list', array( 3075 'type' => 'integer', 3076 'length' => 1, 3077 'notnull' => false, 3078 'default' => 0 3079 )); 3080 3081?> 3082<#4326> 3083<?php 3084 $ilDB->addTableColumn('event', 'reg_limited', array( 3085 'type' => 'integer', 3086 'length' => 1, 3087 'notnull' => false, 3088 'default' => 0 3089 )); 3090 3091?> 3092<#4327> 3093<?php 3094 3095include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 3096ilDBUpdateNewObjectType::addAdminNode('bibs', 'BibliographicAdmin'); 3097 3098$ilCtrlStructureReader->getStructure(); 3099?> 3100<#4328> 3101<?php 3102 3103if (!$ilDB->tableExists('il_bibl_settings')) { 3104 $ilDB->createTable('il_bibl_settings', array( 3105 'id' => array( 3106 'type' => "integer", 3107 'length' => 4, 3108 'notnull' => true, 3109 'default' => 0 3110 ), 3111 'name' => array( 3112 'type' => 'text', 3113 'length' => 50, 3114 'notnull' => true, 3115 'default' => "-" 3116 ), 3117 'url' => array( 3118 'type' => 'text', 3119 'length' => 128, 3120 'notnull' => true, 3121 'default' => "-" 3122 ), 3123 'img' => array( 3124 'type' => 'text', 3125 'length' => 128, 3126 'notnull' => false 3127 ) 3128 )); 3129 $ilDB->addPrimaryKey('il_bibl_settings', array('id')); 3130} 3131?> 3132<#4329> 3133<?php 3134 if (!$ilDB->tableColumnExists('frm_threads', 'thr_author_id')) { 3135 $ilDB->addTableColumn( 3136 'frm_threads', 3137 'thr_author_id', 3138 array( 3139 'type' => 'integer', 3140 'length' => 4, 3141 'notnull' => true, 3142 'default' => 0 3143 ) 3144 ); 3145 } 3146?> 3147<#4330> 3148<?php 3149 if ($ilDB->tableColumnExists('frm_threads', 'thr_author_id')) { 3150 $ilDB->manipulate('UPDATE frm_threads SET thr_author_id = thr_usr_id'); 3151 } 3152?> 3153<#4331> 3154<?php 3155 if (!$ilDB->tableColumnExists('frm_posts', 'pos_author_id')) { 3156 $ilDB->addTableColumn( 3157 'frm_posts', 3158 'pos_author_id', 3159 array( 3160 'type' => 'integer', 3161 'length' => 4, 3162 'notnull' => true, 3163 'default' => 0 3164 ) 3165 ); 3166 } 3167?> 3168<#4332> 3169<?php 3170 if ($ilDB->tableColumnExists('frm_posts', 'pos_author_id')) { 3171 $ilDB->manipulate('UPDATE frm_posts SET pos_author_id = pos_usr_id'); 3172 } 3173?> 3174<#4333> 3175<?php 3176 if (!$ilDB->tableColumnExists('frm_threads', 'thr_display_user_id')) { 3177 $ilDB->addTableColumn( 3178 'frm_threads', 3179 'thr_display_user_id', 3180 array( 3181 'type' => 'integer', 3182 'length' => 4, 3183 'notnull' => true, 3184 'default' => 0 3185 ) 3186 ); 3187 } 3188?> 3189<#4334> 3190<?php 3191 if ($ilDB->tableColumnExists('frm_threads', 'thr_display_user_id')) { 3192 $ilDB->manipulate('UPDATE frm_threads SET thr_display_user_id = thr_usr_id'); 3193 } 3194?> 3195<#4335> 3196<?php 3197 if ($ilDB->tableColumnExists('frm_threads', 'thr_usr_id')) { 3198 $ilDB->dropTableColumn('frm_threads', 'thr_usr_id'); 3199 } 3200 3201?> 3202<#4336> 3203<?php 3204 if (!$ilDB->tableColumnExists('frm_posts', 'pos_display_user_id')) { 3205 $ilDB->addTableColumn( 3206 'frm_posts', 3207 'pos_display_user_id', 3208 array( 3209 'type' => 'integer', 3210 'length' => 4, 3211 'notnull' => true, 3212 'default' => 0 3213 ) 3214 ); 3215 } 3216?> 3217<#4337> 3218<?php 3219 if ($ilDB->tableColumnExists('frm_posts', 'pos_display_user_id')) { 3220 $ilDB->manipulate('UPDATE frm_posts SET pos_display_user_id = pos_usr_id'); 3221 } 3222?> 3223<#4338> 3224<?php 3225 if ($ilDB->tableColumnExists('frm_posts', 'pos_usr_id')) { 3226 $ilDB->dropTableColumn('frm_posts', 'pos_usr_id'); 3227 } 3228?> 3229<#4339> 3230<?php 3231 3232$ilDB->createTable('sty_media_query', array( 3233 'id' => array( 3234 'type' => "integer", 3235 'length' => 4, 3236 'notnull' => true, 3237 'default' => 0 3238 ), 3239 'style_id' => array( 3240 'type' => "integer", 3241 'length' => 4, 3242 'notnull' => true, 3243 'default' => 0 3244 ), 3245 'order_nr' => array( 3246 'type' => "integer", 3247 'length' => 4, 3248 'notnull' => true, 3249 'default' => 0 3250 ), 3251 'mquery' => array( 3252 'type' => 'text', 3253 'length' => 2000, 3254 'notnull' => false, 3255 ))); 3256?> 3257<#4340> 3258<?php 3259 $ilDB->addPrimaryKey('sty_media_query', array('id')); 3260 $ilDB->createSequence('sty_media_query'); 3261?> 3262<#4341> 3263<?php 3264 $ilDB->addTableColumn('style_parameter', 'mq_id', array( 3265 "type" => "integer", 3266 "notnull" => true, 3267 "length" => 4, 3268 "default" => 0 3269 )); 3270?> 3271<#4342> 3272<?php 3273 $ilDB->addTableColumn('style_parameter', 'custom', array( 3274 "type" => "integer", 3275 "notnull" => true, 3276 "length" => 1, 3277 "default" => 0 3278 )); 3279?> 3280 3281<#4343> 3282<?php 3283$ini = new ilIniFile(ILIAS_ABSOLUTE_PATH . "/ilias.ini.php"); 3284 3285if ($ini->read()) { 3286 $ilSetting = new ilSetting(); 3287 3288 $https_header_enable = (bool) $ilSetting->get('ps_auto_https_enabled', false); 3289 $https_header_name = (string) $ilSetting->get('ps_auto_https_headername', "ILIAS_HTTPS_ENABLED"); 3290 $https_header_value = (string) $ilSetting->get('ps_auto_https_headervalue', "1"); 3291 3292 if (!$ini->groupExists('https')) { 3293 $ini->addGroup('https'); 3294 } 3295 3296 $ini->setVariable("https", "auto_https_detect_enabled", (!$https_header_enable) ? 0 : 1); 3297 $ini->setVariable("https", "auto_https_detect_header_name", $https_header_name); 3298 $ini->setVariable("https", "auto_https_detect_header_value", $https_header_value); 3299 3300 $ini->write(); 3301} 3302?> 3303<#4344> 3304<?php 3305 $ilSetting = new ilSetting(); 3306 3307 $ilSetting->delete('ps_auto_https_enabled'); 3308 $ilSetting->delete('ps_auto_https_headername'); 3309 $ilSetting->delete('ps_auto_https_headervalue'); 3310?> 3311<#4345> 3312<?php 3313 $ilCtrlStructureReader->getStructure(); 3314?> 3315<#4346> 3316<?php 3317if (!$ilDB->tableColumnExists('tst_active', 'objective_container')) { 3318 $ilDB->addTableColumn('tst_active', 'objective_container', array( 3319 'type' => 'integer', 3320 'length' => 4, 3321 'notnull' => false, 3322 'default' => null 3323 )); 3324} 3325?> 3326<#4347> 3327<?php 3328if (!$ilDB->tableExists('qpl_a_cloze_combi_res')) { 3329 $ilDB->createTable('qpl_a_cloze_combi_res', array( 3330 'combination_id' => array( 3331 'type' => "integer", 3332 'length' => 4, 3333 'notnull' => true 3334 ), 3335 'question_fi' => array( 3336 'type' => "integer", 3337 'length' => 4, 3338 'notnull' => true 3339 ), 3340 'gap_fi' => array( 3341 'type' => "integer", 3342 'length' => 4, 3343 'notnull' => true 3344 ), 3345 'answer' => array( 3346 'type' => 'text', 3347 'length' => 1000, 3348 'notnull' => false 3349 ), 3350 'points' => array( 3351 'type' => 'float' 3352 ), 3353 'best_solution' => array( 3354 'type' => 'integer', 3355 'length' => 1, 3356 'notnull' => false 3357 ), 3358 )); 3359} 3360?> 3361<#4348> 3362<?php 3363if (!$ilDB->tableColumnExists('conditions', 'hidden_status')) { 3364 $ilDB->addTableColumn('conditions', 'hidden_status', array( 3365 'type' => 'integer', 3366 'length' => 1, 3367 'notnull' => false, 3368 'default' => 0 3369 )); 3370} 3371?> 3372<#4349> 3373<?php 3374 if ($ilDB->tableColumnExists('frm_posts', 'pos_usr_id')) { 3375 $ilDB->dropTableColumn('frm_posts', 'pos_usr_id'); 3376 } 3377?> 3378<#4350> 3379<?php 3380 if ($ilDB->tableColumnExists('frm_threads', 'thr_usr_id')) { 3381 $ilDB->dropTableColumn('frm_threads', 'thr_usr_id'); 3382 } 3383?> 3384 3385 3386<#4351> 3387<?php 3388 $res = $ilDB->query("SELECT value FROM settings WHERE module = 'google_maps' AND keyword = 'enable'"); 3389 if ($rec = $ilDB->fetchAssoc($res)) { 3390 $ilDB->manipulate("INSERT INTO settings (module, keyword, value) VALUES ('maps', 'type', 'googlemaps')"); 3391 } 3392 3393 // adjust naming in settings 3394 $ilDB->manipulate("UPDATE settings SET module = 'maps' WHERE module = 'google_maps'"); 3395 3396 // adjust naming in language data 3397 $ilDB->manipulate("UPDATE lng_data SET module = 'maps' WHERE module = 'gmaps'"); 3398 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_enable_maps_info' WHERE identifier = 'gmaps_enable_gmaps_info'"); 3399 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_enable_maps' WHERE identifier = 'gmaps_enable_gmaps'"); 3400 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_extt_maps' WHERE identifier = 'gmaps_extt_gmaps'"); 3401 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_latitude' WHERE identifier = 'gmaps_latitude'"); 3402 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_longitude' WHERE identifier = 'gmaps_longitude'"); 3403 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_lookup_address' WHERE identifier = 'gmaps_lookup_address'"); 3404 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_public_profile_info' WHERE identifier = 'gmaps_public_profile_info'"); 3405 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_settings' WHERE identifier = 'gmaps_settings'"); 3406 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_std_location_desc' WHERE identifier = 'gmaps_std_location_desc'"); 3407 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_std_location' WHERE identifier = 'gmaps_std_location'"); 3408 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_zoom_level' WHERE identifier = 'gmaps_zoom_level'"); 3409 3410?> 3411<#4352> 3412<?php 3413 3414if (!$ilDB->tableColumnExists('il_blog', 'abs_shorten')) { 3415 $ilDB->addTableColumn( 3416 'il_blog', 3417 'abs_shorten', 3418 array( 3419 'type' => 'integer', 3420 'length' => 1, 3421 'notnull' => false, 3422 'default' => 0 3423 ) 3424 ); 3425} 3426 3427if (!$ilDB->tableColumnExists('il_blog', 'abs_shorten_len')) { 3428 $ilDB->addTableColumn( 3429 'il_blog', 3430 'abs_shorten_len', 3431 array( 3432 'type' => 'integer', 3433 'length' => 2, 3434 'notnull' => false, 3435 'default' => 0 3436 ) 3437 ); 3438} 3439 3440if (!$ilDB->tableColumnExists('il_blog', 'abs_image')) { 3441 $ilDB->addTableColumn( 3442 'il_blog', 3443 'abs_image', 3444 array( 3445 'type' => 'integer', 3446 'length' => 1, 3447 'notnull' => false, 3448 'default' => 0 3449 ) 3450 ); 3451} 3452 3453if (!$ilDB->tableColumnExists('il_blog', 'abs_img_width')) { 3454 $ilDB->addTableColumn( 3455 'il_blog', 3456 'abs_img_width', 3457 array( 3458 'type' => 'integer', 3459 'length' => 2, 3460 'notnull' => false, 3461 'default' => 0 3462 ) 3463 ); 3464} 3465 3466if (!$ilDB->tableColumnExists('il_blog', 'abs_img_height')) { 3467 $ilDB->addTableColumn( 3468 'il_blog', 3469 'abs_img_height', 3470 array( 3471 'type' => 'integer', 3472 'length' => 2, 3473 'notnull' => false, 3474 'default' => 0 3475 ) 3476 ); 3477} 3478 3479?> 3480 3481<#4353> 3482<?php 3483 3484if (!$ilDB->tableExists('usr_data_multi')) { 3485 $ilDB->createTable('usr_data_multi', array( 3486 'usr_id' => array( 3487 'type' => 'integer', 3488 'length' => 4, 3489 'notnull' => true, 3490 'default' => 0 3491 ), 3492 'field_id' => array( 3493 'type' => 'text', 3494 'length' => 255, 3495 'notnull' => true 3496 ), 3497 'value' => array( 3498 'type' => 'text', 3499 'length' => 1000, 3500 'notnull' => false, 3501 ) 3502 )); 3503} 3504 3505?> 3506 3507<#4354> 3508<?php 3509if (!$ilDB->tableColumnExists('crs_start', 'pos')) { 3510 $ilDB->addTableColumn('crs_start', 'pos', array( 3511 'type' => 'integer', 3512 'length' => 4, 3513 'notnull' => false, 3514 'default' => null 3515 )); 3516} 3517?> 3518 3519<#4355> 3520<?php 3521if (!$ilDB->tableExists('loc_settings')) { 3522 $ilDB->createTable( 3523 'loc_settings', 3524 array( 3525 'obj_id' => array( 3526 'type' => 'integer', 3527 'length' => 4, 3528 'notnull' => true, 3529 'default' => 0 3530 ), 3531 'type' => array( 3532 'type' => 'integer', 3533 'length' => 1, 3534 'notnull' => true, 3535 'default' => 0 3536 ) 3537 ) 3538 ); 3539 3540 $ilDB->addPrimaryKey('loc_settings', array('obj_id')); 3541} 3542?> 3543<#4356> 3544<?php 3545if (!$ilDB->tableColumnExists('loc_settings', 'itest')) { 3546 $ilDB->addTableColumn('loc_settings', 'itest', array( 3547 'type' => 'integer', 3548 'length' => 4, 3549 'notnull' => false, 3550 'default' => null 3551 )); 3552} 3553 3554if (!$ilDB->tableColumnExists('loc_settings', 'qtest')) { 3555 $ilDB->addTableColumn('loc_settings', 'qtest', array( 3556 'type' => 'integer', 3557 'length' => 4, 3558 'notnull' => false, 3559 'default' => null 3560 )); 3561} 3562?> 3563 3564<#4357> 3565<?php 3566if (!$ilDB->tableColumnExists('adm_settings_template', 'auto_generated')) { 3567 $ilDB->addTableColumn('adm_settings_template', 'auto_generated', array( 3568 'type' => 'integer', 3569 'length' => 1, 3570 'notnull' => false, 3571 'default' => 0 3572 )); 3573} 3574?> 3575 3576<#4358> 3577<?php 3578if (!$ilDB->tableColumnExists('crs_objective_lm', 'position')) { 3579 $ilDB->addTableColumn('crs_objective_lm', 'position', array( 3580 'type' => 'integer', 3581 'length' => 4, 3582 'notnull' => false, 3583 'default' => 0 3584 )); 3585} 3586?> 3587<#4359> 3588<?php 3589 3590if (!$ilDB->tableExists('loc_rnd_qpl')) { 3591 $ilDB->createTable('loc_rnd_qpl', array( 3592 'container_id' => array( 3593 'type' => 'integer', 3594 'length' => 4, 3595 'notnull' => true, 3596 'default' => 0 3597 ), 3598 'objective_id' => array( 3599 'type' => 'integer', 3600 'length' => 4, 3601 'notnull' => true, 3602 'default' => 0 3603 ), 3604 'tst_type' => array( 3605 'type' => 'integer', 3606 'length' => 1, 3607 'notnull' => true, 3608 'default' => 0 3609 ), 3610 'tst_id' => array( 3611 'type' => 'integer', 3612 'length' => 4, 3613 'notnull' => true, 3614 'default' => 0 3615 ), 3616 'qp_seq' => array( 3617 'type' => 'integer', 3618 'length' => 4, 3619 'notnull' => true, 3620 'default' => 0 3621 ), 3622 'percentage' => array( 3623 'type' => 'integer', 3624 'length' => 4, 3625 'notnull' => true, 3626 'default' => 0 3627 ), 3628 )); 3629 $ilDB->addPrimaryKey('loc_rnd_qpl', array('container_id', 'objective_id', 'tst_type')); 3630} 3631?> 3632<#4360> 3633<?php 3634 3635$query = 'INSERT INTO adm_settings_template ' . 3636 '(id, type, title, description, auto_generated) ' . 3637 'VALUES( ' . 3638 $ilDB->quote($ilDB->nextId('adm_settings_template'), 'integer') . ', ' . 3639 $ilDB->quote('tst', 'text') . ', ' . 3640 $ilDB->quote('il_astpl_loc_initial', 'text') . ', ' . 3641 $ilDB->quote('il_astpl_loc_initial_desc', 'text') . ', ' . 3642 $ilDB->quote(1, 'integer') . ' ' . 3643 ')'; 3644$ilDB->manipulate($query); 3645?> 3646<#4361> 3647<?php 3648 3649$query = 'INSERT INTO adm_settings_template ' . 3650 '(id, type, title, description, auto_generated) ' . 3651 'VALUES( ' . 3652 $ilDB->quote($ilDB->nextId('adm_settings_template'), 'integer') . ', ' . 3653 $ilDB->quote('tst', 'text') . ', ' . 3654 $ilDB->quote('il_astpl_loc_qualified', 'text') . ', ' . 3655 $ilDB->quote('il_astpl_loc_qualified_desc', 'text') . ', ' . 3656 $ilDB->quote(1, 'integer') . ' ' . 3657 ')'; 3658$ilDB->manipulate($query); 3659?> 3660 3661<#4362> 3662<?php 3663 3664if (!$ilDB->tableExists('loc_user_results')) { 3665 $ilDB->createTable('loc_user_results', array( 3666 'user_id' => array( 3667 'type' => 'integer', 3668 'length' => 4, 3669 'notnull' => true, 3670 'default' => 0 3671 ), 3672 'course_id' => array( 3673 'type' => 'integer', 3674 'length' => 4, 3675 'notnull' => true, 3676 'default' => 0 3677 ), 3678 'objective_id' => array( 3679 'type' => 'integer', 3680 'length' => 4, 3681 'notnull' => true, 3682 'default' => 0 3683 ), 3684 'type' => array( 3685 'type' => 'integer', 3686 'length' => 1, 3687 'notnull' => true, 3688 'default' => 0 3689 ), 3690 'status' => array( 3691 'type' => 'integer', 3692 'length' => 1, 3693 'notnull' => false, 3694 'default' => 0 3695 ), 3696 'result_perc' => array( 3697 'type' => 'integer', 3698 'length' => 1, 3699 'notnull' => false, 3700 'default' => 0 3701 ), 3702 'limit_perc' => array( 3703 'type' => 'integer', 3704 'length' => 1, 3705 'notnull' => false, 3706 'default' => 0 3707 ), 3708 'tries' => array( 3709 'type' => 'integer', 3710 'length' => 1, 3711 'notnull' => false, 3712 'default' => 0 3713 ), 3714 'is_final' => array( 3715 'type' => 'integer', 3716 'length' => 1, 3717 'notnull' => false, 3718 'default' => 0 3719 ), 3720 'tstamp' => array( 3721 'type' => 'integer', 3722 'length' => 4, 3723 'notnull' => false, 3724 'default' => 0 3725 ) 3726 )); 3727 3728 $ilDB->addPrimaryKey('loc_user_results', array('user_id', 'course_id', 'objective_id', 'type')); 3729} 3730?> 3731<#4363> 3732<?php 3733if (!$ilDB->tableColumnExists('loc_settings', 'qt_vis_all')) { 3734 $ilDB->addTableColumn('loc_settings', 'qt_vis_all', array( 3735 'type' => 'integer', 3736 'length' => 1, 3737 'notnull' => false, 3738 'default' => 1 3739 )); 3740} 3741?> 3742 3743<#4364> 3744<?php 3745if (!$ilDB->tableColumnExists('loc_settings', 'qt_vis_obj')) { 3746 $ilDB->addTableColumn('loc_settings', 'qt_vis_obj', array( 3747 'type' => 'integer', 3748 'length' => 1, 3749 'notnull' => false, 3750 'default' => 0 3751 )); 3752} 3753?> 3754 3755<#4365> 3756<?php 3757if (!$ilDB->tableColumnExists('crs_objectives', 'active')) { 3758 $ilDB->addTableColumn('crs_objectives', 'active', array( 3759 'type' => 'integer', 3760 'length' => 1, 3761 'notnull' => false, 3762 'default' => 1 3763 )); 3764} 3765?> 3766 3767<#4366> 3768<?php 3769if (!$ilDB->tableColumnExists('crs_objectives', 'passes')) { 3770 $ilDB->addTableColumn('crs_objectives', 'passes', array( 3771 'type' => 'integer', 3772 'length' => 2, 3773 'notnull' => false, 3774 'default' => 0 3775 )); 3776} 3777?> 3778 3779<#4367> 3780<?php 3781if (!$ilDB->tableExists('loc_tst_run')) { 3782 $ilDB->createTable('loc_tst_run', array( 3783 'container_id' => array( 3784 'type' => 'integer', 3785 'length' => 4, 3786 'notnull' => true, 3787 'default' => 0 3788 ), 3789 'user_id' => array( 3790 'type' => 'integer', 3791 'length' => 4, 3792 'notnull' => true, 3793 'default' => 0 3794 ), 3795 'test_id' => array( 3796 'type' => 'integer', 3797 'length' => 4, 3798 'notnull' => true, 3799 'default' => 0 3800 ), 3801 'objective_id' => array( 3802 'type' => 'integer', 3803 'length' => 4, 3804 'notnull' => true, 3805 'default' => 0 3806 ), 3807 'max_points' => array( 3808 'type' => 'integer', 3809 'length' => 4, 3810 'notnull' => false, 3811 'default' => 0 3812 ), 3813 'questions' => array( 3814 'type' => 'text', 3815 'length' => 1000, 3816 'notnull' => false, 3817 'default' => 0 3818 ) 3819 )); 3820 $ilDB->addPrimaryKey('loc_tst_run', array('container_id', 'user_id', 'test_id', 'objective_id')); 3821} 3822?> 3823<#4368> 3824<?php 3825if (!$ilDB->tableColumnExists('loc_settings', 'reset_results')) { 3826 $ilDB->addTableColumn( 3827 'loc_settings', 3828 'reset_results', 3829 array( 3830 'type' => 'integer', 3831 'length' => 1, 3832 'notnull' => false, 3833 'default' => 0 3834 ) 3835 ); 3836} 3837?> 3838<#4369> 3839<?php 3840$ilCtrlStructureReader->getStructure(); 3841?> 3842<#4370> 3843<?php 3844if (!$ilDB->tableColumnExists('il_bibl_settings', 'show_in_list')) { 3845 $ilDB->addTableColumn('il_bibl_settings', 'show_in_list', array( 3846 'type' => 'integer', 3847 'length' => 1, 3848 'notnull' => false, 3849 'default' => 0 3850 )); 3851} 3852?> 3853<#4371> 3854<?php 3855 3856 $a_obj_id = array(); 3857 $a_scope_id = array(); 3858 $a_scope_id_one = array(); 3859 //select targetobjectiveid = cmi_gobjective.objective_id 3860 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid 3861 FROM cp_package, cp_mapinfo, cp_node 3862 WHERE cp_package.global_to_system = 0 AND cp_package.obj_id = cp_node.slm_id AND cp_node.cp_node_id = cp_mapinfo.cp_node_id 3863 GROUP BY cp_mapinfo.targetobjectiveid'); 3864 while ($data = $ilDB->fetchAssoc($res)) { 3865 $a_obj_id[] = $data['targetobjectiveid']; 3866 } 3867 //make arrays 3868 for ($i = 0;$i < count($a_obj_id);$i++) { 3869 $a_scope_id[$a_obj_id[$i]] = array(); 3870 $a_scope_id_one[$a_obj_id[$i]] = array(); 3871 } 3872 //only global_to_system=0 -> should be updated 3873 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid, cp_package.obj_id 3874 FROM cp_package, cp_mapinfo, cp_node 3875 WHERE cp_package.global_to_system = 0 AND cp_package.obj_id = cp_node.slm_id AND cp_node.cp_node_id = cp_mapinfo.cp_node_id'); 3876 while ($data = $ilDB->fetchAssoc($res)) { 3877 $a_scope_id[$data['targetobjectiveid']][] = $data['obj_id']; 3878 } 3879 //only global_to_system=1 -> should maintain 3880 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid, cp_package.obj_id 3881 FROM cp_package, cp_mapinfo, cp_node 3882 WHERE cp_package.global_to_system = 1 AND cp_package.obj_id = cp_node.slm_id AND cp_node.cp_node_id = cp_mapinfo.cp_node_id'); 3883 while ($data = $ilDB->fetchAssoc($res)) { 3884 $a_scope_id_one[$data['targetobjectiveid']][] = $data['obj_id']; 3885 } 3886 3887 //for all targetobjectiveid 3888 for ($i = 0;$i < count($a_obj_id);$i++) { 3889 $a_toupdate = array(); 3890 //get old data without correct scope_id 3891 $res = $ilDB->queryF( 3892 "SELECT * FROM cmi_gobjective WHERE scope_id = %s AND objective_id = %s", 3893 array('integer', 'text'), 3894 array(0, $a_obj_id[$i]) 3895 ); 3896 while ($data = $ilDB->fetchAssoc($res)) { 3897 $a_toupdate[] = $data; 3898 } 3899 //check specific possible scope_ids with global_to_system=0 -> a_o 3900 $a_o = $a_scope_id[$a_obj_id[$i]]; 3901 for ($z = 0; $z < count($a_o); $z++) { 3902 //for all existing entries 3903 for ($y = 0; $y < count($a_toupdate); $y++) { 3904 $a_t = $a_toupdate[$y]; 3905 //only users attempted 3906 $res = $ilDB->queryF( 3907 'SELECT user_id FROM sahs_user WHERE obj_id=%s AND user_id=%s', 3908 array('integer', 'integer'), 3909 array($a_o[$z], $a_t['user_id']) 3910 ); 3911 if ($ilDB->numRows($res)) { 3912 //check existing entry 3913 $res = $ilDB->queryF( 3914 'SELECT user_id FROM cmi_gobjective WHERE scope_id=%s AND user_id=%s AND objective_id=%s', 3915 array('integer', 'integer','text'), 3916 array($a_o[$z], $a_t['user_id'],$a_t['objective_id']) 3917 ); 3918 if (!$ilDB->numRows($res)) { 3919 $ilDB->manipulate("INSERT INTO cmi_gobjective (user_id, satisfied, measure, scope_id, status, objective_id, score_raw, score_min, score_max, progress_measure, completion_status) VALUES" 3920 . " (" . $ilDB->quote($a_t['user_id'], "integer") 3921 . ", " . $ilDB->quote($a_t['satisfied'], "text") 3922 . ", " . $ilDB->quote($a_t['measure'], "text") 3923 . ", " . $ilDB->quote($a_o[$z], "integer") 3924 . ", " . $ilDB->quote($a_t['status'], "text") 3925 . ", " . $ilDB->quote($a_t['objective_id'], "text") 3926 . ", " . $ilDB->quote($a_t['score_raw'], "text") 3927 . ", " . $ilDB->quote($a_t['score_min'], "text") 3928 . ", " . $ilDB->quote($a_t['score_max'], "text") 3929 . ", " . $ilDB->quote($a_t['progress_measure'], "text") 3930 . ", " . $ilDB->quote($a_t['completion_status'], "text") 3931 . ")"); 3932 } 3933 } 3934 } 3935 } 3936 //delete entries if global_to_system=1 is not used by any learning module 3937 if (count($a_scope_id_one[$a_obj_id[$i]]) == 0) { 3938 $ilDB->queryF( 3939 'DELETE FROM cmi_gobjective WHERE scope_id = %s AND objective_id = %s', 3940 array('integer', 'text'), 3941 array(0, $a_obj_id[$i]) 3942 ); 3943 } 3944 } 3945 3946 3947?> 3948<#4372> 3949<?php 3950 if ($ilDB->getDBType() == 'innodb') { 3951 $query = "show index from cmi_gobjective where Key_name = 'PRIMARY'"; 3952 $res = $ilDB->query($query); 3953 if (!$ilDB->numRows($res)) { 3954 $ilDB->addPrimaryKey('cmi_gobjective', array('user_id', 'scope_id', 'objective_id')); 3955 } 3956 } 3957?> 3958<#4373> 3959<?php 3960 if ($ilDB->getDBType() == 'innodb') { 3961 $query = "show index from cp_suspend where Key_name = 'PRIMARY'"; 3962 $res = $ilDB->query($query); 3963 if (!$ilDB->numRows($res)) { 3964 $ilDB->addPrimaryKey('cp_suspend', array('user_id', 'obj_id')); 3965 } 3966 } 3967?> 3968<#4374> 3969<?php 3970 if (!$ilDB->tableColumnExists('frm_posts', 'is_author_moderator')) { 3971 $ilDB->addTableColumn( 3972 'frm_posts', 3973 'is_author_moderator', 3974 array( 3975 'type' => 'integer', 3976 'length' => 1, 3977 'notnull' => false, 3978 'default' => null) 3979 ); 3980 } 3981?> 3982<#4375> 3983<?php 3984if (!$ilDB->tableColumnExists('ecs_part_settings', 'token')) { 3985 $ilDB->addTableColumn( 3986 'ecs_part_settings', 3987 'token', 3988 array( 3989 'type' => 'integer', 3990 'length' => 1, 3991 'notnull' => false, 3992 'default' => 1 3993 ) 3994 ); 3995} 3996?> 3997<#4376> 3998<?php 3999$ilCtrlStructureReader->getStructure(); 4000?> 4001<#4377> 4002<?php 4003if (!$ilDB->tableColumnExists('ecs_part_settings', 'export_types')) { 4004 $ilDB->addTableColumn( 4005 'ecs_part_settings', 4006 'export_types', 4007 array( 4008 'type' => 'text', 4009 'length' => 4000, 4010 'notnull' => false, 4011 ) 4012 ); 4013} 4014?> 4015<#4378> 4016<?php 4017if (!$ilDB->tableColumnExists('ecs_part_settings', 'import_types')) { 4018 $ilDB->addTableColumn( 4019 'ecs_part_settings', 4020 'import_types', 4021 array( 4022 'type' => 'text', 4023 'length' => 4000, 4024 'notnull' => false, 4025 ) 4026 ); 4027} 4028?> 4029<#4379> 4030<?php 4031 4032 $query = 'UPDATE ecs_part_settings SET export_types = ' . $ilDB->quote(serialize(array('cat','crs','file','glo','grp','wiki','lm')), 'text'); 4033 $ilDB->manipulate($query); 4034 4035?> 4036 4037<#4380> 4038<?php 4039 4040 $query = 'UPDATE ecs_part_settings SET import_types = ' . $ilDB->quote(serialize(array('cat','crs','file','glo','grp','wiki','lm')), 'text'); 4041 $ilDB->manipulate($query); 4042 4043?> 4044<#4381> 4045<?php 4046if (!$ilDB->tableColumnExists('reg_registration_codes', 'reg_enabled')) { 4047 $ilDB->addTableColumn( 4048 'reg_registration_codes', 4049 'reg_enabled', 4050 array( 4051 'type' => 'integer', 4052 'length' => 1, 4053 'notnull' => true, 4054 'default' => 1 4055 ) 4056 ); 4057} 4058?> 4059 4060<#4382> 4061<?php 4062if (!$ilDB->tableColumnExists('reg_registration_codes', 'ext_enabled')) { 4063 $ilDB->addTableColumn( 4064 'reg_registration_codes', 4065 'ext_enabled', 4066 array( 4067 'type' => 'integer', 4068 'length' => 1, 4069 'notnull' => true, 4070 'default' => 0 4071 ) 4072 ); 4073} 4074?> 4075<#4383> 4076<?php 4077 4078if ($ilDB->tableColumnExists('reg_registration_codes', 'generated')) { 4079 $ilDB->renameTableColumn('reg_registration_codes', "generated", 'generated_on'); 4080} 4081 4082 4083$query = 'SELECT * FROM usr_account_codes '; 4084$res = $ilDB->query($query); 4085while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 4086 $until = $row->valid_until; 4087 if ($until === '0') { 4088 $alimit = 'unlimited'; 4089 $a_limitdt = null; 4090 } elseif (is_numeric($until)) { 4091 $alimit = 'relative'; 4092 $a_limitdt = array( 4093 'd' => (string) $until, 4094 'm' => '', 4095 'y' => '' 4096 ); 4097 $a_limitdt = serialize($a_limitdt); 4098 } else { 4099 $alimit = 'absolute'; 4100 $a_limitdt = $until; 4101 } 4102 4103 $next_id = $ilDB->nextId('reg_registration_codes'); 4104 $query = 'INSERT INTO reg_registration_codes ' . 4105 '(code_id, code, role, generated_on, used, role_local, alimit, alimitdt, reg_enabled, ext_enabled ) ' . 4106 'VALUES ( ' . 4107 $ilDB->quote($next_id, 'integer') . ', ' . 4108 $ilDB->quote($row->code, 'text') . ', ' . 4109 $ilDB->quote(0, 'integer') . ', ' . 4110 $ilDB->quote($row->generated_on, 'integer') . ', ' . 4111 $ilDB->quote($row->used, 'integer') . ', ' . 4112 $ilDB->quote('', 'text') . ', ' . 4113 $ilDB->quote($alimit, 'text') . ', ' . 4114 $ilDB->quote($a_limitdt, 'text') . ', ' . 4115 $ilDB->quote(0, 'integer') . ', ' . 4116 $ilDB->quote(1, 'integer') . ' ' . 4117 ')'; 4118 $ilDB->manipulate($query); 4119} 4120?> 4121<#4384> 4122<?php 4123$ilCtrlStructureReader->getStructure(); 4124?> 4125<#4385> 4126<?php 4127$ilCtrlStructureReader->getStructure(); 4128?> 4129<#4386> 4130<?php 4131 $ilSetting = new ilSetting("assessment"); 4132 $ilSetting->set("use_javascript", "1"); 4133?> 4134<#4387> 4135<?php 4136 $ilDB->update( 4137 'tst_tests', 4138 array('forcejs' => array('integer', 1)), 4139 array('forcejs' => array('integer', 0)) 4140 ); 4141?> 4142<#4388> 4143<?php 4144$ilCtrlStructureReader->getStructure(); 4145?> 4146<#4389> 4147<?php 4148$ilDB->addTableColumn( 4149 "tst_test_defaults", 4150 "marks_tmp", 4151 array( 4152 "type" => "clob", 4153 "notnull" => false, 4154 "default" => null) 4155); 4156 4157$ilDB->manipulate('UPDATE tst_test_defaults SET marks_tmp = marks'); 4158$ilDB->dropTableColumn('tst_test_defaults', 'marks'); 4159$ilDB->renameTableColumn("tst_test_defaults", "marks_tmp", "marks"); 4160?> 4161<#4390> 4162<?php 4163$ilDB->addTableColumn( 4164 "tst_test_defaults", 4165 "defaults_tmp", 4166 array( 4167 "type" => "clob", 4168 "notnull" => false, 4169 "default" => null) 4170); 4171 4172$ilDB->manipulate('UPDATE tst_test_defaults SET defaults_tmp = defaults'); 4173$ilDB->dropTableColumn('tst_test_defaults', 'defaults'); 4174$ilDB->renameTableColumn("tst_test_defaults", "defaults_tmp", "defaults"); 4175?> 4176 4177<#4391> 4178<?php 4179 4180if (!$ilDB->tableExists('tst_seq_qst_tracking')) { 4181 $ilDB->createTable('tst_seq_qst_tracking', array( 4182 'active_fi' => array( 4183 'type' => 'integer', 4184 'length' => 4, 4185 'notnull' => true, 4186 'default' => 0 4187 ), 4188 'pass' => array( 4189 'type' => 'integer', 4190 'length' => 4, 4191 'notnull' => true, 4192 'default' => 0 4193 ), 4194 'question_fi' => array( 4195 'type' => 'integer', 4196 'length' => 4, 4197 'notnull' => true, 4198 'default' => 0 4199 ), 4200 'status' => array( 4201 'type' => 'text', 4202 'length' => 16, 4203 'notnull' => false 4204 ), 4205 'orderindex' => array( 4206 'type' => 'integer', 4207 'length' => 4, 4208 'notnull' => true, 4209 'default' => 0 4210 ) 4211 )); 4212 4213 $ilDB->addPrimaryKey('tst_seq_qst_tracking', array('active_fi', 'pass', 'question_fi')); 4214 $ilDB->addIndex('tst_seq_qst_tracking', array('active_fi', 'pass'), 'i1'); 4215 $ilDB->addIndex('tst_seq_qst_tracking', array('active_fi', 'question_fi'), 'i2'); 4216} 4217 4218?> 4219 4220<#4392> 4221<?php 4222 4223$query = " 4224 SELECT active_fi, pass, sequence 4225 FROM tst_tests 4226 INNER JOIN tst_active 4227 ON test_fi = test_id 4228 INNER JOIN tst_sequence 4229 ON active_fi = active_id 4230 AND sequence IS NOT NULL 4231 WHERE question_set_type = %s 4232"; 4233 4234$res = $ilDB->queryF($query, array('text'), array('DYNAMIC_QUEST_SET')); 4235 4236while ($row = $ilDB->fetchAssoc($res)) { 4237 $tracking = unserialize($row['sequence']); 4238 4239 if (is_array($tracking)) { 4240 foreach ($tracking as $index => $question) { 4241 $ilDB->replace( 4242 'tst_seq_qst_tracking', 4243 array( 4244 'active_fi' => array('integer', $row['active_fi']), 4245 'pass' => array('integer', $row['pass']), 4246 'question_fi' => array('integer', $question['qid']) 4247 ), 4248 array( 4249 'status' => array('text', $question['status']), 4250 'orderindex' => array('integer', $index + 1) 4251 ) 4252 ); 4253 } 4254 4255 $ilDB->update( 4256 'tst_sequence', 4257 array( 4258 'sequence' => array('text', null) 4259 ), 4260 array( 4261 'active_fi' => array('integer', $row['active_fi']), 4262 'pass' => array('integer', $row['pass']) 4263 ) 4264 ); 4265 } 4266} 4267 4268?> 4269 4270<#4393> 4271<?php 4272 4273if (!$ilDB->tableExists('tst_seq_qst_postponed')) { 4274 $ilDB->createTable('tst_seq_qst_postponed', array( 4275 'active_fi' => array( 4276 'type' => 'integer', 4277 'length' => 4, 4278 'notnull' => true, 4279 'default' => 0 4280 ), 4281 'pass' => array( 4282 'type' => 'integer', 4283 'length' => 4, 4284 'notnull' => true, 4285 'default' => 0 4286 ), 4287 'question_fi' => array( 4288 'type' => 'integer', 4289 'length' => 4, 4290 'notnull' => true, 4291 'default' => 0 4292 ), 4293 'cnt' => array( 4294 'type' => 'integer', 4295 'length' => 4, 4296 'notnull' => true, 4297 'default' => 0 4298 ) 4299 )); 4300 4301 $ilDB->addPrimaryKey('tst_seq_qst_postponed', array('active_fi', 'pass', 'question_fi')); 4302 $ilDB->addIndex('tst_seq_qst_postponed', array('active_fi', 'pass'), 'i1'); 4303 $ilDB->addIndex('tst_seq_qst_postponed', array('active_fi', 'question_fi'), 'i2'); 4304} 4305 4306?> 4307 4308<#4394> 4309<?php 4310 4311$query = " 4312 SELECT active_fi, pass, postponed 4313 FROM tst_tests 4314 INNER JOIN tst_active 4315 ON test_fi = test_id 4316 INNER JOIN tst_sequence 4317 ON active_fi = active_id 4318 AND postponed IS NOT NULL 4319 WHERE question_set_type = %s 4320"; 4321 4322$res = $ilDB->queryF($query, array('text'), array('DYNAMIC_QUEST_SET')); 4323 4324while ($row = $ilDB->fetchAssoc($res)) { 4325 $postponed = unserialize($row['postponed']); 4326 4327 if (is_array($postponed)) { 4328 foreach ($postponed as $questionId => $postponeCount) { 4329 $ilDB->replace( 4330 'tst_seq_qst_postponed', 4331 array( 4332 'active_fi' => array('integer', $row['active_fi']), 4333 'pass' => array('integer', $row['pass']), 4334 'question_fi' => array('integer', $questionId) 4335 ), 4336 array( 4337 'cnt' => array('integer', $postponeCount) 4338 ) 4339 ); 4340 } 4341 4342 $ilDB->update( 4343 'tst_sequence', 4344 array( 4345 'postponed' => array('text', null) 4346 ), 4347 array( 4348 'active_fi' => array('integer', $row['active_fi']), 4349 'pass' => array('integer', $row['pass']) 4350 ) 4351 ); 4352 } 4353} 4354 4355?> 4356 4357<#4395> 4358<?php 4359 4360if (!$ilDB->tableExists('tst_seq_qst_answstatus')) { 4361 $ilDB->createTable('tst_seq_qst_answstatus', array( 4362 'active_fi' => array( 4363 'type' => 'integer', 4364 'length' => 4, 4365 'notnull' => true, 4366 'default' => 0 4367 ), 4368 'pass' => array( 4369 'type' => 'integer', 4370 'length' => 4, 4371 'notnull' => true, 4372 'default' => 0 4373 ), 4374 'question_fi' => array( 4375 'type' => 'integer', 4376 'length' => 4, 4377 'notnull' => true, 4378 'default' => 0 4379 ), 4380 'correctness' => array( 4381 'type' => 'integer', 4382 'length' => 1, 4383 'notnull' => true, 4384 'default' => 0 4385 ) 4386 )); 4387 4388 $ilDB->addPrimaryKey('tst_seq_qst_answstatus', array('active_fi', 'pass', 'question_fi')); 4389 $ilDB->addIndex('tst_seq_qst_answstatus', array('active_fi', 'pass'), 'i1'); 4390 $ilDB->addIndex('tst_seq_qst_answstatus', array('active_fi', 'question_fi'), 'i2'); 4391} 4392 4393?> 4394 4395<#4396> 4396<?php 4397 4398$query = " 4399 SELECT active_fi, pass, hidden 4400 FROM tst_tests 4401 INNER JOIN tst_active 4402 ON test_fi = test_id 4403 INNER JOIN tst_sequence 4404 ON active_fi = active_id 4405 AND hidden IS NOT NULL 4406 WHERE question_set_type = %s 4407"; 4408 4409$res = $ilDB->queryF($query, array('text'), array('DYNAMIC_QUEST_SET')); 4410 4411while ($row = $ilDB->fetchAssoc($res)) { 4412 $answerStatus = unserialize($row['hidden']); 4413 4414 if (is_array($answerStatus)) { 4415 foreach ($answerStatus['correct'] as $questionId) { 4416 $ilDB->replace( 4417 'tst_seq_qst_answstatus', 4418 array( 4419 'active_fi' => array('integer', $row['active_fi']), 4420 'pass' => array('integer', $row['pass']), 4421 'question_fi' => array('integer', $questionId) 4422 ), 4423 array( 4424 'correctness' => array('integer', 1) 4425 ) 4426 ); 4427 } 4428 4429 foreach ($answerStatus['wrong'] as $questionId) { 4430 $ilDB->replace( 4431 'tst_seq_qst_answstatus', 4432 array( 4433 'active_fi' => array('integer', $row['active_fi']), 4434 'pass' => array('integer', $row['pass']), 4435 'question_fi' => array('integer', $questionId) 4436 ), 4437 array( 4438 'correctness' => array('integer', 0) 4439 ) 4440 ); 4441 } 4442 4443 $ilDB->update( 4444 'tst_sequence', 4445 array( 4446 'hidden' => array('text', null) 4447 ), 4448 array( 4449 'active_fi' => array('integer', $row['active_fi']), 4450 'pass' => array('integer', $row['pass']) 4451 ) 4452 ); 4453 } 4454} 4455 4456?> 4457 4458<#4397> 4459<?php 4460 4461//$ilDB->addPrimaryKey('tst_dyn_quest_set_cfg', array('test_fi')); 4462 4463?> 4464 4465<#4398> 4466<?php 4467 4468$indexName = $ilDB->constraintName('tst_dyn_quest_set_cfg', $ilDB->getPrimaryKeyIdentifier()); 4469 4470if (($ilDB->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) && $ilDB->db->options['field_case'] == CASE_LOWER) { 4471 $indexName = strtolower($indexName); 4472} else { 4473 $indexName = strtoupper($indexName); 4474} 4475 4476$indexDefinition = $ilDB->loadModule('Reverse')->getTableConstraintDefinition('tst_dyn_quest_set_cfg', $indexName); 4477 4478if ($indexDefinition instanceof MDB2_Error) { 4479 $res = $ilDB->query(" 4480 SELECT test_fi, source_qpl_fi, source_qpl_title, answer_filter_enabled, tax_filter_enabled, order_tax 4481 FROM tst_dyn_quest_set_cfg 4482 GROUP BY test_fi, source_qpl_fi, source_qpl_title, answer_filter_enabled, tax_filter_enabled, order_tax 4483 HAVING COUNT(*) > 1 4484 "); 4485 4486 $insertStmt = $ilDB->prepareManip( 4487 " 4488 INSERT INTO tst_dyn_quest_set_cfg ( 4489 test_fi, source_qpl_fi, source_qpl_title, answer_filter_enabled, tax_filter_enabled, order_tax 4490 ) VALUES (?, ?, ?, ?, ?, ?) 4491 ", 4492 array('integer', 'integer', 'text', 'integer', 'integer', 'integer') 4493 ); 4494 4495 while ($row = $ilDB->fetchAssoc($res)) { 4496 $expressions = array(); 4497 4498 foreach ($row as $field => $value) { 4499 if ($value === null) { 4500 $expressions[] = "$field IS NULL"; 4501 } else { 4502 if ($field == 'source_qpl_title') { 4503 $value = $ilDB->quote($value, 'text'); 4504 } else { 4505 $value = $ilDB->quote($value, 'integer'); 4506 } 4507 4508 $expressions[] = "$field = $value"; 4509 } 4510 } 4511 4512 $expressions = implode(' AND ', $expressions); 4513 4514 $ilDB->manipulate("DELETE FROM tst_dyn_quest_set_cfg WHERE $expressions"); 4515 4516 $ilDB->execute($insertStmt, array_values($row)); 4517 } 4518 4519 $ilDB->addPrimaryKey('tst_dyn_quest_set_cfg', array('test_fi')); 4520} 4521 4522?> 4523 4524<#4399> 4525<?php 4526if (!$ilDB->tableColumnExists('tst_dyn_quest_set_cfg', 'prev_quest_list_enabled')) { 4527 $ilDB->addTableColumn( 4528 'tst_dyn_quest_set_cfg', 4529 'prev_quest_list_enabled', 4530 array( 4531 'type' => 'integer', 4532 'length' => 1, 4533 'notnull' => true, 4534 'default' => 0 4535 ) 4536 ); 4537} 4538?> 4539<#4400> 4540<?php 4541$set = $ilDB->query('SELECT * FROM il_dcl_datatype_prop WHERE id = 14'); 4542if (!$ilDB->numRows($set)) { 4543 $ilDB->insert('il_dcl_datatype_prop', array( 4544 'id' => array('integer', 14), 4545 'datatype_id' => array('integer', 2), 4546 'title' => array('text', 'link_detail_page'), 4547 'inputformat' => array('integer', 4), 4548 )); 4549} 4550$set = $ilDB->query('SELECT * FROM il_dcl_datatype_prop WHERE id = 15'); 4551if (!$ilDB->numRows($set)) { 4552 $ilDB->insert('il_dcl_datatype_prop', array( 4553 'id' => array('integer', 15), 4554 'datatype_id' => array('integer', 9), 4555 'title' => array('text', 'link_detail_page'), 4556 'inputformat' => array('integer', 4), 4557 )); 4558} 4559?> 4560<#4401> 4561<?php 4562$ilDB->dropIndex("page_object", $a_name = "i2"); 4563?> 4564<#4402> 4565<?php 4566 4567$ilDB->manipulate("DELETE FROM settings" . 4568 " WHERE module = " . $ilDB->quote("common", "text") . 4569 " AND keyword = " . $ilDB->quote("obj_dis_creation_rcrs", "text")); 4570 4571?> 4572<#4403> 4573<?php 4574 4575$settings = new ilSetting(); 4576if (!$settings->get('ommit_legacy_ou_dbtable_deletion', 0)) { 4577 $ilDB->dropSequence('org_unit_data'); 4578 $ilDB->dropTable('org_unit_data'); 4579 $ilDB->dropTable('org_unit_tree'); 4580 $ilDB->dropTable('org_unit_assignments'); 4581} 4582 4583?> 4584<#4404> 4585<?php 4586 $ilDB->manipulate("UPDATE frm_posts SET pos_update = pos_date WHERE pos_update IS NULL"); 4587?> 4588<#4405> 4589<?php 4590$ilCtrlStructureReader->getStructure(); 4591?> 4592<#4406> 4593<?php 4594$ilDB->insert('il_dcl_datatype_prop', array( 4595 'id' => array('integer', 16), 4596 'datatype_id' => array('integer', 9), 4597 'title' => array('text', 'allowed_file_types'), 4598 'inputformat' => array('integer', 12), 4599)); 4600?> 4601<#4407> 4602<?php 4603$setting = new ilSetting(); 4604$fixState = $setting->get('dbupdate_randtest_pooldef_migration_fix', '0'); 4605 4606if ($fixState === '0') { 4607 $query = " 4608 SELECT tst_tests.test_id, COUNT(tst_rnd_quest_set_qpls.def_id) 4609 4610 FROM tst_tests 4611 4612 LEFT JOIN tst_rnd_quest_set_qpls 4613 ON tst_tests.test_id = tst_rnd_quest_set_qpls.test_fi 4614 4615 WHERE question_set_type = %s 4616 4617 GROUP BY tst_tests.test_id 4618 4619 HAVING COUNT(tst_rnd_quest_set_qpls.def_id) < 1 4620 "; 4621 4622 $res = $ilDB->queryF($query, array('text'), array('RANDOM_QUEST_SET')); 4623 4624 $testsWithoutDefinitionsDetected = false; 4625 4626 while ($row = $ilDB->fetchAssoc($res)) { 4627 $testsWithoutDefinitionsDetected = true; 4628 break; 4629 } 4630 4631 if ($testsWithoutDefinitionsDetected) { 4632 $setting->set('dbupdate_randtest_pooldef_migration_fix', '1'); 4633 setup_exit(" 4634 4635 Dear Administrator, 4636 4637 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 4638 4639 The update process has been stopped, because your attention is required. 4640 4641 If you did not migrate ILIAS from version 4.3 to 4.4, but installed a 4.4 version from scratch, 4642 please ignore this message and simply refresh the page. 4643 4644 Otherwise please have a look to: http://www.ilias.de/mantis/view.php?id=12700 4645 4646 A bug in the db migration for ILIAS 4.4.x has lead to missing source pool definitions within several random tests. 4647 Your installation could be affected, because random tests without any source pool definition were detected. 4648 Perhaps, these tests were just created, but the update process has to assume that these tests are broken. 4649 4650 If you have a backup of your old ILIAS 4.3.x database the update process can repair these tests. 4651 Therefor please restore the table > tst_test_random < from your ILIAS 4.3.x backup database to your productive ILIAS 4.4.x database. 4652 4653 If you try to rerun the update process by refreshing the page, this message will be skipped. 4654 4655 Possibly broken random tests will be repaired, if the old database table mentioned above is available. 4656 After repairing the tests, the old database table will be dropped again. 4657 4658 Best regards, 4659 The Test Maintainers 4660 4661 "); 4662 // db update step MUST NOT finish in a normal way, so step will be processed again 4663 } else { 4664 $setting->set('dbupdate_randtest_pooldef_migration_fix', '2'); 4665 } 4666} elseif ($fixState === '1') { 4667 if ($ilDB->tableExists('tst_test_random')) { 4668 $query = " 4669 SELECT tst_test_random.test_fi, 4670 tst_test_random.questionpool_fi, 4671 tst_test_random.num_of_q, 4672 tst_test_random.tstamp, 4673 tst_test_random.sequence, 4674 object_data.title pool_title 4675 4676 FROM tst_tests 4677 4678 INNER JOIN tst_test_random 4679 ON tst_tests.test_id = tst_test_random.test_fi 4680 4681 LEFT JOIN tst_rnd_quest_set_qpls 4682 ON tst_tests.test_id = tst_rnd_quest_set_qpls.test_fi 4683 4684 LEFT JOIN object_data 4685 ON object_data.obj_id = tst_test_random.questionpool_fi 4686 4687 WHERE question_set_type = %s 4688 AND tst_rnd_quest_set_qpls.def_id IS NULL 4689 "; 4690 4691 $res = $ilDB->queryF($query, array('text'), array('RANDOM_QUEST_SET')); 4692 4693 $syncTimes = array(); 4694 4695 while ($row = $ilDB->fetchAssoc($res)) { 4696 if (!(int) $row['num_of_q']) { 4697 $row['num_of_q'] = null; 4698 } 4699 4700 if (!strlen($row['pool_title'])) { 4701 $row['pool_title'] = '*** unknown/deleted ***'; 4702 } 4703 4704 $nextId = $ilDB->nextId('tst_rnd_quest_set_qpls'); 4705 4706 $ilDB->insert('tst_rnd_quest_set_qpls', array( 4707 'def_id' => array('integer', $nextId), 4708 'test_fi' => array('integer', $row['test_fi']), 4709 'pool_fi' => array('integer', $row['questionpool_fi']), 4710 'pool_title' => array('text', $row['pool_title']), 4711 'origin_tax_fi' => array('integer', null), 4712 'origin_node_fi' => array('integer', null), 4713 'mapped_tax_fi' => array('integer', null), 4714 'mapped_node_fi' => array('integer', null), 4715 'quest_amount' => array('integer', $row['num_of_q']), 4716 'sequence_pos' => array('integer', $row['sequence']) 4717 )); 4718 4719 if (!is_array($syncTimes[$row['test_fi']])) { 4720 $syncTimes[$row['test_fi']] = array(); 4721 } 4722 4723 $syncTimes[$row['test_fi']][] = $row['tstamp']; 4724 } 4725 4726 foreach ($syncTimes as $testId => $times) { 4727 $assumedSyncTS = max($times); 4728 4729 $ilDB->update( 4730 'tst_rnd_quest_set_cfg', 4731 array( 4732 'quest_sync_timestamp' => array('integer', $assumedSyncTS) 4733 ), 4734 array( 4735 'test_fi' => array('integer', $testId) 4736 ) 4737 ); 4738 } 4739 } 4740 4741 $setting->set('dbupdate_randtest_pooldef_migration_fix', '2'); 4742} 4743?> 4744<#4408> 4745<?php 4746if ($ilDB->tableExists('tst_test_random')) { 4747 $ilDB->dropTable('tst_test_random'); 4748} 4749?> 4750 4751<#4409> 4752<?php 4753 $ilCtrlStructureReader->getStructure(); 4754?> 4755<#4410> 4756<?php 4757 $ilCtrlStructureReader->getStructure(); 4758?> 4759<#4411> 4760<?php 4761if (!$ilDB->sequenceExists('il_bibl_settings')) { 4762 $ilDB->createSequence('il_bibl_settings'); 4763 $set = $ilDB->query('SELECT MAX(id) new_seq FROM il_bibl_settings'); 4764 $rec = $ilDB->fetchObject($set); 4765 $ilDB->insert('il_bibl_settings_seq', array('sequence' => array('integer', $rec->new_seq))); 4766} 4767?> 4768<#4412> 4769<?php 4770if (!$ilDB->tableColumnExists('ecs_part_settings', 'dtoken')) { 4771 $ilDB->addTableColumn( 4772 'ecs_part_settings', 4773 'dtoken', 4774 array( 4775 'type' => 'integer', 4776 'length' => 1, 4777 'notnull' => true, 4778 'default' => 1 4779 ) 4780 ); 4781} 4782?> 4783<#4413> 4784<?php 4785if ($ilDB->tableColumnExists('crs_objectives', 'description')) { 4786 $ilDB->modifyTableColumn( 4787 'crs_objectives', 4788 'description', 4789 array( 4790 "type" => "text", 4791 "length" => 500, 4792 "notnull" => false, 4793 "default" => "" 4794 ) 4795 ); 4796} 4797?> 4798<#4414> 4799<?php 4800 4801$ilDB->insert("payment_settings", array( 4802 "keyword" => array("text", 'enable_topics'), 4803 "value" => array("clob", 1), 4804 "scope" => array("text", 'gui'))); 4805 4806?> 4807<#4415> 4808<?php 4809 4810if (!$ilDB->uniqueConstraintExists('tst_active', array('user_fi', 'test_fi', 'anonymous_id'))) { 4811 $ilDB->createTable('tmp_active_fix', array( 4812 'test_fi' => array( 4813 'type' => 'integer', 4814 'length' => 4, 4815 'notnull' => true, 4816 'default' => 0 4817 ), 4818 'user_fi' => array( 4819 'type' => 'integer', 4820 'length' => 4, 4821 'notnull' => true, 4822 'default' => 0 4823 ), 4824 'anonymous_id' => array( 4825 'type' => 'text', 4826 'length' => 255, 4827 'notnull' => true, 4828 'default' => '-' 4829 ), 4830 'active_id' => array( 4831 'type' => 'integer', 4832 'length' => 4, 4833 'notnull' => false, 4834 'default' => null 4835 ) 4836 )); 4837 4838 $ilDB->addPrimaryKey('tmp_active_fix', array('test_fi', 'user_fi', 'anonymous_id')); 4839 4840 $res = $ilDB->query(" 4841 SELECT COUNT(*), test_fi, user_fi, anonymous_id 4842 FROM tst_active 4843 GROUP BY user_fi, test_fi, anonymous_id 4844 HAVING COUNT(*) > 1 4845 "); 4846 4847 while ($row = $ilDB->fetchAssoc($res)) { 4848 if (is_null($row['anonymous_id']) || !strlen($row['anonymous_id'])) { 4849 $row['anonymous_id'] = '-'; 4850 } 4851 4852 $ilDB->replace( 4853 'tmp_active_fix', 4854 array( 4855 'test_fi' => array('integer', $row['test_fi']), 4856 'user_fi' => array('integer', (int) $row['user_fi']), 4857 'anonymous_id' => array('text', $row['anonymous_id']) 4858 ), 4859 array() 4860 ); 4861 } 4862} 4863 4864?> 4865<#4416> 4866<?php 4867 4868if ($ilDB->tableExists('tmp_active_fix')) { 4869 $selectUser = $ilDB->prepare( 4870 " 4871 SELECT active_id, max_points, reached_points, passed FROM tst_active 4872 LEFT JOIN tst_result_cache ON active_fi = active_id 4873 WHERE test_fi = ? AND user_fi = ? AND anonymous_id IS NULL 4874 ", 4875 array('integer', 'integer') 4876 ); 4877 4878 $selectAnonym = $ilDB->prepare( 4879 " 4880 SELECT active_id, max_points, reached_points, passed FROM tst_active 4881 LEFT JOIN tst_result_cache ON active_fi = active_id 4882 WHERE test_fi = ? AND user_fi IS NULL AND anonymous_id = ? 4883 ", 4884 array('integer', 'text') 4885 ); 4886 4887 $select = $ilDB->prepare( 4888 " 4889 SELECT active_id, max_points, reached_points, passed FROM tst_active 4890 LEFT JOIN tst_result_cache ON active_fi = active_id 4891 WHERE test_fi = ? AND user_fi = ? AND anonymous_id = ? 4892 ", 4893 array('integer', 'integer', 'text') 4894 ); 4895 4896 $update = $ilDB->prepareManip( 4897 " 4898 UPDATE tmp_active_fix SET active_id = ? 4899 WHERE test_fi = ? AND user_fi = ? AND anonymous_id = ? 4900 ", 4901 array('integer', 'integer', 'integer', 'text') 4902 ); 4903 4904 $res1 = $ilDB->query("SELECT * FROM tmp_active_fix WHERE active_id IS NULL"); 4905 4906 while ($row1 = $ilDB->fetchAssoc($res1)) { 4907 if (!$row1['user_fi']) { 4908 $res2 = $ilDB->execute($selectAnonym, array( 4909 $row1['test_fi'], $row1['anonymous_id'] 4910 )); 4911 } elseif ($row1['anonymous_id'] == '-') { 4912 $res2 = $ilDB->execute($selectUser, array( 4913 $row1['test_fi'], $row1['user_fi'] 4914 )); 4915 } else { 4916 $res2 = $ilDB->execute($select, array( 4917 $row1['test_fi'], $row1['user_fi'], $row1['anonymous_id'] 4918 )); 4919 } 4920 4921 $activeId = null; 4922 $passed = null; 4923 $points = null; 4924 4925 while ($row2 = $ilDB->fetchAssoc($res2)) { 4926 if ($activeId === null) { 4927 $activeId = $row2['active_id']; 4928 $passed = $row2['passed']; 4929 $points = $row2['reached_points']; 4930 continue; 4931 } 4932 4933 if (!$row2['max_points']) { 4934 continue; 4935 } 4936 4937 if (!$passed && $row2['passed']) { 4938 $activeId = $row2['active_id']; 4939 $passed = $row2['passed']; 4940 $points = $row2['reached_points']; 4941 continue; 4942 } 4943 4944 if ($passed && !$row2['passed']) { 4945 continue; 4946 } 4947 4948 if ($row2['reached_points'] > $points) { 4949 $activeId = $row2['active_id']; 4950 $passed = $row2['passed']; 4951 $points = $row2['reached_points']; 4952 continue; 4953 } 4954 } 4955 4956 $ilDB->execute($update, array( 4957 $activeId, $row1['test_fi'], $row1['user_fi'], $row1['anonymous_id'] 4958 )); 4959 } 4960} 4961 4962?> 4963<#4417> 4964<?php 4965 4966if ($ilDB->tableExists('tmp_active_fix')) { 4967 $deleteUserActives = $ilDB->prepareManip( 4968 "DELETE FROM tst_active WHERE active_id != ? AND test_fi = ? AND user_fi = ? AND anonymous_id IS NULL", 4969 array('integer', 'integer', 'integer') 4970 ); 4971 4972 $deleteAnonymActives = $ilDB->prepareManip( 4973 "DELETE FROM tst_active WHERE active_id != ? AND test_fi = ? AND user_fi IS NULL AND anonymous_id = ?", 4974 array('integer', 'integer', 'text') 4975 ); 4976 4977 $deleteActives = $ilDB->prepareManip( 4978 "DELETE FROM tst_active WHERE active_id != ? AND test_fi = ? AND user_fi = ? AND anonymous_id = ?", 4979 array('integer', 'integer', 'integer', 'text') 4980 ); 4981 4982 $deleteLp = $ilDB->prepareManip( 4983 "DELETE FROM ut_lp_marks WHERE obj_id = ? AND usr_id = ?", 4984 array('integer', 'integer') 4985 ); 4986 4987 $deleteTmpRec = $ilDB->prepareManip( 4988 "DELETE FROM tmp_active_fix WHERE test_fi = ? AND user_fi = ? AND anonymous_id = ?", 4989 array('integer', 'integer', 'text') 4990 ); 4991 4992 $res = $ilDB->query(" 4993 SELECT tmp_active_fix.*, obj_fi FROM tmp_active_fix INNER JOIN tst_tests ON test_id = test_fi 4994 "); 4995 4996 while ($row = $ilDB->fetchAssoc($res)) { 4997 if (!$row['user_fi']) { 4998 $ilDB->execute($deleteAnonymActives, array( 4999 $row['active_id'], $row['test_fi'], $row['anonymous_id'] 5000 )); 5001 } elseif ($row['anonymous_id'] == '-') { 5002 $ilDB->execute($deleteUserActives, array( 5003 $row['active_id'], $row['test_fi'], $row['user_fi'] 5004 )); 5005 } else { 5006 $ilDB->execute($deleteActives, array( 5007 $row['active_id'], $row['test_fi'], $row['user_fi'], $row['anonymous_id'] 5008 )); 5009 } 5010 5011 $ilDB->execute($deleteLp, array( 5012 $row['obj_fi'], $row['user_fi'] 5013 )); 5014 5015 $ilDB->execute($deleteTmpRec, array( 5016 $row['test_fi'], $row['user_fi'], $row['anonymous_id'] 5017 )); 5018 } 5019 5020 $ilDB->dropTable('tmp_active_fix'); 5021} 5022 5023?> 5024<#4418> 5025<?php 5026 5027if (!$ilDB->uniqueConstraintExists('tst_active', array('user_fi', 'test_fi', 'anonymous_id'))) { 5028 $ilDB->addUniqueConstraint('tst_active', array('user_fi', 'test_fi', 'anonymous_id'), 'uc1'); 5029} 5030 5031?> 5032<#4419> 5033<?php 5034 5035$ilDB->manipulate('delete from ecs_course_assignments'); 5036 5037?> 5038<#4420> 5039<?php 5040 $ilCtrlStructureReader->getStructure(); 5041?> 5042<#4421> 5043<?php 5044 $ilCtrlStructureReader->getStructure(); 5045?> 5046<#4422> 5047<?php 5048 5049$settings = new ilSetting('assessment'); 5050 5051if (!(int) $settings->get('quest_process_lock_mode_autoinit', 0)) { 5052 if ($settings->get('quest_process_lock_mode', 'none') == 'none') { 5053 $settings->set('quest_process_lock_mode', 'db'); 5054 } 5055 5056 $settings->set('quest_process_lock_mode_autoinit_done', 1); 5057} 5058 5059?> 5060<#4423> 5061<?php 5062 5063if ($ilDB->tableColumnExists("usr_portfolio", "comments")) { 5064 // #14661 - centralized public comments setting 5065 include_once "Services/Notes/classes/class.ilNote.php"; 5066 5067 $data = array(); 5068 5069 $set = $ilDB->query("SELECT prtf.id,prtf.comments,od.type" . 5070 " FROM usr_portfolio prtf" . 5071 " JOIN object_data od ON (prtf.id = od.obj_id)"); 5072 while ($row = $ilDB->fetchAssoc($set)) { 5073 $row["comments"] = (bool) $row["comments"]; 5074 $data[] = $row; 5075 } 5076 5077 $set = $ilDB->query("SELECT id,notes comments" . 5078 " FROM il_blog"); 5079 while ($row = $ilDB->fetchAssoc($set)) { 5080 $row["type"] = "blog"; 5081 $row["comments"] = (bool) $row["comments"]; 5082 $data[] = $row; 5083 } 5084 5085 $set = $ilDB->query("SELECT cobj.id,cobj.pub_notes comments,od.type" . 5086 " FROM content_object cobj" . 5087 " JOIN object_data od ON (cobj.id = od.obj_id)"); 5088 while ($row = $ilDB->fetchAssoc($set)) { 5089 $row["comments"] = ($row["comments"] == "y" ? true : false); 5090 $data[] = $row; 5091 } 5092 5093 $set = $ilDB->query("SELECT id,show_comments comments" . 5094 " FROM il_poll"); 5095 while ($row = $ilDB->fetchAssoc($set)) { 5096 $row["type"] = "poll"; 5097 $row["comments"] = (bool) $row["comments"]; 5098 $data[] = $row; 5099 } 5100 5101 if (sizeof($data)) { 5102 foreach ($data as $item) { 5103 if ($item["id"] && $item["type"]) { 5104 $ilDB->manipulate("DELETE FROM note_settings" . 5105 " WHERE rep_obj_id = " . $ilDB->quote($item["id"], "integer") . 5106 " AND obj_id = " . $ilDB->quote(0, "integer") . 5107 " AND obj_type = " . $ilDB->quote($item["type"], "text")); 5108 5109 if ($item["comments"]) { 5110 $ilDB->manipulate("INSERT INTO note_settings" . 5111 " (rep_obj_id, obj_id, obj_type, activated)" . 5112 " VALUES (" . $ilDB->quote($item["id"], "integer") . 5113 ", " . $ilDB->quote(0, "integer") . 5114 ", " . $ilDB->quote($item["type"], "text") . 5115 ", " . $ilDB->quote(1, "integer") . ")"); 5116 } 5117 } 5118 } 5119 } 5120} 5121 5122?> 5123<#4424> 5124<?php 5125 5126if ($ilDB->tableColumnExists("usr_portfolio", "comments")) { 5127 $ilDB->dropTableColumn("usr_portfolio", "comments"); 5128 $ilDB->dropTableColumn("il_blog", "notes"); 5129 $ilDB->dropTableColumn("content_object", "pub_notes"); 5130 $ilDB->dropTableColumn("il_poll", "show_comments"); 5131} 5132 5133?> 5134 5135<#4425> 5136<?php 5137 5138if ($ilDB->tableColumnExists('ecs_cms_data', 'cms_id')) { 5139 $ilDB->renameTableColumn('ecs_cms_data', 'cms_id', 'cms_bak'); 5140 $ilDB->addTableColumn( 5141 'ecs_cms_data', 5142 'cms_id', 5143 array( 5144 "type" => "text", 5145 "notnull" => false, 5146 "length" => 512 5147 ) 5148 ); 5149 5150 $query = 'UPDATE ecs_cms_data SET cms_id = cms_bak '; 5151 $ilDB->manipulate($query); 5152 5153 $ilDB->dropTableColumn('ecs_cms_data', 'cms_bak'); 5154} 5155?> 5156<#4426> 5157<?php 5158 $ilCtrlStructureReader->getStructure(); 5159?> 5160<#4427> 5161<?php 5162 5163if ($ilDB->tableColumnExists('ecs_import', 'econtent_id')) { 5164 $ilDB->renameTableColumn('ecs_import', 'econtent_id', 'econtent_id_bak'); 5165 $ilDB->addTableColumn( 5166 'ecs_import', 5167 'econtent_id', 5168 array( 5169 "type" => "text", 5170 "notnull" => false, 5171 "length" => 512 5172 ) 5173 ); 5174 5175 $query = 'UPDATE ecs_import SET econtent_id = econtent_id_bak '; 5176 $ilDB->manipulate($query); 5177 5178 $ilDB->dropTableColumn('ecs_import', 'econtent_id_bak'); 5179} 5180?> 5181<#4428> 5182<?php 5183 5184include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 5185$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 5186if ($tgt_ops_id) { 5187 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId('sess'); 5188 if ($lp_type_id) { 5189 // add "edit_learning_progress" to session 5190 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $tgt_ops_id); 5191 5192 // clone settings from "write" to "edit_learning_progress" 5193 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 5194 ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 5195 5196 // clone settings from "write" to "read_learning_progress" (4287 did not work for sessions) 5197 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('read_learning_progress'); 5198 if ($tgt_ops_id) { 5199 ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 5200 } 5201 } 5202} 5203 5204?> 5205 5206<#4429> 5207<?php 5208 5209$query = 'DELETE from cal_recurrence_rules WHERE cal_id IN ( select cal_id from cal_entries where is_milestone = ' . $ilDB->quote(1, 'integer') . ')'; 5210$ilDB->manipulate($query); 5211 5212?> 5213 5214<#4430> 5215<?php 5216if (!$ilDB->tableColumnExists('qpl_a_cloze_combi_res', 'row_id')) { 5217 $query = 'DELETE from qpl_a_cloze_combi_res'; 5218 $ilDB->manipulate($query); 5219 $ilDB->addTableColumn( 5220 'qpl_a_cloze_combi_res', 5221 'row_id', 5222 array( 5223 'type' => 'integer', 5224 'length' => 4, 5225 'default' => 0 5226 ) 5227 ); 5228} 5229?> 5230<#4431> 5231<?php 5232$ilCtrlStructureReader->getStructure(); 5233?> 5234<#4432> 5235<?php 5236$ilCtrlStructureReader->getStructure(); 5237?> 5238<#4433> 5239<?php 5240$ilCtrlStructureReader->getStructure(); 5241?> 5242<#4434> 5243<?php 5244if ($ilDB->tableColumnExists('tst_tests', 'examid_in_kiosk')) { 5245 $ilDB->renameTableColumn('tst_tests', 'examid_in_kiosk', 'examid_in_test_pass'); 5246} 5247?> 5248<#4435> 5249<?php 5250if ($ilDB->tableColumnExists('tst_tests', 'show_exam_id')) { 5251 $ilDB->renameTableColumn('tst_tests', 'show_exam_id', 'examid_in_test_res'); 5252} 5253?> 5254<#4436> 5255<?php 5256if (!$ilDB->tableColumnExists('il_wiki_page', 'hide_adv_md')) { 5257 $ilDB->addTableColumn( 5258 'il_wiki_page', 5259 'hide_adv_md', 5260 array( 5261 'type' => 'integer', 5262 'length' => 1, 5263 'default' => 0 5264 ) 5265 ); 5266} 5267?> 5268<#4437> 5269<?php 5270if (!$ilDB->tableColumnExists('tst_active', 'start_lock')) { 5271 $ilDB->addTableColumn( 5272 'tst_active', 5273 'start_lock', 5274 array( 5275 'type' => 'text', 5276 'length' => 128, 5277 'notnull' => false, 5278 'default' => null 5279 ) 5280 ); 5281} 5282?> 5283<#4438> 5284<?php 5285 5286$row = $ilDB->fetchAssoc($ilDB->queryF( 5287 "SELECT count(*) cnt FROM settings WHERE module = %s AND keyword = %s", 5288 array('text', 'text'), 5289 array('assessment', 'ass_process_lock_mode') 5290)); 5291 5292if ($row['cnt']) { 5293 $ilDB->manipulateF( 5294 "DELETE FROM settings WHERE module = %s AND keyword = %s", 5295 array('text', 'text'), 5296 array('assessment', 'quest_process_lock_mode') 5297 ); 5298} else { 5299 $ilDB->update( 5300 'settings', 5301 array( 5302 'keyword' => array('text', 'ass_process_lock_mode') 5303 ), 5304 array( 5305 'module' => array('text', 'assessment'), 5306 'keyword' => array('text', 'quest_process_lock_mode') 5307 ) 5308 ); 5309} 5310 5311?> 5312<#4439> 5313<?php 5314if (!$ilDB->tableColumnExists('file_based_lm', 'show_lic')) { 5315 $ilDB->addTableColumn( 5316 'file_based_lm', 5317 'show_lic', 5318 array( 5319 'type' => 'integer', 5320 'length' => 1, 5321 'notnull' => false, 5322 'default' => null 5323 ) 5324 ); 5325} 5326if (!$ilDB->tableColumnExists('file_based_lm', 'show_bib')) { 5327 $ilDB->addTableColumn( 5328 'file_based_lm', 5329 'show_bib', 5330 array( 5331 'type' => 'integer', 5332 'length' => 1, 5333 'notnull' => false, 5334 'default' => null 5335 ) 5336 ); 5337} 5338?> 5339<#4440> 5340<?php 5341 5342$ilDB->manipulate("UPDATE settings " . 5343 "SET value = " . $ilDB->quote(1370, "text") . 5344 " WHERE module = " . $ilDB->quote("blga", "text") . 5345 " AND keyword = " . $ilDB->quote("banner_width", "text") . 5346 " AND value = " . $ilDB->quote(880, "text")); 5347 5348$ilDB->manipulate("UPDATE settings " . 5349 "SET value = " . $ilDB->quote(1370, "text") . 5350 " WHERE module = " . $ilDB->quote("prfa", "text") . 5351 " AND keyword = " . $ilDB->quote("banner_width", "text") . 5352 " AND value = " . $ilDB->quote(880, "text")); 5353 5354?> 5355<#4441> 5356<?php 5357 5358include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 5359$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('copy'); 5360if ($tgt_ops_id) { 5361 $feed_type_id = ilDBUpdateNewObjectType::getObjectTypeId('feed'); 5362 if ($feed_type_id) { 5363 // add "copy" to (external) feed 5364 ilDBUpdateNewObjectType::addRBACOperation($feed_type_id, $tgt_ops_id); 5365 5366 // clone settings from "write" to "copy" 5367 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 5368 ilDBUpdateNewObjectType::cloneOperation('feed', $src_ops_id, $tgt_ops_id); 5369 } 5370} 5371 5372?> 5373<#4442> 5374<?php 5375 $ilCtrlStructureReader->getStructure(); 5376?> 5377<#4443> 5378<?php 5379 $ilCtrlStructureReader->getStructure(); 5380?> 5381<#4444> 5382<?php 5383 $ilCtrlStructureReader->getStructure(); 5384?> 5385<#4445> 5386<?php 5387 $ilCtrlStructureReader->getStructure(); 5388?> 5389<#4446> 5390<?php 5391 $ilCtrlStructureReader->getStructure(); 5392?> 5393<#4447> 5394<?php 5395 if (!$ilDB->tableColumnExists('skl_user_has_level', 'self_eval')) { 5396 $ilDB->addTableColumn("skl_user_has_level", "self_eval", array( 5397 "type" => "integer", 5398 "length" => 1, 5399 "notnull" => true, 5400 "default" => 0 5401 )); 5402 } 5403?> 5404<#4448> 5405<?php 5406 if (!$ilDB->tableColumnExists('skl_user_skill_level', 'self_eval')) { 5407 $ilDB->addTableColumn("skl_user_skill_level", "self_eval", array( 5408 "type" => "integer", 5409 "length" => 1, 5410 "notnull" => true, 5411 "default" => 0 5412 )); 5413 } 5414?> 5415<#4449> 5416<?php 5417 $ilDB->dropPrimaryKey("skl_user_has_level"); 5418 $ilDB->addPrimaryKey( 5419 "skl_user_has_level", 5420 array("level_id", "user_id", "trigger_obj_id", "tref_id", "self_eval") 5421 ); 5422?> 5423<#4450> 5424<?php 5425 $ilDB->modifyTableColumn( 5426 "skl_user_has_level", 5427 "trigger_obj_type", 5428 array( 5429 "type" => "text", 5430 "length" => 4, 5431 "notnull" => false 5432 ) 5433); 5434 5435 $ilDB->modifyTableColumn( 5436 "skl_user_skill_level", 5437 "trigger_obj_type", 5438 array( 5439 "type" => "text", 5440 "length" => 4, 5441 "notnull" => false 5442 ) 5443 ); 5444?> 5445<#4451> 5446<?php 5447 $ilSetting = new ilSetting(); 5448 if ((int) $ilSetting->get("optes_360_db") <= 0) { 5449 /*$ilDB->manipulate("DELETE FROM skl_user_has_level WHERE ". 5450 " self_eval = ".$ilDB->quote(1, "integer") 5451 ); 5452 $ilDB->manipulate("DELETE FROM skl_user_skill_level WHERE ". 5453 " self_eval = ".$ilDB->quote(1, "integer") 5454 );*/ 5455 5456 $set = $ilDB->query("SELECT * FROM skl_self_eval_level ORDER BY last_update ASC"); 5457 $writtenkeys = array(); 5458 while ($rec = $ilDB->fetchAssoc($set)) { 5459 if (!in_array($rec["level_id"] . ":" . $rec["user_id"] . ":" . $rec["tref_id"], $writtenkeys)) { 5460 $writtenkeys[] = $rec["level_id"] . ":" . $rec["user_id"] . ":" . $rec["tref_id"]; 5461 $q = "INSERT INTO skl_user_has_level " . 5462 "(level_id, user_id, status_date, skill_id, trigger_ref_id, trigger_obj_id, trigger_title, tref_id, trigger_obj_type, self_eval) VALUES (" . 5463 $ilDB->quote($rec["level_id"], "integer") . "," . 5464 $ilDB->quote($rec["user_id"], "integer") . "," . 5465 $ilDB->quote($rec["last_update"], "timestamp") . "," . 5466 $ilDB->quote($rec["skill_id"], "integer") . "," . 5467 $ilDB->quote(0, "integer") . "," . 5468 $ilDB->quote(0, "integer") . "," . 5469 $ilDB->quote("", "text") . "," . 5470 $ilDB->quote($rec["tref_id"], "integer") . "," . 5471 $ilDB->quote("", "text") . "," . 5472 $ilDB->quote(1, "integer") . 5473 ")"; 5474 $ilDB->manipulate($q); 5475 } else { 5476 $ilDB->manipulate( 5477 "UPDATE skl_user_has_level SET " . 5478 " status_date = " . $ilDB->quote($rec["last_update"], "timestamp") . "," . 5479 " skill_id = " . $ilDB->quote($rec["skill_id"], "integer") . 5480 " WHERE level_id = " . $ilDB->quote($rec["level_id"], "integer") . 5481 " AND user_id = " . $ilDB->quote($rec["user_id"], "integer") . 5482 " AND trigger_obj_id = " . $ilDB->quote(0, "integer") . 5483 " AND tref_id = " . $ilDB->quote($rec["tref_id"], "integer") . 5484 " AND self_eval = " . $ilDB->quote(1, "integer") 5485 ); 5486 } 5487 $q = "INSERT INTO skl_user_skill_level " . 5488 "(level_id, user_id, status_date, skill_id, trigger_ref_id, trigger_obj_id, trigger_title, tref_id, trigger_obj_type, self_eval, status, valid) VALUES (" . 5489 $ilDB->quote($rec["level_id"], "integer") . "," . 5490 $ilDB->quote($rec["user_id"], "integer") . "," . 5491 $ilDB->quote($rec["last_update"], "timestamp") . "," . 5492 $ilDB->quote($rec["skill_id"], "integer") . "," . 5493 $ilDB->quote(0, "integer") . "," . 5494 $ilDB->quote(0, "integer") . "," . 5495 $ilDB->quote("", "text") . "," . 5496 $ilDB->quote($rec["tref_id"], "integer") . "," . 5497 $ilDB->quote("", "text") . "," . 5498 $ilDB->quote(1, "integer") . "," . 5499 $ilDB->quote(1, "integer") . "," . 5500 $ilDB->quote(1, "integer") . 5501 ")"; 5502 $ilDB->manipulate($q); 5503 } 5504 } 5505?> 5506<#4452> 5507<?php 5508 $ilCtrlStructureReader->getStructure(); 5509?> 5510<#4453> 5511<?php 5512 $ilCtrlStructureReader->getStructure(); 5513?> 5514<#4454> 5515<?php 5516 $ilCtrlStructureReader->getStructure(); 5517?> 5518<#4455> 5519<?php 5520 if (!$ilDB->sequenceExists('booking_reservation_group')) { 5521 $ilDB->createSequence('booking_reservation_group'); 5522 } 5523?> 5524<#4456> 5525<?php 5526 5527 if (!$ilDB->tableColumnExists('crs_objective_tst', 'tst_limit_p')) { 5528 $ilDB->addTableColumn('crs_objective_tst', 'tst_limit_p', array( 5529 'type' => 'integer', 5530 'length' => 2, 5531 'notnull' => true, 5532 'default' => 0 5533 )); 5534 } 5535?> 5536<#4457> 5537<?php 5538 5539// update question assignment limits 5540$query = 'SELECT objective_id, ref_id, question_id FROM crs_objective_qst '; 5541$res = $ilDB->query($query); 5542 5543$questions = array(); 5544while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 5545 $questions[$row->objective_id . '_' . $row->ref_id][] = $row->question_id; 5546} 5547 5548$GLOBALS['ilLog']->write(__METHOD__ . ': ' . print_r($questions, true)); 5549 5550foreach ($questions as $objective_ref_id => $qst_ids) { 5551 $parts = explode('_', $objective_ref_id); 5552 $objective_id = $parts[0]; 5553 $tst_ref_id = $parts[1]; 5554 5555 $sum = 0; 5556 foreach ((array) $qst_ids as $qst_id) { 5557 $query = 'SELECT points FROM qpl_questions WHERE question_id = ' . $ilDB->quote($qst_id, 'integer'); 5558 $res_qst = $ilDB->query($query); 5559 while ($row = $res_qst->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 5560 $sum += $row->points; 5561 } 5562 if ($sum > 0) { 5563 // read limit 5564 $query = 'SELECT tst_limit FROM crs_objective_tst ' . 5565 'WHERE objective_id = ' . $ilDB->quote($objective_id, 'integer'); 5566 $res_limit = $ilDB->query($query); 5567 5568 $limit_points = 0; 5569 while ($row = $res_limit->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 5570 $limit_points = $row->tst_limit; 5571 } 5572 // calculate percentage 5573 $limit_p = $limit_points / $sum * 100; 5574 $limit_p = intval($limit_p); 5575 $limit_p = ($limit_p >= 100 ? 100 : $limit_p); 5576 5577 // update 5578 $query = 'UPDATE crs_objective_tst ' . 5579 'SET tst_limit_p = ' . $ilDB->quote($limit_p, 'integer') . ' ' . 5580 'WHERE objective_id = ' . $ilDB->quote($objective_id, 'integer') . ' ' . 5581 'AND ref_id = ' . $ilDB->quote($tst_ref_id, 'integer'); 5582 $ilDB->manipulate($query); 5583 } 5584 } 5585} 5586?> 5587<#4458> 5588<?php 5589if (!$ilDB->tableColumnExists('tst_tests', 'intro_enabled')) { 5590 $ilDB->addTableColumn('tst_tests', 'intro_enabled', array( 5591 'type' => 'integer', 5592 'length' => 1, 5593 'notnull' => false, 5594 'default' => null 5595 )); 5596} 5597?> 5598<#4459> 5599<?php 5600if (!$ilDB->tableColumnExists('tst_tests', 'starting_time_enabled')) { 5601 $ilDB->addTableColumn('tst_tests', 'starting_time_enabled', array( 5602 'type' => 'integer', 5603 'length' => 1, 5604 'notnull' => false, 5605 'default' => null 5606 )); 5607} 5608?> 5609<#4460> 5610<?php 5611if (!$ilDB->tableColumnExists('tst_tests', 'ending_time_enabled')) { 5612 $ilDB->addTableColumn('tst_tests', 'ending_time_enabled', array( 5613 'type' => 'integer', 5614 'length' => 1, 5615 'notnull' => false, 5616 'default' => null 5617 )); 5618} 5619?> 5620<#4461> 5621<?php 5622if ($ilDB->tableColumnExists('tst_tests', 'intro_enabled')) { 5623 $ilDB->dropTableColumn('tst_tests', 'intro_enabled'); 5624} 5625?> 5626<#4462> 5627<?php 5628if ($ilDB->tableColumnExists('tst_tests', 'starting_time_enabled')) { 5629 $ilDB->dropTableColumn('tst_tests', 'starting_time_enabled'); 5630} 5631?> 5632<#4463> 5633<?php 5634if ($ilDB->tableColumnExists('tst_tests', 'ending_time_enabled')) { 5635 $ilDB->dropTableColumn('tst_tests', 'ending_time_enabled'); 5636} 5637?> 5638<#4464> 5639<?php 5640if (!$ilDB->tableColumnExists('tst_tests', 'intro_enabled')) { 5641 $ilDB->addTableColumn('tst_tests', 'intro_enabled', array( 5642 'type' => 'integer', 5643 'length' => 1, 5644 'notnull' => false, 5645 'default' => null 5646 )); 5647 5648 $ilDB->queryF( 5649 "UPDATE tst_tests SET intro_enabled = %s WHERE LENGTH(introduction) > %s", 5650 array('integer', 'integer'), 5651 array(1, 0) 5652 ); 5653 5654 $ilDB->queryF( 5655 "UPDATE tst_tests SET intro_enabled = %s WHERE LENGTH(introduction) = %s OR LENGTH(introduction) IS NULL", 5656 array('integer', 'integer'), 5657 array(0, 0) 5658 ); 5659} 5660?> 5661<#4465> 5662<?php 5663if (!$ilDB->tableColumnExists('tst_tests', 'starting_time_enabled')) { 5664 $ilDB->addTableColumn('tst_tests', 'starting_time_enabled', array( 5665 'type' => 'integer', 5666 'length' => 1, 5667 'notnull' => false, 5668 'default' => null 5669 )); 5670 5671 $ilDB->queryF( 5672 "UPDATE tst_tests SET starting_time_enabled = %s WHERE LENGTH(starting_time) > %s", 5673 array('integer', 'integer'), 5674 array(1, 0) 5675 ); 5676 5677 $ilDB->queryF( 5678 "UPDATE tst_tests SET starting_time_enabled = %s WHERE LENGTH(starting_time) = %s OR LENGTH(starting_time) IS NULL", 5679 array('integer', 'integer'), 5680 array(0, 0) 5681 ); 5682} 5683?> 5684<#4466> 5685<?php 5686if (!$ilDB->tableColumnExists('tst_tests', 'ending_time_enabled')) { 5687 $ilDB->addTableColumn('tst_tests', 'ending_time_enabled', array( 5688 'type' => 'integer', 5689 'length' => 1, 5690 'notnull' => false, 5691 'default' => null 5692 )); 5693 5694 $ilDB->queryF( 5695 "UPDATE tst_tests SET ending_time_enabled = %s WHERE LENGTH(ending_time) > %s", 5696 array('integer', 'integer'), 5697 array(1, 0) 5698 ); 5699 5700 $ilDB->queryF( 5701 "UPDATE tst_tests SET ending_time_enabled = %s WHERE LENGTH(ending_time) = %s OR LENGTH(ending_time) IS NULL", 5702 array('integer', 'integer'), 5703 array(0, 0) 5704 ); 5705} 5706?> 5707<#4467> 5708<?php 5709if (!$ilDB->tableColumnExists('tst_tests', 'password_enabled')) { 5710 $ilDB->addTableColumn('tst_tests', 'password_enabled', array( 5711 'type' => 'integer', 5712 'length' => 1, 5713 'notnull' => false, 5714 'default' => null 5715 )); 5716 5717 $ilDB->queryF( 5718 "UPDATE tst_tests SET password_enabled = %s WHERE LENGTH(password) > %s", 5719 array('integer', 'integer'), 5720 array(1, 0) 5721 ); 5722 5723 $ilDB->queryF( 5724 "UPDATE tst_tests SET password_enabled = %s WHERE LENGTH(password) = %s OR LENGTH(password) IS NULL", 5725 array('integer', 'integer'), 5726 array(0, 0) 5727 ); 5728} 5729?> 5730<#4468> 5731<?php 5732if (!$ilDB->tableColumnExists('tst_tests', 'limit_users_enabled')) { 5733 $ilDB->addTableColumn('tst_tests', 'limit_users_enabled', array( 5734 'type' => 'integer', 5735 'length' => 1, 5736 'notnull' => false, 5737 'default' => null 5738 )); 5739 5740 $ilDB->queryF( 5741 "UPDATE tst_tests SET limit_users_enabled = %s WHERE allowedusers IS NOT NULL AND allowedusers > %s", 5742 array('integer', 'integer'), 5743 array(1, 0) 5744 ); 5745 5746 $ilDB->queryF( 5747 "UPDATE tst_tests SET limit_users_enabled = %s WHERE allowedusers IS NULL OR allowedusers <= %s", 5748 array('integer', 'integer'), 5749 array(0, 0) 5750 ); 5751} 5752?> 5753<#4469> 5754<?php 5755// @ukonhle: Please do not commit empty database steps ;-) 5756?> 5757<#4470> 5758<?php 5759$ilDB->queryF( 5760 'DELETE FROM settings WHERE keyword = %s', 5761 array('text'), 5762 array('ps_export_scorm') 5763); 5764$ilDB->queryF( 5765 'INSERT INTO settings (module, keyword, value) VALUES (%s,%s,%s)', 5766 array('text','text','text'), 5767 array('common','ps_export_scorm','1') 5768); 5769?> 5770<#4471> 5771<?php 5772$ilDB->manipulate('DELETE FROM addressbook WHERE login NOT IN(SELECT login FROM usr_data) AND email IS NULL'); 5773$ilDB->manipulate( 5774 'DELETE FROM addressbook_mlist_ass WHERE addr_id NOT IN( 5775 SELECT addr_id FROM addressbook 5776 )' 5777); 5778?> 5779<#4472> 5780<?php 5781 if (!$ilDB->indexExistsByFields('page_question', array('page_parent_type','page_id', 'page_lang'))) { 5782 $ilDB->addIndex('page_question', array('page_parent_type','page_id', 'page_lang'), 'i1'); 5783 } 5784?> 5785<#4473> 5786<?php 5787 $ilCtrlStructureReader->getStructure(); 5788?> 5789<#4474> 5790<?php 5791 5792include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 5793$lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId('svy'); 5794if ($lp_type_id) { 5795 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 5796 5797 // clone settings from "write" to "edit_learning_progress" 5798 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 5799 if ($tgt_ops_id) { 5800 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $tgt_ops_id); 5801 ilDBUpdateNewObjectType::cloneOperation('svy', $src_ops_id, $tgt_ops_id); 5802 } 5803 5804 // clone settings from "write" to "read_learning_progress" 5805 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('read_learning_progress'); 5806 if ($tgt_ops_id) { 5807 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $tgt_ops_id); 5808 ilDBUpdateNewObjectType::cloneOperation('svy', $src_ops_id, $tgt_ops_id); 5809 } 5810} 5811 5812?> 5813<#4475> 5814<?php 5815 5816if ($ilDB->tableColumnExists('obj_stat', 'tstamp')) { 5817 $ilDB->dropTableColumn('obj_stat', 'tstamp'); 5818} 5819 5820?> 5821<#4476> 5822<?php 5823if (!$ilDB->uniqueConstraintExists('usr_data', array('login'))) { 5824 $res = $ilDB->query(" 5825 SELECT COUNT(*) cnt 5826 FROM ( 5827 SELECT login 5828 FROM usr_data 5829 GROUP BY login 5830 HAVING COUNT(*) > 1 5831 ) duplicatelogins 5832 "); 5833 $data = $ilDB->fetchAssoc($res); 5834 if ($data['cnt'] > 0) { 5835 setup_exit(" 5836 5837 Dear Administrator, 5838 5839 PLEASE READ THE FOLLOWING INSTRUCTIONS 5840 5841 The update process has been stopped due to data inconsistency reasons. 5842 We found multiple ILIAS user accounts with the same login. You have to fix this issue manually. 5843 5844 Database table: usr_data 5845 Field: login 5846 5847 You can determine these accounts by executing the following SQL statement: 5848 5849 SELECT ud.* FROM usr_data ud 5850 INNER JOIN ( 5851 SELECT login FROM usr_data GROUP BY login HAVING COUNT(*) > 1 5852 ) tmp ON tmp.login = ud.login 5853 5854 Please manipulate the affected records by choosing different login names or use the following statement 5855 to change the duplicate login name to unique name like [usr_id]_[login]_duplicate. The further changes on 5856 user data (e.g. deletion of duplicates) could then be easily done in ILIAS administration. 5857 5858 UPDATE usr_data ud 5859 INNER JOIN ( 5860 SELECT udinner.login, udinner.usr_id 5861 FROM usr_data udinner 5862 GROUP BY udinner.login 5863 HAVING COUNT(udinner.login) > 1 5864 ) dup ON ud.login = dup.login 5865 SET ud.login = CONCAT(CONCAT(CONCAT(ud.usr_id, '_'), CONCAT(ud.login, '_')), 'duplicate') 5866 5867 If you try to rerun the update process, this warning will apear again if the issue is still not solved. 5868 5869 Best regards, 5870 The ILIAS developers 5871 "); 5872 } 5873 5874 $ilDB->addUniqueConstraint('usr_data', array('login'), 'uc1'); 5875} 5876?> 5877<#4477> 5878<?php 5879 5880$query = " 5881 UPDATE tst_rnd_quest_set_qpls SET pool_title = ( 5882 COALESCE( 5883 (SELECT title FROM object_data WHERE obj_id = pool_fi), %s 5884 ) 5885 ) WHERE pool_title IS NULL OR pool_title = %s 5886"; 5887 5888$ilDB->manipulateF($query, array('text', 'text'), array('*** unknown/deleted ***', '')); 5889 5890?> 5891<#4478> 5892<?php 5893 5894if (!$ilDB->tableColumnExists('tst_tests', 'broken')) { 5895 $ilDB->addTableColumn( 5896 'tst_tests', 5897 'broken', 5898 array( 5899 'type' => 'integer', 5900 'length' => 1, 5901 'notnull' => false, 5902 'default' => null 5903 ) 5904 ); 5905 5906 $ilDB->queryF("UPDATE tst_tests SET broken = %s", array('integer'), array(0)); 5907} 5908 5909?> 5910<#4479> 5911<?php 5912$ilDB->manipulate( 5913 "UPDATE style_data SET " . 5914 " uptodate = " . $ilDB->quote(0, "integer") 5915 ); 5916?> 5917<#4480> 5918<?php 5919 $ilCtrlStructureReader->getStructure(); 5920?> 5921<#4481> 5922<?php 5923$ilDB->manipulate("UPDATE tst_active SET last_finished_pass = (tries - 1) WHERE last_finished_pass IS NULL"); 5924?> 5925<#4482> 5926<?php 5927$ilDB->manipulate("DELETE FROM il_dcl_datatype_prop WHERE title = " . $ilDB->quote('allowed_file_types', 'text')); 5928?> 5929<#4483> 5930<?php 5931 $ilCtrlStructureReader->getStructure(); 5932?> 5933<#4484> 5934<?php 5935if (!$ilDB->tableColumnExists('qpl_questionpool', 'skill_service')) { 5936 $ilDB->addTableColumn('qpl_questionpool', 'skill_service', array( 5937 'type' => 'integer', 5938 'length' => 1, 5939 'notnull' => false, 5940 'default' => null 5941 )); 5942 5943 $ilDB->manipulateF( 5944 'UPDATE qpl_questionpool SET skill_service = %s', 5945 array('integer'), 5946 array(0) 5947 ); 5948} 5949?> 5950<#4485> 5951<?php 5952if (!$ilDB->tableExists('qpl_qst_skl_assigns')) { 5953 $ilDB->createTable('qpl_qst_skl_assigns', array( 5954 'obj_fi' => array( 5955 'type' => 'integer', 5956 'length' => 4, 5957 'notnull' => true, 5958 'default' => 0 5959 ), 5960 'question_fi' => array( 5961 'type' => 'integer', 5962 'length' => 4, 5963 'notnull' => true, 5964 'default' => 0 5965 ), 5966 'skill_base_fi' => array( 5967 'type' => 'integer', 5968 'length' => 4, 5969 'notnull' => true, 5970 'default' => 0 5971 ), 5972 'skill_tref_fi' => array( 5973 'type' => 'integer', 5974 'length' => 4, 5975 'notnull' => true, 5976 'default' => 0 5977 ), 5978 'skill_points' => array( 5979 'type' => 'integer', 5980 'length' => 4, 5981 'notnull' => true, 5982 'default' => 0 5983 ) 5984 )); 5985 5986 $ilDB->addPrimaryKey('qpl_qst_skl_assigns', array('obj_fi', 'question_fi', 'skill_base_fi', 'skill_tref_fi')); 5987 5988 if ($ilDB->tableExists('tst_skl_qst_assigns')) { 5989 $res = $ilDB->query(" 5990 SELECT tst_skl_qst_assigns.*, tst_tests.obj_fi 5991 FROM tst_skl_qst_assigns 5992 INNER JOIN tst_tests ON test_id = test_fi 5993 "); 5994 5995 while ($row = $ilDB->fetchAssoc($res)) { 5996 $ilDB->replace( 5997 'qpl_qst_skl_assigns', 5998 array( 5999 'obj_fi' => array('integer', $row['obj_fi']), 6000 'question_fi' => array('integer', $row['question_fi']), 6001 'skill_base_fi' => array('integer', $row['skill_base_fi']), 6002 'skill_tref_fi' => array('integer', $row['skill_tref_fi']) 6003 ), 6004 array( 6005 'skill_points' => array('integer', $row['skill_points']) 6006 ) 6007 ); 6008 } 6009 6010 $ilDB->dropTable('tst_skl_qst_assigns'); 6011 } 6012} 6013?> 6014<#4486> 6015<?php 6016$setting = new ilSetting(); 6017 6018if (!$setting->get('dbup_tst_skl_thres_mig_done', 0)) { 6019 if (!$ilDB->tableExists('tst_threshold_tmp')) { 6020 $ilDB->createTable('tst_threshold_tmp', array( 6021 'test_id' => array( 6022 'type' => 'integer', 6023 'length' => 4, 6024 'notnull' => true, 6025 'default' => 0 6026 ), 6027 'obj_id' => array( 6028 'type' => 'integer', 6029 'length' => 4, 6030 'notnull' => true, 6031 'default' => 0 6032 ) 6033 )); 6034 6035 $ilDB->addPrimaryKey('tst_threshold_tmp', array('test_id')); 6036 } 6037 6038 $res = $ilDB->query(" 6039 SELECT DISTINCT tst_tests.test_id, obj_fi FROM tst_tests 6040 INNER JOIN tst_skl_thresholds ON test_fi = tst_tests.test_id 6041 LEFT JOIN tst_threshold_tmp ON tst_tests.test_id = tst_threshold_tmp.test_id 6042 WHERE tst_threshold_tmp.test_id IS NULL 6043 "); 6044 6045 while ($row = $ilDB->fetchAssoc($res)) { 6046 $ilDB->replace( 6047 'tst_threshold_tmp', 6048 array('test_id' => array('integer', $row['test_id'])), 6049 array('obj_id' => array('integer', $row['obj_fi'])) 6050 ); 6051 } 6052 6053 if (!$ilDB->tableColumnExists('tst_skl_thresholds', 'tmp')) { 6054 $ilDB->addTableColumn('tst_skl_thresholds', 'tmp', array( 6055 'type' => 'integer', 6056 'length' => 4, 6057 'notnull' => false, 6058 'default' => null 6059 )); 6060 } 6061 6062 $setting->set('dbup_tst_skl_thres_mig_done', 1); 6063} 6064?> 6065<#4487> 6066<?php 6067if ($ilDB->tableExists('tst_threshold_tmp')) { 6068 $stmtSelectSklPointSum = $ilDB->prepare( 6069 "SELECT skill_base_fi, skill_tref_fi, SUM(skill_points) points_sum FROM qpl_qst_skl_assigns 6070 WHERE obj_fi = ? GROUP BY skill_base_fi, skill_tref_fi", 6071 array('integer') 6072 ); 6073 6074 $stmtUpdatePercentThresholds = $ilDB->prepareManip( 6075 "UPDATE tst_skl_thresholds SET tmp = ROUND( ((threshold * 100) / ?), 0 ) 6076 WHERE test_fi = ? AND skill_base_fi = ? AND skill_tref_fi = ?", 6077 array('integer', 'integer', 'integer', 'integer') 6078 ); 6079 6080 $res1 = $ilDB->query(" 6081 SELECT DISTINCT test_id, obj_id FROM tst_threshold_tmp 6082 INNER JOIN tst_skl_thresholds ON test_fi = test_id 6083 WHERE tmp IS NULL 6084 "); 6085 6086 while ($row1 = $ilDB->fetchAssoc($res1)) { 6087 $res2 = $ilDB->execute($stmtSelectSklPointSum, array($row1['obj_id'])); 6088 6089 while ($row2 = $ilDB->fetchAssoc($res2)) { 6090 $ilDB->execute($stmtUpdatePercentThresholds, array( 6091 $row2['points_sum'], $row1['test_id'], $row2['skill_base_fi'], $row2['skill_tref_fi'] 6092 )); 6093 } 6094 } 6095} 6096?> 6097<#4488> 6098<?php 6099if ($ilDB->tableExists('tst_threshold_tmp')) { 6100 $ilDB->dropTable('tst_threshold_tmp'); 6101} 6102?> 6103<#4489> 6104<?php 6105if ($ilDB->tableColumnExists('tst_skl_thresholds', 'tmp')) { 6106 $ilDB->manipulate("UPDATE tst_skl_thresholds SET threshold = tmp"); 6107 $ilDB->dropTableColumn('tst_skl_thresholds', 'tmp'); 6108} 6109?> 6110<#4490> 6111<?php 6112if (!$ilDB->tableColumnExists('qpl_qst_skl_assigns', 'eval_mode')) { 6113 $ilDB->addTableColumn('qpl_qst_skl_assigns', 'eval_mode', array( 6114 'type' => 'text', 6115 'length' => 16, 6116 'notnull' => false, 6117 'default' => null 6118 )); 6119 6120 $ilDB->manipulateF( 6121 "UPDATE qpl_qst_skl_assigns SET eval_mode = %s", 6122 array('text'), 6123 array('result') 6124 ); 6125} 6126?> 6127<#4491> 6128<?php 6129if (!$ilDB->tableExists('qpl_qst_skl_sol_expr')) { 6130 $ilDB->createTable('qpl_qst_skl_sol_expr', array( 6131 'question_fi' => array( 6132 'type' => 'integer', 6133 'length' => 4, 6134 'notnull' => true, 6135 'default' => 0 6136 ), 6137 'skill_base_fi' => array( 6138 'type' => 'integer', 6139 'length' => 4, 6140 'notnull' => true, 6141 'default' => 0 6142 ), 6143 'skill_tref_fi' => array( 6144 'type' => 'integer', 6145 'length' => 4, 6146 'notnull' => true, 6147 'default' => 0 6148 ), 6149 'order_index' => array( 6150 'type' => 'integer', 6151 'length' => 4, 6152 'notnull' => true, 6153 'default' => 0 6154 ), 6155 'expression' => array( 6156 'type' => 'text', 6157 'length' => 255, 6158 'notnull' => true, 6159 'default' => '' 6160 ), 6161 'points' => array( 6162 'type' => 'integer', 6163 'length' => 4, 6164 'notnull' => true, 6165 'default' => 0 6166 ) 6167 )); 6168 6169 $ilDB->addPrimaryKey('qpl_qst_skl_sol_expr', array( 6170 'question_fi', 'skill_base_fi', 'skill_tref_fi', 'order_index' 6171 )); 6172} 6173?> 6174<#4492> 6175<?php 6176$res = $ilDB->query(" 6177 SELECT DISTINCT(question_fi) FROM qpl_qst_skl_assigns 6178 LEFT JOIN qpl_questions ON question_fi = question_id 6179 WHERE question_id IS NULL 6180"); 6181 6182$deletedQuestionIds = array(); 6183 6184while ($row = $ilDB->fetchAssoc($res)) { 6185 $deletedQuestionIds[] = $row['question_fi']; 6186} 6187 6188$inDeletedQuestionIds = $ilDB->in('question_fi', $deletedQuestionIds, false, 'integer'); 6189 6190$ilDB->query(" 6191 DELETE FROM qpl_qst_skl_assigns WHERE $inDeletedQuestionIds 6192"); 6193?> 6194<#4493> 6195<?php 6196$row = $ilDB->fetchAssoc($ilDB->queryF( 6197 'SELECT COUNT(*) cnt FROM qpl_qst_skl_assigns LEFT JOIN skl_tree_node ON skill_base_fi = obj_id WHERE type = %s', 6198 array('text'), 6199 array('sktr') 6200)); 6201 6202if ($row['cnt']) { 6203 $res = $ilDB->queryF( 6204 'SELECT obj_fi, question_fi, skill_base_fi, skill_tref_fi FROM qpl_qst_skl_assigns LEFT JOIN skl_tree_node ON skill_base_fi = obj_id WHERE type = %s', 6205 array('text'), 6206 array('sktr') 6207 ); 6208 6209 while ($row = $ilDB->fetchAssoc($res)) { 6210 $ilDB->update( 6211 'qpl_qst_skl_assigns', 6212 array( 6213 'skill_base_fi' => array('integer', $row['skill_tref_fi']), 6214 'skill_tref_fi' => array('integer', $row['skill_base_fi']) 6215 ), 6216 array( 6217 'obj_fi' => array('integer', $row['obj_fi']), 6218 'question_fi' => array('integer', $row['question_fi']), 6219 'skill_base_fi' => array('integer', $row['skill_base_fi']), 6220 'skill_tref_fi' => array('integer', $row['skill_tref_fi']) 6221 ) 6222 ); 6223 } 6224} 6225?> 6226<#4494> 6227<?php 6228$ilDB->manipulateF( 6229 "UPDATE qpl_qst_skl_assigns SET eval_mode = %s WHERE eval_mode IS NULL", 6230 array('text'), 6231 array('result') 6232); 6233?> 6234<#4495> 6235<?php 6236 $ilCtrlStructureReader->getStructure(); 6237?> 6238<#4496> 6239<?php 6240if (!$ilDB->tableExists('mail_cron_orphaned')) { 6241 $ilDB->createTable('mail_cron_orphaned', array( 6242 'mail_id' => array( 6243 'type' => 'integer', 6244 'length' => 4, 6245 'notnull' => true 6246 ), 6247 'folder_id' => array( 6248 'type' => 'integer', 6249 'length' => 4, 6250 'notnull' => true 6251 ), 6252 'ts_do_delete' => array( 6253 'type' => 'integer', 6254 'length' => 4, 6255 'notnull' => true 6256 ) 6257 )); 6258 6259 $ilDB->addPrimaryKey('mail_cron_orphaned', array('mail_id', 'folder_id')); 6260} 6261?> 6262<#4497> 6263<?php 6264if ($ilDB->tableExists('chat_blocked')) { 6265 $ilDB->dropTable('chat_blocked'); 6266} 6267?> 6268<#4498> 6269<?php 6270// Don't remove this comment 6271?> 6272<#4499> 6273<?php 6274if ($ilDB->tableExists('chat_invitations')) { 6275 $ilDB->dropTable('chat_invitations'); 6276} 6277?> 6278<#4500> 6279<?php 6280if ($ilDB->tableExists('chat_records')) { 6281 $ilDB->dropTable('chat_records'); 6282} 6283?> 6284<#4501> 6285<?php 6286if ($ilDB->sequenceExists('chat_records')) { 6287 $ilDB->dropSequence('chat_records'); 6288} 6289?> 6290<#4502> 6291<?php 6292if ($ilDB->sequenceExists('chat_rooms')) { 6293 $ilDB->dropSequence('chat_rooms'); 6294} 6295?> 6296<#4503> 6297<?php 6298if ($ilDB->tableExists('chat_rooms')) { 6299 $ilDB->dropTable('chat_rooms'); 6300} 6301?> 6302<#4504> 6303<?php 6304if ($ilDB->tableExists('chat_room_messages')) { 6305 $ilDB->dropTable('chat_room_messages'); 6306} 6307?> 6308<#4505> 6309<?php 6310if ($ilDB->sequenceExists('chat_room_messages')) { 6311 $ilDB->dropSequence('chat_room_messages'); 6312} 6313?> 6314<#4506> 6315<?php 6316if ($ilDB->sequenceExists('chat_smilies')) { 6317 $ilDB->dropSequence('chat_smilies'); 6318} 6319?> 6320<#4507> 6321<?php 6322if ($ilDB->tableExists('chat_smilies')) { 6323 $ilDB->dropTable('chat_smilies'); 6324} 6325?> 6326<#4508> 6327<?php 6328if ($ilDB->tableExists('chat_user')) { 6329 $ilDB->dropTable('chat_user'); 6330} 6331?> 6332<#4509> 6333<?php 6334if ($ilDB->tableExists('chat_record_data')) { 6335 $ilDB->dropTable('chat_record_data'); 6336} 6337?> 6338<#4510> 6339<?php 6340if ($ilDB->sequenceExists('chat_record_data')) { 6341 $ilDB->dropSequence('chat_record_data'); 6342} 6343?> 6344<#4511> 6345<?php 6346if ($ilDB->tableExists('ilinc_data')) { 6347 $ilDB->dropTable('ilinc_data'); 6348} 6349?> 6350<#4512> 6351<?php 6352if ($ilDB->tableExists('ilinc_registration')) { 6353 $ilDB->dropTable('ilinc_registration'); 6354} 6355?> 6356<#4513> 6357<?php 6358if ($ilDB->tableColumnExists('usr_data', 'ilinc_id')) { 6359 $ilDB->dropTableColumn('usr_data', 'ilinc_id'); 6360} 6361 6362if ($ilDB->tableColumnExists('usr_data', 'ilinc_login')) { 6363 $ilDB->dropTableColumn('usr_data', 'ilinc_login'); 6364} 6365 6366if ($ilDB->tableColumnExists('usr_data', 'ilinc_passwd')) { 6367 $ilDB->dropTableColumn('usr_data', 'ilinc_passwd'); 6368} 6369?> 6370<#4514> 6371<?php 6372if ($ilDB->uniqueConstraintExists('tst_sequence', array('active_fi', 'pass'))) { 6373 $ilDB->dropUniqueConstraintByFields('tst_sequence', array('active_fi', 'pass')); 6374 $ilDB->addPrimaryKey('tst_sequence', array('active_fi', 'pass')); 6375} 6376?> 6377<#4515> 6378<?php 6379if ($ilDB->uniqueConstraintExists('tst_pass_result', array('active_fi', 'pass'))) { 6380 $ilDB->dropUniqueConstraintByFields('tst_pass_result', array('active_fi', 'pass')); 6381 $ilDB->addPrimaryKey('tst_pass_result', array('active_fi', 'pass')); 6382} 6383?> 6384<#4516> 6385<?php 6386$crpra_dup_query_num = " 6387SELECT COUNT(*) cnt 6388FROM ( 6389 SELECT proom_id, user_id 6390 FROM chatroom_proomaccess 6391 GROUP BY proom_id, user_id 6392 HAVING COUNT(*) > 1 6393) duplicateChatProoms 6394"; 6395$res = $ilDB->query($crpra_dup_query_num); 6396$data = $ilDB->fetchAssoc($res); 6397if ($data['cnt']) { 6398 $mopt_dup_query = " 6399 SELECT proom_id, user_id 6400 FROM chatroom_proomaccess 6401 GROUP BY proom_id, user_id 6402 HAVING COUNT(*) > 1 6403 "; 6404 $res = $ilDB->query($mopt_dup_query); 6405 6406 $stmt_del = $ilDB->prepareManip("DELETE FROM chatroom_proomaccess WHERE proom_id = ? AND user_id = ?", array('integer', 'integer')); 6407 $stmt_in = $ilDB->prepareManip("INSERT INTO chatroom_proomaccess (proom_id, user_id) VALUES(?, ?)", array('integer', 'integer')); 6408 6409 while ($row = $ilDB->fetchAssoc($res)) { 6410 $ilDB->execute($stmt_del, array($row['proom_id'], $row['user_id'])); 6411 $ilDB->execute($stmt_in, array($row['proom_id'], $row['user_id'])); 6412 } 6413} 6414 6415$res = $ilDB->query($crpra_dup_query_num); 6416$data = $ilDB->fetchAssoc($res); 6417if ($data['cnt'] > 0) { 6418 setup_exit("There are still duplicate entries in table 'chatroom_proomaccess'. Please execute this database update step again."); 6419} 6420 6421$ilDB->addPrimaryKey('chatroom_proomaccess', array('proom_id', 'user_id')); 6422?> 6423<#4517> 6424<?php 6425$mopt_dup_query_num = " 6426SELECT COUNT(*) cnt 6427FROM ( 6428 SELECT user_id 6429 FROM mail_options 6430 GROUP BY user_id 6431 HAVING COUNT(*) > 1 6432) duplicateMailOptions 6433"; 6434$res = $ilDB->query($mopt_dup_query_num); 6435$data = $ilDB->fetchAssoc($res); 6436if ($data['cnt']) { 6437 $mopt_dup_query = " 6438 SELECT user_id 6439 FROM mail_options 6440 GROUP BY user_id 6441 HAVING COUNT(*) > 1 6442 "; 6443 $res = $ilDB->query($mopt_dup_query); 6444 6445 $stmt_sel = $ilDB->prepare("SELECT * FROM mail_options WHERE user_id = ?", array('integer')); 6446 $stmt_del = $ilDB->prepareManip("DELETE FROM mail_options WHERE user_id = ?", array('integer')); 6447 $stmt_in = $ilDB->prepareManip("INSERT INTO mail_options (user_id, linebreak, signature, incoming_type, cronjob_notification) VALUES(?, ?, ?, ?, ?)", array('integer', 'integer', 'text', 'integer', 'integer')); 6448 6449 while ($row = $ilDB->fetchAssoc($res)) { 6450 $opt_res = $ilDB->execute($stmt_sel, array($row['user_id'])); 6451 $opt_row = $ilDB->fetchAssoc($opt_res); 6452 if ($opt_row) { 6453 $ilDB->execute($stmt_del, array($opt_row['user_id'])); 6454 $ilDB->execute($stmt_in, array($opt_row['user_id'], $opt_row['linebreak'], $opt_row['signature'], $opt_row['incoming_type'], $opt_row['cronjob_notification'])); 6455 } 6456 } 6457} 6458 6459$res = $ilDB->query($mopt_dup_query_num); 6460$data = $ilDB->fetchAssoc($res); 6461if ($data['cnt'] > 0) { 6462 setup_exit("There are still duplicate entries in table 'mail_options'. Please execute this database update step again."); 6463} 6464 6465$ilDB->addPrimaryKey('mail_options', array('user_id')); 6466?> 6467<#4518> 6468<?php 6469$psc_dup_query_num = " 6470SELECT COUNT(*) cnt 6471FROM ( 6472 SELECT psc_ps_fk, psc_pc_fk, psc_pcc_fk 6473 FROM payment_statistic_coup 6474 GROUP BY psc_ps_fk, psc_pc_fk, psc_pcc_fk 6475 HAVING COUNT(*) > 1 6476) duplicatePaymentStatistics 6477"; 6478$res = $ilDB->query($psc_dup_query_num); 6479$data = $ilDB->fetchAssoc($res); 6480if ($data['cnt']) { 6481 $psc_dup_query = " 6482 SELECT psc_ps_fk, psc_pc_fk, psc_pcc_fk 6483 FROM payment_statistic_coup 6484 GROUP BY psc_ps_fk, psc_pc_fk, psc_pcc_fk 6485 HAVING COUNT(*) > 1 6486 "; 6487 $res = $ilDB->query($psc_dup_query); 6488 6489 $stmt_del = $ilDB->prepareManip("DELETE FROM payment_statistic_coup WHERE psc_ps_fk = ? AND psc_pc_fk = ? AND psc_pcc_fk = ?", array('integer', 'integer', 'integer')); 6490 $stmt_in = $ilDB->prepareManip("INSERT INTO payment_statistic_coup (psc_ps_fk, psc_pc_fk, psc_pcc_fk) VALUES(?, ?, ?)", array('integer', 'integer', 'integer')); 6491 6492 while ($row = $ilDB->fetchAssoc($res)) { 6493 $ilDB->execute($stmt_del, array($row['psc_ps_fk'], $row['psc_pc_fk'], $row['psc_pcc_fk'])); 6494 $ilDB->execute($stmt_in, array($row['psc_ps_fk'], $row['psc_pc_fk'], $row['psc_pcc_fk'])); 6495 } 6496} 6497 6498$res = $ilDB->query($psc_dup_query_num); 6499$data = $ilDB->fetchAssoc($res); 6500if ($data['cnt'] > 0) { 6501 setup_exit("There are still duplicate entries in table 'payment_statistic_coup'. Please execute this database update step again."); 6502} 6503 6504$ilDB->addPrimaryKey('payment_statistic_coup', array('psc_ps_fk', 'psc_pc_fk', 'psc_pcc_fk')); 6505?> 6506<#4519> 6507<?php 6508$msave_dup_query_num = " 6509SELECT COUNT(*) cnt 6510FROM ( 6511 SELECT user_id 6512 FROM mail_saved 6513 GROUP BY user_id 6514 HAVING COUNT(*) > 1 6515) duplicateMailSaved 6516"; 6517$res = $ilDB->query($msave_dup_query_num); 6518$data = $ilDB->fetchAssoc($res); 6519if ($data['cnt']) { 6520 $msave_dup_query = " 6521 SELECT user_id 6522 FROM mail_saved 6523 GROUP BY user_id 6524 HAVING COUNT(*) > 1 6525 "; 6526 $res = $ilDB->query($msave_dup_query); 6527 6528 $stmt_sel = $ilDB->prepare("SELECT * FROM mail_saved WHERE user_id = ?", array('integer')); 6529 $stmt_del = $ilDB->prepareManip("DELETE FROM mail_saved WHERE user_id = ?", array('integer')); 6530 6531 while ($row = $ilDB->fetchAssoc($res)) { 6532 $opt_res = $ilDB->execute($stmt_sel, array($row['user_id'])); 6533 $opt_row = $ilDB->fetchAssoc($opt_res); 6534 if ($opt_row) { 6535 $ilDB->execute($stmt_del, array($opt_row['user_id'])); 6536 $ilDB->insert( 6537 'mail_saved', 6538 array( 6539 'user_id' => array('integer', $opt_row['user_id']), 6540 'm_type' => array('text', $opt_row['m_type']), 6541 'm_email' => array('integer', $opt_row['m_email']), 6542 'm_subject' => array('text', $opt_row['m_subject']), 6543 'use_placeholders' => array('integer', $opt_row['use_placeholders']), 6544 'm_message' => array('clob', $opt_row['m_message']), 6545 'rcp_to' => array('clob', $opt_row['rcp_to']), 6546 'rcp_cc' => array('clob', $opt_row['rcp_cc']), 6547 'rcp_bcc' => array('clob', $opt_row['rcp_bcc']), 6548 'attachments' => array('clob', $opt_row['attachments']) 6549 ) 6550 ); 6551 } 6552 } 6553} 6554 6555$res = $ilDB->query($msave_dup_query_num); 6556$data = $ilDB->fetchAssoc($res); 6557if ($data['cnt']) { 6558 setup_exit("There are still duplicate entries in table 'mail_saved'. Please execute this database update step again."); 6559} 6560 6561$ilDB->addPrimaryKey('mail_saved', array('user_id')); 6562?> 6563<#4520> 6564<?php 6565$chrban_dup_query_num = " 6566SELECT COUNT(*) cnt 6567FROM ( 6568 SELECT room_id, user_id 6569 FROM chatroom_bans 6570 GROUP BY room_id, user_id 6571 HAVING COUNT(*) > 1 6572) duplicateChatroomBans 6573"; 6574$res = $ilDB->query($chrban_dup_query_num); 6575$data = $ilDB->fetchAssoc($res); 6576if ($data['cnt']) { 6577 $chrban_dup_query = " 6578 SELECT DISTINCT finalDuplicateChatroomBans.room_id, finalDuplicateChatroomBans.user_id, finalDuplicateChatroomBans.timestamp, finalDuplicateChatroomBans.remark 6579 FROM ( 6580 SELECT chatroom_bans.* 6581 FROM chatroom_bans 6582 INNER JOIN ( 6583 SELECT room_id, user_id, MAX(timestamp) ts 6584 FROM chatroom_bans 6585 GROUP BY room_id, user_id 6586 HAVING COUNT(*) > 1 6587 ) duplicateChatroomBans 6588 ON duplicateChatroomBans.room_id = chatroom_bans.room_id 6589 AND duplicateChatroomBans.user_id = chatroom_bans.user_id 6590 AND duplicateChatroomBans.ts = chatroom_bans.timestamp 6591 ) finalDuplicateChatroomBans 6592 "; 6593 $res = $ilDB->query($chrban_dup_query); 6594 6595 $stmt_del = $ilDB->prepareManip("DELETE FROM chatroom_bans WHERE room_id = ? AND user_id = ?", array('integer', 'integer')); 6596 $stmt_in = $ilDB->prepareManip("INSERT INTO chatroom_bans (room_id, user_id, timestamp, remark) VALUES(?, ?, ?, ?)", array('integer', 'integer', 'integer', 'text')); 6597 6598 while ($row = $ilDB->fetchAssoc($res)) { 6599 $ilDB->execute($stmt_del, array($row['room_id'], $row['user_id'])); 6600 $ilDB->execute($stmt_in, array($row['room_id'], $row['user_id'], $row['timestamp'], $row['remark'])); 6601 } 6602} 6603 6604$res = $ilDB->query($chrban_dup_query_num); 6605$data = $ilDB->fetchAssoc($res); 6606if ($data['cnt']) { 6607 setup_exit("There are still duplicate entries in table 'chatroom_bans'. Please execute this database update step again."); 6608} 6609 6610$ilDB->addPrimaryKey('chatroom_bans', array('room_id', 'user_id')); 6611?> 6612<#4521> 6613<?php 6614if (!$ilDB->sequenceExists('chatroom_psessionstmp')) { 6615 $ilDB->createSequence('chatroom_psessionstmp'); 6616} 6617?> 6618<#4522> 6619<?php 6620if (!$ilDB->tableExists('chatroom_psessionstmp')) { 6621 $fields = array( 6622 'psess_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 6623 'proom_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6624 'user_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6625 'connected' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6626 'disconnected' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0) 6627 ); 6628 $ilDB->createTable('chatroom_psessionstmp', $fields); 6629 $ilDB->addPrimaryKey('chatroom_psessionstmp', array('psess_id')); 6630} 6631?> 6632<#4523> 6633<?php 6634$query = ' 6635SELECT chatroom_psessions.proom_id, chatroom_psessions.user_id, chatroom_psessions.connected, chatroom_psessions.disconnected 6636FROM chatroom_psessions 6637LEFT JOIN chatroom_psessionstmp 6638 ON chatroom_psessionstmp.proom_id = chatroom_psessions.proom_id 6639 AND chatroom_psessionstmp.user_id = chatroom_psessions.user_id 6640 AND chatroom_psessionstmp.connected = chatroom_psessions.connected 6641 AND chatroom_psessionstmp.disconnected = chatroom_psessions.disconnected 6642WHERE chatroom_psessionstmp.psess_id IS NULL 6643GROUP BY chatroom_psessions.proom_id, chatroom_psessions.user_id, chatroom_psessions.connected, chatroom_psessions.disconnected 6644'; 6645$res = $ilDB->query($query); 6646 6647$stmt_in = $ilDB->prepareManip('INSERT INTO chatroom_psessionstmp (psess_id, proom_id, user_id, connected, disconnected) VALUES(?, ?, ?, ?, ?)', array('integer', 'integer', 'integer', 'integer','integer')); 6648 6649while ($row = $ilDB->fetchAssoc($res)) { 6650 $psess_id = $ilDB->nextId('chatroom_psessionstmp'); 6651 $ilDB->execute($stmt_in, array($psess_id, (int) $row['proom_id'], (int) $row['user_id'], (int) $row['connected'], (int) $row['disconnected'])); 6652} 6653?> 6654<#4524> 6655<?php 6656$ilDB->dropTable('chatroom_psessions'); 6657?> 6658<#4525> 6659<?php 6660$ilDB->renameTable('chatroom_psessionstmp', 'chatroom_psessions'); 6661?> 6662<#4526> 6663<?php 6664if (!$ilDB->sequenceExists('chatroom_psessions')) { 6665 $query = "SELECT MAX(psess_id) mpsess_id FROM chatroom_psessions"; 6666 $row = $ilDB->fetchAssoc($ilDB->query($query)); 6667 $ilDB->createSequence('chatroom_psessions', (int) $row['mpsess_id'] + 1); 6668} 6669?> 6670<#4527> 6671<?php 6672if ($ilDB->sequenceExists('chatroom_psessionstmp')) { 6673 $ilDB->dropSequence('chatroom_psessionstmp'); 6674} 6675?> 6676<#4528> 6677<?php 6678$ilDB->addIndex('chatroom_psessions', array('proom_id', 'user_id'), 'i1'); 6679?> 6680<#4529> 6681<?php 6682$ilDB->addIndex('chatroom_psessions', array('disconnected'), 'i2'); 6683?> 6684<#4530> 6685<?php 6686if (!$ilDB->sequenceExists('chatroom_sessionstmp')) { 6687 $ilDB->createSequence('chatroom_sessionstmp'); 6688} 6689?> 6690<#4531> 6691<?php 6692if (!$ilDB->tableExists('chatroom_sessionstmp')) { 6693 $fields = array( 6694 'sess_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 6695 'room_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6696 'user_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6697 'userdata' => array('type' => 'text', 'length' => 4000, 'notnull' => false, 'default' => null), 6698 'connected' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6699 'disconnected' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0) 6700 ); 6701 $ilDB->createTable('chatroom_sessionstmp', $fields); 6702 $ilDB->addPrimaryKey('chatroom_sessionstmp', array('sess_id')); 6703} 6704?> 6705<#4532> 6706<?php 6707if ($ilDB->getDBType() == 'innodb' || $ilDB->getDBType() == 'mysql') { 6708 $query = ' 6709 SELECT chatroom_sessions.room_id, chatroom_sessions.user_id, chatroom_sessions.connected, chatroom_sessions.disconnected, chatroom_sessions.userdata 6710 FROM chatroom_sessions 6711 LEFT JOIN chatroom_sessionstmp 6712 ON chatroom_sessionstmp.room_id = chatroom_sessions.room_id 6713 AND chatroom_sessionstmp.user_id = chatroom_sessions.user_id 6714 AND chatroom_sessionstmp.connected = chatroom_sessions.connected 6715 AND chatroom_sessionstmp.disconnected = chatroom_sessions.disconnected 6716 AND chatroom_sessionstmp.userdata = chatroom_sessions.userdata COLLATE utf8_general_ci 6717 WHERE chatroom_sessionstmp.sess_id IS NULL 6718 GROUP BY chatroom_sessions.room_id, chatroom_sessions.user_id, chatroom_sessions.connected, chatroom_sessions.disconnected, chatroom_sessions.userdata 6719 '; 6720} else { 6721 $query = ' 6722 SELECT chatroom_sessions.room_id, chatroom_sessions.user_id, chatroom_sessions.connected, chatroom_sessions.disconnected, chatroom_sessions.userdata 6723 FROM chatroom_sessions 6724 LEFT JOIN chatroom_sessionstmp 6725 ON chatroom_sessionstmp.room_id = chatroom_sessions.room_id 6726 AND chatroom_sessionstmp.user_id = chatroom_sessions.user_id 6727 AND chatroom_sessionstmp.connected = chatroom_sessions.connected 6728 AND chatroom_sessionstmp.disconnected = chatroom_sessions.disconnected 6729 AND chatroom_sessionstmp.userdata = chatroom_sessions.userdata 6730 WHERE chatroom_sessionstmp.sess_id IS NULL 6731 GROUP BY chatroom_sessions.room_id, chatroom_sessions.user_id, chatroom_sessions.connected, chatroom_sessions.disconnected, chatroom_sessions.userdata 6732 '; 6733} 6734 6735$res = $ilDB->query($query); 6736 6737$stmt_in = $ilDB->prepareManip('INSERT INTO chatroom_sessionstmp (sess_id, room_id, user_id, connected, disconnected, userdata) VALUES(?, ?, ?, ?, ?, ?)', array('integer', 'integer', 'integer', 'integer','integer', 'text')); 6738 6739while ($row = $ilDB->fetchAssoc($res)) { 6740 $sess_id = $ilDB->nextId('chatroom_sessionstmp'); 6741 $ilDB->execute($stmt_in, array($sess_id, (int) $row['room_id'], (int) $row['user_id'], (int) $row['connected'], (int) $row['disconnected'], (string) $row['userdata'])); 6742} 6743?> 6744<#4533> 6745<?php 6746$ilDB->dropTable('chatroom_sessions'); 6747?> 6748<#4534> 6749<?php 6750$ilDB->renameTable('chatroom_sessionstmp', 'chatroom_sessions'); 6751?> 6752<#4535> 6753<?php 6754if (!$ilDB->sequenceExists('chatroom_sessions')) { 6755 $query = "SELECT MAX(sess_id) msess_id FROM chatroom_sessions"; 6756 $row = $ilDB->fetchAssoc($ilDB->query($query)); 6757 $ilDB->createSequence('chatroom_sessions', (int) $row['msess_id'] + 1); 6758} 6759?> 6760<#4536> 6761<?php 6762if ($ilDB->sequenceExists('chatroom_sessionstmp')) { 6763 $ilDB->dropSequence('chatroom_sessionstmp'); 6764} 6765?> 6766<#4537> 6767<?php 6768$ilDB->addIndex('chatroom_sessions', array('room_id', 'user_id'), 'i1'); 6769?> 6770<#4538> 6771<?php 6772$ilDB->addIndex('chatroom_sessions', array('disconnected'), 'i2'); 6773?> 6774<#4539> 6775<?php 6776$ilDB->addIndex('chatroom_sessions', array('user_id'), 'i3'); 6777?> 6778<#4540> 6779<?php 6780// qpl_a_cloze_combi_res - primary key step 1/8 6781 6782$dupsCountRes = $ilDB->query(" 6783 SELECT COUNT(*) dups_cnt FROM ( 6784 SELECT combination_id, question_fi, gap_fi, row_id 6785 FROM qpl_a_cloze_combi_res 6786 GROUP BY combination_id, question_fi, gap_fi, row_id 6787 HAVING COUNT(*) > 1 6788 ) dups"); 6789 6790$dupsCountRow = $ilDB->fetchAssoc($dupsCountRes); 6791 6792if ($dupsCountRow['dups_cnt'] > 0) { 6793 if (!$ilDB->tableExists('dups_clozecombis_qst')) { 6794 $ilDB->createTable('dups_clozecombis_qst', array( 6795 'qst' => array( 6796 'type' => 'integer', 6797 'length' => 4, 6798 'notnull' => true 6799 ), 6800 'num' => array( 6801 'type' => 'integer', 6802 'length' => 4, 6803 'notnull' => false 6804 ) 6805 )); 6806 6807 $ilDB->addPrimaryKey('dups_clozecombis_qst', array('qst')); 6808 } 6809 6810 if (!$ilDB->tableExists('dups_clozecombis_rows')) { 6811 $ilDB->createTable('dups_clozecombis_rows', array( 6812 'combination_id' => array( 6813 'type' => 'integer', 6814 'length' => 4, 6815 'notnull' => true 6816 ), 6817 'question_fi' => array( 6818 'type' => 'integer', 6819 'length' => 4, 6820 'notnull' => true 6821 ), 6822 'gap_fi' => array( 6823 'type' => 'integer', 6824 'length' => 4, 6825 'notnull' => true 6826 ), 6827 'answer' => array( 6828 'type' => 'text', 6829 'length' => 1000, 6830 'notnull' => false 6831 ), 6832 'points' => array( 6833 'type' => 'float', 6834 'notnull' => false 6835 ), 6836 'best_solution' => array( 6837 'type' => 'integer', 6838 'length' => 1, 6839 'notnull' => false 6840 ), 6841 'row_id' => array( 6842 'type' => 'integer', 6843 'length' => 4, 6844 'notnull' => false, 6845 'default' => 0 6846 ) 6847 )); 6848 6849 $ilDB->addPrimaryKey('dups_clozecombis_rows', array( 6850 'combination_id', 'question_fi', 'gap_fi', 'row_id' 6851 )); 6852 } 6853} 6854?> 6855<#4541> 6856<?php 6857// qpl_a_cloze_combi_res - primary key step 2/8 6858 6859// break safe update step 6860 6861if ($ilDB->tableExists('dups_clozecombis_qst')) { 6862 $res = $ilDB->query(" 6863 SELECT combination_id, question_fi, gap_fi, row_id, COUNT(*) 6864 FROM qpl_a_cloze_combi_res 6865 LEFT JOIN dups_clozecombis_qst ON qst = question_fi 6866 WHERE qst IS NULL 6867 GROUP BY combination_id, question_fi, gap_fi, row_id 6868 HAVING COUNT(*) > 1 6869 "); 6870 6871 while ($row = $ilDB->fetchAssoc($res)) { 6872 $ilDB->replace( 6873 'dups_clozecombis_qst', 6874 array( 6875 'qst' => array('integer', $row['question_fi']) 6876 ), 6877 array( 6878 'num' => array('integer', null) 6879 ) 6880 ); 6881 } 6882} 6883?> 6884<#4542> 6885<?php 6886// qpl_a_cloze_combi_res - primary key step 3/8 6887 6888// break safe update step 6889 6890if ($ilDB->tableExists('dups_clozecombis_qst')) { 6891 $selectNumQuery = " 6892 SELECT COUNT(*) num FROM ( 6893 SELECT question_fi FROM qpl_a_cloze_combi_res WHERE question_fi = ? 6894 GROUP BY combination_id, question_fi, gap_fi, row_id 6895 ) numrows 6896 "; 6897 $selectNumStmt = $ilDB->prepare($selectNumQuery, array('integer')); 6898 6899 $updateNumQuery = " 6900 UPDATE dups_clozecombis_qst SET num = ? WHERE qst = ? 6901 "; 6902 $updateNumStmt = $ilDB->prepareManip($updateNumQuery, array('integer', 'integer')); 6903 6904 $qstRes = $ilDB->query("SELECT qst FROM dups_clozecombis_qst WHERE num IS NULL"); 6905 6906 while ($qstRow = $ilDB->fetchAssoc($qstRes)) { 6907 $selectNumRes = $ilDB->execute($selectNumStmt, array($qstRow['qst'])); 6908 $selectNumRow = $ilDB->fetchAssoc($selectNumRes); 6909 6910 $ilDB->execute($updateNumStmt, array($selectNumRow['num'], $qstRow['qst'])); 6911 } 6912} 6913?> 6914<#4543> 6915<?php 6916// qpl_a_cloze_combi_res - primary key step 4/8 6917 6918// break safe update step 6919 6920if ($ilDB->tableExists('dups_clozecombis_qst')) { 6921 $deleteRowsStmt = $ilDB->prepareManip( 6922 "DELETE FROM dups_clozecombis_rows WHERE question_fi = ?", 6923 array('integer') 6924 ); 6925 6926 $selectRowsStmt = $ilDB->prepare( 6927 "SELECT * FROM qpl_a_cloze_combi_res WHERE question_fi = ? ORDER BY combination_id, row_id, gap_fi", 6928 array('integer') 6929 ); 6930 6931 $insertRowStmt = $ilDB->prepareManip( 6932 "INSERT INTO dups_clozecombis_rows (combination_id, question_fi, gap_fi, answer, points, best_solution, row_id) 6933 VALUES (?, ?, ?, ?, ?, ?, ?)", 6934 array('integer', 'integer', 'integer', 'text', 'float', 'integer', 'integer') 6935 ); 6936 6937 $qstRes = $ilDB->query(" 6938 SELECT qst, num 6939 FROM dups_clozecombis_qst 6940 LEFT JOIN dups_clozecombis_rows 6941 ON question_fi = qst 6942 GROUP BY qst, num, question_fi 6943 HAVING COUNT(question_fi) < num 6944 "); 6945 6946 while ($qstRow = $ilDB->fetchAssoc($qstRes)) { 6947 $ilDB->execute($deleteRowsStmt, array($qstRow['qst'])); 6948 6949 $selectRowsRes = $ilDB->execute($selectRowsStmt, array($qstRow['qst'])); 6950 6951 $existingRows = array(); 6952 while ($selectRowsRow = $ilDB->fetchAssoc($selectRowsRes)) { 6953 $combinationId = $selectRowsRow['combination_id']; 6954 $rowId = $selectRowsRow['row_id']; 6955 $gapFi = $selectRowsRow['gap_fi']; 6956 6957 if (!isset($existingRows[$combinationId])) { 6958 $existingRows[$combinationId] = array(); 6959 } 6960 6961 if (!isset($existingRows[$combinationId][$rowId])) { 6962 $existingRows[$combinationId][$rowId] = array(); 6963 } 6964 6965 if (!isset($existingRows[$combinationId][$rowId][$gapFi])) { 6966 $existingRows[$combinationId][$rowId][$gapFi] = array(); 6967 } 6968 6969 $existingRows[$combinationId][$rowId][$gapFi][] = array( 6970 'answer' => $selectRowsRow['answer'], 6971 'points' => $selectRowsRow['points'] 6972 ); 6973 } 6974 6975 $newRows = array(); 6976 foreach ($existingRows as $combinationId => $combination) { 6977 if (!isset($newRows[$combinationId])) { 6978 $newRows[$combinationId] = array(); 6979 } 6980 6981 $maxPointsForCombination = null; 6982 $maxPointsRowIdForCombination = null; 6983 foreach ($combination as $rowId => $row) { 6984 if (!isset($newRows[$combinationId][$rowId])) { 6985 $newRows[$combinationId][$rowId] = array(); 6986 } 6987 6988 $maxPointsForRow = null; 6989 foreach ($row as $gapFi => $gap) { 6990 foreach ($gap as $dups) { 6991 if (!isset($newRows[$combinationId][$rowId][$gapFi])) { 6992 $newRows[$combinationId][$rowId][$gapFi] = array( 6993 'answer' => $dups['answer'] 6994 ); 6995 6996 if ($maxPointsForRow === null || $maxPointsForRow < $dups['points']) { 6997 $maxPointsForRow = $dups['points']; 6998 } 6999 } 7000 } 7001 } 7002 7003 foreach ($newRows[$combinationId][$rowId] as $gapFi => $gap) { 7004 $newRows[$combinationId][$rowId][$gapFi]['points'] = $maxPointsForRow; 7005 } 7006 7007 if ($maxPointsForCombination === null || $maxPointsForCombination < $maxPointsForRow) { 7008 $maxPointsForCombination = $maxPointsForRow; 7009 $maxPointsRowIdForCombination = $rowId; 7010 } 7011 } 7012 7013 foreach ($combination as $rowId => $row) { 7014 foreach ($newRows[$combinationId][$rowId] as $gapFi => $gap) { 7015 $newRows[$combinationId][$rowId][$gapFi]['best_solution'] = ($rowId == $maxPointsRowIdForCombination ? 1 : 0); 7016 } 7017 } 7018 } 7019 7020 foreach ($newRows as $combinationId => $combination) { 7021 foreach ($combination as $rowId => $row) { 7022 foreach ($row as $gapFi => $gap) { 7023 $ilDB->execute($insertRowStmt, array( 7024 $combinationId, $qstRow['qst'], $gapFi, $gap['answer'], 7025 $gap['points'], $gap['best_solution'], $rowId 7026 )); 7027 } 7028 } 7029 } 7030 } 7031} 7032?> 7033<#4544> 7034<?php 7035// qpl_a_cloze_combi_res - primary key step 5/8 7036 7037if ($ilDB->tableExists('dups_clozecombis_rows')) { 7038 $ilDB->manipulate(" 7039 DELETE FROM qpl_a_cloze_combi_res WHERE question_fi IN( 7040 SELECT DISTINCT question_fi FROM dups_clozecombis_rows 7041 ) 7042 "); 7043} 7044?> 7045<#4545> 7046<?php 7047// qpl_a_cloze_combi_res - primary key step 6/8 7048 7049if ($ilDB->tableExists('dups_clozecombis_rows')) { 7050 $ilDB->manipulate(" 7051 INSERT INTO qpl_a_cloze_combi_res ( 7052 combination_id, question_fi, gap_fi, answer, points, best_solution, row_id 7053 ) SELECT combination_id, question_fi, gap_fi, answer, points, best_solution, row_id 7054 FROM dups_clozecombis_rows 7055 "); 7056} 7057?> 7058<#4546> 7059<?php 7060// qpl_a_cloze_combi_res - primary key step 7/8 7061 7062if ($ilDB->tableExists('dups_clozecombis_qst')) { 7063 $ilDB->dropTable('dups_clozecombis_qst'); 7064} 7065 7066if ($ilDB->tableExists('dups_clozecombis_rows')) { 7067 $ilDB->dropTable('dups_clozecombis_rows'); 7068} 7069?> 7070<#4547> 7071<?php 7072// qpl_a_cloze_combi_res - primary key step 8/8 7073 7074$ilDB->addPrimaryKey('qpl_a_cloze_combi_res', array( 7075 'combination_id', 'question_fi', 'gap_fi', 'row_id' 7076)); 7077?> 7078<#4548> 7079<?php 7080if (!$ilDB->sequenceExists('chatroom_historytmp')) { 7081 $ilDB->createSequence('chatroom_historytmp'); 7082} 7083?> 7084<#4549> 7085<?php 7086if (!$ilDB->tableExists('chatroom_historytmp')) { 7087 $fields = array( 7088 'hist_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 7089 'room_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 7090 'message' => array('type' => 'text', 'length' => 4000, 'notnull' => false, 'default' => null), 7091 'timestamp' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 7092 'sub_room' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0) 7093 ); 7094 $ilDB->createTable('chatroom_historytmp', $fields); 7095 $ilDB->addPrimaryKey('chatroom_historytmp', array('hist_id')); 7096} 7097?> 7098<#4550> 7099<?php 7100require_once 'Services/Migration/DBUpdate_4550/classes/class.ilDBUpdate4550.php'; 7101ilDBUpdate4550::cleanupOrphanedChatRoomData(); 7102if ($ilDB->getDBType() == 'innodb' || $ilDB->getDBType() == 'mysql' || $ilDB->getDBType() == '') { 7103 $query = ' 7104 SELECT chatroom_history.room_id, chatroom_history.timestamp, chatroom_history.sub_room, chatroom_history.message 7105 FROM chatroom_history 7106 LEFT JOIN chatroom_historytmp 7107 ON chatroom_historytmp.room_id = chatroom_history.room_id 7108 AND chatroom_historytmp.timestamp = chatroom_history.timestamp 7109 AND chatroom_historytmp.sub_room = chatroom_history.sub_room 7110 AND chatroom_historytmp.message = chatroom_history.message COLLATE utf8_general_ci 7111 WHERE chatroom_historytmp.hist_id IS NULL 7112 GROUP BY chatroom_history.room_id, chatroom_history.timestamp, chatroom_history.sub_room, chatroom_history.message 7113 '; 7114} else { 7115 $query = ' 7116 SELECT chatroom_history.room_id, chatroom_history.timestamp, chatroom_history.sub_room, chatroom_history.message 7117 FROM chatroom_history 7118 LEFT JOIN chatroom_historytmp 7119 ON chatroom_historytmp.room_id = chatroom_history.room_id 7120 AND chatroom_historytmp.timestamp = chatroom_history.timestamp 7121 AND chatroom_historytmp.sub_room = chatroom_history.sub_room 7122 AND chatroom_historytmp.message = chatroom_history.message 7123 WHERE chatroom_historytmp.hist_id IS NULL 7124 GROUP BY chatroom_history.room_id, chatroom_history.timestamp, chatroom_history.sub_room, chatroom_history.message 7125 '; 7126} 7127$res = $ilDB->query($query); 7128 7129$stmt_in = $ilDB->prepareManip('INSERT INTO chatroom_historytmp (hist_id, room_id, timestamp, sub_room, message) VALUES(?, ?, ?, ?, ?)', array('integer', 'integer', 'integer', 'integer', 'text')); 7130 7131while ($row = $ilDB->fetchAssoc($res)) { 7132 $hist_id = $ilDB->nextId('chatroom_historytmp'); 7133 $ilDB->execute($stmt_in, array($hist_id, (int) $row['room_id'], (int) $row['timestamp'], (int) $row['sub_room'], (string) $row['message'])); 7134} 7135?> 7136<#4551> 7137<?php 7138$ilDB->dropTable('chatroom_history'); 7139?> 7140<#4552> 7141<?php 7142$ilDB->renameTable('chatroom_historytmp', 'chatroom_history'); 7143?> 7144<#4553> 7145<?php 7146if (!$ilDB->sequenceExists('chatroom_history')) { 7147 $query = "SELECT MAX(hist_id) mhist_id FROM chatroom_history"; 7148 $row = $ilDB->fetchAssoc($ilDB->query($query)); 7149 $ilDB->createSequence('chatroom_history', (int) $row['mhist_id'] + 1); 7150} 7151?> 7152<#4554> 7153<?php 7154if ($ilDB->sequenceExists('chatroom_historytmp')) { 7155 $ilDB->dropSequence('chatroom_historytmp'); 7156} 7157?> 7158<#4555> 7159<?php 7160$ilDB->addIndex('chatroom_history', array('room_id', 'sub_room'), 'i1'); 7161?> 7162<#4556> 7163<?php 7164require_once 'Services/Migration/DBUpdate_4550/classes/class.ilDBUpdate4550.php'; 7165ilDBUpdate4550::cleanupOrphanedChatRoomData(); 7166?> 7167<#4557> 7168<?php 7169if ($ilDB->getDBType() == 'postgres') { 7170 $ilDB->manipulate("ALTER TABLE chatroom_prooms ALTER COLUMN parent_id SET DEFAULT 0"); 7171 $ilDB->manipulate("ALTER TABLE chatroom_prooms ALTER parent_id TYPE INTEGER USING (parent_id::INTEGER)"); 7172} else { 7173 $ilDB->modifyTableColumn('chatroom_prooms', 'parent_id', array( 7174 'type' => 'integer', 7175 'length' => 4, 7176 'notnull' => true, 7177 'default' => 0 7178 )); 7179} 7180$ilDB->addIndex('chatroom_prooms', array('parent_id'), 'i1'); 7181?> 7182<#4558> 7183<?php 7184$ilDB->addIndex('chatroom_prooms', array('owner'), 'i2'); 7185?> 7186<#4559> 7187<?php 7188/* 7189Moved to 4557 7190if($ilDB->getDBType() == 'postgres') 7191{ 7192 $ilDB->manipulate("ALTER TABLE chatroom_prooms ALTER COLUMN parent_id SET DEFAULT 0"); 7193 $ilDB->manipulate("ALTER TABLE chatroom_prooms ALTER parent_id TYPE INTEGER USING (parent_id::INTEGER)"); 7194} 7195else 7196{ 7197 $ilDB->modifyTableColumn('chatroom_prooms', 'parent_id', array( 7198 'type' => 'integer', 7199 'length' => 4, 7200 'notnull' => true, 7201 'default' => 0 7202 )); 7203} 7204*/ 7205?> 7206<#4560> 7207<?php 7208if ($ilDB->sequenceExists('chatroom_smilies')) { 7209 $ilDB->dropSequence('chatroom_smilies'); 7210} 7211?> 7212<#4561> 7213<?php 7214$query = "SELECT MAX(smiley_id) msmiley_id FROM chatroom_smilies"; 7215$row = $ilDB->fetchAssoc($ilDB->query($query)); 7216$ilDB->createSequence('chatroom_smilies', (int) $row['msmiley_id'] + 1); 7217?> 7218<#4562> 7219<?php 7220if (!$ilDB->tableColumnExists('frm_settings', 'file_upload_allowed')) { 7221 $ilDB->addTableColumn( 7222 'frm_settings', 7223 'file_upload_allowed', 7224 array( 7225 "type" => "integer", 7226 "notnull" => true, 7227 "length" => 1, 7228 "default" => 0 7229 ) 7230 ); 7231} 7232?> 7233<#4563> 7234<?php 7235 7236if ($ilDB->tableExists('sysc_groups')) { 7237 $ilDB->dropTable('sysc_groups'); 7238} 7239if ($ilDB->tableExists('sysc_groups_seq')) { 7240 $ilDB->dropTable('sysc_groups_seq'); 7241} 7242 7243if (!$ilDB->tableExists('sysc_groups')) { 7244 $fields = array( 7245 'id' => array( 7246 'type' => 'integer', 7247 'length' => 4, 7248 'notnull' => true), 7249 'component' => array( 7250 "type" => "text", 7251 "notnull" => false, 7252 "length" => 16, 7253 "fixed" => true), 7254 7255 'last_update' => array( 7256 "type" => "timestamp", 7257 "notnull" => false), 7258 7259 'status' => array( 7260 "type" => "integer", 7261 "notnull" => true, 7262 'length' => 1, 7263 'default' => 0) 7264 ); 7265 $ilDB->createTable('sysc_groups', $fields); 7266 $ilDB->addPrimaryKey('sysc_groups', array('id')); 7267 $ilDB->createSequence("sysc_groups"); 7268} 7269?> 7270<#4564> 7271<?php 7272 7273if (!$ilDB->tableExists('sysc_tasks')) { 7274 $fields = array( 7275 'id' => array( 7276 'type' => 'integer', 7277 'length' => 4, 7278 'notnull' => true), 7279 'grp_id' => array( 7280 "type" => "integer", 7281 "notnull" => true, 7282 "length" => 4), 7283 7284 'last_update' => array( 7285 "type" => "timestamp", 7286 "notnull" => false), 7287 7288 'status' => array( 7289 "type" => "integer", 7290 "notnull" => true, 7291 'length' => 1, 7292 'default' => 0), 7293 'identifier' => array( 7294 "type" => "text", 7295 "notnull" => false, 7296 'length' => 64) 7297 ); 7298 $ilDB->createTable('sysc_tasks', $fields); 7299 $ilDB->addPrimaryKey('sysc_tasks', array('id')); 7300 $ilDB->createSequence("sysc_tasks"); 7301} 7302 7303?> 7304<#4565> 7305<?php 7306// primary key for tst_addtime - step 1/8 7307 7308$cntRes = $ilDB->query(" 7309 SELECT COUNT(active_fi) cnt FROM ( 7310 SELECT active_fi FROM tst_addtime 7311 GROUP BY active_fi HAVING COUNT(active_fi) > 1 7312 ) actives 7313"); 7314 7315$cntRow = $ilDB->fetchAssoc($cntRes); 7316 7317if ($cntRow['cnt'] > 0) { 7318 $ilDB->createTable('tst_addtime_tmp', array( 7319 'active_fi' => array( 7320 'type' => 'integer', 7321 'length' => 8, 7322 'notnull' => true, 7323 'default' => 0 7324 ), 7325 'additionaltime' => array( 7326 'type' => 'integer', 7327 'length' => 8, 7328 'notnull' => false, 7329 'default' => null, 7330 ), 7331 'tstamp' => array( 7332 'type' => 'integer', 7333 'length' => 8, 7334 'notnull' => false, 7335 'default' => null 7336 ) 7337 )); 7338 7339 $ilDB->addPrimaryKey('tst_addtime_tmp', array('active_fi')); 7340} 7341?> 7342<#4566> 7343<?php 7344// primary key for tst_addtime - step 2/8 7345 7346// break safe 7347 7348if ($ilDB->tableExists('tst_addtime_tmp')) { 7349 $res = $ilDB->query(" 7350 SELECT orig.active_fi FROM tst_addtime orig 7351 LEFT JOIN tst_addtime_tmp tmp ON tmp.active_fi = orig.active_fi 7352 WHERE tmp.active_fi IS NULL 7353 GROUP BY orig.active_fi HAVING COUNT(orig.active_fi) > 1 7354 "); 7355 7356 while ($row = $ilDB->fetchAssoc($res)) { 7357 $ilDB->replace( 7358 'tst_addtime_tmp', 7359 array( 7360 'additionaltime' => array('integer', null), 7361 'tstamp' => array('integer', null) 7362 ), 7363 array( 7364 'active_fi' => array('integer', $row['active_fi']) 7365 ) 7366 ); 7367 } 7368} 7369?> 7370<#4567> 7371<?php 7372// primary key for tst_addtime - step 3/8 7373 7374// break safe 7375 7376if ($ilDB->tableExists('tst_addtime_tmp')) { 7377 $res = $ilDB->query(" 7378 SELECT orig.* 7379 FROM tst_addtime_tmp tmp 7380 INNER JOIN tst_addtime orig ON orig.active_fi = tmp.active_fi 7381 WHERE tmp.additionaltime IS NULL 7382 AND tmp.tstamp IS NULL 7383 ORDER BY tmp.active_fi ASC, orig.tstamp ASC 7384 "); 7385 7386 $active_fi = null; 7387 $addtime = null; 7388 $tstamp = null; 7389 7390 while ($row = $ilDB->fetchAssoc($res)) { 7391 if ($active_fi === null) { 7392 // first loop 7393 $active_fi = $row['active_fi']; 7394 } elseif ($row['active_fi'] != $active_fi) { 7395 // update last active 7396 $ilDB->update( 7397 'tst_addtime_tmp', 7398 array( 7399 'additionaltime' => array('integer', $addtime), 7400 'tstamp' => array('integer', $tstamp) 7401 ), 7402 array( 7403 'active_fi' => array('integer', $active_fi) 7404 ) 7405 ); 7406 7407 // process next active 7408 $active_fi = $row['active_fi']; 7409 $addtime = null; 7410 $tstamp = null; 7411 } 7412 7413 if ($addtime === null || $row['additionaltime'] >= $addtime) { 7414 $addtime = $row['additionaltime']; 7415 $tstamp = $row['tstamp']; 7416 } 7417 } 7418 7419 $ilDB->update( 7420 'tst_addtime_tmp', 7421 array( 7422 'additionaltime' => array('integer', $addtime), 7423 'tstamp' => array('integer', $tstamp) 7424 ), 7425 array( 7426 'active_fi' => array('integer', $active_fi) 7427 ) 7428 ); 7429} 7430?> 7431<#4568> 7432<?php 7433// primary key for tst_addtime - step 4/8 7434 7435if ($ilDB->tableExists('tst_addtime_tmp')) { 7436 $ilDB->manipulate(" 7437 DELETE FROM tst_addtime WHERE active_fi IN( 7438 SELECT DISTINCT active_fi FROM tst_addtime_tmp 7439 ) 7440 "); 7441} 7442?> 7443<#4569> 7444<?php 7445// primary key for tst_addtime - step 5/8 7446 7447if ($ilDB->tableExists('tst_addtime_tmp')) { 7448 $ilDB->manipulate(" 7449 INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) 7450 SELECT active_fi, additionaltime, tstamp 7451 FROM tst_addtime_tmp 7452 "); 7453} 7454?> 7455<#4570> 7456<?php 7457// primary key for tst_addtime - step 6/8 7458 7459if ($ilDB->tableExists('tst_addtime_tmp')) { 7460 $ilDB->dropTable('tst_addtime_tmp'); 7461} 7462?> 7463<#4571> 7464<?php 7465// primary key for tst_addtime - step 7/8 7466 7467if ($ilDB->indexExistsByFields('tst_addtime', array('active_fi'))) { 7468 $ilDB->dropIndexByFields('tst_addtime', array('active_fi')); 7469} 7470?> 7471<#4572> 7472<?php 7473// primary key for tst_addtime - step 8/8 7474 7475$ilDB->addPrimaryKey('tst_addtime', array('active_fi')); 7476?> 7477<#4573> 7478<?php 7479 7480// delete all entries 7481// structure reload is done at end of db update. 7482$query = 'DELETE from ctrl_calls'; 7483$ilDB->manipulate($query); 7484 7485if ($ilDB->indexExistsByFields('ctrl_calls', array('parent'))) { 7486 $ilDB->dropIndexByFields('ctrl_calls', array('parent')); 7487} 7488$ilDB->addPrimaryKey('ctrl_calls', array('parent','child')); 7489?> 7490<#4574> 7491<?php 7492global $ilDB; 7493if (!$ilDB->tableColumnExists('il_dcl_table', 'delete_by_owner')) { 7494 $ilDB->addTableColumn( 7495 'il_dcl_table', 7496 'delete_by_owner', 7497 array( 7498 "type" => "integer", 7499 "notnull" => true, 7500 "length" => 1, 7501 "default" => 0 7502 ) 7503 ); 7504 // Migrate tables: Set new setting to true if "edit by owner" is true 7505 // Set edit permission to true if edit 7506 $ilDB->manipulate("UPDATE il_dcl_table SET delete_by_owner = 1, edit_perm = 1, delete_perm = 1 WHERE edit_by_owner = 1"); 7507} 7508?> 7509<#4575> 7510<?php 7511// primary key for tst_result_cache - step 1/7 7512 7513$res = $ilDB->query(" 7514 SELECT COUNT(active_fi) cnt FROM ( 7515 SELECT active_fi FROM tst_result_cache 7516 GROUP BY active_fi HAVING COUNT(active_fi) > 1 7517 ) actives 7518"); 7519 7520$row = $ilDB->fetchAssoc($res); 7521 7522if ($row['cnt'] > 0) { 7523 $ilDB->createTable('tst_result_cache_tmp', array( 7524 'active_fi' => array( 7525 'type' => 'integer', 7526 'length' => 8, 7527 'notnull' => true, 7528 'default' => 0 7529 ) 7530 )); 7531 7532 $ilDB->addPrimaryKey('tst_result_cache_tmp', array('active_fi')); 7533} 7534?> 7535<#4576> 7536<?php 7537// primary key for tst_result_cache - step 2/7 7538 7539// break safe 7540 7541if ($ilDB->tableExists('tst_result_cache_tmp')) { 7542 $res = $ilDB->query(" 7543 SELECT active_fi FROM tst_result_cache 7544 GROUP BY active_fi HAVING COUNT(active_fi) > 1 7545 "); 7546 7547 while ($row = $ilDB->fetchAssoc($res)) { 7548 $ilDB->replace('tst_result_cache_tmp', array(), array( 7549 'active_fi' => array('integer', $row['active_fi']) 7550 )); 7551 } 7552} 7553?> 7554<#4577> 7555<?php 7556// primary key for tst_result_cache - step 3/7 7557 7558if ($ilDB->tableExists('tst_result_cache_tmp')) { 7559 $ilDB->manipulate(" 7560 DELETE FROM tst_result_cache WHERE active_fi IN( 7561 SELECT DISTINCT active_fi FROM tst_result_cache_tmp 7562 ) 7563 "); 7564} 7565?> 7566<#4578> 7567<?php 7568// primary key for tst_result_cache - step 4/7 7569 7570if ($ilDB->indexExistsByFields('tst_result_cache', array('active_fi'))) { 7571 $ilDB->dropIndexByFields('tst_result_cache', array('active_fi')); 7572} 7573?> 7574<#4579> 7575<?php 7576// primary key for tst_result_cache - step 5/7 7577 7578$ilDB->addPrimaryKey('tst_result_cache', array('active_fi')); 7579?> 7580<#4580> 7581<?php 7582// primary key for tst_result_cache - step 6/7 7583 7584// break safe 7585 7586if ($ilDB->tableExists('tst_result_cache_tmp')) { 7587 include_once 'Services/Migration/DBUpdate_4209/classes/class.DBUpdateTestResultCalculator.php'; 7588 7589 $res = $ilDB->query(" 7590 SELECT tmp.active_fi, pass_scoring FROM tst_result_cache_tmp tmp 7591 INNER JOIN tst_active ON active_id = tmp.active_fi 7592 INNER JOIN tst_tests ON test_id = test_fi 7593 LEFT JOIN tst_result_cache orig ON orig.active_fi = tmp.active_fi 7594 WHERE orig.active_fi IS NULL 7595 "); 7596 7597 while ($row = $ilDB->fetchAssoc($res)) { 7598 DBUpdateTestResultCalculator::_updateTestResultCache( 7599 $row['active_fi'], 7600 $row['pass_scoring'] 7601 ); 7602 } 7603} 7604?> 7605<#4581> 7606<?php 7607// primary key for tst_result_cache - step 7/7 7608 7609if ($ilDB->tableExists('tst_result_cache_tmp')) { 7610 $ilDB->dropTable('tst_result_cache_tmp'); 7611} 7612?> 7613<#4582> 7614<?php 7615$ilDB->addIndex('mail_obj_data', array('obj_id', 'user_id'), 'i2'); 7616?> 7617<#4583> 7618<?php 7619$ilDB->dropPrimaryKey('mail_obj_data'); 7620?> 7621<#4584> 7622<?php 7623$mod_dup_query_num = " 7624SELECT COUNT(*) cnt 7625FROM ( 7626 SELECT obj_id 7627 FROM mail_obj_data 7628 GROUP BY obj_id 7629 HAVING COUNT(*) > 1 7630) duplicateMailFolders 7631"; 7632 7633$res = $ilDB->query($mod_dup_query_num); 7634$data = $ilDB->fetchAssoc($res); 7635 7636$ilSetting = new ilSetting(); 7637$setting = $ilSetting->get('mail_mod_dupl_warn_51x_shown', 0); 7638if ($data['cnt'] > 0 && !(int) $setting) { 7639 $ilSetting->set('mail_mod_dupl_warn_51x_shown', 1); 7640 setup_exit(" 7641 7642 Dear Administrator, 7643 7644 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 7645 7646 The update process has been stopped due to a data consistency issue in table 'mail_obj_data'. 7647 The values in field 'obj_id' should be unique, but there are different values in field 'user_id', associated to the same 'obj_id'. 7648 You have the opportunity to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 7649 7650 SELECT mail_obj_data.* FROM mail_obj_data INNER JOIN (SELECT obj_id FROM mail_obj_data GROUP BY obj_id HAVING COUNT(*) > 1) duplicateMailFolders ON duplicateMailFolders.obj_id = mail_obj_data.obj_id ORDER BY mail_obj_data.obj_id 7651 7652 If you try to rerun the update process, this warning will be skipped. 7653 The remaining duplicates will be removed automatically by the criteria documented below. 7654 7655 Foreach each duplicate record, ... 7656 7657 1. ILIAS temporarily stores the value of the duplicate 'obj_id' in a variable: \$old_folder_id . 7658 2. ILIAS deletes every duplicate row in table 'mail_obj_data' determined by \$old_folder_id (field: 'obj_id') and the respective 'user_id'. 7659 3. ILIAS creates a new record for the user account (with a unique 'obj_id') and stores this value in a variable: \$new_folder_id . 7660 4. All messages of the user stored in table 'mail' and related to the \$old_folder_id will be updated to \$new_folder_id (field: 'folder_id'). 7661 5. The existing tree entries of the old \$old_folder_id in table 'mail_tree' will be replaced by the \$new_folder_id (fields: 'child' and 'parent'). 7662 7663 Please ensure to backup your current database before reloading this page or executing the database update in general. 7664 Furthermore disable your client while executing the following 2 update steps. 7665 7666 Best regards, 7667 The mail system maintainer 7668 7669 "); 7670} 7671 7672 7673if ($data['cnt'] > 0) { 7674 $db_step = $nr; 7675 7676 $ps_delete_mf_by_obj_and_usr = $ilDB->prepareManip( 7677 "DELETE FROM mail_obj_data WHERE obj_id = ? AND user_id = ?", 7678 array('integer', 'integer') 7679 ); 7680 7681 $ps_create_mf_by_obj_and_usr = $ilDB->prepareManip( 7682 "INSERT INTO mail_obj_data (obj_id, user_id, title, m_type) VALUES(?, ?, ?, ?)", 7683 array('integer','integer', 'text', 'text') 7684 ); 7685 7686 $ps_update_mail_by_usr_and_folder = $ilDB->prepareManip( 7687 "UPDATE mail SET folder_id = ? WHERE folder_id = ? AND user_id = ?", 7688 array('integer', 'integer', 'integer') 7689 ); 7690 7691 $ps_update_tree_entry_by_child_and_usr = $ilDB->prepareManip( 7692 "UPDATE mail_tree SET child = ? WHERE child = ? AND tree = ?", 7693 array('integer', 'integer', 'integer') 7694 ); 7695 7696 $ps_update_tree_par_entry_by_child_and_usr = $ilDB->prepareManip( 7697 "UPDATE mail_tree SET parent = ? WHERE parent = ? AND tree = ?", 7698 array('integer', 'integer', 'integer') 7699 ); 7700 7701 $mod_dup_query = " 7702 SELECT mail_obj_data.* 7703 FROM mail_obj_data 7704 INNER JOIN ( 7705 SELECT obj_id 7706 FROM mail_obj_data 7707 GROUP BY obj_id 7708 HAVING COUNT(*) > 1 7709 ) duplicateMailFolders ON duplicateMailFolders.obj_id = mail_obj_data.obj_id 7710 ORDER BY mail_obj_data.obj_id 7711 "; 7712 $res = $ilDB->query($mod_dup_query); 7713 while ($row = $ilDB->fetchAssoc($res)) { 7714 $old_folder_id = $row['obj_id']; 7715 $user_id = $row['user_id']; 7716 $title = $row['title']; 7717 $type = $row['m_type']; 7718 7719 // Delete old folder entry 7720 $ilDB->execute($ps_delete_mf_by_obj_and_usr, array($old_folder_id, $user_id)); 7721 $GLOBALS['ilLog']->write(sprintf( 7722 "DB Step %s: Deleted folder %s of user %s .", 7723 $db_step, 7724 $old_folder_id, 7725 $user_id 7726 )); 7727 7728 $new_folder_id = $ilDB->nextId('mail_obj_data'); 7729 // create new folder entry 7730 $ilDB->execute($ps_create_mf_by_obj_and_usr, array($new_folder_id, $user_id, $title, $type)); 7731 $GLOBALS['ilLog']->write(sprintf( 7732 "DB Step %s: Created new folder %s for user %s .", 7733 $db_step, 7734 $new_folder_id, 7735 $user_id 7736 )); 7737 7738 // Move mails to new folder 7739 $ilDB->execute($ps_update_mail_by_usr_and_folder, array($new_folder_id, $old_folder_id, $user_id)); 7740 $GLOBALS['ilLog']->write(sprintf( 7741 "DB Step %s: Moved mails from %s to %s for user %s .", 7742 $db_step, 7743 $old_folder_id, 7744 $new_folder_id, 7745 $user_id 7746 )); 7747 7748 // Change existing tree entry 7749 $ilDB->execute($ps_update_tree_entry_by_child_and_usr, array($new_folder_id, $old_folder_id, $user_id)); 7750 $GLOBALS['ilLog']->write(sprintf( 7751 "DB Step %s: Changed child in table 'mail_tree' from %s to %s for tree %s .", 7752 $db_step, 7753 $old_folder_id, 7754 $new_folder_id, 7755 $user_id 7756 )); 7757 // Change existing tree parent entry 7758 $ilDB->execute($ps_update_tree_par_entry_by_child_and_usr, array($new_folder_id, $old_folder_id, $user_id)); 7759 $GLOBALS['ilLog']->write(sprintf( 7760 "DB Step %s: Changed parent in table 'mail_tree' from %s to %s for tree %s .", 7761 $db_step, 7762 $old_folder_id, 7763 $new_folder_id, 7764 $user_id 7765 )); 7766 } 7767} 7768 7769$res = $ilDB->query($mod_dup_query_num); 7770$data = $ilDB->fetchAssoc($res); 7771if ($data['cnt'] > 0) { 7772 setup_exit("There are still duplicate entries in table 'mail_obj_data'. Please execute this database update step again."); 7773} 7774$ilSetting->delete('mail_mod_dupl_warn_51x_shown'); 7775?> 7776<#4585> 7777<?php 7778$mod_dup_query_num = " 7779SELECT COUNT(*) cnt 7780FROM ( 7781 SELECT obj_id 7782 FROM mail_obj_data 7783 GROUP BY obj_id 7784 HAVING COUNT(*) > 1 7785) duplicateMailFolders 7786"; 7787$res = $ilDB->query($mod_dup_query_num); 7788$data = $ilDB->fetchAssoc($res); 7789if ($data['cnt'] > 0) { 7790 setup_exit("There are still duplicate entries in table 'mail_obj_data'. Please execute database update step 4584 again. Execute the following SQL string manually: UPDATE settings SET value = 4583 WHERE keyword = 'db_version'; "); 7791} 7792$ilDB->addPrimaryKey('mail_obj_data', array('obj_id')); 7793?> 7794<#4586> 7795<?php 7796$fields = array( 7797 'id' => array( 7798 'type' => 'integer', 7799 'length' => '8', 7800 ), 7801 'status' => array( 7802 'type' => 'integer', 7803 'length' => '1', 7804 ), 7805 'host' => array( 7806 'type' => 'text', 7807 'length' => '256', 7808 ), 7809 'port' => array( 7810 'type' => 'integer', 7811 'length' => '8', 7812 ), 7813 'weight' => array( 7814 'type' => 'integer', 7815 'length' => '2', 7816 ), 7817 'flush_needed' => array( 7818 'type' => 'integer', 7819 'length' => '1', 7820 ), 7821 ); 7822if (!$ilDB->tableExists('il_gc_memcache_server')) { 7823 $ilDB->createTable('il_gc_memcache_server', $fields); 7824 $ilDB->addPrimaryKey('il_gc_memcache_server', array( 'id' )); 7825 $ilDB->createSequence('il_gc_memcache_server'); 7826} 7827?> 7828<#4587> 7829<?php 7830include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 7831ilDBUpdate3136::addStyleClass( 7832 "Sup", 7833 "sup", 7834 "sup", 7835 array() 7836); 7837ilDBUpdate3136::addStyleClass( 7838 "Sub", 7839 "sub", 7840 "sub", 7841 array() 7842); 7843?> 7844<#4588> 7845<?php 7846if (!$ilDB->tableColumnExists("il_wiki_data", "link_md_values")) { 7847 $ilDB->addTableColumn("il_wiki_data", "link_md_values", array( 7848 "type" => "integer", 7849 "length" => 1, 7850 "notnull" => false, 7851 "default" => 0, 7852 )); 7853} 7854?> 7855<#4589> 7856<?php 7857$mt_dup_query_num = " 7858SELECT COUNT(*) cnt 7859FROM ( 7860 SELECT child 7861 FROM mail_tree 7862 GROUP BY child 7863 HAVING COUNT(*) > 1 7864) duplicateMailFolderNodes 7865"; 7866$res = $ilDB->query($mt_dup_query_num); 7867$data = $ilDB->fetchAssoc($res); 7868 7869$ilSetting = new ilSetting(); 7870$setting = $ilSetting->get('mail_mt_dupl_warn_51x_shown', 0); 7871if ($data['cnt'] > 0 && !(int) $setting) { 7872 $ilSetting->set('mail_mt_dupl_warn_51x_shown', 1); 7873 setup_exit(" 7874 7875 Dear Administrator, 7876 7877 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 7878 7879 The update process has been stopped due to a data consistency issue in table 'mail_tree'. 7880 The values in field 'child' should be unique, but there are different values in field 'tree', associated to the same 'child'. 7881 You have the opportunity to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 7882 7883 SELECT * FROM mail_tree INNER JOIN (SELECT child FROM mail_tree GROUP BY child HAVING COUNT(*) > 1) duplicateMailFolderNodes ON duplicateMailFolderNodes.child = mail_tree.child 7884 7885 If you try to rerun the update process, this warning will be skipped. 7886 The remaining duplicates will be removed automatically by the criteria documented below. 7887 7888 1. ILIAS determines the relevant unique users for the duplicate entries (field: tree) 7889 2. ILIAS ensures that the default folders (root, inbox, trash, drafts, sent, local) exist in table 'mail_obj_data' 7890 3. For every affected user ILIAS deletes all records in table 'mail_tree' 7891 4. For every affected user ILIAS creates a new root node in table 'mail_tree' 7892 5. For every affected user ILIAS creates new nodes (inbox, trash, drafts, sent, local) below the root node 7893 6. For every affected user ILIAS creates new nodes for the custom folters below the 'local' folder 7894 7895 Please ensure to backup your current database before reloading this page or executing the database update in general. 7896 Furthermore disable your client while executing the following 3 update steps. 7897 7898 Best regards, 7899 The mail system maintainer 7900 7901 "); 7902} 7903 7904if ($data['cnt'] > 0) { 7905 if (!$ilDB->tableExists('mail_tree_migr')) { 7906 $ilDB->createTable('mail_tree_migr', array( 7907 'usr_id' => array( 7908 'type' => 'integer', 7909 'length' => 4, 7910 'notnull' => true, 7911 'default' => 0 7912 ) 7913 )); 7914 $ilDB->addPrimaryKey('mail_tree_migr', array('usr_id')); 7915 } 7916} 7917?> 7918<#4590> 7919<?php 7920if ($ilDB->tableExists('mail_tree_migr')) { 7921 $db_step = $nr; 7922 7923 $ps_create_mtmig_rec = $ilDB->prepareManip( 7924 "INSERT INTO mail_tree_migr (usr_id) VALUES(?)", 7925 array('integer') 7926 ); 7927 7928 $mt_dup_query = " 7929 SELECT DISTINCT mail_tree.tree 7930 FROM mail_tree 7931 INNER JOIN ( 7932 SELECT child 7933 FROM mail_tree 7934 GROUP BY child 7935 HAVING COUNT(*) > 1 7936 ) duplicateMailFolderNodes ON duplicateMailFolderNodes.child = mail_tree.child 7937 LEFT JOIN mail_tree_migr ON mail_tree_migr.usr_id = mail_tree.tree 7938 WHERE mail_tree_migr.usr_id IS NULL 7939 "; 7940 $res = $ilDB->query($mt_dup_query); 7941 while ($row = $ilDB->fetchAssoc($res)) { 7942 $ilDB->execute($ps_create_mtmig_rec, array($row['tree'])); 7943 7944 $GLOBALS['ilLog']->write(sprintf( 7945 "DB Step %s: Detected duplicate entries (field: child) in table 'mail_tree' for user (field: tree) %s .", 7946 $db_step, 7947 $row['tree'] 7948 )); 7949 } 7950} 7951?> 7952<#4591> 7953<?php 7954if ($ilDB->tableExists('mail_tree_migr')) { 7955 $db_step = $nr; 7956 7957 $ps_del_tree_entries = $ilDB->prepareManip( 7958 "DELETE FROM mail_tree WHERE tree = ?", 7959 array('integer') 7960 ); 7961 7962 $ps_sel_fold_entries = $ilDB->prepare( 7963 "SELECT obj_id, title, m_type FROM mail_obj_data WHERE user_id = ?", 7964 array('integer') 7965 ); 7966 7967 $default_folders_title_to_type_map = array( 7968 'a_root' => 'root', 7969 'b_inbox' => 'inbox', 7970 'c_trash' => 'trash', 7971 'd_drafts' => 'drafts', 7972 'e_sent' => 'sent', 7973 'z_local' => 'local' 7974 ); 7975 $default_folder_type_to_title_map = array_flip($default_folders_title_to_type_map); 7976 7977 $ps_in_fold_entry = $ilDB->prepareManip( 7978 "INSERT INTO mail_obj_data (obj_id, user_id, title, m_type) VALUES(?, ?, ?, ?)", 7979 array('integer','integer', 'text', 'text') 7980 ); 7981 7982 $ps_in_tree_entry = $ilDB->prepareManip( 7983 "INSERT INTO mail_tree (tree, child, parent, lft, rgt, depth) VALUES(?, ?, ?, ?, ?, ?)", 7984 array('integer', 'integer', 'integer', 'integer', 'integer', 'integer') 7985 ); 7986 7987 $ps_sel_tree_entry = $ilDB->prepare( 7988 "SELECT rgt, lft, parent FROM mail_tree WHERE child = ? AND tree = ?", 7989 array('integer', 'integer') 7990 ); 7991 7992 $ps_up_tree_entry = $ilDB->prepareManip( 7993 "UPDATE mail_tree SET lft = CASE WHEN lft > ? THEN lft + 2 ELSE lft END, rgt = CASE WHEN rgt >= ? THEN rgt + 2 ELSE rgt END WHERE tree = ?", 7994 array('integer', 'integer', 'integer') 7995 ); 7996 7997 $ps_del_mtmig_rec = $ilDB->prepareManip( 7998 "DELETE FROM mail_tree_migr WHERE usr_id = ?", 7999 array('integer') 8000 ); 8001 8002 $res = $ilDB->query("SELECT usr_id FROM mail_tree_migr"); 8003 $num = $ilDB->numRows($res); 8004 8005 $GLOBALS['ilLog']->write(sprintf( 8006 "DB Step %s: Found %s duplicates in table 'mail_tree'.", 8007 $db_step, 8008 $num 8009 )); 8010 8011 $i = 0; 8012 while ($row = $ilDB->fetchAssoc($res)) { 8013 ++$i; 8014 8015 $usr_id = $row['usr_id']; 8016 8017 $ilDB->execute($ps_del_tree_entries, array($usr_id)); 8018 $GLOBALS['ilLog']->write(sprintf( 8019 "DB Step %s: Started 'mail_tree' migration for user %s. Deleted all records referring this user (field: tree)", 8020 $db_step, 8021 $usr_id 8022 )); 8023 8024 $fold_res = $ilDB->execute($ps_sel_fold_entries, array($usr_id)); 8025 $user_folders = array(); 8026 $user_default_folders = array(); 8027 while ($fold_row = $ilDB->fetchAssoc($fold_res)) { 8028 $user_folders[$fold_row['obj_id']] = $fold_row; 8029 if (isset($default_folder_type_to_title_map[strtolower($fold_row['m_type'])])) { 8030 $user_default_folders[$fold_row['m_type']] = $fold_row['title']; 8031 } 8032 } 8033 8034 // Create missing default folders 8035 $folders_to_create = array_diff_key($default_folder_type_to_title_map, $user_default_folders); 8036 foreach ($folders_to_create as $type => $title) { 8037 $folder_id = $ilDB->nextId('mail_obj_data'); 8038 $ilDB->execute($ps_in_fold_entry, array($folder_id, $usr_id, $title, $type)); 8039 8040 $user_folders[$folder_id] = array( 8041 'obj_id' => $folder_id, 8042 'user_id' => $usr_id, 8043 'title' => $title, 8044 'm_type' => $type 8045 ); 8046 $GLOBALS['ilLog']->write(sprintf( 8047 "DB Step %s, iteration %s: Created 'mail_obj_data' record (missing folder type): %s, %s, %s, %s .", 8048 $db_step, 8049 $i, 8050 $folder_id, 8051 $usr_id, 8052 $title, 8053 $type 8054 )); 8055 } 8056 8057 // Create a new root folder node 8058 $root_id = null; 8059 foreach ($user_folders as $folder_id => $data) { 8060 if ('root' != $data['m_type']) { 8061 continue; 8062 } 8063 8064 $root_id = $folder_id; 8065 $ilDB->execute($ps_in_tree_entry, array($usr_id, $root_id, 0, 1, 2, 1)); 8066 8067 $GLOBALS['ilLog']->write(sprintf( 8068 "DB Step %s, iteration %s: Created root node with id %s for user %s in 'mail_tree'.", 8069 $db_step, 8070 $i, 8071 $root_id, 8072 $usr_id 8073 )); 8074 break; 8075 } 8076 8077 if (!$root_id) { 8078 // Did not find root folder, skip user and move to the next one 8079 $GLOBALS['ilLog']->write(sprintf( 8080 "DB Step %s, iteration %s: No root folder found for user %s . Skipped user.", 8081 $db_step, 8082 $i, 8083 $usr_id 8084 )); 8085 continue; 8086 } 8087 8088 $custom_folder_root_id = null; 8089 // Create all default folders below 'root' 8090 foreach ($user_folders as $folder_id => $data) { 8091 if ('root' == $data['m_type'] || !isset($default_folder_type_to_title_map[strtolower($data['m_type'])])) { 8092 continue; 8093 } 8094 8095 if (null === $custom_folder_root_id && 'local' == $data['m_type']) { 8096 $custom_folder_root_id = $folder_id; 8097 } 8098 8099 $res_parent = $ilDB->execute($ps_sel_tree_entry, array($root_id, $usr_id)); 8100 $parent_row = $ilDB->fetchAssoc($res_parent); 8101 8102 $right = $parent_row['rgt']; 8103 $lft = $right; 8104 $rgt = $right + 1; 8105 8106 $ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id)); 8107 $ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $root_id, $lft, $rgt, 2)); 8108 $GLOBALS['ilLog']->write(sprintf( 8109 "DB Step %s, iteration %s: Created node with id %s (lft: %s | rgt: %s) for user %s in 'mail_tree'.", 8110 $db_step, 8111 $i, 8112 $folder_id, 8113 $lft, 8114 $rgt, 8115 $usr_id 8116 )); 8117 } 8118 8119 if (!$custom_folder_root_id) { 8120 // Did not find custom folder root, skip user and move to the next one 8121 $GLOBALS['ilLog']->write(sprintf( 8122 "DB Step %s, iteration %s: No custom folder root found for user %s . Skipped user.", 8123 $db_step, 8124 $i, 8125 $usr_id 8126 )); 8127 continue; 8128 } 8129 8130 // Create all custom folders below 'local' 8131 foreach ($user_folders as $folder_id => $data) { 8132 if (isset($default_folder_type_to_title_map[strtolower($data['m_type'])])) { 8133 continue; 8134 } 8135 8136 $res_parent = $ilDB->execute($ps_sel_tree_entry, array($custom_folder_root_id, $usr_id)); 8137 $parent_row = $ilDB->fetchAssoc($res_parent); 8138 8139 $right = $parent_row['rgt']; 8140 $lft = $right; 8141 $rgt = $right + 1; 8142 8143 $ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id)); 8144 $ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $custom_folder_root_id, $lft, $rgt, 3)); 8145 $GLOBALS['ilLog']->write(sprintf( 8146 "DB Step %s, iteration %s: Created custom folder node with id %s (lft: %s | rgt: %s) for user % in 'mail_tree'.", 8147 $db_step, 8148 $i, 8149 $folder_id, 8150 $lft, 8151 $rgt, 8152 $usr_id 8153 )); 8154 } 8155 8156 // Tree completely created, remove migration record 8157 $ilDB->execute($ps_del_mtmig_rec, array($usr_id)); 8158 8159 $GLOBALS['ilLog']->write(sprintf( 8160 "DB Step %s, iteration %s: Finished 'mail_tree' migration for user %s .", 8161 $db_step, 8162 $i, 8163 $usr_id 8164 )); 8165 } 8166 8167 $res = $ilDB->query("SELECT usr_id FROM mail_tree_migr"); 8168 $num = $ilDB->numRows($res); 8169 if ($num > 0) { 8170 setup_exit("There are still duplicate entries in table 'mail_tree'. Please execute this database update step again."); 8171 } 8172} 8173?> 8174<#4592> 8175<?php 8176if ($ilDB->tableExists('mail_tree_migr')) { 8177 $ilDB->dropTable('mail_tree_migr'); 8178} 8179 8180$ilSetting = new ilSetting(); 8181$ilSetting->delete('mail_mt_dupl_warn_51x_shown'); 8182 8183$mt_dup_query_num = " 8184SELECT COUNT(*) cnt 8185FROM ( 8186 SELECT child 8187 FROM mail_tree 8188 GROUP BY child 8189 HAVING COUNT(*) > 1 8190) duplicateMailFolderNodes 8191"; 8192$res = $ilDB->query($mt_dup_query_num); 8193$data = $ilDB->fetchAssoc($res); 8194if ($data['cnt'] > 0) { 8195 setup_exit("There are still duplicate entries in table 'mail_tree'. Please execute database update step 4589 again. Execute the following SQL string manually: UPDATE settings SET value = 4588 WHERE keyword = 'db_version'; "); 8196} 8197 8198$ilDB->addPrimaryKey('mail_tree', array('child')); 8199?> 8200<#4593> 8201<?php 8202$ilDB->dropIndex('mail_tree', 'i1'); 8203?> 8204<#4594> 8205<?php 8206 if (!$ilDB->tableColumnExists("booking_schedule", "av_from")) { 8207 $ilDB->addTableColumn("booking_schedule", "av_from", array( 8208 "type" => "integer", 8209 "notnull" => false, 8210 "length" => 4 8211 )); 8212 } 8213 if (!$ilDB->tableColumnExists("booking_schedule", "av_to")) { 8214 $ilDB->addTableColumn("booking_schedule", "av_to", array( 8215 "type" => "integer", 8216 "notnull" => false, 8217 "length" => 4 8218 )); 8219 } 8220?> 8221<#4595> 8222<?php 8223include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 8224ilDBUpdate3136::addStyleClass( 8225 "CarouselCntr", 8226 "ca_cntr", 8227 "div", 8228 array() 8229); 8230?> 8231<#4596> 8232<?php 8233include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 8234ilDBUpdate3136::addStyleClass( 8235 "CarouselICntr", 8236 "ca_icntr", 8237 "div", 8238 array() 8239); 8240?> 8241<#4597> 8242<?php 8243include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 8244ilDBUpdate3136::addStyleClass( 8245 "CarouselIHead", 8246 "ca_ihead", 8247 "div", 8248 array() 8249); 8250?> 8251<#4598> 8252<?php 8253include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 8254ilDBUpdate3136::addStyleClass( 8255 "CarouselICont", 8256 "ca_icont", 8257 "div", 8258 array() 8259); 8260?> 8261<#4599> 8262<?php 8263 8264if (!$ilDB->tableExists('member_noti')) { 8265 $ilDB->createTable('member_noti', array( 8266 'ref_id' => array( 8267 'type' => 'integer', 8268 'length' => 4, 8269 'notnull' => true, 8270 'default' => 0 8271 ), 8272 'nmode' => array( 8273 'type' => 'integer', 8274 'length' => 1, 8275 'notnull' => true, 8276 'default' => 0 8277 ) 8278 )); 8279 8280 $ilDB->addPrimaryKey('member_noti', array('ref_id')); 8281} 8282 8283?> 8284<#4600> 8285<?php 8286 8287if (!$ilDB->tableExists('member_noti_user')) { 8288 $ilDB->createTable('member_noti_user', array( 8289 'ref_id' => array( 8290 'type' => 'integer', 8291 'length' => 4, 8292 'notnull' => true, 8293 'default' => 0 8294 ), 8295 'user_id' => array( 8296 'type' => 'integer', 8297 'length' => 4, 8298 'notnull' => true, 8299 'default' => 0 8300 ), 8301 'status' => array( 8302 'type' => 'integer', 8303 'length' => 1, 8304 'notnull' => true, 8305 'default' => 0 8306 ) 8307 )); 8308 8309 $ilDB->addPrimaryKey('member_noti_user', array('ref_id', 'user_id')); 8310} 8311 8312?> 8313<#4601> 8314<?php 8315if (!$ilDB->tableColumnExists('frm_posts', 'pos_cens_date')) { 8316 $ilDB->addTableColumn( 8317 'frm_posts', 8318 'pos_cens_date', 8319 array( 8320 'type' => 'timestamp', 8321 'notnull' => false) 8322 ); 8323} 8324?> 8325<#4602> 8326<?php 8327if (!$ilDB->tableExists('frm_posts_deleted')) { 8328 $ilDB->createTable( 8329 'frm_posts_deleted', 8330 array( 8331 'deleted_id' => array( 8332 'type' => 'integer', 8333 'length' => 4, 8334 'notnull' => true 8335 ), 8336 'deleted_date' => array( 8337 'type' => 'timestamp', 8338 'notnull' => true 8339 ), 8340 'deleted_by' => array( 8341 'type' => 'text', 8342 'length' => 255, 8343 'notnull' => true 8344 ), 8345 'forum_title' => array( 8346 'type' => 'text', 8347 'length' => 255, 8348 'notnull' => true 8349 ), 8350 'thread_title' => array( 8351 'type' => 'text', 8352 'length' => 255, 8353 'notnull' => true 8354 ), 8355 'post_title' => array( 8356 'type' => 'text', 8357 'length' => 255, 8358 'notnull' => true 8359 ), 8360 'post_message' => array( 8361 'type' => 'clob', 8362 'notnull' => true 8363 ), 8364 'post_date' => array( 8365 'type' => 'timestamp', 8366 'notnull' => true 8367 ), 8368 'obj_id' => array( 8369 'type' => 'integer', 8370 'length' => 4, 8371 'notnull' => true 8372 ), 8373 'ref_id' => array( 8374 'type' => 'integer', 8375 'length' => 4, 8376 'notnull' => true 8377 ), 8378 'thread_id' => array( 8379 'type' => 'integer', 8380 'length' => 4, 8381 'notnull' => true 8382 ), 8383 'forum_id' => array( 8384 'type' => 'integer', 8385 'length' => 4, 8386 'notnull' => true 8387 ), 8388 'pos_display_user_id' => array( 8389 'type' => 'integer', 8390 'length' => 4, 8391 'notnull' => true, 8392 'default' => 0 8393 ), 8394 'pos_usr_alias' => array( 8395 'type' => 'text', 8396 'length' => 255, 8397 'notnull' => false 8398 ) 8399 ) 8400 ); 8401 8402 $ilDB->addPrimaryKey('frm_posts_deleted', array('deleted_id')); 8403 $ilDB->createSequence('frm_posts_deleted'); 8404} 8405?> 8406<#4603> 8407<?php 8408 $ilCtrlStructureReader->getStructure(); 8409?> 8410<#4604> 8411<?php 8412if (!$ilDB->tableColumnExists('frm_posts_deleted', 'is_thread_deleted')) { 8413 $ilDB->addTableColumn( 8414 'frm_posts_deleted', 8415 'is_thread_deleted', 8416 array( 8417 'type' => 'integer', 8418 'length' => 1, 8419 'notnull' => true, 8420 'default' => 0) 8421 ); 8422} 8423?> 8424<#4605> 8425<?php 8426 8427$res = $ilDB->query("SELECT a.id, a.tpl_id, od.obj_id , od.title FROM " . 8428 "(didactic_tpl_a a JOIN " . 8429 "(didactic_tpl_alr alr JOIN " . 8430 "object_data od " . 8431 "ON (alr.role_template_id = od.obj_id)) " . 8432 "ON ( a.id = alr.action_id)) " . 8433 "WHERE a.type_id = " . $ilDB->quote(2, 'integer')); 8434 8435$names = array(); 8436$templates = array(); 8437 8438while ($row = $ilDB->fetchAssoc($res)) { 8439 $names[$row["tpl_id"]][$row["id"]] = array( 8440 "action_id" => $row["id"], 8441 "role_template_id" => $row["obj_id"], 8442 "role_title" => $row["title"]); 8443 8444 $templates[$row["tpl_id"]] = $row["tpl_id"]; 8445} 8446 8447$res = $ilDB->query("SELECT * FROM didactic_tpl_objs"); 8448 8449while ($row = $ilDB->fetchAssoc($res)) { 8450 if (in_array($row["tpl_id"], $templates)) { 8451 $roles = array(); 8452 $rol_res = $ilDB->query("SELECT rol_id FROM rbac_fa " . 8453 "WHERE parent = " . $ilDB->quote($row["ref_id"], 'integer') . " AND assign = " . $ilDB->quote('y', 'text')); 8454 8455 while ($rol_row = $ilDB->fetchObject($rol_res)) { 8456 $roles[] = $rol_row->rol_id; 8457 } 8458 8459 foreach ($names[$row["tpl_id"]] as $name) { 8460 $concat = $ilDB->concat(array( 8461 array("title", "text"), 8462 array($ilDB->quote("_" . $row["ref_id"], "text"), "text") 8463 ), false); 8464 8465 $ilDB->manipulate("UPDATE object_data" . 8466 " SET title = " . $concat . 8467 " WHERE " . $ilDB->in("obj_id", $roles, "", "integer") . 8468 " AND title = " . $ilDB->quote($name['role_title'])); 8469 } 8470 } 8471} 8472?> 8473<#4606> 8474<?php 8475if (!$ilDB->tableColumnExists('exc_assignment', 'peer_char')) { 8476 $ilDB->addTableColumn('exc_assignment', 'peer_char', array( 8477 'type' => 'integer', 8478 'length' => 2, 8479 'notnull' => false 8480 )); 8481} 8482?> 8483<#4607> 8484<?php 8485if (!$ilDB->tableColumnExists('exc_assignment', 'peer_unlock')) { 8486 $ilDB->addTableColumn('exc_assignment', 'peer_unlock', array( 8487 'type' => 'integer', 8488 'length' => 1, 8489 'notnull' => true, 8490 'default' => 0 8491 )); 8492} 8493?> 8494<#4608> 8495<?php 8496if (!$ilDB->tableColumnExists('exc_assignment', 'peer_valid')) { 8497 $ilDB->addTableColumn('exc_assignment', 'peer_valid', array( 8498 'type' => 'integer', 8499 'length' => 1, 8500 'notnull' => true, 8501 'default' => 1 8502 )); 8503} 8504?> 8505<#4609> 8506<?php 8507if (!$ilDB->tableColumnExists('exc_assignment', 'team_tutor')) { 8508 $ilDB->addTableColumn('exc_assignment', 'team_tutor', array( 8509 'type' => 'integer', 8510 'length' => 1, 8511 'notnull' => true, 8512 'default' => 0 8513 )); 8514} 8515?> 8516<#4610> 8517<?php 8518if (!$ilDB->tableColumnExists('exc_assignment', 'max_file')) { 8519 $ilDB->addTableColumn('exc_assignment', 'max_file', array( 8520 'type' => 'integer', 8521 'length' => 1, 8522 'notnull' => false 8523 )); 8524} 8525?> 8526<#4611> 8527<?php 8528if (!$ilDB->tableColumnExists('exc_assignment', 'deadline2')) { 8529 $ilDB->addTableColumn('exc_assignment', 'deadline2', array( 8530 'type' => 'integer', 8531 'length' => 4, 8532 'notnull' => false 8533 )); 8534} 8535?> 8536<#4612> 8537<?php 8538 $ilCtrlStructureReader->getStructure(); 8539?> 8540<#4613> 8541<?php 8542if (!$ilDB->tableColumnExists('exc_returned', 'late')) { 8543 $ilDB->addTableColumn('exc_returned', 'late', array( 8544 'type' => 'integer', 8545 'length' => 1, 8546 'notnull' => true, 8547 'default' => 0 8548 )); 8549} 8550?> 8551<#4614> 8552<?php 8553 8554if (!$ilDB->tableExists('exc_crit_cat')) { 8555 $ilDB->createTable('exc_crit_cat', array( 8556 'id' => array( 8557 'type' => 'integer', 8558 'length' => 4, 8559 'notnull' => true, 8560 'default' => 0 8561 ), 8562 'parent' => array( 8563 'type' => 'integer', 8564 'length' => 4, 8565 'notnull' => true, 8566 'default' => 0 8567 ), 8568 'title' => array( 8569 'type' => 'text', 8570 'length' => 255, 8571 'notnull' => false 8572 ), 8573 'pos' => array( 8574 'type' => 'integer', 8575 'length' => 4, 8576 'notnull' => true, 8577 'default' => 0 8578 ) 8579 )); 8580 $ilDB->addPrimaryKey('exc_crit_cat', array('id')); 8581 $ilDB->createSequence('exc_crit_cat'); 8582} 8583 8584?> 8585<#4615> 8586<?php 8587 8588if (!$ilDB->tableExists('exc_crit')) { 8589 $ilDB->createTable('exc_crit', array( 8590 'id' => array( 8591 'type' => 'integer', 8592 'length' => 4, 8593 'notnull' => true, 8594 'default' => 0 8595 ), 8596 'parent' => array( 8597 'type' => 'integer', 8598 'length' => 4, 8599 'notnull' => true, 8600 'default' => 0 8601 ), 8602 'type' => array( 8603 'type' => 'text', 8604 'length' => 255, 8605 'notnull' => false 8606 ), 8607 'title' => array( 8608 'type' => 'text', 8609 'length' => 255, 8610 'notnull' => false 8611 ), 8612 'descr' => array( 8613 'type' => 'text', 8614 'length' => 1000, 8615 'notnull' => false 8616 ), 8617 'pos' => array( 8618 'type' => 'integer', 8619 'length' => 4, 8620 'notnull' => true, 8621 'default' => 0 8622 ) 8623 )); 8624 $ilDB->addPrimaryKey('exc_crit', array('id')); 8625 $ilDB->createSequence('exc_crit'); 8626} 8627 8628?> 8629<#4616> 8630<?php 8631 8632if (!$ilDB->tableColumnExists('exc_crit', 'required')) { 8633 $ilDB->addTableColumn('exc_crit', 'required', array( 8634 'type' => 'integer', 8635 'length' => 1, 8636 'notnull' => true, 8637 'default' => 0 8638 )); 8639} 8640 8641?> 8642<#4617> 8643<?php 8644 8645if (!$ilDB->tableColumnExists('exc_crit', 'def')) { 8646 $ilDB->addTableColumn('exc_crit', 'def', array( 8647 'type' => 'text', 8648 'length' => 4000, 8649 'notnull' => false 8650 )); 8651} 8652 8653?> 8654<#4618> 8655<?php 8656 $ilCtrlStructureReader->getStructure(); 8657?> 8658<#4619> 8659<?php 8660 8661if (!$ilDB->tableColumnExists('exc_assignment', 'peer_text')) { 8662 $ilDB->addTableColumn('exc_assignment', 'peer_text', array( 8663 'type' => 'integer', 8664 'length' => 1, 8665 'notnull' => true, 8666 'default' => 1 8667 )); 8668} 8669 8670?> 8671<#4620> 8672<?php 8673 8674if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rating')) { 8675 $ilDB->addTableColumn('exc_assignment', 'peer_rating', array( 8676 'type' => 'integer', 8677 'length' => 1, 8678 'notnull' => true, 8679 'default' => 1 8680 )); 8681} 8682 8683?> 8684<#4621> 8685<?php 8686 8687if (!$ilDB->tableColumnExists('exc_assignment', 'peer_crit_cat')) { 8688 $ilDB->addTableColumn('exc_assignment', 'peer_crit_cat', array( 8689 'type' => 'integer', 8690 'length' => 4, 8691 'notnull' => false 8692 )); 8693} 8694 8695?> 8696<#4622> 8697<?php 8698 8699include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 8700$blog_type_id = ilDBUpdateNewObjectType::getObjectTypeId('blog'); 8701if ($blog_type_id) { 8702 // not sure if we want to clone "write" or "contribute"? 8703 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('redact', 'Redact', 'object', 6100); 8704 if ($new_ops_id) { 8705 ilDBUpdateNewObjectType::addRBACOperation($blog_type_id, $new_ops_id); 8706 } 8707} 8708 8709?> 8710<#4623> 8711<?php 8712 8713include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 8714$redact_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('redact'); 8715if ($redact_ops_id) { 8716 ilDBUpdateNewObjectType::addRBACTemplate( 8717 'blog', 8718 'il_blog_editor', 8719 'Editor template for blogs', 8720 array( 8721 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 8722 ilDBUpdateNewObjectType::RBAC_OP_READ, 8723 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 8724 $redact_ops_id) 8725 ); 8726} 8727 8728?> 8729<#4624> 8730<?php 8731 8732if (!$ilDB->tableColumnExists('adv_md_record_objs', 'optional')) { 8733 $ilDB->addTableColumn('adv_md_record_objs', 'optional', array( 8734 "type" => "integer", 8735 "notnull" => true, 8736 "length" => 1, 8737 "default" => 0 8738 )); 8739} 8740 8741?> 8742<#4625> 8743<?php 8744 8745if (!$ilDB->tableColumnExists('adv_md_record', 'parent_obj')) { 8746 $ilDB->addTableColumn('adv_md_record', 'parent_obj', array( 8747 "type" => "integer", 8748 "notnull" => false, 8749 "length" => 4 8750 )); 8751} 8752 8753?> 8754<#4626> 8755<?php 8756 $ilCtrlStructureReader->getStructure(); 8757?> 8758<#4627> 8759<?php 8760 if (!$ilDB->tableExists("copg_section_timings")) { 8761 $fields = array( 8762 'pm_id' => array('type' => 'integer', 'length' => 4,'notnull' => true, 'default' => 0), 8763 'pm_title' => array('type' => 'text', 'notnull' => true, 'length' => 60, 'fixed' => false), 8764 'pm_enabled' => array('type' => 'integer', 'length' => 1,"notnull" => true,"default" => 0), 8765 'save_usr_adr' => array('type' => 'integer', 'length' => 1,"notnull" => true,"default" => 0) 8766 ); 8767 8768 8769 $fields = array( 8770 "page_id" => array( 8771 "type" => "integer", 8772 "length" => 4, 8773 "notnull" => true 8774 ), 8775 "parent_type" => array( 8776 "type" => "text", 8777 "length" => 10, 8778 "notnull" => true 8779 ), 8780 "utc_ts" => array( 8781 "type" => "timestamp", 8782 "notnull" => true 8783 ) 8784 ); 8785 8786 $ilDB->createTable("copg_section_timings", $fields); 8787 } 8788?> 8789<#4628> 8790<?php 8791 $ilDB->dropTableColumn("copg_section_timings", "utc_ts"); 8792 $ilDB->addTableColumn( 8793 'copg_section_timings', 8794 'unix_ts', 8795 array( 8796 "type" => "integer", 8797 "notnull" => true, 8798 "length" => 4, 8799 "default" => 0 8800 ) 8801 ); 8802?> 8803<#4629> 8804<?php 8805if (!$ilDB->tableColumnExists('skl_user_skill_level', 'unique_identifier')) { 8806 $ilDB->addTableColumn('skl_user_skill_level', 'unique_identifier', array( 8807 'type' => 'text', 8808 'length' => 80, 8809 'notnull' => false 8810 )); 8811} 8812?> 8813<#4630> 8814<?php 8815 $ilCtrlStructureReader->getStructure(); 8816?> 8817<#4631> 8818<?php 8819 if (!$ilDB->tableColumnExists('crs_settings', 'crs_start')) { 8820 $ilDB->addTableColumn('crs_settings', 'crs_start', array( 8821 "type" => "integer", 8822 "notnull" => false, 8823 "length" => 4 8824 )); 8825 } 8826 if (!$ilDB->tableColumnExists('crs_settings', 'crs_end')) { 8827 $ilDB->addTableColumn('crs_settings', 'crs_end', array( 8828 "type" => "integer", 8829 "notnull" => false, 8830 "length" => 4 8831 )); 8832 } 8833?> 8834<#4632> 8835<?php 8836 if (!$ilDB->tableColumnExists('crs_settings', 'leave_end')) { 8837 $ilDB->addTableColumn('crs_settings', 'leave_end', array( 8838 "type" => "integer", 8839 "notnull" => false, 8840 "length" => 4 8841 )); 8842 } 8843?> 8844<#4633> 8845<?php 8846 if (!$ilDB->tableColumnExists('crs_settings', 'auto_wait')) { 8847 $ilDB->addTableColumn('crs_settings', 'auto_wait', array( 8848 "type" => "integer", 8849 "notnull" => true, 8850 "length" => 1, 8851 "default" => 0 8852 )); 8853 } 8854?> 8855<#4634> 8856<?php 8857 if (!$ilDB->tableColumnExists('crs_settings', 'min_members')) { 8858 $ilDB->addTableColumn('crs_settings', 'min_members', array( 8859 "type" => "integer", 8860 "notnull" => false, 8861 "length" => 2 8862 )); 8863 } 8864?> 8865<#4635> 8866<?php 8867 if (!$ilDB->tableColumnExists('grp_settings', 'registration_min_members')) { 8868 $ilDB->addTableColumn('grp_settings', 'registration_min_members', array( 8869 "type" => "integer", 8870 "notnull" => false, 8871 "length" => 2 8872 )); 8873 } 8874?> 8875<#4636> 8876<?php 8877 if (!$ilDB->tableColumnExists('grp_settings', 'leave_end')) { 8878 $ilDB->addTableColumn('grp_settings', 'leave_end', array( 8879 "type" => "integer", 8880 "notnull" => false, 8881 "length" => 4 8882 )); 8883 } 8884?> 8885<#4637> 8886<?php 8887 if (!$ilDB->tableColumnExists('grp_settings', 'auto_wait')) { 8888 $ilDB->addTableColumn('grp_settings', 'auto_wait', array( 8889 "type" => "integer", 8890 "notnull" => true, 8891 "length" => 1, 8892 "default" => 0 8893 )); 8894 } 8895?> 8896<#4638> 8897<?php 8898 if (!$ilDB->tableColumnExists('event', 'reg_min_users')) { 8899 $ilDB->addTableColumn('event', 'reg_min_users', array( 8900 "type" => "integer", 8901 "notnull" => false, 8902 "length" => 2 8903 )); 8904 } 8905?> 8906<#4639> 8907<?php 8908 if (!$ilDB->tableColumnExists('event', 'reg_auto_wait')) { 8909 $ilDB->addTableColumn('event', 'reg_auto_wait', array( 8910 "type" => "integer", 8911 "notnull" => true, 8912 "length" => 1, 8913 "default" => 0 8914 )); 8915 } 8916?> 8917<#4640> 8918<?php 8919if (!$ilDB->tableExists('mail_man_tpl')) { 8920 $ilDB->createTable('mail_man_tpl', array( 8921 'tpl_id' => array( 8922 'type' => 'integer', 8923 'length' => 4, 8924 'notnull' => true, 8925 'default' => 0 8926 ), 8927 'title' => array( 8928 'type' => 'text', 8929 'length' => 255, 8930 'notnull' => true 8931 ), 8932 'context' => array( 8933 'type' => 'text', 8934 'length' => 100, 8935 'notnull' => true 8936 ), 8937 'lang' => array( 8938 'type' => 'text', 8939 'length' => 2, 8940 'notnull' => true 8941 ), 8942 'm_subject' => array( 8943 'type' => 'text', 8944 'length' => 255, 8945 'notnull' => false, 8946 'default' => null 8947 ), 8948 'm_message' => array( 8949 'type' => 'clob', 8950 'notnull' => false, 8951 'default' => null 8952 ) 8953 )); 8954 8955 $ilDB->addPrimaryKey('mail_man_tpl', array('tpl_id')); 8956 $ilDB->createSequence('mail_man_tpl'); 8957} 8958?> 8959<#4641> 8960<?php 8961if (!$ilDB->tableExists('mail_tpl_ctx')) { 8962 $ilDB->createTable('mail_tpl_ctx', array( 8963 'id' => array( 8964 'type' => 'text', 8965 'length' => 100, 8966 'notnull' => true 8967 ), 8968 'component' => array( 8969 'type' => 'text', 8970 'length' => 100, 8971 'notnull' => true 8972 ), 8973 'class' => array( 8974 'type' => 'text', 8975 'length' => 100, 8976 'notnull' => true 8977 ), 8978 'path' => array( 8979 'type' => 'text', 8980 'length' => 4000, 8981 'notnull' => false, 8982 'default' => null 8983 ) 8984 )); 8985 $ilDB->addPrimaryKey('mail_tpl_ctx', array('id')); 8986} 8987?> 8988<#4642> 8989<?php 8990$ilDB->addIndex('mail_man_tpl', array('context'), 'i1'); 8991?> 8992<#4643> 8993<?php 8994if (!$ilDB->tableColumnExists('mail_saved', 'tpl_ctx_id')) { 8995 $ilDB->addTableColumn( 8996 'mail_saved', 8997 'tpl_ctx_id', 8998 array( 8999 'type' => 'text', 9000 'length' => '100', 9001 'notnull' => false, 9002 'default' => null 9003 ) 9004 ); 9005} 9006 9007if (!$ilDB->tableColumnExists('mail_saved', 'tpl_ctx_params')) { 9008 $ilDB->addTableColumn( 9009 'mail_saved', 9010 'tpl_ctx_params', 9011 array( 9012 'type' => 'blob', 9013 'notnull' => false, 9014 'default' => null 9015 ) 9016 ); 9017} 9018?> 9019<#4644> 9020<?php 9021if (!$ilDB->tableColumnExists('mail', 'tpl_ctx_id')) { 9022 $ilDB->addTableColumn( 9023 'mail', 9024 'tpl_ctx_id', 9025 array( 9026 'type' => 'text', 9027 'length' => '100', 9028 'notnull' => false, 9029 'default' => null 9030 ) 9031 ); 9032} 9033 9034if (!$ilDB->tableColumnExists('mail', 'tpl_ctx_params')) { 9035 $ilDB->addTableColumn( 9036 'mail', 9037 'tpl_ctx_params', 9038 array( 9039 'type' => 'blob', 9040 'notnull' => false, 9041 'default' => null 9042 ) 9043 ); 9044} 9045?> 9046<#4645> 9047<?php 9048$ilCtrlStructureReader->getStructure(); 9049?> 9050<#4646> 9051<?php 9052if (!$ilDB->tableExists('itgr_data')) { 9053 $ilDB->createTable('itgr_data', array( 9054 'id' => array( 9055 'type' => 'integer', 9056 'length' => 4, 9057 'notnull' => true 9058 ), 9059 'hide_title' => array( 9060 'type' => 'integer', 9061 'length' => 1, 9062 'notnull' => true, 9063 'default' => 0 9064 ) 9065 )); 9066 9067 $ilDB->addPrimaryKey('itgr_data', array('id')); 9068} 9069?> 9070<#4647> 9071<?php 9072$set = $ilDB->query( 9073 "SELECT * FROM object_data " . 9074 " WHERE type = " . $ilDB->quote("itgr", "text") 9075 ); 9076while ($rec = $ilDB->fetchAssoc($set)) { 9077 $ilDB->manipulate("INSERT INTO itgr_data " . 9078 "(id, hide_title) VALUES (" . 9079 $ilDB->quote($rec["obj_id"], "integer") . "," . 9080 $ilDB->quote(0, "integer") . 9081 ")"); 9082} 9083?> 9084<#4648> 9085<?php 9086//$ilDB->query('ALTER TABLE il_dcl_record_field ADD INDEX (record_id)'); 9087//$ilDB->query('ALTER TABLE il_dcl_record_field ADD INDEX (field_id)'); 9088//$ilDB->query('ALTER TABLE il_dcl_record ADD INDEX (table_id)'); 9089//$ilDB->query('ALTER TABLE il_dcl_stloc1_value ADD INDEX (record_field_id)'); 9090//$ilDB->query('ALTER TABLE il_dcl_stloc2_value ADD INDEX (record_field_id)'); 9091//$ilDB->query('ALTER TABLE il_dcl_stloc3_value ADD INDEX (record_field_id)'); 9092//$ilDB->query('ALTER TABLE il_dcl_field ADD INDEX (table_id)'); 9093//$ilDB->query('ALTER TABLE il_dcl_field_prop ADD INDEX (field_id)'); 9094//$ilDB->query('ALTER TABLE il_dcl_field_prop ADD INDEX (datatype_prop_id)'); 9095//$ilDB->query('ALTER TABLE il_dcl_viewdefinition ADD INDEX (view_id)'); 9096//$ilDB->query('ALTER TABLE il_dcl_view ADD INDEX (table_id)'); 9097//$ilDB->query('ALTER TABLE il_dcl_view ADD INDEX (type)'); 9098//$ilDB->query('ALTER TABLE il_dcl_data ADD INDEX (main_table_id)'); 9099//$ilDB->query('ALTER TABLE il_dcl_table ADD INDEX (obj_id)'); 9100?> 9101<#4649> 9102<?php 9103if (!$ilDB->tableColumnExists("content_object", "for_translation")) { 9104 $ilDB->addTableColumn("content_object", "for_translation", array( 9105 "type" => "integer", 9106 "notnull" => true, 9107 "length" => 1, 9108 "default" => 0)); 9109} 9110?> 9111<#4650> 9112<?php 9113$set = $ilDB->query( 9114 "SELECT * FROM mep_item JOIN mep_tree ON (mep_item.obj_id = mep_tree.child) " . 9115 " WHERE mep_item.type = " . $ilDB->quote("pg", "text") 9116 ); 9117while ($rec = $ilDB->fetchAssoc($set)) { 9118 $q = "UPDATE page_object SET " . 9119 " parent_id = " . $ilDB->quote($rec["mep_id"], "integer") . 9120 " WHERE parent_type = " . $ilDB->quote("mep", "text") . 9121 " AND page_id = " . $ilDB->quote($rec["obj_id"], "integer"); 9122 //echo "<br>".$q; 9123 $ilDB->manipulate($q); 9124} 9125?> 9126<#4651> 9127<?php 9128if (!$ilDB->tableColumnExists("mep_data", "for_translation")) { 9129 $ilDB->addTableColumn("mep_data", "for_translation", array( 9130 "type" => "integer", 9131 "notnull" => true, 9132 "length" => 1, 9133 "default" => 0)); 9134} 9135?> 9136<#4652> 9137<?php 9138if (!$ilDB->tableColumnExists("mep_item", "import_id")) { 9139 $ilDB->addTableColumn("mep_item", "import_id", array( 9140 "type" => "text", 9141 "notnull" => false, 9142 "length" => 50)); 9143} 9144?> 9145<#4653> 9146<?php 9147 $ilCtrlStructureReader->getStructure(); 9148?> 9149<#4654> 9150<?php 9151 9152include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 9153 9154$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 9155if ($wiki_type_id) { 9156 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('edit_wiki_navigation', 'Edit Wiki Navigation', 'object', 3220); 9157 if ($new_ops_id) { 9158 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 9159 } 9160} 9161?> 9162<#4655> 9163<?php 9164 9165include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 9166 9167$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 9168if ($wiki_type_id) { 9169 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('delete_wiki_pages', 'Delete Wiki Pages', 'object', 3300); 9170 if ($new_ops_id) { 9171 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 9172 } 9173} 9174 9175?> 9176<#4656> 9177<?php 9178 9179include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 9180 9181$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 9182if ($wiki_type_id) { 9183 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('activate_wiki_protection', 'Set Read-Only', 'object', 3240); 9184 if ($new_ops_id) { 9185 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 9186 } 9187} 9188 9189?> 9190<#4657> 9191<?php 9192 $ilCtrlStructureReader->getStructure(); 9193?> 9194<#4658> 9195<?php 9196 if (!$ilDB->tableExists('wiki_user_html_export')) { 9197 $ilDB->createTable('wiki_user_html_export', array( 9198 'wiki_id' => array( 9199 'type' => 'integer', 9200 'length' => 4, 9201 'notnull' => true 9202 ), 9203 'usr_id' => array( 9204 'type' => 'integer', 9205 'length' => 4, 9206 'notnull' => true 9207 ), 9208 'progress' => array( 9209 'type' => 'integer', 9210 'length' => 4, 9211 'notnull' => true 9212 ), 9213 'start_ts' => array( 9214 'type' => 'timestamp', 9215 'notnull' => false 9216 ), 9217 'status' => array( 9218 'type' => 'integer', 9219 'length' => 1, 9220 'notnull' => true, 9221 'default' => 0 9222 ) 9223 )); 9224 $ilDB->addPrimaryKey('wiki_user_html_export', array('wiki_id')); 9225 } 9226?> 9227<#4659> 9228<?php 9229 9230include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 9231 9232$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 9233if ($wiki_type_id) { 9234 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('wiki_html_export', 'Wiki HTML Export', 'object', 3242); 9235 if ($new_ops_id) { 9236 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 9237 } 9238} 9239 9240?> 9241 9242<#4660> 9243<?php 9244 9245if (!$ilDB->tableColumnExists('loc_settings', 'it_type')) { 9246 $ilDB->addTableColumn( 9247 'loc_settings', 9248 'it_type', 9249 array( 9250 'type' => 'integer', 9251 'length' => 1, 9252 'notnull' => false, 9253 'default' => 5 9254 ) 9255 ); 9256} 9257?> 9258<#4661> 9259<?php 9260 9261if (!$ilDB->tableColumnExists('loc_settings', 'qt_type')) { 9262 $ilDB->addTableColumn( 9263 'loc_settings', 9264 'qt_type', 9265 array( 9266 'type' => 'integer', 9267 'length' => 1, 9268 'notnull' => false, 9269 'default' => 1 9270 ) 9271 ); 9272} 9273 9274?> 9275 9276<#4662> 9277<?php 9278 9279if (!$ilDB->tableColumnExists('loc_settings', 'it_start')) { 9280 $ilDB->addTableColumn( 9281 'loc_settings', 9282 'it_start', 9283 array( 9284 'type' => 'integer', 9285 'length' => 1, 9286 'notnull' => false, 9287 'default' => 1 9288 ) 9289 ); 9290} 9291 9292?> 9293 9294<#4663> 9295<?php 9296 9297if (!$ilDB->tableColumnExists('loc_settings', 'qt_start')) { 9298 $ilDB->addTableColumn( 9299 'loc_settings', 9300 'qt_start', 9301 array( 9302 'type' => 'integer', 9303 'length' => 1, 9304 'notnull' => false, 9305 'default' => 1 9306 ) 9307 ); 9308} 9309?> 9310 9311<#4664> 9312<?php 9313 9314 9315$query = 'UPDATE loc_settings SET it_type = ' . $ilDB->quote(1, 'integer') . ' WHERE type = ' . $ilDB->quote(1, 'integer'); 9316$res = $ilDB->manipulate($query); 9317 9318?> 9319 9320<#4665> 9321<?php 9322 9323 9324$query = 'UPDATE loc_settings SET qt_start = ' . $ilDB->quote(0, 'integer') . ' WHERE type = ' . $ilDB->quote(4, 'integer'); 9325$res = $ilDB->manipulate($query); 9326 9327?> 9328 9329<#4666> 9330<?php 9331 9332if (!$ilDB->tableExists('loc_tst_assignments')) { 9333 $ilDB->createTable('loc_tst_assignments', array( 9334 'assignment_id' => array( 9335 'type' => 'integer', 9336 'length' => 4, 9337 'notnull' => true, 9338 'default' => 0 9339 ), 9340 'container_id' => array( 9341 'type' => 'integer', 9342 'length' => 4, 9343 'notnull' => true, 9344 'default' => 0 9345 ), 9346 'assignment_type' => array( 9347 'type' => 'integer', 9348 'length' => 1, 9349 'notnull' => true, 9350 'default' => 0 9351 ), 9352 'objective_id' => array( 9353 'type' => 'integer', 9354 'length' => 4, 9355 'notnull' => true, 9356 'default' => 0 9357 ), 9358 'tst_ref_id' => array( 9359 'type' => 'integer', 9360 'length' => 4, 9361 'notnull' => true, 9362 'default' => 0 9363 ) 9364 )); 9365 9366 $ilDB->addPrimaryKey('loc_tst_assignments', array('assignment_id')); 9367 $ilDB->createSequence('loc_tst_assignments'); 9368} 9369?> 9370 9371 9372<#4667> 9373<?php 9374 9375if (!$ilDB->tableColumnExists('loc_settings', 'passed_obj_mode')) { 9376 $ilDB->addTableColumn( 9377 'loc_settings', 9378 'passed_obj_mode', 9379 array( 9380 'type' => 'integer', 9381 'length' => 1, 9382 'notnull' => false, 9383 'default' => 1 9384 ) 9385 ); 9386} 9387?> 9388 9389<#4668> 9390<?php 9391if (!$ilDB->tableExists('tst_seq_qst_optional')) { 9392 $ilDB->createTable('tst_seq_qst_optional', array( 9393 'active_fi' => array( 9394 'type' => 'integer', 9395 'length' => 4, 9396 'notnull' => true, 9397 'default' => 0 9398 ), 9399 'pass' => array( 9400 'type' => 'integer', 9401 'length' => 4, 9402 'notnull' => true, 9403 'default' => 0 9404 ), 9405 'question_fi' => array( 9406 'type' => 'integer', 9407 'length' => 4, 9408 'notnull' => true, 9409 'default' => 0 9410 ) 9411 )); 9412 9413 $ilDB->addPrimaryKey('tst_seq_qst_optional', array( 9414 'active_fi', 'pass', 'question_fi' 9415 )); 9416} 9417?> 9418 9419<#4669> 9420<?php 9421if (!$ilDB->tableColumnExists('tst_sequence', 'ans_opt_confirmed')) { 9422 $ilDB->addTableColumn('tst_sequence', 'ans_opt_confirmed', array( 9423 'type' => 'integer', 9424 'length' => 1, 9425 'notnull' => true, 9426 'default' => 0 9427 )); 9428} 9429?> 9430 9431<#4670> 9432<?php 9433if (!$ilDB->tableExists('il_wac_secure_path')) { 9434 $fields = array( 9435 'path' => array( 9436 'type' => 'text', 9437 'length' => '64', 9438 9439 ), 9440 'component_directory' => array( 9441 'type' => 'text', 9442 'length' => '256', 9443 9444 ), 9445 'checking_class' => array( 9446 'type' => 'text', 9447 'length' => '256', 9448 9449 ), 9450 'in_sec_folder' => array( 9451 'type' => 'integer', 9452 'length' => '1', 9453 ), 9454 9455 ); 9456 9457 $ilDB->createTable('il_wac_secure_path', $fields); 9458 $ilDB->addPrimaryKey('il_wac_secure_path', array( 'path' )); 9459} 9460?> 9461<#4671> 9462 <?php 9463 //step 1/5 search for dublicates and store it in desktop_item_tmp 9464 9465 if ($ilDB->tableExists('desktop_item')) { 9466 $res = $ilDB->query(" 9467 SELECT first.item_id, first.user_id 9468 FROM desktop_item first 9469 WHERE EXISTS ( 9470 SELECT second.item_id, second.user_id 9471 FROM desktop_item second 9472 WHERE first.item_id = second.item_id AND first.user_id = second.user_id 9473 GROUP BY second.item_id, second.user_id 9474 HAVING COUNT(second.item_id) > 1 9475 ) 9476 GROUP BY first.item_id, first.user_id 9477 "); 9478 9479 if ($ilDB->numRows($res)) { 9480 if (!$ilDB->tableExists('desktop_item_tmp')) { 9481 $ilDB->createTable('desktop_item_tmp', array( 9482 'item_id' => array( 9483 'type' => 'integer', 9484 'length' => 8, 9485 'notnull' => true, 9486 'default' => 0 9487 ), 9488 'user_id' => array( 9489 'type' => 'integer', 9490 'length' => 8, 9491 'notnull' => true, 9492 'default' => 0 9493 ) 9494 )); 9495 $ilDB->addPrimaryKey('desktop_item_tmp', array('item_id','user_id')); 9496 } 9497 9498 while ($row = $ilDB->fetchAssoc($res)) { 9499 $ilDB->replace('desktop_item_tmp', array(), array( 9500 'item_id' => array('integer', $row['item_id']), 9501 'user_id' => array('integer', $row['user_id']) 9502 )); 9503 } 9504 } 9505 } 9506 ?> 9507<#4672> 9508 <?php 9509 //step 2/5 deletes dublicates stored in desktop_item_tmp 9510 9511 if ($ilDB->tableExists('desktop_item_tmp')) { 9512 $res = $ilDB->query(" 9513 SELECT item_id, user_id 9514 FROM desktop_item_tmp 9515 "); 9516 9517 while ($row = $ilDB->fetchAssoc($res)) { 9518 $res_data = $ilDB->query( 9519 " 9520 SELECT * 9521 FROM desktop_item 9522 WHERE 9523 item_id = " . $ilDB->quote($row['item_id'], 'integer') . " AND 9524 user_id = " . $ilDB->quote($row['user_id'], 'integer') 9525 ); 9526 $data = $ilDB->fetchAssoc($res_data); 9527 9528 $ilDB->manipulate( 9529 "DELETE FROM desktop_item WHERE" . 9530 " item_id = " . $ilDB->quote($row['item_id'], 'integer') . 9531 " AND user_id = " . $ilDB->quote($row['user_id'], 'integer') 9532 ); 9533 9534 $ilDB->manipulate("INSERT INTO desktop_item (item_id,user_id,type,parameters) " . 9535 "VALUES ( " . 9536 $ilDB->quote($data['item_id'], 'integer') . ', ' . 9537 $ilDB->quote($data['user_id'], 'integer') . ', ' . 9538 $ilDB->quote($data['type'], 'text') . ', ' . 9539 $ilDB->quote($data['parameters'], 'text') . 9540 ")"); 9541 } 9542 } 9543 ?> 9544<#4673> 9545 <?php 9546 //step 3/5 drop desktop_item_tmp 9547 9548 if ($ilDB->tableExists('desktop_item_tmp')) { 9549 $ilDB->dropTable('desktop_item_tmp'); 9550 } 9551 ?> 9552<#4674> 9553 <?php 9554 //step 4/5 drops not used indexes 9555 9556 if ($ilDB->indexExistsByFields('desktop_item', array('item_id'))) { 9557 $ilDB->dropIndexByFields('desktop_item', array('item_id')); 9558 } 9559 if ($ilDB->indexExistsByFields('desktop_item', array('user_id'))) { 9560 $ilDB->dropIndexByFields('desktop_item', array('user_id')); 9561 } 9562 ?> 9563<#4675> 9564<?php 9565//step 5/5 adding primary keys and useful indexes 9566 9567if ($ilDB->tableExists('desktop_item')) { 9568 $ilDB->addPrimaryKey('desktop_item', array('user_id', 'item_id')); 9569} 9570?> 9571<#4676> 9572<?php 9573if (!$ilDB->tableExists('buddylist')) { 9574 $ilDB->createTable('buddylist', array( 9575 'usr_id' => array( 9576 'type' => 'integer', 9577 'length' => 4, 9578 'notnull' => true, 9579 'default' => 0 9580 ), 9581 'buddy_usr_id' => array( 9582 'type' => 'integer', 9583 'length' => 4, 9584 'notnull' => true, 9585 'default' => 0 9586 ), 9587 'ts' => array( 9588 'type' => 'integer', 9589 'length' => 4, 9590 'notnull' => true, 9591 'default' => 0 9592 ) 9593 )); 9594 $ilDB->addPrimaryKey('buddylist', array('usr_id', 'buddy_usr_id')); 9595} 9596?> 9597<#4677> 9598<?php 9599if (!$ilDB->tableExists('buddylist_requests')) { 9600 $ilDB->createTable('buddylist_requests', array( 9601 'usr_id' => array( 9602 'type' => 'integer', 9603 'length' => 4, 9604 'notnull' => true, 9605 'default' => 0 9606 ), 9607 'buddy_usr_id' => array( 9608 'type' => 'integer', 9609 'length' => 4, 9610 'notnull' => true, 9611 'default' => 0 9612 ), 9613 'ignored' => array( 9614 'type' => 'integer', 9615 'length' => 1, 9616 'notnull' => true, 9617 'default' => 0 9618 ), 9619 'ts' => array( 9620 'type' => 'integer', 9621 'length' => 4, 9622 'notnull' => true, 9623 'default' => 0 9624 ) 9625 )); 9626 $ilDB->addPrimaryKey('buddylist_requests', array('usr_id', 'buddy_usr_id')); 9627 $ilDB->addIndex('buddylist_requests', array('buddy_usr_id', 'ignored'), 'i1'); 9628} 9629?> 9630<#4678> 9631<?php 9632$ilDB->manipulate('DELETE FROM addressbook_mlist_ass'); 9633if ($ilDB->tableColumnExists('addressbook_mlist_ass', 'addr_id')) { 9634 $ilDB->renameTableColumn('addressbook_mlist_ass', 'addr_id', 'usr_id'); 9635} 9636?> 9637<#4679> 9638<?php 9639if ($ilDB->tableExists('addressbook')) { 9640 $query = " 9641 SELECT ud1.usr_id 'u1', ud2.usr_id 'u2' 9642 FROM addressbook a1 9643 INNER JOIN usr_data ud1 ON ud1.usr_id = a1.user_id 9644 INNER JOIN usr_data ud2 ON ud2.login = a1.login 9645 INNER JOIN addressbook a2 ON a2.user_id = ud2.usr_id AND a2.login = ud1.login 9646 WHERE ud1.usr_id != ud2.usr_id 9647 "; 9648 $res = $ilDB->query($query); 9649 while ($row = $ilDB->fetchAssoc($res)) { 9650 $this->db->replace( 9651 'buddylist', 9652 array( 9653 'usr_id' => array('integer', $row['u1']), 9654 'buddy_usr_id' => array('integer', $row['u2']) 9655 ), 9656 array( 9657 'ts' => array('integer', time()) 9658 ) 9659 ); 9660 9661 $this->db->replace( 9662 'buddylist', 9663 array( 9664 'usr_id' => array('integer', $row['u2']), 9665 'buddy_usr_id' => array('integer', $row['u1']) 9666 ), 9667 array( 9668 'ts' => array('integer', time()) 9669 ) 9670 ); 9671 } 9672 9673 $query = " 9674 SELECT ud1.usr_id 'u1', ud2.usr_id 'u2' 9675 FROM addressbook a1 9676 INNER JOIN usr_data ud1 ON ud1.usr_id = a1.user_id 9677 INNER JOIN usr_data ud2 ON ud2.login = a1.login 9678 LEFT JOIN addressbook a2 ON a2.user_id = ud2.usr_id AND a2.login = ud1.login 9679 WHERE a2.addr_id IS NULL AND ud1.usr_id != ud2.usr_id 9680 "; 9681 $res = $ilDB->query($query); 9682 while ($row = $ilDB->fetchAssoc($res)) { 9683 $this->db->replace( 9684 'buddylist_requests', 9685 array( 9686 'usr_id' => array('integer', $row['u1']), 9687 'buddy_usr_id' => array('integer', $row['u2']) 9688 ), 9689 array( 9690 'ts' => array('integer', time()), 9691 'ignored' => array('integer', 0) 9692 ) 9693 ); 9694 } 9695 9696 $ilDB->dropTable('addressbook'); 9697} 9698?> 9699<#4680> 9700<?php 9701if ($ilDB->sequenceExists('addressbook')) { 9702 $ilDB->dropSequence('addressbook'); 9703} 9704?> 9705<#4681> 9706<?php 9707$ilCtrlStructureReader->getStructure(); 9708?> 9709<#4682> 9710<?php 9711$res = $ilDB->queryF( 9712 'SELECT * FROM notification_usercfg WHERE usr_id = %s AND module = %s AND channel = %s', 9713 array('integer', 'text', 'text'), 9714 array(-1, 'buddysystem_request', 'mail') 9715); 9716$num = $ilDB->numRows($res); 9717if (!$ilDB->numRows($res)) { 9718 $ilDB->insert( 9719 'notification_usercfg', 9720 array( 9721 'usr_id' => array('integer', -1), 9722 'module' => array('text', 'buddysystem_request'), 9723 'channel' => array('text', 'mail') 9724 ) 9725 ); 9726} 9727 9728$res = $ilDB->queryF( 9729 'SELECT * FROM notification_usercfg WHERE usr_id = %s AND module = %s AND channel = %s', 9730 array('integer', 'text', 'text'), 9731 array(-1, 'buddysystem_request', 'osd') 9732); 9733if (!$ilDB->numRows($res)) { 9734 $ilDB->insert( 9735 'notification_usercfg', 9736 array( 9737 'usr_id' => array('integer', -1), 9738 'module' => array('text', 'buddysystem_request'), 9739 'channel' => array('text', 'osd') 9740 ) 9741 ); 9742} 9743?> 9744<#4683> 9745<?php 9746if (!$ilDB->tableColumnExists('obj_members', 'contact')) { 9747 $ilDB->addTableColumn( 9748 'obj_members', 9749 'contact', 9750 array( 9751 'type' => 'integer', 9752 'length' => 1, 9753 'notnull' => false, 9754 'default' => 0 9755 ) 9756 ); 9757} 9758?> 9759<#4684> 9760<?php 9761 // register new object type 'awra' for awareness tool administration 9762 $id = $ilDB->nextId("object_data"); 9763 $ilDB->manipulateF( 9764 "INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 9765 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 9766 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 9767 array($id, "typ", "awra", "Awareness Tool Administration", -1, ilUtil::now(), ilUtil::now()) 9768 ); 9769 $typ_id = $id; 9770 9771 // create object data entry 9772 $id = $ilDB->nextId("object_data"); 9773 $ilDB->manipulateF( 9774 "INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 9775 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 9776 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 9777 array($id, "awra", "__AwarenessToolAdministration", "Awareness Tool Administration", -1, ilUtil::now(), ilUtil::now()) 9778 ); 9779 9780 // create object reference entry 9781 $ref_id = $ilDB->nextId('object_reference'); 9782 $res = $ilDB->manipulateF( 9783 "INSERT INTO object_reference (ref_id, obj_id) VALUES (%s, %s)", 9784 array("integer", "integer"), 9785 array($ref_id, $id) 9786 ); 9787 9788 // put in tree 9789 $tree = new ilTree(ROOT_FOLDER_ID); 9790 $tree->insertNode($ref_id, SYSTEM_FOLDER_ID); 9791 9792 // add rbac operations 9793 // 1: edit_permissions, 2: visible, 3: read, 4:write 9794 $ilDB->manipulateF( 9795 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 9796 array("integer", "integer"), 9797 array($typ_id, 1) 9798 ); 9799 $ilDB->manipulateF( 9800 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 9801 array("integer", "integer"), 9802 array($typ_id, 2) 9803 ); 9804 $ilDB->manipulateF( 9805 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 9806 array("integer", "integer"), 9807 array($typ_id, 3) 9808 ); 9809 $ilDB->manipulateF( 9810 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 9811 array("integer", "integer"), 9812 array($typ_id, 4) 9813 ); 9814?> 9815<#4685> 9816<?php 9817 $ilCtrlStructureReader->getStructure(); 9818?> 9819<#4686> 9820<?php 9821 $ilCtrlStructureReader->getStructure(); 9822?> 9823<#4687> 9824<?php 9825 $ilCtrlStructureReader->getStructure(); 9826?> 9827<#4688> 9828<?php 9829 $s = new ilSetting("awrn"); 9830 $s->set("max_nr_entries", 50); 9831?> 9832<#4689> 9833<?php 9834 $ilCtrlStructureReader->getStructure(); 9835?> 9836<#4690> 9837<?php 9838//step 1/4 rbac_log renames old table 9839 9840if ($ilDB->tableExists('rbac_log') && !$ilDB->tableExists('rbac_log_old')) { 9841 $ilDB->renameTable("rbac_log", "rbac_log_old"); 9842} 9843?> 9844<#4691> 9845<?php 9846//step 2/4 rbac_log creates new table with unique id and sequenz 9847 9848if (!$ilDB->tableExists('rbac_log')) { 9849 $ilDB->createTable('rbac_log', array( 9850 'log_id' => array( 9851 'type' => 'integer', 9852 'length' => 4, 9853 'notnull' => true 9854 ), 9855 'user_id' => array( 9856 'type' => 'integer', 9857 'length' => 4, 9858 'notnull' => true 9859 ), 9860 'created' => array( 9861 'type' => 'integer', 9862 'length' => 4, 9863 'notnull' => true 9864 ), 9865 'ref_id' => array( 9866 'type' => 'integer', 9867 'length' => 4, 9868 'notnull' => true 9869 ), 9870 'action' => array( 9871 'type' => 'integer', 9872 'length' => 4, 9873 'notnull' => true 9874 ), 9875 'data' => array( 9876 'type' => 'clob', 9877 'notnull' => false, 9878 'default' => null 9879 ) 9880 )); 9881 $ilDB->addPrimaryKey('rbac_log', array('log_id')); 9882 $ilDB->addIndex('rbac_log', array('ref_id'), 'i1'); 9883 $ilDB->createSequence('rbac_log'); 9884} 9885?> 9886<#4692> 9887<?php 9888//step 3/4 rbac_log moves all data to new table 9889 9890if ($ilDB->tableExists('rbac_log') && $ilDB->tableExists('rbac_log_old')) { 9891 $res = $ilDB->query(" 9892 SELECT * 9893 FROM rbac_log_old 9894 "); 9895 9896 while ($row = $ilDB->fetchAssoc($res)) { 9897 $id = $ilDB->nextId('rbac_log'); 9898 9899 $ilDB->manipulate( 9900 "INSERT INTO rbac_log (log_id, user_id, created, ref_id, action, data)" . 9901 " VALUES (" . 9902 $ilDB->quote($id, "integer") . 9903 "," . $ilDB->quote($row['user_id'], "integer") . 9904 "," . $ilDB->quote($row['created'], "integer") . 9905 "," . $ilDB->quote($row['ref_id'], "integer") . 9906 "," . $ilDB->quote($row['action'], "integer") . 9907 "," . $ilDB->quote($row['data'], "text") . 9908 ")" 9909 ); 9910 9911 $ilDB->manipulateF( 9912 "DELETE FROM rbac_log_old WHERE user_id = %s AND created = %s AND ref_id = %s AND action = %s", 9913 array('integer', 'integer', 'integer', 'integer'), 9914 array($row['user_id'], $row['created'], $row['ref_id'], $row['action']) 9915 ); 9916 } 9917} 9918?> 9919<#4693> 9920<?php 9921//step 4/4 rbac_log removes all table 9922 9923if ($ilDB->tableExists('rbac_log_old')) { 9924 $ilDB->dropTable('rbac_log_old'); 9925} 9926?> 9927<#4694> 9928<?php 9929//step 1/3 rbac_templates removes all dublicates 9930if ($ilDB->tableExists('rbac_templates')) { 9931 $res = $ilDB->query( 9932 'select * from rbac_templates GROUP BY rol_id, type, ops_id, parent ' . 9933 'having count(*) > 1' 9934 ); 9935 9936 9937 /* 9938 $res = $ilDB->query(" 9939 SELECT first.rol_id rol_id, first.type type, first.ops_id ops_id, first.parent parent 9940 FROM rbac_templates first 9941 WHERE EXISTS ( 9942 SELECT second.rol_id, second.type, second.ops_id, second.parent 9943 FROM rbac_templates second 9944 WHERE first.rol_id = second.rol_id 9945 AND first.type = second.type 9946 AND first.ops_id = second.ops_id 9947 AND first.parent = second.parent 9948 GROUP BY second.rol_id, second.type, second.ops_id, second.parent 9949 HAVING COUNT(second.rol_id) > 1 9950 ) 9951 GROUP BY first.rol_id, first.type, first.ops_id, first.parent 9952 "); 9953 */ 9954 9955 while ($row = $ilDB->fetchAssoc($res)) { 9956 $ilDB->manipulateF( 9957 "DELETE FROM rbac_templates WHERE rol_id = %s AND type = %s AND ops_id = %s AND parent = %s", 9958 array('integer', 'text', 'integer', 'integer'), 9959 array($row['rol_id'], $row['type'], $row['ops_id'], $row['parent']) 9960 ); 9961 9962 $ilDB->manipulate( 9963 "INSERT INTO rbac_templates (rol_id, type, ops_id, parent)" . 9964 " VALUES (" . 9965 $ilDB->quote($row['rol_id'], "integer") . 9966 "," . $ilDB->quote($row['type'], "text") . 9967 "," . $ilDB->quote($row['ops_id'], "integer") . 9968 "," . $ilDB->quote($row['parent'], "integer") . 9969 ")" 9970 ); 9971 } 9972} 9973?> 9974<#4695> 9975<?php 9976//step 2/3 rbac_templates remove indexes 9977if ($ilDB->indexExistsByFields('rbac_templates', array('rol_id'))) { 9978 $ilDB->dropIndexByFields('rbac_templates', array('rol_id')); 9979} 9980if ($ilDB->indexExistsByFields('rbac_templates', array('type'))) { 9981 $ilDB->dropIndexByFields('rbac_templates', array('type')); 9982} 9983if ($ilDB->indexExistsByFields('rbac_templates', array('ops_id'))) { 9984 $ilDB->dropIndexByFields('rbac_templates', array('ops_id')); 9985} 9986if ($ilDB->indexExistsByFields('rbac_templates', array('parent'))) { 9987 $ilDB->dropIndexByFields('rbac_templates', array('parent')); 9988} 9989if ($ilDB->indexExistsByFields('rbac_templates', array('rol_id','parent'))) { 9990 $ilDB->dropIndexByFields('rbac_templates', array('rol_id','parent')); 9991} 9992?> 9993<#4696> 9994<?php 9995//step 3/3 rbac_templates add primary 9996if ($ilDB->tableExists('rbac_templates')) { 9997 $ilDB->addPrimaryKey('rbac_templates', array('rol_id','parent', 'type', 'ops_id')); 9998} 9999?> 10000<#4697> 10001<?php 10002//remove unused table search_tree 10003if ($ilDB->tableExists('search_tree')) { 10004 $ilDB->dropTable('search_tree'); 10005} 10006?> 10007<#4698> 10008<?php 10009 if (!$ilDB->tableColumnExists('sahs_lm', 'mastery_score')) { 10010 $ilDB->addTableColumn( 10011 'sahs_lm', 10012 'mastery_score', 10013 array( 10014 'type' => 'integer', 10015 'length' => 1, 10016 'notnull' => false 10017 ) 10018 ); 10019 } 10020?> 10021<#4699> 10022<?php 10023//step 1/2 adm_set_templ_hide_tab removes all dublicates 10024if ($ilDB->tableExists('adm_set_templ_hide_tab')) { 10025 $res = $ilDB->query(" 10026 SELECT first.template_id template_id, first.tab_id tab_id 10027 FROM adm_set_templ_hide_tab first 10028 WHERE EXISTS ( 10029 SELECT second.template_id, second.tab_id 10030 FROM adm_set_templ_hide_tab second 10031 WHERE first.template_id = second.template_id AND first.tab_id = second.tab_id 10032 GROUP BY second.template_id, second.tab_id HAVING COUNT(second.template_id) > 1 10033 ) 10034 GROUP BY first.template_id, first.tab_id; 10035 "); 10036 10037 while ($row = $ilDB->fetchAssoc($res)) { 10038 $ilDB->manipulateF( 10039 "DELETE FROM adm_set_templ_hide_tab WHERE template_id = %s AND tab_id = %s", 10040 array('integer', 'text'), 10041 array($row['template_id'], $row['tab_id']) 10042 ); 10043 10044 $ilDB->manipulate( 10045 "INSERT INTO adm_set_templ_hide_tab (template_id, tab_id)" . 10046 " VALUES (" . 10047 $ilDB->quote($row['template_id'], "integer") . 10048 ", " . $ilDB->quote($row['tab_id'], "text") . 10049 ")" 10050 ); 10051 } 10052} 10053?> 10054<#4700> 10055<?php 10056//step 2/2 adm_set_templ_hide_tab add primary 10057if ($ilDB->tableExists('adm_set_templ_hide_tab')) { 10058 $ilDB->addPrimaryKey('adm_set_templ_hide_tab', array('template_id','tab_id')); 10059} 10060?> 10061<#4701> 10062<?php 10063//step 1/4 adm_set_templ_value search for dublicates and store it in adm_set_tpl_val_tmp 10064 10065if ($ilDB->tableExists('adm_set_templ_value')) { 10066 $res = $ilDB->query(" 10067 SELECT first.template_id template_id, first.setting setting 10068 FROM adm_set_templ_value first 10069 WHERE EXISTS ( 10070 SELECT second.template_id, second.setting 10071 FROM adm_set_templ_value second 10072 WHERE first.template_id = second.template_id AND first.setting = second.setting 10073 GROUP BY second.template_id, second.setting 10074 HAVING COUNT(second.template_id) > 1 10075 ) 10076 GROUP BY first.template_id, first.setting 10077 "); 10078 10079 if ($ilDB->numRows($res)) { 10080 if (!$ilDB->tableExists('adm_set_tpl_val_tmp')) { 10081 $ilDB->createTable('adm_set_tpl_val_tmp', array( 10082 'template_id' => array( 10083 'type' => 'integer', 10084 'length' => 8, 10085 'notnull' => true, 10086 'default' => 0 10087 ), 10088 'setting' => array( 10089 'type' => 'text', 10090 'length' => 40, 10091 'notnull' => true, 10092 'default' => 0 10093 ) 10094 )); 10095 $ilDB->addPrimaryKey('adm_set_tpl_val_tmp', array('template_id','setting')); 10096 } 10097 10098 while ($row = $ilDB->fetchAssoc($res)) { 10099 $ilDB->replace('adm_set_tpl_val_tmp', array(), array( 10100 'template_id' => array('integer', $row['template_id']), 10101 'setting' => array('text', $row['setting']) 10102 )); 10103 } 10104 } 10105} 10106?> 10107<#4702> 10108<?php 10109//step 2/4 adm_set_templ_value deletes dublicates stored in adm_set_tpl_val_tmp 10110 10111if ($ilDB->tableExists('adm_set_tpl_val_tmp')) { 10112 $res = $ilDB->query(" 10113 SELECT template_id, setting 10114 FROM adm_set_tpl_val_tmp 10115 "); 10116 10117 while ($row = $ilDB->fetchAssoc($res)) { 10118 $res_data = $ilDB->query( 10119 " 10120 SELECT * 10121 FROM adm_set_templ_value 10122 WHERE 10123 template_id = " . $ilDB->quote($row['template_id'], 'integer') . " AND 10124 setting = " . $ilDB->quote($row['setting'], 'text') 10125 ); 10126 $data = $ilDB->fetchAssoc($res_data); 10127 10128 $ilDB->manipulate( 10129 "DELETE FROM adm_set_templ_value WHERE" . 10130 " template_id = " . $ilDB->quote($row['template_id'], 'integer') . 10131 " AND setting = " . $ilDB->quote($row['setting'], 'text') 10132 ); 10133 10134 $ilDB->manipulate("INSERT INTO adm_set_templ_value (template_id,setting,value,hide) " . 10135 "VALUES ( " . 10136 $ilDB->quote($data['template_id'], 'integer') . ', ' . 10137 $ilDB->quote($data['setting'], 'text') . ', ' . 10138 $ilDB->quote($data['value'], 'text') . ', ' . 10139 $ilDB->quote($data['hide'], 'integer') . 10140 ")"); 10141 10142 $ilDB->manipulate( 10143 "DELETE FROM adm_set_tpl_val_tmp WHERE" . 10144 " template_id = " . $ilDB->quote($row['template_id'], 'integer') . 10145 " AND setting = " . $ilDB->quote($row['setting'], 'text') 10146 ); 10147 } 10148} 10149?> 10150<#4703> 10151<?php 10152//step 3/4 adm_set_templ_value drop adm_set_tpl_val_tmp 10153 10154if ($ilDB->tableExists('adm_set_tpl_val_tmp')) { 10155 $ilDB->dropTable('adm_set_tpl_val_tmp'); 10156} 10157?> 10158<#4704> 10159<?php 10160//step 4/4 adm_set_templ_value adding primary keys 10161 10162if ($ilDB->tableExists('adm_set_templ_value')) { 10163 $ilDB->addPrimaryKey('adm_set_templ_value', array('template_id', 'setting')); 10164} 10165?> 10166<#4705> 10167<?php 10168//step 1/4 svy_times renames old table 10169 10170if ($ilDB->tableExists('svy_times') && !$ilDB->tableExists('svy_times_old')) { 10171 $ilDB->renameTable("svy_times", "svy_times_old"); 10172} 10173?> 10174<#4706> 10175<?php 10176//step 2/4 svy_times creates new table with unique id, sequenz and index 10177 10178if (!$ilDB->tableExists('svy_times')) { 10179 $ilDB->createTable('svy_times', array( 10180 'id' => array( 10181 'type' => 'integer', 10182 'length' => 4, 10183 'notnull' => true 10184 ), 10185 'finished_fi' => array( 10186 'type' => 'integer', 10187 'length' => 4, 10188 'notnull' => true 10189 ), 10190 'entered_page' => array( 10191 'type' => 'integer', 10192 'length' => 4, 10193 ), 10194 'left_page' => array( 10195 'type' => 'integer', 10196 'length' => 4, 10197 ), 10198 'first_question' => array( 10199 'type' => 'integer', 10200 'length' => 4, 10201 ) 10202 )); 10203 $ilDB->addPrimaryKey('svy_times', array('id')); 10204 $ilDB->addIndex('svy_times', array('finished_fi'), 'i1'); 10205 $ilDB->createSequence('svy_times'); 10206} 10207?> 10208<#4707> 10209<?php 10210//step 3/4 svy_times moves all data to new table 10211 10212if ($ilDB->tableExists('svy_times') && $ilDB->tableExists('svy_times_old')) { 10213 $res = $ilDB->query(" 10214 SELECT * 10215 FROM svy_times_old 10216 "); 10217 10218 while ($row = $ilDB->fetchAssoc($res)) { 10219 $id = $ilDB->nextId('svy_times'); 10220 10221 $ilDB->manipulate( 10222 "INSERT INTO svy_times (id, finished_fi, entered_page, left_page, first_question)" . 10223 " VALUES (" . 10224 $ilDB->quote($id, "integer") . 10225 "," . $ilDB->quote($row['finished_fi'], "integer") . 10226 "," . $ilDB->quote($row['entered_page'], "integer") . 10227 "," . $ilDB->quote($row['left_page'], "integer") . 10228 "," . $ilDB->quote($row['first_question'], "integer") . 10229 ")" 10230 ); 10231 10232 $ilDB->manipulateF( 10233 "DELETE FROM svy_times_old WHERE finished_fi = %s AND entered_page = %s AND left_page = %s AND first_question = %s", 10234 array('integer', 'integer', 'integer', 'integer'), 10235 array($row['finished_fi'], $row['entered_page'], $row['left_page'], $row['first_question']) 10236 ); 10237 } 10238} 10239?> 10240<#4708> 10241<?php 10242//step 4/4 svy_times removes old table 10243 10244if ($ilDB->tableExists('svy_times_old')) { 10245 $ilDB->dropTable('svy_times_old'); 10246} 10247?> 10248 10249<#4709> 10250<?php 10251 10252if (!$ilDB->tableColumnExists("ldap_server_settings", "username_filter")) { 10253 $ilDB->addTableColumn("ldap_server_settings", "username_filter", array( 10254 'type' => 'text', 10255 'length' => 255, 10256 )); 10257} 10258?> 10259<#4710> 10260<?php 10261$query = "SELECT max(server_id) id FROM ldap_server_settings"; 10262$res = $ilDB->query($query); 10263$set = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT); 10264 10265if (!$set->id) { 10266 $set->id = 1; 10267} 10268 10269$query = "UPDATE ldap_role_assignments " . 10270 "SET server_id = " . $set->id . 10271 " WHERE server_id = 0"; 10272$ilDB->manipulate($query); 10273 10274?> 10275<#4711> 10276<?php 10277if (!$ilDB->tableColumnExists('usr_search', 'creation_filter')) { 10278 $ilDB->addTableColumn("usr_search", "creation_filter", array( 10279 "type" => "text", 10280 "notnull" => false, 10281 "length" => 1000, 10282 "fixed" => false)); 10283} 10284?> 10285<#4712> 10286<?php 10287$ilCtrlStructureReader->getStructure(); 10288?> 10289 10290<#4713> 10291<?php 10292 // register new object type 'logs' for Logging administration 10293 $id = $ilDB->nextId("object_data"); 10294 $ilDB->manipulateF( 10295 "INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 10296 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 10297 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 10298 array($id, "typ", "logs", "Logging Administration", -1, ilUtil::now(), ilUtil::now()) 10299 ); 10300 $typ_id = $id; 10301 10302 // create object data entry 10303 $id = $ilDB->nextId("object_data"); 10304 $ilDB->manipulateF( 10305 "INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 10306 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 10307 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 10308 array($id, "logs", "__LoggingSettings", "Logging Administration", -1, ilUtil::now(), ilUtil::now()) 10309 ); 10310 10311 // create object reference entry 10312 $ref_id = $ilDB->nextId('object_reference'); 10313 $res = $ilDB->manipulateF( 10314 "INSERT INTO object_reference (ref_id, obj_id) VALUES (%s, %s)", 10315 array("integer", "integer"), 10316 array($ref_id, $id) 10317 ); 10318 10319 // put in tree 10320 $tree = new ilTree(ROOT_FOLDER_ID); 10321 $tree->insertNode($ref_id, SYSTEM_FOLDER_ID); 10322 10323 // add rbac operations 10324 // 1: edit_permissions, 2: visible, 3: read, 4:write 10325 $ilDB->manipulateF( 10326 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 10327 array("integer", "integer"), 10328 array($typ_id, 1) 10329 ); 10330 $ilDB->manipulateF( 10331 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 10332 array("integer", "integer"), 10333 array($typ_id, 2) 10334 ); 10335 $ilDB->manipulateF( 10336 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 10337 array("integer", "integer"), 10338 array($typ_id, 3) 10339 ); 10340 $ilDB->manipulateF( 10341 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 10342 array("integer", "integer"), 10343 array($typ_id, 4) 10344 ); 10345 10346 10347?> 10348<#4714> 10349<?php 10350 $ilCtrlStructureReader->getStructure(); 10351?> 10352 10353<#4715> 10354<?php 10355 10356 if (!$ilDB->tableExists('log_components')) { 10357 $ilDB->createTable('log_components', array( 10358 'component_id' => array( 10359 'type' => 'text', 10360 'length' => 20, 10361 'notnull' => false 10362 ), 10363 'log_level' => array( 10364 'type' => 'integer', 10365 'length' => 4, 10366 'notnull' => false, 10367 'default' => null 10368 ) 10369 )); 10370 10371 $ilDB->addPrimaryKey('log_components', array('component_id')); 10372 } 10373?> 10374<#4716> 10375<?php 10376 $ilCtrlStructureReader->getStructure(); 10377?> 10378<#4717> 10379<?php 10380 $ilCtrlStructureReader->getStructure(); 10381?> 10382<#4718> 10383<?php 10384$ilCtrlStructureReader->getStructure(); 10385?> 10386<#4719> 10387<?php 10388 10389$res = $ilDB->queryF( 10390 "SELECT COUNT(*) cnt FROM qpl_qst_type WHERE type_tag = %s", 10391 array('text'), 10392 array('assLongMenu') 10393); 10394 10395$row = $ilDB->fetchAssoc($res); 10396 10397if (!$row['cnt']) { 10398 $res = $ilDB->query("SELECT MAX(question_type_id) maxid FROM qpl_qst_type"); 10399 $data = $ilDB->fetchAssoc($res); 10400 $nextId = $data['maxid'] + 1; 10401 10402 $ilDB->insert('qpl_qst_type', array( 10403 'question_type_id' => array('integer', $nextId), 10404 'type_tag' => array('text', 'assLongMenu'), 10405 'plugin' => array('integer', 0) 10406 )); 10407} 10408 10409?> 10410<#4720> 10411<?php 10412if (!$ilDB->tableExists('qpl_qst_lome')) { 10413 $ilDB->createTable('qpl_qst_lome', array( 10414 'question_fi' => array( 10415 'type' => 'integer', 10416 'length' => 4, 10417 'notnull' => true, 10418 'default' => 0 10419 ), 10420 'shuffle_answers' => array( 10421 'type' => 'integer', 10422 'length' => 1, 10423 'notnull' => true, 10424 'default' => 0 10425 ), 10426 'answer_type' => array( 10427 'type' => 'text', 10428 'length' => 16, 10429 'notnull' => true, 10430 'default' => 'singleLine' 10431 ), 10432 'feedback_setting' => array( 10433 'type' => 'integer', 10434 'length' => 4, 10435 'notnull' => true, 10436 'default' => 1 10437 ), 10438 'long_menu_text' => array( 10439 "type" => "clob", 10440 "notnull" => false, 10441 "default" => null 10442 ) 10443 )); 10444 10445 $ilDB->addPrimaryKey('qpl_qst_lome', array('question_fi')); 10446} 10447?> 10448<#4721> 10449<?php 10450if (!$ilDB->tableExists('qpl_a_lome')) { 10451 $ilDB->createTable('qpl_a_lome', array( 10452 'question_fi' => array( 10453 'type' => 'integer', 10454 'length' => 4, 10455 'notnull' => true, 10456 'default' => 0 10457 ), 10458 'gap_number' => array( 10459 'type' => 'integer', 10460 'length' => 4, 10461 'notnull' => true, 10462 'default' => 0 10463 ), 10464 'position' => array( 10465 'type' => 'integer', 10466 'length' => 4, 10467 'notnull' => true, 10468 'default' => 0 10469 ), 10470 'answer_text' => array( 10471 'type' => 'text', 10472 'length' => 1000 10473 ), 10474 'points' => array( 10475 'type' => 'float' 10476 ), 10477 'type' => array( 10478 'type' => 'integer', 10479 'length' => 4 10480 ) 10481 )); 10482 $ilDB->addPrimaryKey('qpl_a_lome', array('question_fi', 'gap_number', 'position')); 10483} 10484?> 10485<#4722> 10486<?php 10487$ilCtrlStructureReader->getStructure(); 10488?> 10489 10490<#4723> 10491<?php 10492 10493 $query = 'SELECT child FROM tree group by child having count(child) > 1'; 10494 $res = $ilDB->query($query); 10495 10496 $found_dup = false; 10497 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 10498 $found_dup = true; 10499 } 10500 10501 if (!$found_dup) { 10502 $ilDB->addPrimaryKey('tree', array('child')); 10503 } else { 10504 $ilSetting = new ilSetting(); 10505 $is_read = $ilSetting->get('tree_dups', 0); 10506 10507 if (!$is_read) { 10508 $ilSetting->set('tree_dups', 1); 10509 setup_exit(" 10510 10511 Dear Administrator, 10512 10513 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 10514 10515 The update process has been stopped due to an invalid data structure of the repository tree. 10516 Duplicates have been detected in your installation. 10517 10518 You can continue with the update process. 10519 But you should perform a system check and repair the tree structure in \"Adminstration -> Systemcheck -> Tree\" 10520 10521 Best regards, 10522 The Tree Maintainer 10523 "); 10524 } 10525 } 10526?> 10527<#4724> 10528<?php 10529//step 1/4 usr_data_multi renames old table 10530 10531if ($ilDB->tableExists('usr_data_multi') && !$ilDB->tableExists('usr_data_multi_old')) { 10532 $ilDB->renameTable("usr_data_multi", "usr_data_multi_old"); 10533} 10534?> 10535<#4725> 10536<?php 10537//step 2/4 usr_data_multi creates new table with unique id, sequenz and index 10538 10539if (!$ilDB->tableExists('usr_data_multi')) { 10540 $ilDB->createTable('usr_data_multi', array( 10541 'id' => array( 10542 'type' => 'integer', 10543 'length' => 4, 10544 'notnull' => true 10545 ), 10546 'usr_id' => array( 10547 'type' => 'integer', 10548 'length' => 4, 10549 'notnull' => true 10550 ), 10551 'field_id' => array( 10552 'type' => 'text', 10553 'length' => 255, 10554 'notnull' => true 10555 ), 10556 'value' => array( 10557 'type' => 'text', 10558 'length' => 1000, 10559 'default' => '' 10560 ) 10561 )); 10562 $ilDB->addPrimaryKey('usr_data_multi', array('id')); 10563 $ilDB->addIndex('usr_data_multi', array('usr_id'), 'i1'); 10564 $ilDB->createSequence('usr_data_multi'); 10565} 10566?> 10567<#4726> 10568<?php 10569//step 3/4 usr_data_multi moves all data to new table 10570 10571if ($ilDB->tableExists('usr_data_multi') && $ilDB->tableExists('usr_data_multi_old')) { 10572 $res = $ilDB->query(" 10573 SELECT * 10574 FROM usr_data_multi_old 10575 "); 10576 10577 while ($row = $ilDB->fetchAssoc($res)) { 10578 $id = $ilDB->nextId('usr_data_multi'); 10579 10580 $ilDB->manipulate( 10581 "INSERT INTO usr_data_multi (id, usr_id, field_id, value)" . 10582 " VALUES (" . 10583 $ilDB->quote($id, "integer") . 10584 "," . $ilDB->quote($row['usr_id'], "integer") . 10585 "," . $ilDB->quote($row['field_id'], "text") . 10586 "," . $ilDB->quote($row['value'], "text") . 10587 ")" 10588 ); 10589 10590 $ilDB->manipulateF( 10591 "DELETE FROM usr_data_multi_old WHERE usr_id = %s AND field_id = %s AND value = %s", 10592 array('integer', 'text', 'text'), 10593 array($row['usr_id'], $row['field_id'], $row['value']) 10594 ); 10595 } 10596} 10597?> 10598<#4727> 10599<?php 10600//step 4/4 usr_data_multi removes old table 10601 10602if ($ilDB->tableExists('usr_data_multi_old')) { 10603 $ilDB->dropTable('usr_data_multi_old'); 10604} 10605?> 10606<#4728> 10607<?php 10608//step 1/4 xmlnestedset renames old table 10609 10610if ($ilDB->tableExists('xmlnestedset') && !$ilDB->tableExists('xmlnestedset_old')) { 10611 $ilDB->renameTable("xmlnestedset", "xmlnestedset_old"); 10612} 10613?> 10614<#4729> 10615<?php 10616//step 2/4 xmlnestedset creates new table with unique id and sequenz 10617 10618if (!$ilDB->tableExists('xmlnestedset')) { 10619 $ilDB->createTable( 10620 "xmlnestedset", 10621 array( 10622 "ns_id" => array( 10623 "type" => "integer", 10624 "length" => 4, 10625 "notnull" => true 10626 ), 10627 "ns_book_fk" => array( 10628 "type" => "integer", 10629 "length" => 4, 10630 "notnull" => true 10631 ), 10632 "ns_type" => array( 10633 "type" => "text", 10634 "length" => 50, 10635 "notnull" => true 10636 ), 10637 "ns_tag_fk" => array( 10638 "type" => "integer", 10639 "length" => 4, 10640 "notnull" => true 10641 ), 10642 "ns_l" => array( 10643 "type" => "integer", 10644 "length" => 4, 10645 "notnull" => true 10646 ), 10647 "ns_r" => array( 10648 "type" => "integer", 10649 "length" => 4, 10650 "notnull" => true 10651 ) 10652 ) 10653 ); 10654 $ilDB->addIndex("xmlnestedset", array("ns_tag_fk"), 'i1'); 10655 $ilDB->addIndex("xmlnestedset", array("ns_l"), 'i2'); 10656 $ilDB->addIndex("xmlnestedset", array("ns_r"), 'i3'); 10657 $ilDB->addIndex("xmlnestedset", array("ns_book_fk"), 'i4'); 10658 $ilDB->addPrimaryKey('xmlnestedset', array('ns_id')); 10659 $ilDB->createSequence('xmlnestedset'); 10660} 10661?> 10662<#4730> 10663<?php 10664//step 3/4 xmlnestedset moves all data to new table 10665 10666if ($ilDB->tableExists('xmlnestedset') && $ilDB->tableExists('xmlnestedset_old')) { 10667 $res = $ilDB->query(" 10668 SELECT * 10669 FROM xmlnestedset_old 10670 "); 10671 10672 while ($row = $ilDB->fetchAssoc($res)) { 10673 $id = $ilDB->nextId('xmlnestedset'); 10674 10675 $ilDB->manipulate( 10676 "INSERT INTO xmlnestedset (ns_id, ns_book_fk, ns_type, ns_tag_fk, ns_l, ns_r)" . 10677 " VALUES (" . 10678 $ilDB->quote($id, "integer") . 10679 "," . $ilDB->quote($row['ns_book_fk'], "integer") . 10680 "," . $ilDB->quote($row['ns_type'], "text") . 10681 "," . $ilDB->quote($row['ns_tag_fk'], "integer") . 10682 "," . $ilDB->quote($row['ns_l'], "integer") . 10683 "," . $ilDB->quote($row['ns_r'], "integer") . 10684 ")" 10685 ); 10686 10687 $ilDB->manipulateF( 10688 "DELETE FROM xmlnestedset_old WHERE ns_book_fk = %s AND ns_type = %s AND ns_tag_fk = %s AND ns_l = %s AND ns_r = %s", 10689 array('integer', 'text', 'integer', 'integer', 'integer'), 10690 array($row['ns_book_fk'], $row['ns_type'], $row['ns_tag_fk'], $row['ns_l'], $row['ns_r']) 10691 ); 10692 } 10693} 10694?> 10695<#4731> 10696<?php 10697//step 4/4 xmlnestedset removes old table 10698 10699if ($ilDB->tableExists('xmlnestedset_old')) { 10700 $ilDB->dropTable('xmlnestedset_old'); 10701} 10702?> 10703<#4732> 10704<?php 10705//step 1/4 xmlnestedsettmp renames old table 10706 10707if ($ilDB->tableExists('xmlnestedsettmp') && !$ilDB->tableExists('xmlnestedsettmp_old')) { 10708 $ilDB->renameTable("xmlnestedsettmp", "xmlnestedsettmp_old"); 10709} 10710?> 10711<#4733> 10712<?php 10713//step 2/4 xmlnestedsettmp creates new table with unique id and sequenz 10714 10715if (!$ilDB->tableExists('xmlnestedsettmp')) { 10716 $ilDB->createTable( 10717 "xmlnestedsettmp", 10718 array( 10719 "ns_id" => array( 10720 "type" => "integer", 10721 "length" => 4, 10722 "notnull" => true 10723 ), 10724 "ns_unique_id" => array(// text because maybe we have to store a session_id in future e.g. 10725 "type" => "text", 10726 "length" => 32, 10727 "notnull" => true 10728 ), 10729 "ns_book_fk" => array( 10730 "type" => "integer", 10731 "length" => 4, 10732 "notnull" => true 10733 ), 10734 "ns_type" => array( 10735 "type" => "text", 10736 "length" => 50, 10737 "notnull" => true 10738 ), 10739 "ns_tag_fk" => array( 10740 "type" => "integer", 10741 "length" => 4, 10742 "notnull" => true 10743 ), 10744 "ns_l" => array( 10745 "type" => "integer", 10746 "length" => 4, 10747 "notnull" => true 10748 ), 10749 "ns_r" => array( 10750 "type" => "integer", 10751 "length" => 4, 10752 "notnull" => true 10753 ) 10754 ) 10755 ); 10756 $ilDB->addIndex("xmlnestedsettmp", array("ns_tag_fk"), 'i1'); 10757 $ilDB->addIndex("xmlnestedsettmp", array("ns_l"), 'i2'); 10758 $ilDB->addIndex("xmlnestedsettmp", array("ns_r"), 'i3'); 10759 $ilDB->addIndex("xmlnestedsettmp", array("ns_book_fk"), 'i4'); 10760 $ilDB->addIndex("xmlnestedsettmp", array("ns_unique_id"), 'i5'); 10761 $ilDB->addPrimaryKey('xmlnestedsettmp', array('ns_id')); 10762 $ilDB->createSequence('xmlnestedsettmp'); 10763} 10764?> 10765<#4734> 10766<?php 10767//step 3/4 xmlnestedsettmp moves all data to new table 10768 10769if ($ilDB->tableExists('xmlnestedsettmp') && $ilDB->tableExists('xmlnestedsettmp_old')) { 10770 $res = $ilDB->query(" 10771 SELECT * 10772 FROM xmlnestedsettmp_old 10773 "); 10774 10775 while ($row = $ilDB->fetchAssoc($res)) { 10776 $id = $ilDB->nextId('xmlnestedsettmp'); 10777 10778 $ilDB->manipulate( 10779 "INSERT INTO xmlnestedsettmp (ns_id, ns_unique_id, ns_book_fk, ns_type, ns_tag_fk, ns_l, ns_r)" . 10780 " VALUES (" . 10781 $ilDB->quote($id, "integer") . 10782 "," . $ilDB->quote($row['ns_unique_id'], "text") . 10783 "," . $ilDB->quote($row['ns_book_fk'], "integer") . 10784 "," . $ilDB->quote($row['ns_type'], "text") . 10785 "," . $ilDB->quote($row['ns_tag_fk'], "integer") . 10786 "," . $ilDB->quote($row['ns_l'], "integer") . 10787 "," . $ilDB->quote($row['ns_r'], "integer") . 10788 ")" 10789 ); 10790 10791 $ilDB->manipulateF( 10792 "DELETE FROM xmlnestedsettmp_old WHERE ns_unique_id = %s AND ns_book_fk = %s AND ns_type = %s AND ns_tag_fk = %s AND ns_l = %s AND ns_r = %s", 10793 array('text', 'integer', 'text', 'integer', 'integer', 'integer'), 10794 array($row['ns_unique_id'], $row['ns_book_fk'], $row['ns_type'], $row['ns_tag_fk'], $row['ns_l'], $row['ns_r']) 10795 ); 10796 } 10797} 10798?> 10799<#4735> 10800<?php 10801//step 4/4 xmlnestedset_tmp removes old table 10802 10803if ($ilDB->tableExists('xmlnestedsettmp_old')) { 10804 $ilDB->dropTable('xmlnestedsettmp_old'); 10805} 10806?> 10807<#4736> 10808<?php 10809//step 1/5 xmlparam search for dublicates and store it in xmlparam_tmp 10810 10811if ($ilDB->tableExists('xmlparam')) { 10812 $res = $ilDB->query(" 10813 SELECT first.tag_fk tag_fk, first.param_name param_name 10814 FROM xmlparam first 10815 WHERE EXISTS ( 10816 SELECT second.tag_fk, second.param_name 10817 FROM xmlparam second 10818 WHERE first.tag_fk = second.tag_fk AND first.param_name = second.param_name 10819 GROUP BY second.tag_fk, second.param_name 10820 HAVING COUNT(second.tag_fk) > 1 10821 ) 10822 GROUP BY first.tag_fk, first.param_name 10823 "); 10824 10825 if ($ilDB->numRows($res)) { 10826 if (!$ilDB->tableExists('xmlparam_tmp')) { 10827 $ilDB->createTable('xmlparam_tmp', array( 10828 'tag_fk' => array( 10829 'type' => 'integer', 10830 'length' => 4, 10831 'notnull' => true, 10832 'default' => 0 10833 ), 10834 'param_name' => array( 10835 'type' => 'text', 10836 'length' => 50, 10837 'notnull' => true, 10838 'default' => 0 10839 ) 10840 )); 10841 $ilDB->addPrimaryKey('xmlparam_tmp', array('tag_fk','param_name')); 10842 } 10843 10844 while ($row = $ilDB->fetchAssoc($res)) { 10845 $ilDB->replace('xmlparam_tmp', array(), array( 10846 'tag_fk' => array('integer', $row['tag_fk']), 10847 'param_name' => array('text', $row['param_name']) 10848 )); 10849 } 10850 } 10851} 10852?> 10853<#4737> 10854<?php 10855//step 2/5 xmlparam deletes dublicates stored in xmlparam_tmp 10856 10857if ($ilDB->tableExists('xmlparam_tmp')) { 10858 $res = $ilDB->query(" 10859 SELECT tag_fk, param_name 10860 FROM xmlparam_tmp 10861 "); 10862 10863 while ($row = $ilDB->fetchAssoc($res)) { 10864 $res_data = $ilDB->query( 10865 " 10866 SELECT * 10867 FROM xmlparam 10868 WHERE 10869 tag_fk = " . $ilDB->quote($row['tag_fk'], 'integer') . " AND 10870 param_name = " . $ilDB->quote($row['param_name'], 'text') 10871 ); 10872 $data = $ilDB->fetchAssoc($res_data); 10873 10874 $ilDB->manipulate( 10875 "DELETE FROM xmlparam WHERE" . 10876 " tag_fk = " . $ilDB->quote($row['tag_fk'], 'integer') . 10877 " AND param_name = " . $ilDB->quote($row['param_name'], 'text') 10878 ); 10879 10880 $ilDB->manipulate("INSERT INTO xmlparam (tag_fk,param_name,param_value) " . 10881 "VALUES ( " . 10882 $ilDB->quote($data['tag_fk'], 'integer') . ', ' . 10883 $ilDB->quote($data['param_name'], 'text') . ', ' . 10884 $ilDB->quote($data['param_value'], 'text') . 10885 ")"); 10886 10887 $ilDB->manipulate( 10888 "DELETE FROM xmlparam_tmp WHERE" . 10889 " tag_fk = " . $ilDB->quote($row['tag_fk'], 'integer') . 10890 " AND param_name = " . $ilDB->quote($row['param_name'], 'text') 10891 ); 10892 } 10893} 10894?> 10895<#4738> 10896<?php 10897//step 3/5 xmlparam drop xmlparam_tmp 10898 10899if ($ilDB->tableExists('xmlparam_tmp')) { 10900 $ilDB->dropTable('xmlparam_tmp'); 10901} 10902?> 10903<#4739> 10904<?php 10905//step 4/5 xmlparam drops not used indexes 10906 10907if ($ilDB->indexExistsByFields('xmlparam', array('tag_fk'))) { 10908 $ilDB->dropIndexByFields('xmlparam', array('tag_fk')); 10909} 10910?> 10911<#4740> 10912<?php 10913//step 5/5 xmlparam adding primary keys 10914 10915if ($ilDB->tableExists('xmlparam')) { 10916 $ilDB->addPrimaryKey('xmlparam', array('tag_fk', 'param_name')); 10917} 10918?> 10919<#4741> 10920<?php 10921//step 1/1 tree_workspace adding primary key 10922 10923if ($ilDB->tableExists('tree_workspace')) { 10924 if ($ilDB->indexExistsByFields('tree_workspace', array('child'))) { 10925 $ilDB->dropIndexByFields('tree_workspace', array('child')); 10926 } 10927 10928 $ilDB->addPrimaryKey('tree_workspace', array('child')); 10929} 10930?> 10931<#4742> 10932<?php 10933if (!$ilDB->tableColumnExists('tst_active', 'last_pmode')) { 10934 $ilDB->addTableColumn('tst_active', 'last_pmode', array( 10935 'type' => 'text', 10936 'length' => 16, 10937 'notnull' => false, 10938 'default' => null 10939 )); 10940} 10941?> 10942<#4743> 10943<?php 10944if (!$ilDB->tableColumnExists('tst_solutions', 'authorized')) { 10945 $ilDB->addTableColumn('tst_solutions', 'authorized', array( 10946 'type' => 'integer', 10947 'length' => 1, 10948 'notnull' => false, 10949 'default' => 1 10950 )); 10951 10952 $ilDB->queryF("UPDATE tst_solutions SET authorized = %s", array('integer'), array(1)); 10953} 10954?> 10955<#4744> 10956<?php 10957if ($ilDB->tableColumnExists('tst_dyn_quest_set_cfg', 'prev_quest_list_enabled')) { 10958 $ilDB->dropTableColumn('tst_dyn_quest_set_cfg', 'prev_quest_list_enabled'); 10959} 10960?> 10961<#4745> 10962<?php 10963if (!$ilDB->tableColumnExists('tst_tests', 'force_inst_fb')) { 10964 $ilDB->addTableColumn('tst_tests', 'force_inst_fb', array( 10965 'type' => 'integer', 10966 'length' => 1, 10967 'notnull' => false, 10968 'default' => 0 10969 )); 10970} 10971?> 10972<#4746> 10973<?php 10974require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgramme.php"); 10975require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAssignment.php"); 10976require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeProgress.php"); 10977 10978//ilStudyProgramme::installDB(); 10979 10980$fields = array( 10981 'obj_id' => array( 10982 'type' => 'integer', 10983 'length' => '4', 10984 10985 ), 10986 'last_change' => array( 10987 'notnull' => '1', 10988 'type' => 'timestamp', 10989 10990 ), 10991 'subtype_id' => array( 10992 'notnull' => '1', 10993 'type' => 'integer', 10994 'length' => '4', 10995 10996 ), 10997 'points' => array( 10998 'notnull' => '1', 10999 'type' => 'integer', 11000 'length' => '4', 11001 11002 ), 11003 'lp_mode' => array( 11004 'notnull' => '1', 11005 'type' => 'integer', 11006 'length' => '1', 11007 11008 ), 11009 'status' => array( 11010 'notnull' => '1', 11011 'type' => 'integer', 11012 'length' => '1', 11013 11014 ), 11015 11016); 11017/** 11018 * @var $ilDB ilDB 11019 */ 11020if (!$ilDB->tableExists('prg_settings')) { 11021 $ilDB->createTable('prg_settings', $fields); 11022 $ilDB->addPrimaryKey('prg_settings', array( 'obj_id' )); 11023 if (!$ilDB->sequenceExists('prg_settings')) { 11024 $ilDB->createSequence('prg_settings'); 11025 } 11026} 11027 11028$fields = array( 11029 'id' => array( 11030 'type' => 'integer', 11031 'length' => '4', 11032 11033 ), 11034 'usr_id' => array( 11035 'notnull' => '1', 11036 'type' => 'integer', 11037 'length' => '4', 11038 11039 ), 11040 'root_prg_id' => array( 11041 'notnull' => '1', 11042 'type' => 'integer', 11043 'length' => '4', 11044 11045 ), 11046 'last_change' => array( 11047 'notnull' => '1', 11048 'type' => 'timestamp', 11049 11050 ), 11051 'last_change_by' => array( 11052 'notnull' => '1', 11053 'type' => 'integer', 11054 'length' => '4', 11055 11056 ), 11057 11058); 11059if (!$ilDB->tableExists('prg_usr_assignments')) { 11060 $ilDB->createTable('prg_usr_assignments', $fields); 11061 $ilDB->addPrimaryKey('prg_usr_assignments', array( 'id' )); 11062 11063 if (!$ilDB->sequenceExists('prg_usr_assignments')) { 11064 $ilDB->createSequence('prg_usr_assignments'); 11065 } 11066} 11067 11068 11069$fields = array( 11070 'id' => array( 11071 'type' => 'integer', 11072 'length' => '4', 11073 11074 ), 11075 'assignment_id' => array( 11076 'notnull' => '1', 11077 'type' => 'integer', 11078 'length' => '4', 11079 11080 ), 11081 'prg_id' => array( 11082 'notnull' => '1', 11083 'type' => 'integer', 11084 'length' => '4', 11085 11086 ), 11087 'usr_id' => array( 11088 'notnull' => '1', 11089 'type' => 'integer', 11090 'length' => '4', 11091 11092 ), 11093 'points' => array( 11094 'notnull' => '1', 11095 'type' => 'integer', 11096 'length' => '4', 11097 11098 ), 11099 'points_cur' => array( 11100 'notnull' => '1', 11101 'type' => 'integer', 11102 'length' => '4', 11103 11104 ), 11105 'status' => array( 11106 'notnull' => '1', 11107 'type' => 'integer', 11108 'length' => '1', 11109 11110 ), 11111 'completion_by' => array( 11112 'type' => 'integer', 11113 'length' => '4', 11114 11115 ), 11116 'last_change' => array( 11117 'notnull' => '1', 11118 'type' => 'timestamp', 11119 11120 ), 11121 'last_change_by' => array( 11122 'type' => 'integer', 11123 'length' => '4', 11124 11125 ), 11126 11127); 11128if (!$ilDB->tableExists('prg_usr_progress')) { 11129 $ilDB->createTable('prg_usr_progress', $fields); 11130 $ilDB->addPrimaryKey('prg_usr_progress', array( 'id' )); 11131 11132 if (!$ilDB->sequenceExists('prg_usr_progress')) { 11133 $ilDB->createSequence('prg_usr_progress'); 11134 } 11135} 11136 11137// Active Record does not support tuples as primary keys, so we have to 11138// set those on our own. 11139$ilDB->addUniqueConstraint( 11140 ilStudyProgrammeProgress::returnDbTableName(), 11141 array("assignment_id", "prg_id", "usr_id") 11142 ); 11143 11144// ActiveRecord seems to not interpret con_is_null correctly, so we have to set 11145// it manually. 11146$ilDB->modifyTableColumn( 11147 ilStudyProgrammeProgress::returnDbTableName(), 11148 "completion_by", 11149 array( "notnull" => false 11150 , "default" => null 11151 ) 11152 ); 11153$ilDB->modifyTableColumn( 11154 ilStudyProgrammeProgress::returnDbTableName(), 11155 "last_change_by", 11156 array( "notnull" => false 11157 , "default" => null 11158 ) 11159 ); 11160 11161require_once("./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php"); 11162$obj_type_id = ilDBUpdateNewObjectType::addNewType("prg", "StudyProgramme"); 11163$existing_ops = array("visible", "write", "copy", "delete", "edit_permission"); 11164foreach ($existing_ops as $op) { 11165 $op_id = ilDBUpdateNewObjectType::getCustomRBACOperationId($op); 11166 ilDBUpdateNewObjectType::addRBACOperation($obj_type_id, $op_id); 11167} 11168 11169require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAdvancedMetadataRecord.php"); 11170require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeType.php"); 11171require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeTypeTranslation.php"); 11172 11173$fields = array( 11174 'id' => array( 11175 'type' => 'integer', 11176 'length' => '4', 11177 11178 ), 11179 'type_id' => array( 11180 'type' => 'integer', 11181 'length' => '4', 11182 11183 ), 11184 'rec_id' => array( 11185 'type' => 'integer', 11186 'length' => '4', 11187 11188 ), 11189 11190); 11191if (!$ilDB->tableExists('prg_type_adv_md_rec')) { 11192 $ilDB->createTable('prg_type_adv_md_rec', $fields); 11193 $ilDB->addPrimaryKey('prg_type_adv_md_rec', array( 'id' )); 11194 11195 if (!$ilDB->sequenceExists('prg_type_adv_md_rec')) { 11196 $ilDB->createSequence('prg_type_adv_md_rec'); 11197 } 11198} 11199 11200$fields = array( 11201 'id' => array( 11202 'type' => 'integer', 11203 'length' => '4', 11204 11205 ), 11206 'default_lang' => array( 11207 'type' => 'text', 11208 'length' => '4', 11209 11210 ), 11211 'owner' => array( 11212 'type' => 'integer', 11213 'length' => '4', 11214 11215 ), 11216 'create_date' => array( 11217 'notnull' => '1', 11218 'type' => 'timestamp', 11219 11220 ), 11221 'last_update' => array( 11222 'type' => 'timestamp', 11223 11224 ), 11225 'icon' => array( 11226 'type' => 'text', 11227 'length' => '255', 11228 11229 ), 11230 11231); 11232if (!$ilDB->tableExists('prg_type')) { 11233 $ilDB->createTable('prg_type', $fields); 11234 $ilDB->addPrimaryKey('prg_type', array( 'id' )); 11235 11236 if (!$ilDB->sequenceExists('prg_type')) { 11237 $ilDB->createSequence('prg_type'); 11238 } 11239} 11240 11241$fields = array( 11242 'id' => array( 11243 'type' => 'integer', 11244 'length' => '4', 11245 11246 ), 11247 'prg_type_id' => array( 11248 'type' => 'integer', 11249 'length' => '4', 11250 11251 ), 11252 'lang' => array( 11253 'type' => 'text', 11254 'length' => '4', 11255 11256 ), 11257 'member' => array( 11258 'type' => 'text', 11259 'length' => '32', 11260 11261 ), 11262 'value' => array( 11263 'type' => 'text', 11264 'length' => '3500', 11265 11266 ), 11267 11268); 11269if (!$ilDB->tableExists('prg_translations')) { 11270 $ilDB->createTable('prg_translations', $fields); 11271 $ilDB->addPrimaryKey('prg_translations', array( 'id' )); 11272 11273 if (!$ilDB->sequenceExists('prg_translations')) { 11274 $ilDB->createSequence('prg_translations'); 11275 } 11276} 11277 11278 11279 11280?> 11281<#4747> 11282<?php 11283 11284include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 11285 11286// workaround to avoid error when using addAdminNode. Bug? 11287class EventHandler 11288{ 11289 public function raise($a_component, $a_event, $a_parameter = "") 11290 { 11291 // nothing to do... 11292 } 11293} 11294$GLOBALS['ilAppEventHandler'] = new EventHandler(); 11295 11296ilDBUpdateNewObjectType::addAdminNode('prgs', 'StudyProgrammeAdmin'); 11297 11298?> 11299<#4748> 11300<?php 11301 $ilCtrlStructureReader->getStructure(); 11302?> 11303<#4749> 11304<?php 11305if (!$ilDB->tableColumnExists("obj_members", "admin")) { 11306 $ilDB->addTableColumn( 11307 "obj_members", 11308 "admin", 11309 array( 11310 'type' => 'integer', 11311 'length' => 1, 11312 'notnull' => false, 11313 'default' => 0 11314 ) 11315 ); 11316} 11317if (!$ilDB->tableColumnExists("obj_members", "tutor")) { 11318 $ilDB->addTableColumn( 11319 "obj_members", 11320 "tutor", 11321 array( 11322 'type' => 'integer', 11323 'length' => 1, 11324 'notnull' => false, 11325 'default' => 0 11326 ) 11327 ); 11328} 11329if (!$ilDB->tableColumnExists("obj_members", "member")) { 11330 $ilDB->addTableColumn( 11331 "obj_members", 11332 "member", 11333 array( 11334 'type' => 'integer', 11335 'length' => 2, 11336 'notnull' => false, 11337 'default' => 0 11338 ) 11339 ); 11340} 11341?> 11342<#4750> 11343<?php 11344 $ilCtrlStructureReader->getStructure(); 11345?> 11346<#4751> 11347<?php 11348 $ilCtrlStructureReader->getStructure(); 11349?> 11350<#4752> 11351<?php 11352if (!$ilDB->sequenceExists('prg_settings')) { 11353 $ilDB->createSequence('prg_settings'); 11354} 11355if (!$ilDB->sequenceExists('prg_usr_assignments')) { 11356 $ilDB->createSequence('prg_usr_assignments'); 11357} 11358if (!$ilDB->sequenceExists('prg_usr_progress')) { 11359 $ilDB->createSequence('prg_usr_progress'); 11360} 11361if (!$ilDB->sequenceExists('prg_type_adv_md_rec')) { 11362 $ilDB->createSequence('prg_type_adv_md_rec'); 11363} 11364if (!$ilDB->sequenceExists('prg_type')) { 11365 $ilDB->createSequence('prg_type'); 11366} 11367if (!$ilDB->sequenceExists('prg_translations')) { 11368 $ilDB->createSequence('prg_translations'); 11369} 11370?> 11371<#4753> 11372<?php 11373include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 11374 11375$parent_types = array('root', 'cat', 'prg'); 11376ilDBUpdateNewObjectType::addRBACCreate('create_prg', 'Create Study Programme', $parent_types); 11377?> 11378<#4754> 11379<?php 11380$ilCtrlStructureReader->getStructure(); 11381?> 11382<#4755> 11383<?php 11384$ilDB->modifyTableColumn('il_wac_secure_path', 'path', array( 11385 'length' => 64, 11386)); 11387?> 11388<#4756> 11389<?php 11390$obj_type = 'icla'; 11391$set = $ilDB->queryF( 11392 "SELECT obj_id FROM object_data WHERE type = %s", 11393 array('text'), 11394 array($obj_type) 11395); 11396while ($row = $ilDB->fetchAssoc($set)) { 11397 $obj_id = $row['obj_id']; 11398 11399 $refset = $ilDB->queryF( 11400 "SELECT ref_id FROM object_reference WHERE obj_id = %s", 11401 array('integer'), 11402 array($obj_id) 11403 ); 11404 while ($refrow = $ilDB->fetchAssoc($refset)) { 11405 $ref_id = $refrow['ref_id']; 11406 11407 $ilDB->manipulate("DELETE FROM crs_items WHERE obj_id = " . $ilDB->quote($ref_id, 'integer')); 11408 $ilDB->manipulate("DELETE FROM crs_items WHERE parent_id = " . $ilDB->quote($ref_id, 'integer')); 11409 $ilDB->manipulate("DELETE FROM rbac_log WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11410 $ilDB->manipulate("DELETE FROM rbac_pa WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11411 $ilDB->manipulate("DELETE FROM desktop_item WHERE item_id = " . $ilDB->quote($ref_id, 'integer')); 11412 $ilDB->manipulate("DELETE FROM conditions WHERE target_ref_id = " . $ilDB->quote($ref_id, 'integer') . " OR trigger_ref_id = " . $ilDB->quote($ref_id, 'integer')); 11413 $ilDB->manipulate("DELETE FROM didactic_tpl_objs WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11414 // We know that all of these objects are leafs, so we can delete the records without determining the tree impl. and processing additional checks 11415 $ilDB->manipulate("DELETE FROM tree WHERE child = " . $ilDB->quote($ref_id, 'integer')); 11416 $ilDB->manipulate("DELETE FROM object_reference WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11417 11418 $GLOBALS['ilLog']->write(sprintf( 11419 "DB Step %s: Deleted object reference of type %s with ref_id %s.", 11420 $nr, 11421 $obj_type, 11422 $ref_id 11423 )); 11424 } 11425 11426 $ilDB->manipulate("DELETE FROM il_news_item WHERE context_obj_id = " . $ilDB->quote($obj_id, "integer") . " AND context_obj_type = " . $ilDB->quote($obj_type, "text")); 11427 $ilDB->manipulate("DELETE FROM il_block_setting WHERE block_id = " . $ilDB->quote($obj_id, "integer") . " AND type = " . $ilDB->quote("news", "text")); 11428 $ilDB->manipulate("DELETE FROM ut_lp_settings WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11429 $ilDB->manipulate("DELETE FROM ecs_import WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11430 $ilDB->manipulate("DELETE FROM dav_property WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11431 $ilDB->manipulate("DELETE FROM didactic_tpl_objs WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11432 $ilDB->manipulate("DELETE FROM object_description WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11433 $ilDB->manipulate("DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11434 11435 $GLOBALS['ilLog']->write(sprintf( 11436 "DB Step %s: Deleted object of type %s with obj_id %s.", 11437 $nr, 11438 $obj_type, 11439 $obj_id 11440 )); 11441} 11442?> 11443<#4757> 11444<?php 11445$obj_type = 'icrs'; 11446$set = $ilDB->queryF( 11447 "SELECT obj_id FROM object_data WHERE type = %s", 11448 array('text'), 11449 array($obj_type) 11450); 11451while ($row = $ilDB->fetchAssoc($set)) { 11452 $obj_id = $row['obj_id']; 11453 11454 $refset = $ilDB->queryF( 11455 "SELECT ref_id FROM object_reference WHERE obj_id = %s", 11456 array('integer'), 11457 array($obj_id) 11458 ); 11459 while ($refrow = $ilDB->fetchAssoc($refset)) { 11460 $ref_id = $refrow['ref_id']; 11461 11462 $ilDB->manipulate("DELETE FROM crs_items WHERE obj_id = " . $ilDB->quote($ref_id, 'integer')); 11463 $ilDB->manipulate("DELETE FROM crs_items WHERE parent_id = " . $ilDB->quote($ref_id, 'integer')); 11464 $ilDB->manipulate("DELETE FROM rbac_log WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11465 $ilDB->manipulate("DELETE FROM rbac_pa WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11466 $ilDB->manipulate("DELETE FROM desktop_item WHERE item_id = " . $ilDB->quote($ref_id, 'integer')); 11467 $ilDB->manipulate("DELETE FROM conditions WHERE target_ref_id = " . $ilDB->quote($ref_id, 'integer') . " OR trigger_ref_id = " . $ilDB->quote($ref_id, 'integer')); 11468 $ilDB->manipulate("DELETE FROM didactic_tpl_objs WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11469 // We know that all of these objects are leafs, so we can delete the records without determining the tree impl. and processing additional checks 11470 $ilDB->manipulate("DELETE FROM tree WHERE child = " . $ilDB->quote($ref_id, 'integer')); 11471 $ilDB->manipulate("DELETE FROM object_reference WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11472 11473 $GLOBALS['ilLog']->write(sprintf( 11474 "DB Step %s: Deleted object reference of type %s with ref_id %s.", 11475 $nr, 11476 $obj_type, 11477 $ref_id 11478 )); 11479 } 11480 11481 $ilDB->manipulate("DELETE FROM il_news_item WHERE context_obj_id = " . $ilDB->quote($obj_id, "integer") . " AND context_obj_type = " . $ilDB->quote($obj_type, "text")); 11482 $ilDB->manipulate("DELETE FROM il_block_setting WHERE block_id = " . $ilDB->quote($obj_id, "integer") . " AND type = " . $ilDB->quote("news", "text")); 11483 $ilDB->manipulate("DELETE FROM ut_lp_settings WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11484 $ilDB->manipulate("DELETE FROM ecs_import WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11485 $ilDB->manipulate("DELETE FROM dav_property WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11486 $ilDB->manipulate("DELETE FROM didactic_tpl_objs WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11487 $ilDB->manipulate("DELETE FROM object_description WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11488 $ilDB->manipulate("DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11489 11490 $GLOBALS['ilLog']->write(sprintf( 11491 "DB Step %s: Deleted object of type %s with obj_id %s.", 11492 $nr, 11493 $obj_type, 11494 $obj_id 11495 )); 11496} 11497?> 11498<#4758> 11499<?php 11500$a_type = 'icla'; 11501$set = $ilDB->queryF( 11502 "SELECT obj_id FROM object_data WHERE type = %s AND title = %s", 11503 array('text', 'text'), 11504 array('typ', $a_type) 11505); 11506$row = $ilDB->fetchAssoc($set); 11507$type_id = $row['obj_id']; 11508if ($type_id) { 11509 // RBAC 11510 11511 // basic operations 11512 $ilDB->manipulate("DELETE FROM rbac_ta WHERE typ_id = " . $ilDB->quote($type_id, "integer")); 11513 11514 // creation operation 11515 $set = $ilDB->query("SELECT ops_id" . 11516 " FROM rbac_operations " . 11517 " WHERE class = " . $ilDB->quote("create", "text") . 11518 " AND operation = " . $ilDB->quote("create_" . $a_type, "text")); 11519 $row = $ilDB->fetchAssoc($set); 11520 $create_ops_id = $row["ops_id"]; 11521 if ($create_ops_id) { 11522 $ilDB->manipulate("DELETE FROM rbac_templates WHERE ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11523 $GLOBALS['ilLog']->write(sprintf( 11524 "DB Step %s: Deleted rbac_templates create operation with ops_id %s for object type %s with obj_id %s.", 11525 $nr, 11526 $create_ops_id, 11527 $a_type, 11528 $type_id 11529 )); 11530 11531 // container create 11532 foreach (array("icrs") as $parent_type) { 11533 $pset = $ilDB->queryF( 11534 "SELECT obj_id FROM object_data WHERE type = %s AND title = %s", 11535 array('text', 'text'), 11536 array('typ', $parent_type) 11537 ); 11538 $prow = $ilDB->fetchAssoc($pset); 11539 $parent_type_id = $prow['obj_id']; 11540 if ($parent_type_id) { 11541 $ilDB->manipulate("DELETE FROM rbac_ta" . 11542 " WHERE typ_id = " . $ilDB->quote($parent_type_id, "integer") . 11543 " AND ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11544 } 11545 } 11546 11547 $ilDB->manipulate("DELETE FROM rbac_operations WHERE ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11548 $GLOBALS['ilLog']->write(sprintf( 11549 "DB Step %s: Deleted create operation with ops_id %s for object type %s with obj_id %s.", 11550 $nr, 11551 $create_ops_id, 11552 $a_type, 11553 $type_id 11554 )); 11555 } 11556 11557 // Type 11558 $ilDB->manipulate("DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($type_id, "integer")); 11559 $GLOBALS['ilLog']->write(sprintf( 11560 "DB Step %s: Deleted object type %s with obj_id %s.", 11561 $nr, 11562 $a_type, 11563 $type_id 11564 )); 11565} 11566 11567$set = new ilSetting(); 11568$set->delete("obj_dis_creation_" . $a_type); 11569$set->delete("obj_add_new_pos_" . $a_type); 11570$set->delete("obj_add_new_pos_grp_" . $a_type); 11571?> 11572<#4759> 11573<?php 11574$a_type = 'icrs'; 11575$set = $ilDB->queryF( 11576 "SELECT obj_id FROM object_data WHERE type = %s AND title = %s", 11577 array('text', 'text'), 11578 array('typ', $a_type) 11579); 11580$row = $ilDB->fetchAssoc($set); 11581$type_id = $row['obj_id']; 11582if ($type_id) { 11583 // RBAC 11584 11585 // basic operations 11586 $ilDB->manipulate("DELETE FROM rbac_ta WHERE typ_id = " . $ilDB->quote($type_id, "integer")); 11587 11588 // creation operation 11589 $set = $ilDB->query("SELECT ops_id" . 11590 " FROM rbac_operations " . 11591 " WHERE class = " . $ilDB->quote("create", "text") . 11592 " AND operation = " . $ilDB->quote("create_" . $a_type, "text")); 11593 $row = $ilDB->fetchAssoc($set); 11594 $create_ops_id = $row["ops_id"]; 11595 if ($create_ops_id) { 11596 $ilDB->manipulate("DELETE FROM rbac_templates WHERE ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11597 $GLOBALS['ilLog']->write(sprintf( 11598 "DB Step %s: Deleted rbac_templates create operation with ops_id %s for object type %s with obj_id %s.", 11599 $nr, 11600 $create_ops_id, 11601 $a_type, 11602 $type_id 11603 )); 11604 11605 // container create 11606 foreach (array("root", "cat", "crs", "grp", "fold") as $parent_type) { 11607 $pset = $ilDB->queryF( 11608 "SELECT obj_id FROM object_data WHERE type = %s AND title = %s", 11609 array('text', 'text'), 11610 array('typ', $parent_type) 11611 ); 11612 $prow = $ilDB->fetchAssoc($pset); 11613 $parent_type_id = $prow['obj_id']; 11614 if ($parent_type_id) { 11615 $ilDB->manipulate("DELETE FROM rbac_ta" . 11616 " WHERE typ_id = " . $ilDB->quote($parent_type_id, "integer") . 11617 " AND ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11618 } 11619 } 11620 11621 $ilDB->manipulate("DELETE FROM rbac_operations WHERE ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11622 $GLOBALS['ilLog']->write(sprintf( 11623 "DB Step %s: Deleted create operation with ops_id %s for object type %s with obj_id %s.", 11624 $nr, 11625 $create_ops_id, 11626 $a_type, 11627 $type_id 11628 )); 11629 } 11630 11631 // Type 11632 $ilDB->manipulate("DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($type_id, "integer")); 11633 $GLOBALS['ilLog']->write(sprintf( 11634 "DB Step %s: Deleted object type %s with obj_id %s.", 11635 $nr, 11636 $a_type, 11637 $type_id 11638 )); 11639} 11640 11641$set = new ilSetting(); 11642$set->delete("obj_dis_creation_" . $a_type); 11643$set->delete("obj_add_new_pos_" . $a_type); 11644$set->delete("obj_add_new_pos_grp_" . $a_type); 11645?> 11646<#4760> 11647<?php 11648$ilCtrlStructureReader->getStructure(); 11649?> 11650<#4761> 11651<?php 11652$mt_mod_incon_query_num = " 11653 SELECT COUNT(*) cnt 11654 FROM mail_obj_data 11655 INNER JOIN mail_tree ON mail_tree.child = mail_obj_data.obj_id 11656 WHERE mail_tree.tree != mail_obj_data.user_id 11657"; 11658$res = $ilDB->query($mt_mod_incon_query_num); 11659$data = $ilDB->fetchAssoc($res); 11660 11661if ($data['cnt'] > 0) { 11662 if (!$ilDB->tableExists('mail_tree_mod_migr')) { 11663 $ilDB->createTable('mail_tree_mod_migr', array( 11664 'usr_id' => array( 11665 'type' => 'integer', 11666 'length' => 4, 11667 'notnull' => true, 11668 'default' => 0 11669 ) 11670 )); 11671 $ilDB->addPrimaryKey('mail_tree_mod_migr', array('usr_id')); 11672 } 11673} 11674?> 11675<#4762> 11676<?php 11677if ($ilDB->tableExists('mail_tree_mod_migr')) { 11678 $db_step = $nr; 11679 11680 $ps_create_mtmig_rec = $ilDB->prepareManip( 11681 "INSERT INTO mail_tree_mod_migr (usr_id) VALUES(?)", 11682 array('integer') 11683 ); 11684 11685 // Important: Use the field "tree" (usr_id in table: tree) AND the "user_id" (table: mail_obj_data) 11686 $mt_mod_incon_query = " 11687 SELECT DISTINCT(mail_tree.tree) 11688 FROM mail_obj_data 11689 INNER JOIN mail_tree ON mail_tree.child = mail_obj_data.obj_id 11690 LEFT JOIN mail_tree_mod_migr ON mail_tree_mod_migr.usr_id = mail_tree.tree 11691 WHERE mail_tree.tree != mail_obj_data.user_id AND mail_tree_mod_migr.usr_id IS NULL 11692 "; 11693 $res = $ilDB->query($mt_mod_incon_query); 11694 while ($row = $ilDB->fetchAssoc($res)) { 11695 $ilDB->execute($ps_create_mtmig_rec, array($row['tree'])); 11696 11697 $GLOBALS['ilLog']->write(sprintf( 11698 "DB Step %s: Detected wrong child in table 'mail_tree' for user (field: tree) %s .", 11699 $db_step, 11700 $row['tree'] 11701 )); 11702 } 11703 11704 $mt_mod_incon_query = " 11705 SELECT DISTINCT(mail_obj_data.user_id) 11706 FROM mail_obj_data 11707 INNER JOIN mail_tree ON mail_tree.child = mail_obj_data.obj_id 11708 LEFT JOIN mail_tree_mod_migr ON mail_tree_mod_migr.usr_id = mail_obj_data.user_id 11709 WHERE mail_tree.tree != mail_obj_data.user_id AND mail_tree_mod_migr.usr_id IS NULL 11710 "; 11711 $res = $ilDB->query($mt_mod_incon_query); 11712 while ($row = $ilDB->fetchAssoc($res)) { 11713 $ilDB->execute($ps_create_mtmig_rec, array($row['user_id'])); 11714 11715 $GLOBALS['ilLog']->write(sprintf( 11716 "DB Step %s: Detected missing child in table 'mail_tree' for user (field: tree) %s .", 11717 $db_step, 11718 $row['user_id'] 11719 )); 11720 } 11721} 11722?> 11723<#4763> 11724<?php 11725if ($ilDB->tableExists('mail_tree_mod_migr')) { 11726 $db_step = $nr; 11727 11728 $ps_del_tree_entries = $ilDB->prepareManip( 11729 "DELETE FROM mail_tree WHERE tree = ?", 11730 array('integer') 11731 ); 11732 11733 $ps_sel_fold_entries = $ilDB->prepare( 11734 "SELECT obj_id, title, m_type FROM mail_obj_data WHERE user_id = ?", 11735 array('integer') 11736 ); 11737 11738 $default_folders_title_to_type_map = array( 11739 'a_root' => 'root', 11740 'b_inbox' => 'inbox', 11741 'c_trash' => 'trash', 11742 'd_drafts' => 'drafts', 11743 'e_sent' => 'sent', 11744 'z_local' => 'local' 11745 ); 11746 $default_folder_type_to_title_map = array_flip($default_folders_title_to_type_map); 11747 11748 $ps_in_fold_entry = $ilDB->prepareManip( 11749 "INSERT INTO mail_obj_data (obj_id, user_id, title, m_type) VALUES(?, ?, ?, ?)", 11750 array('integer','integer', 'text', 'text') 11751 ); 11752 11753 $ps_in_tree_entry = $ilDB->prepareManip( 11754 "INSERT INTO mail_tree (tree, child, parent, lft, rgt, depth) VALUES(?, ?, ?, ?, ?, ?)", 11755 array('integer', 'integer', 'integer', 'integer', 'integer', 'integer') 11756 ); 11757 11758 $ps_sel_tree_entry = $ilDB->prepare( 11759 "SELECT rgt, lft, parent FROM mail_tree WHERE child = ? AND tree = ?", 11760 array('integer', 'integer') 11761 ); 11762 11763 $ps_up_tree_entry = $ilDB->prepareManip( 11764 "UPDATE mail_tree SET lft = CASE WHEN lft > ? THEN lft + 2 ELSE lft END, rgt = CASE WHEN rgt >= ? THEN rgt + 2 ELSE rgt END WHERE tree = ?", 11765 array('integer', 'integer', 'integer') 11766 ); 11767 11768 $ps_del_mtmig_rec = $ilDB->prepareManip( 11769 "DELETE FROM mail_tree_mod_migr WHERE usr_id = ?", 11770 array('integer') 11771 ); 11772 11773 $res = $ilDB->query("SELECT usr_id FROM mail_tree_mod_migr"); 11774 $num = $ilDB->numRows($res); 11775 11776 $GLOBALS['ilLog']->write(sprintf( 11777 "DB Step %s: Found %s duplicates in table 'mail_tree'.", 11778 $db_step, 11779 $num 11780 )); 11781 11782 // We need a first loop to delete all affected mail trees 11783 $i = 0; 11784 while ($row = $ilDB->fetchAssoc($res)) { 11785 ++$i; 11786 11787 $usr_id = $row['usr_id']; 11788 11789 $ilDB->execute($ps_del_tree_entries, array($usr_id)); 11790 $GLOBALS['ilLog']->write(sprintf( 11791 "DB Step %s: Started 'mail_tree' migration for user %s. Deleted all records referring this user (field: tree)", 11792 $db_step, 11793 $usr_id 11794 )); 11795 } 11796 11797 $res = $ilDB->query("SELECT usr_id FROM mail_tree_mod_migr"); 11798 11799 $i = 0; 11800 while ($row = $ilDB->fetchAssoc($res)) { 11801 ++$i; 11802 11803 $usr_id = $row['usr_id']; 11804 11805 $fold_res = $ilDB->execute($ps_sel_fold_entries, array($usr_id)); 11806 $user_folders = array(); 11807 $user_default_folders = array(); 11808 while ($fold_row = $ilDB->fetchAssoc($fold_res)) { 11809 $user_folders[$fold_row['obj_id']] = $fold_row; 11810 if (isset($default_folder_type_to_title_map[strtolower($fold_row['m_type'])])) { 11811 $user_default_folders[$fold_row['m_type']] = $fold_row['title']; 11812 } 11813 } 11814 11815 // Create missing default folders 11816 $folders_to_create = array_diff_key($default_folder_type_to_title_map, $user_default_folders); 11817 foreach ($folders_to_create as $type => $title) { 11818 $folder_id = $ilDB->nextId('mail_obj_data'); 11819 $ilDB->execute($ps_in_fold_entry, array($folder_id, $usr_id, $title, $type)); 11820 11821 $user_folders[$folder_id] = array( 11822 'obj_id' => $folder_id, 11823 'user_id' => $usr_id, 11824 'title' => $title, 11825 'm_type' => $type 11826 ); 11827 $GLOBALS['ilLog']->write(sprintf( 11828 "DB Step %s, iteration %s: Created 'mail_obj_data' record (missing folder type): %s, %s, %s, %s .", 11829 $db_step, 11830 $i, 11831 $folder_id, 11832 $usr_id, 11833 $title, 11834 $type 11835 )); 11836 } 11837 11838 // Create a new root folder node 11839 $root_id = null; 11840 foreach ($user_folders as $folder_id => $data) { 11841 if ('root' != $data['m_type']) { 11842 continue; 11843 } 11844 11845 $root_id = $folder_id; 11846 $ilDB->execute($ps_in_tree_entry, array($usr_id, $root_id, 0, 1, 2, 1)); 11847 11848 $GLOBALS['ilLog']->write(sprintf( 11849 "DB Step %s, iteration %s: Created root node with id %s for user %s in 'mail_tree'.", 11850 $db_step, 11851 $i, 11852 $root_id, 11853 $usr_id 11854 )); 11855 break; 11856 } 11857 11858 if (!$root_id) { 11859 // Did not find root folder, skip user and move to the next one 11860 $GLOBALS['ilLog']->write(sprintf( 11861 "DB Step %s, iteration %s: No root folder found for user %s . Skipped user.", 11862 $db_step, 11863 $i, 11864 $usr_id 11865 )); 11866 continue; 11867 } 11868 11869 $custom_folder_root_id = null; 11870 // Create all default folders below 'root' 11871 foreach ($user_folders as $folder_id => $data) { 11872 if ('root' == $data['m_type'] || !isset($default_folder_type_to_title_map[strtolower($data['m_type'])])) { 11873 continue; 11874 } 11875 11876 if (null === $custom_folder_root_id && 'local' == $data['m_type']) { 11877 $custom_folder_root_id = $folder_id; 11878 } 11879 11880 $res_parent = $ilDB->execute($ps_sel_tree_entry, array($root_id, $usr_id)); 11881 $parent_row = $ilDB->fetchAssoc($res_parent); 11882 11883 $right = $parent_row['rgt']; 11884 $lft = $right; 11885 $rgt = $right + 1; 11886 11887 $ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id)); 11888 $ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $root_id, $lft, $rgt, 2)); 11889 $GLOBALS['ilLog']->write(sprintf( 11890 "DB Step %s, iteration %s: Created node with id %s (lft: %s | rgt: %s) for user %s in 'mail_tree'.", 11891 $db_step, 11892 $i, 11893 $folder_id, 11894 $lft, 11895 $rgt, 11896 $usr_id 11897 )); 11898 } 11899 11900 if (!$custom_folder_root_id) { 11901 // Did not find custom folder root, skip user and move to the next one 11902 $GLOBALS['ilLog']->write(sprintf( 11903 "DB Step %s, iteration %s: No custom folder root found for user %s . Skipped user.", 11904 $db_step, 11905 $i, 11906 $usr_id 11907 )); 11908 continue; 11909 } 11910 11911 // Create all custom folders below 'local' 11912 foreach ($user_folders as $folder_id => $data) { 11913 if (isset($default_folder_type_to_title_map[strtolower($data['m_type'])])) { 11914 continue; 11915 } 11916 11917 $res_parent = $ilDB->execute($ps_sel_tree_entry, array($custom_folder_root_id, $usr_id)); 11918 $parent_row = $ilDB->fetchAssoc($res_parent); 11919 11920 $right = $parent_row['rgt']; 11921 $lft = $right; 11922 $rgt = $right + 1; 11923 11924 $ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id)); 11925 $ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $custom_folder_root_id, $lft, $rgt, 3)); 11926 $GLOBALS['ilLog']->write(sprintf( 11927 "DB Step %s, iteration %s: Created custom folder node with id %s (lft: %s | rgt: %s) for user % in 'mail_tree'.", 11928 $db_step, 11929 $i, 11930 $folder_id, 11931 $lft, 11932 $rgt, 11933 $usr_id 11934 )); 11935 } 11936 11937 // Tree completely created, remove migration record 11938 $ilDB->execute($ps_del_mtmig_rec, array($usr_id)); 11939 11940 $GLOBALS['ilLog']->write(sprintf( 11941 "DB Step %s, iteration %s: Finished 'mail_tree' migration for user %s .", 11942 $db_step, 11943 $i, 11944 $usr_id 11945 )); 11946 } 11947 11948 $res = $ilDB->query("SELECT usr_id FROM mail_tree_mod_migr"); 11949 $num = $ilDB->numRows($res); 11950 if ($num > 0) { 11951 setup_exit("There are still wrong child entries in table 'mail_tree'. Please execute this database update step again."); 11952 } 11953} 11954 11955if ($ilDB->tableExists('mail_tree_mod_migr')) { 11956 $ilDB->dropTable('mail_tree_mod_migr'); 11957} 11958 11959$mt_mod_incon_query_num = " 11960 SELECT COUNT(*) cnt 11961 FROM mail_obj_data 11962 INNER JOIN mail_tree ON mail_tree.child = mail_obj_data.obj_id 11963 WHERE mail_tree.tree != mail_obj_data.user_id 11964"; 11965$res = $ilDB->query($mt_mod_incon_query_num); 11966$data = $ilDB->fetchAssoc($res); 11967if ($data['cnt'] > 0) { 11968 setup_exit("There are still wrong child entries in table 'mail_tree'. Please execute database update step 4761 again. Execute the following SQL string manually: UPDATE settings SET value = 4760 WHERE keyword = 'db_version'; "); 11969} 11970?> 11971<#4764> 11972<?php 11973 $ilCtrlStructureReader->getStructure(); 11974?> 11975<#4765> 11976<?php 11977if (!$ilDB->indexExistsByFields('frm_posts_tree', array('thr_fk'))) { 11978 $ilDB->addIndex('frm_posts_tree', array('thr_fk'), 'i1'); 11979} 11980?> 11981<#4766> 11982<?php 11983if (!$ilDB->indexExistsByFields('frm_posts_tree', array('pos_fk'))) { 11984 $ilDB->addIndex('frm_posts_tree', array('pos_fk'), 'i2'); 11985} 11986?> 11987<#4767> 11988<?php 11989 11990 if (!$ilDB->indexExistsByFields('role_data', array('auth_mode'))) { 11991 $ilDB->addIndex('role_data', array('auth_mode'), 'i1'); 11992 } 11993?> 11994<#4768> 11995<?php 11996$ilDB->modifyTableColumn('cmi_gobjective', 'objective_id', array( 11997 'length' => 253, 11998)); 11999?> 12000<#4769> 12001<?php 12002 $ilCtrlStructureReader->getStructure(); 12003?> 12004<#4770> 12005<?php 12006 $query = 'INSERT INTO log_components (component_id) VALUES (' . $ilDB->quote('log_root', 'text') . ')'; 12007 $ilDB->manipulate($query); 12008?> 12009 12010<#4771> 12011<?php 12012 12013// remove role entries in obj_members 12014$query = 'update obj_members set admin = ' . $ilDB->quote(0, 'integer') . ', ' . 12015 'tutor = ' . $ilDB->quote(0, 'integer') . ', member = ' . $ilDB->quote(0, 'integer'); 12016$ilDB->manipulate($query); 12017 12018// iterate through all courses 12019$offset = 0; 12020$limit = 100; 12021do { 12022 $query = 'SELECT obr.ref_id, obr.obj_id FROM object_reference obr ' . 12023 'join object_data obd on obr.obj_id = obd.obj_id where (type = ' . $ilDB->quote('crs', 'text') . ' or type = ' . $ilDB->quote('grp', 'text') . ') ' . 12024 $ilDB->setLimit($limit, $offset); 12025 $res = $ilDB->query($query); 12026 12027 if (!$res->numRows()) { 12028 break; 12029 } 12030 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12031 // find course members roles 12032 $query = 'select rol_id, title from rbac_fa ' . 12033 'join object_data on rol_id = obj_id ' . 12034 'where parent = ' . $ilDB->quote($row->ref_id, 'integer') . ' ' . 12035 'and assign = ' . $ilDB->quote('y', 'text'); 12036 $rol_res = $ilDB->query($query); 12037 while ($rol_row = $rol_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12038 // find users which are not assigned to obj_members and create a default entry 12039 $query = 'select ua.usr_id from rbac_ua ua ' . 12040 'left join obj_members om on ua.usr_id = om.usr_id ' . 12041 'where om.usr_id IS NULL ' . 12042 'and rol_id = ' . $ilDB->quote($rol_row->rol_id, 'integer') . ' ' . 12043 'and om.obj_id = ' . $ilDB->quote($row->obj_id, 'integer'); 12044 $ua_res = $ilDB->query($query); 12045 while ($ua_row = $ua_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12046 $query = 'insert into obj_members (obj_id, usr_id) ' . 12047 'values(' . 12048 $ilDB->quote($row->obj_id, 'integer') . ', ' . 12049 $ilDB->quote($ua_row->usr_id, 'integer') . ' ' . 12050 ')'; 12051 $ilDB->manipulate($query); 12052 } 12053 12054 // find users which are assigned to obj_members and update their role assignment 12055 $query = 'select * from rbac_ua ua ' . 12056 'left join obj_members om on ua.usr_id = om.usr_id ' . 12057 'where om.usr_id IS NOT NULL ' . 12058 'and rol_id = ' . $ilDB->quote($rol_row->rol_id, 'integer') . ' ' . 12059 'and om.obj_id = ' . $ilDB->quote($row->obj_id, 'integer'); 12060 $ua_res = $ilDB->query($query); 12061 while ($ua_row = $ua_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12062 $admin = $tutor = $member = 0; 12063 switch (substr($rol_row->title, 0, 8)) { 12064 case 'il_crs_a': 12065 case 'il_grp_a': 12066 $admin = 1; 12067 break; 12068 12069 case 'il_crs_t': 12070 $tutor = 1; 12071 break; 12072 12073 default: 12074 case 'il_grp_m': 12075 case 'il_crs_m': 12076 $member = 1; 12077 break; 12078 } 12079 12080 $query = 'update obj_members ' . 12081 'set admin = admin + ' . $ilDB->quote($admin, 'integer') . ', ' . 12082 'tutor = tutor + ' . $ilDB->quote($tutor, 'integer') . ', ' . 12083 'member = member + ' . $ilDB->quote($member, 'integer') . ' ' . 12084 'WHERE usr_id = ' . $ilDB->quote($ua_row->usr_id, 'integer') . ' ' . 12085 'AND obj_id = ' . $ilDB->quote($row->obj_id, 'integer'); 12086 $ilDB->manipulate($query); 12087 } 12088 } 12089 } 12090 // increase offset 12091 $offset += $limit; 12092} while (true); 12093 12094?> 12095<#4772> 12096<?php 12097 12098if (!$ilDB->indexExistsByFields('obj_members', array('usr_id'))) { 12099 $ilDB->addIndex('obj_members', array('usr_id'), 'i1'); 12100} 12101 12102?> 12103<#4773> 12104<?php 12105 $ilCtrlStructureReader->getStructure(); 12106?> 12107<#4774> 12108<?php 12109 $ilCtrlStructureReader->getStructure(); 12110?> 12111<#4775> 12112<?php 12113$ilDB->modifyTableColumn( 12114 'il_dcl_field', 12115 'description', 12116 array("type" => "clob") 12117); 12118?> 12119<#4776> 12120<?php 12121 $ilCtrlStructureReader->getStructure(); 12122?> 12123<#4777> 12124<?php 12125 12126 // see #3172 12127 if ($ilDB->getDBType() == 'oracle') { 12128 if (!$ilDB->tableColumnExists('svy_qst_matrixrows', 'title_tmp')) { 12129 $ilDB->addTableColumn( 12130 'svy_qst_matrixrows', 12131 'title_tmp', 12132 array( 12133 "type" => "text", 12134 "length" => 1000, 12135 "notnull" => false, 12136 "default" => null) 12137 ); 12138 $ilDB->manipulate('UPDATE svy_qst_matrixrows SET title_tmp = title'); 12139 $ilDB->dropTableColumn('svy_qst_matrixrows', 'title'); 12140 $ilDB->renameTableColumn('svy_qst_matrixrows', 'title_tmp', 'title'); 12141 } 12142 } else { 12143 $ilDB->modifyTableColumn( 12144 'svy_qst_matrixrows', 12145 'title', 12146 array( 12147 "type" => "text", 12148 "length" => 1000, 12149 "default" => null, 12150 "notnull" => false) 12151 ); 12152 } 12153 12154?> 12155<#4778> 12156<?php 12157 $ilCtrlStructureReader->getStructure(); 12158?> 12159<#4779> 12160<?php 12161 $ilCtrlStructureReader->getStructure(); 12162?> 12163<#4780> 12164<?php 12165 $ilCtrlStructureReader->getStructure(); 12166?> 12167<#4781> 12168<?php 12169 $ilCtrlStructureReader->getStructure(); 12170?> 12171<#4782> 12172<?php 12173 $ilCtrlStructureReader->getStructure(); 12174?> 12175<#4783> 12176<?php 12177 $ilCtrlStructureReader->getStructure(); 12178?> 12179<#4784> 12180<?php 12181 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 12182 $obj_type_id = ilDBUpdateNewObjectType::getObjectTypeId("prg"); 12183 $existing_ops = array("read"); 12184 foreach ($existing_ops as $op) { 12185 $op_id = ilDBUpdateNewObjectType::getCustomRBACOperationId($op); 12186 ilDBUpdateNewObjectType::addRBACOperation($obj_type_id, $op_id); 12187 } 12188?> 12189<#4785> 12190<?php 12191 $ilCtrlStructureReader->getStructure(); 12192?> 12193<#4786> 12194<?php 12195$ilCtrlStructureReader->getStructure(); 12196?> 12197<#4787> 12198<?php 12199include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 12200ilDBUpdateNewObjectType::addAdminNode('cadm', 'Contact'); 12201?> 12202<#4788> 12203<?php 12204$ilSetting = new ilSetting('buddysystem'); 12205$ilSetting->set('enabled', 1); 12206?> 12207<#4789> 12208<?php 12209$stmt = $ilDB->prepareManip('INSERT INTO usr_pref (usr_id, keyword, value) VALUES(?, ?, ?)', array('integer', 'text', 'text')); 12210 12211$notin = $ilDB->in('usr_data.usr_id', array(13), true, 'integer'); 12212$query = 'SELECT usr_data.usr_id FROM usr_data LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s WHERE usr_pref.keyword IS NULL AND ' . $notin; 12213$res = $ilDB->queryF($query, array('text'), array('bs_allow_to_contact_me')); 12214while ($row = $ilDB->fetchAssoc($res)) { 12215 $ilDB->execute($stmt, array($row['usr_id'], 'bs_allow_to_contact_me', 'y')); 12216} 12217?> 12218<#4790> 12219<?php 12220 12221 if (!$ilDB->indexExistsByFields('page_question', array('question_id'))) { 12222 $ilDB->addIndex('page_question', array('question_id'), 'i2'); 12223 } 12224?> 12225<#4791> 12226<?php 12227 if (!$ilDB->indexExistsByFields('help_tooltip', array('tt_id', 'module_id'))) { 12228 $ilDB->addIndex('help_tooltip', array('tt_id', 'module_id'), 'i1'); 12229 } 12230?> 12231<#4792> 12232<?php 12233$ilCtrlStructureReader->getStructure(); 12234?> 12235<#4793> 12236<?php 12237$ilCtrlStructureReader->getStructure(); 12238?> 12239<#4794> 12240<?php 12241$ilCtrlStructureReader->getStructure(); 12242?> 12243<#4795> 12244<?php 12245 12246 $query = 'SELECT server_id FROM ldap_server_settings'; 12247 $res = $ilDB->query($query); 12248 12249 $server_id = 0; 12250 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12251 $server_id = $row->server_id; 12252 } 12253 12254 if ($server_id) { 12255 $query = 'UPDATE usr_data SET auth_mode = ' . $ilDB->quote('ldap_' . (int) $server_id, 'text') . ' ' . 12256 'WHERE auth_mode = ' . $ilDB->quote('ldap', 'text'); 12257 $ilDB->manipulate($query); 12258 } 12259?> 12260<#4796> 12261<?php 12262$delQuery = " 12263 DELETE FROM tax_node_assignment 12264 WHERE node_id = %s 12265 AND component = %s 12266 AND obj_id = %s 12267 AND item_type = %s 12268 AND item_id = %s 12269"; 12270 12271$types = array('integer', 'text', 'integer', 'text', 'integer'); 12272 12273$selQuery = " 12274 SELECT tax_node_assignment.* FROM tax_node_assignment 12275 LEFT JOIN qpl_questions ON question_id = item_id 12276 WHERE component = %s 12277 AND item_type = %s 12278 AND question_id IS NULL 12279"; 12280 12281$res = $ilDB->queryF($selQuery, array('text', 'text'), array('qpl', 'quest')); 12282 12283while ($row = $ilDB->fetchAssoc($res)) { 12284 $ilDB->manipulateF($delQuery, $types, array( 12285 $row['node_id'], $row['component'], $row['obj_id'], $row['item_type'], $row['item_id'] 12286 )); 12287} 12288?> 12289<#4797> 12290<?php 12291$ilCtrlStructureReader->getStructure(); 12292?> 12293<#4798> 12294<?php 12295$ilCtrlStructureReader->getStructure(); 12296?> 12297 12298<#4799> 12299<?php 12300 12301 if (!$ilDB->tableColumnExists('rbac_fa', 'blocked')) { 12302 $ilDB->addTableColumn( 12303 'rbac_fa', 12304 'blocked', 12305 array( 12306 "type" => "integer", 12307 "length" => 1, 12308 "notnull" => true, 12309 "default" => 0) 12310 ); 12311 } 12312?> 12313<#4800> 12314<?php 12315$indices = array( 12316 'il_dcl_record_field' => array( 12317 'record_id', 12318 'field_id' 12319 ), 12320 'il_dcl_record' => array( 'table_id' ), 12321 'il_dcl_stloc1_value' => array( 'record_field_id' ), 12322 'il_dcl_stloc2_value' => array( 'record_field_id' ), 12323 'il_dcl_stloc3_value' => array( 'record_field_id' ), 12324 'il_dcl_field' => array( 12325 'datatype_id', 12326 'table_id' 12327 ), 12328 'il_dcl_field_prop' => array( 12329 'field_id', 12330 'datatype_prop_id' 12331 ), 12332 'il_dcl_viewdefinition' => array( 'view_id' ), 12333 'il_dcl_view' => array( 12334 'table_id', 12335 'type' 12336 ), 12337 'il_dcl_data' => array( 'main_table_id' ), 12338 'il_dcl_table' => array( 'obj_id' ), 12339); 12340 12341$manager = $ilDB->loadModule('Manager'); 12342 12343foreach ($indices as $table_name => $field_names) { 12344 if ($manager) { 12345 foreach ($manager->listTableIndexes($table_name) as $idx_name) { 12346 if ($ilDB->getDbType() == 'oracle' || $ilDB->getDbType() == 'postgres') { 12347 $manager->getDBInstance()->exec('DROP INDEX ' . $idx_name); 12348 $manager->getDBInstance()->exec('DROP INDEX ' . $idx_name . '_idx'); 12349 } else { 12350 $manager->getDBInstance()->exec('DROP INDEX ' . $idx_name . ' ON ' . $table_name); 12351 $manager->getDBInstance()->exec('DROP INDEX ' . $idx_name . '_idx ON ' . $table_name); 12352 } 12353 } 12354 foreach ($field_names as $i => $field_name) { 12355 $ilDB->addIndex($table_name, array( $field_name ), 'i' . ($i + 1)); 12356 } 12357 } 12358} 12359?> 12360<#4801> 12361<?php 12362$ilCtrlStructureReader->getStructure(); 12363?> 12364<#4802> 12365<?php 12366$ilCtrlStructureReader->getStructure(); 12367?> 12368<#4803> 12369<?php 12370if (!$ilDB->tableColumnExists('adl_shared_data', 'cp_node_id')) { 12371 $ilDB->addTableColumn( 12372 'adl_shared_data', 12373 'cp_node_id', 12374 array( 12375 "type" => "integer", 12376 "length" => 4, 12377 "notnull" => true, 12378 "default" => "0" 12379 ) 12380 ); 12381 12382 $dataRes = $ilDB->query( 12383 "select cp_datamap.cp_node_id, cp_datamap.slm_id, cp_datamap.target_id from cp_datamap, adl_shared_data " 12384 . "WHERE cp_datamap.slm_id = adl_shared_data.slm_id AND cp_datamap.target_id = adl_shared_data.target_id" 12385 ); 12386 while ($row = $ilDB->fetchAssoc($dataRes)) { 12387 $ilDB->manipulateF( 12388 "UPDATE adl_shared_data SET cp_node_id = %s WHERE slm_id = %s AND target_id = %s", 12389 array("integer","integer","text"), 12390 array($row["cp_node_id"],$row["slm_id"],$row["target_id"]) 12391 ); 12392 } 12393 $ilDB->manipulate("delete from adl_shared_data WHERE cp_node_id = 0"); 12394 12395 $ilDB->addPrimaryKey("adl_shared_data", array('cp_node_id','user_id')); 12396} 12397?> 12398<#4804> 12399<?php 12400 $query = "show index from sahs_sc13_seq_templ where Key_name = 'PRIMARY'"; 12401 $res = $ilDB->query($query); 12402 if (!$ilDB->numRows($res)) { 12403 $ilDB->addPrimaryKey('sahs_sc13_seq_templ', array('seqnodeid','id')); 12404 } 12405?> 12406<#4805> 12407<?php 12408 $query = "show index from sahs_sc13_seq_tree where Key_name = 'PRIMARY'"; 12409 $res = $ilDB->query($query); 12410 if (!$ilDB->numRows($res)) { 12411 $ilDB->addPrimaryKey('sahs_sc13_seq_tree', array('child','importid','parent')); 12412 } 12413?> 12414<#4806> 12415<?php 12416 $query = "show index from sahs_sc13_tree where Key_name = 'PRIMARY'"; 12417 $res = $ilDB->query($query); 12418 if (!$ilDB->numRows($res)) { 12419 $ilDB->addPrimaryKey('sahs_sc13_tree', array('child','parent','slm_id')); 12420 } 12421?> 12422<#4807> 12423<?php 12424 $query = "show index from scorm_tree where Key_name = 'PRIMARY'"; 12425 $res = $ilDB->query($query); 12426 if (!$ilDB->numRows($res)) { 12427 $ilDB->addPrimaryKey('scorm_tree', array('slm_id','child')); 12428 } 12429?> 12430<#4808> 12431<?php 12432 $ilDB->modifyTableColumn('cp_tree', 'obj_id', array( 12433 "notnull" => true, 12434 "default" => "0" 12435 )); 12436 $ilDB->modifyTableColumn('cp_tree', 'child', array( 12437 "notnull" => true, 12438 "default" => "0" 12439 )); 12440 12441 $query = "show index from cp_tree where Key_name = 'PRIMARY'"; 12442 $res = $ilDB->query($query); 12443 if (!$ilDB->numRows($res)) { 12444 $ilDB->addPrimaryKey('cp_tree', array('obj_id','child')); 12445 } 12446?> 12447<#4809> 12448<?php 12449if (!$ilDB->tableColumnExists('notification_osd', 'visible_for')) { 12450 $ilDB->addTableColumn( 12451 'notification_osd', 12452 'visible_for', 12453 array( 12454 'type' => 'integer', 12455 'length' => 4, 12456 'notnull' => true, 12457 'default' => 0) 12458 ); 12459} 12460?> 12461<#4810> 12462<?php 12463if ($ilDB->tableColumnExists('svy_times', 'first_question')) { 12464 $ilDB->modifyTableColumn( 12465 'svy_times', 12466 'first_question', 12467 array( 12468 'type' => 'integer', 12469 'length' => 4) 12470 ); 12471} 12472?> 12473<#4811> 12474<?php 12475//step 1/4 ecs_part_settings search for dublicates and store it in ecs_part_settings_tmp 12476 12477if ($ilDB->tableExists('ecs_part_settings')) { 12478 $res = $ilDB->query(" 12479 SELECT sid, mid 12480 FROM ecs_part_settings 12481 GROUP BY sid, mid 12482 HAVING COUNT(sid) > 1 12483 "); 12484 12485 if ($ilDB->numRows($res)) { 12486 if (!$ilDB->tableExists('ecs_part_settings_tmp')) { 12487 $ilDB->createTable('ecs_part_settings_tmp', array( 12488 'sid' => array( 12489 'type' => 'integer', 12490 'length' => 8, 12491 'notnull' => true, 12492 'default' => 0 12493 ), 12494 'mid' => array( 12495 'type' => 'integer', 12496 'length' => 8, 12497 'notnull' => true, 12498 'default' => 0 12499 ) 12500 )); 12501 $ilDB->addPrimaryKey('ecs_part_settings_tmp', array('sid','mid')); 12502 } 12503 12504 while ($row = $ilDB->fetchAssoc($res)) { 12505 $ilDB->replace('ecs_part_settings_tmp', array(), array( 12506 'sid' => array('integer', $row['sid']), 12507 'mid' => array('integer', $row['mid']) 12508 )); 12509 } 12510 } 12511} 12512?> 12513<#4812> 12514<?php 12515//step 2/4 ecs_part_settings deletes dublicates stored in ecs_part_settings_tmp 12516 12517if ($ilDB->tableExists('ecs_part_settings_tmp')) { 12518 $res = $ilDB->query(" 12519 SELECT sid, mid 12520 FROM ecs_part_settings_tmp 12521"); 12522 12523 while ($row = $ilDB->fetchAssoc($res)) { 12524 $res_data = $ilDB->query( 12525 " 12526 SELECT * 12527 FROM ecs_part_settings 12528 WHERE 12529 sid = " . $ilDB->quote($row['sid'], 'integer') . " AND 12530 mid = " . $ilDB->quote($row['mid'], 'integer') 12531 ); 12532 $data = $ilDB->fetchAssoc($res_data); 12533 12534 $ilDB->manipulate( 12535 "DELETE FROM ecs_part_settings WHERE" . 12536 " sid = " . $ilDB->quote($row['sid'], 'integer') . 12537 " AND mid = " . $ilDB->quote($row['mid'], 'integer') 12538 ); 12539 12540 $ilDB->manipulate("INSERT INTO ecs_part_settings (sid, mid, export, import, import_type, title, cname, token, export_types, import_types, dtoken) " . 12541 "VALUES ( " . 12542 $ilDB->quote($data['sid'], 'integer') . ', ' . 12543 $ilDB->quote($data['mid'], 'integer') . ', ' . 12544 $ilDB->quote($data['export'], 'integer') . ', ' . 12545 $ilDB->quote($data['import'], 'integer') . ', ' . 12546 $ilDB->quote($data['import_type'], 'integer') . ', ' . 12547 $ilDB->quote($data['title'], 'text') . ', ' . 12548 $ilDB->quote($data['cname'], 'text') . ', ' . 12549 $ilDB->quote($data['token'], 'integer') . ', ' . 12550 $ilDB->quote($data['export_types'], 'text') . ', ' . 12551 $ilDB->quote($data['import_types'], 'text') . ', ' . 12552 $ilDB->quote($data['dtoken'], 'integer') . 12553 ")"); 12554 12555 $ilDB->manipulate( 12556 "DELETE FROM ecs_part_settings_tmp WHERE" . 12557 " sid = " . $ilDB->quote($row['sid'], 'integer') . 12558 " AND mid = " . $ilDB->quote($row['mid'], 'integer') 12559 ); 12560 } 12561} 12562?> 12563<#4813> 12564<?php 12565//step 3/4 ecs_part_settings adding primary key 12566 12567if ($ilDB->tableExists('ecs_part_settings')) { 12568 $ilDB->addPrimaryKey('ecs_part_settings', array('sid', 'mid')); 12569} 12570?> 12571<#4814> 12572<?php 12573//step 4/4 ecs_part_settings removes temp table 12574 12575if ($ilDB->tableExists('ecs_part_settings_tmp')) { 12576 $ilDB->dropTable('ecs_part_settings_tmp'); 12577} 12578?> 12579<#4815> 12580<?php 12581//step 1/1 feedback_results removes table 12582 12583if ($ilDB->tableExists('feedback_results')) { 12584 $ilDB->dropTable('feedback_results'); 12585} 12586if ($ilDB->tableExists('feedback_items')) { 12587 $ilDB->dropTable('feedback_items'); 12588} 12589?> 12590<#4816> 12591<?php 12592//step 1/4 il_exc_team_log renames old table 12593 12594if ($ilDB->tableExists('il_exc_team_log') && !$ilDB->tableExists('exc_team_log_old')) { 12595 $ilDB->renameTable("il_exc_team_log", "exc_team_log_old"); 12596} 12597?> 12598<#4817> 12599<?php 12600//step 2/4 il_exc_team_log creates new table with unique id and sequenz 12601 12602if (!$ilDB->tableExists('il_exc_team_log')) { 12603 $ilDB->createTable('il_exc_team_log', array( 12604 'log_id' => array( 12605 'type' => 'integer', 12606 'length' => 4, 12607 'notnull' => true 12608 ), 12609 'team_id' => array( 12610 'type' => 'integer', 12611 'length' => 4, 12612 'notnull' => true 12613 ), 12614 'user_id' => array( 12615 'type' => 'integer', 12616 'length' => 4, 12617 'notnull' => true 12618 ), 12619 'details' => array( 12620 'type' => 'text', 12621 'length' => 500, 12622 'notnull' => false 12623 ), 12624 'action' => array( 12625 'type' => 'integer', 12626 'length' => 1, 12627 'notnull' => true 12628 ), 12629 'tstamp' => array( 12630 'type' => 'integer', 12631 'length' => 4, 12632 'notnull' => true 12633 ) 12634 )); 12635 $ilDB->addPrimaryKey('il_exc_team_log', array('log_id')); 12636 $ilDB->addIndex('il_exc_team_log', array('team_id'), 'i1'); 12637 $ilDB->createSequence('il_exc_team_log'); 12638} 12639?> 12640<#4818> 12641<?php 12642//step 3/4 il_exc_team_log moves all data to new table 12643 12644if ($ilDB->tableExists('il_exc_team_log') && $ilDB->tableExists('exc_team_log_old')) { 12645 $res = $ilDB->query(" 12646 SELECT * 12647 FROM exc_team_log_old 12648 "); 12649 12650 while ($row = $ilDB->fetchAssoc($res)) { 12651 $id = $ilDB->nextId('il_exc_team_log'); 12652 12653 $ilDB->manipulate( 12654 "INSERT INTO il_exc_team_log (log_id, team_id, user_id, details, action, tstamp)" . 12655 " VALUES (" . 12656 $ilDB->quote($id, "integer") . 12657 "," . $ilDB->quote($row['team_id'], "integer") . 12658 "," . $ilDB->quote($row['user_id'], "integer") . 12659 "," . $ilDB->quote($row['details'], "text") . 12660 "," . $ilDB->quote($row['action'], "integer") . 12661 "," . $ilDB->quote($row['tstamp'], "integer") . 12662 ")" 12663 ); 12664 } 12665} 12666?> 12667<#4819> 12668<?php 12669//step 4/4 il_exc_team_log removes old table 12670 12671if ($ilDB->tableExists('exc_team_log_old')) { 12672 $ilDB->dropTable('exc_team_log_old'); 12673} 12674?> 12675<#4820> 12676<?php 12677//step 1/1 il_log removes old table 12678 12679if ($ilDB->tableExists('il_log')) { 12680 $ilDB->dropTable('il_log'); 12681} 12682?> 12683<#4821> 12684<?php 12685//step 1/5 il_verification removes dublicates 12686 12687if ($ilDB->tableExists('il_verification')) { 12688 $res = $ilDB->query(" 12689 SELECT id, type 12690 FROM il_verification 12691 GROUP BY id, type 12692 HAVING COUNT(id) > 1 12693 "); 12694 12695 if ($ilDB->numRows($res)) { 12696 if (!$ilDB->tableExists('il_verification_tmp')) { 12697 $ilDB->createTable('il_verification_tmp', array( 12698 'id' => array( 12699 'type' => 'integer', 12700 'length' => 8, 12701 'notnull' => true, 12702 'default' => 0 12703 ) 12704 )); 12705 $ilDB->addPrimaryKey('il_verification_tmp', array('id', 'type')); 12706 } 12707 12708 while ($row = $ilDB->fetchAssoc($res)) { 12709 $ilDB->replace('il_verification_tmp', array(), array( 12710 'id' => array('integer', $row['id']), 12711 'type' => array('text', $row['type']) 12712 )); 12713 } 12714 } 12715} 12716?> 12717<#4822> 12718<?php 12719//step 2/5 il_verification deletes dublicates stored in il_verification_tmp 12720 12721if ($ilDB->tableExists('il_verification_tmp')) { 12722 $res = $ilDB->query(" 12723 SELECT id, type 12724 FROM il_verification_tmp 12725 "); 12726 12727 while ($row = $ilDB->fetchAssoc($res)) { 12728 $res_data = $ilDB->query( 12729 " 12730 SELECT * 12731 FROM il_verification 12732 WHERE 12733 id = " . $ilDB->quote($row['id'], 'integer') . " AND 12734 type = " . $ilDB->quote($row['type'], 'text') 12735 ); 12736 $data = $ilDB->fetchAssoc($res_data); 12737 12738 $ilDB->manipulate( 12739 "DELETE FROM il_verification WHERE" . 12740 " id = " . $ilDB->quote($row['id'], 'integer') . 12741 " AND type = " . $ilDB->quote($row['type'], 'text') 12742 ); 12743 12744 $ilDB->manipulate("INSERT INTO il_verification (id, type, parameters, raw_data) " . 12745 "VALUES ( " . 12746 $ilDB->quote($data['id'], 'integer') . ', ' . 12747 $ilDB->quote($data['type'], 'text') . ', ' . 12748 $ilDB->quote($data['parameters'], 'text') . ', ' . 12749 $ilDB->quote($data['raw_data'], 'text') . 12750 ")"); 12751 12752 $ilDB->manipulate( 12753 "DELETE FROM il_verification_tmp WHERE" . 12754 " id = " . $ilDB->quote($row['id'], 'integer') . 12755 " AND type = " . $ilDB->quote($row['type'], 'text') 12756 ); 12757 } 12758} 12759?> 12760<#4823> 12761<?php 12762//step 3/5 il_verification drops not used indexes 12763 12764if ($ilDB->indexExistsByFields('il_verification', array('id'))) { 12765 $ilDB->dropIndexByFields('il_verification', array('id')); 12766} 12767?> 12768<#4824> 12769<?php 12770//step 4/5 il_verification adding primary key 12771 12772if ($ilDB->tableExists('il_verification')) { 12773 $ilDB->addPrimaryKey('il_verification', array('id', 'type')); 12774} 12775?> 12776<#4825> 12777<?php 12778//step 5/5 il_verification removes temp table 12779 12780if ($ilDB->tableExists('il_verification_tmp')) { 12781 $ilDB->dropTable('il_verification_tmp'); 12782} 12783?> 12784<#4826> 12785<?php 12786//step 1/4 il_wiki_imp_pages removes dublicates 12787 12788if ($ilDB->tableExists('il_wiki_imp_pages')) { 12789 $res = $ilDB->query(" 12790 SELECT wiki_id, page_id 12791 FROM il_wiki_imp_pages 12792 GROUP BY wiki_id, page_id 12793 HAVING COUNT(wiki_id) > 1 12794 "); 12795 12796 if ($ilDB->numRows($res)) { 12797 if (!$ilDB->tableExists('wiki_imp_pages_tmp')) { 12798 $ilDB->createTable('wiki_imp_pages_tmp', array( 12799 'wiki_id' => array( 12800 'type' => 'integer', 12801 'length' => 8, 12802 'notnull' => true, 12803 'default' => 0 12804 ), 12805 'page_id' => array( 12806 'type' => 'integer', 12807 'length' => 8, 12808 'notnull' => true, 12809 'default' => 0 12810 ) 12811 )); 12812 $ilDB->addPrimaryKey('wiki_imp_pages_tmp', array('wiki_id','page_id')); 12813 } 12814 12815 while ($row = $ilDB->fetchAssoc($res)) { 12816 $ilDB->replace('wiki_imp_pages_tmp', array(), array( 12817 'wiki_id' => array('integer', $row['wiki_id']), 12818 'page_id' => array('integer', $row['page_id']) 12819 )); 12820 } 12821 } 12822} 12823?> 12824<#4827> 12825<?php 12826//step 2/4 il_wiki_imp_pages deletes dublicates stored in wiki_imp_pages_tmp 12827 12828if ($ilDB->tableExists('wiki_imp_pages_tmp')) { 12829 $res = $ilDB->query(" 12830 SELECT wiki_id, page_id 12831 FROM wiki_imp_pages_tmp 12832 "); 12833 12834 while ($row = $ilDB->fetchAssoc($res)) { 12835 $res_data = $ilDB->query( 12836 " 12837 SELECT * 12838 FROM il_wiki_imp_pages 12839 WHERE 12840 wiki_id = " . $ilDB->quote($row['wiki_id'], 'integer') . " AND 12841 page_id = " . $ilDB->quote($row['page_id'], 'integer') 12842 ); 12843 $data = $ilDB->fetchAssoc($res_data); 12844 12845 $ilDB->manipulate( 12846 "DELETE FROM il_wiki_imp_pages WHERE" . 12847 " wiki_id = " . $ilDB->quote($row['wiki_id'], 'integer') . 12848 " AND page_id = " . $ilDB->quote($row['page_id'], 'integer') 12849 ); 12850 12851 $ilDB->manipulate("INSERT INTO il_wiki_imp_pages (wiki_id, ord, indent, page_id) " . 12852 "VALUES ( " . 12853 $ilDB->quote($data['wiki_id'], 'integer') . ', ' . 12854 $ilDB->quote($data['ord'], 'integer') . ', ' . 12855 $ilDB->quote($data['indent'], 'integer') . ', ' . 12856 $ilDB->quote($data['page_id'], 'integer') . 12857 ")"); 12858 12859 $ilDB->manipulate( 12860 "DELETE FROM wiki_imp_pages_tmp WHERE" . 12861 " wiki_id = " . $ilDB->quote($row['wiki_id'], 'integer') . 12862 " AND page_id = " . $ilDB->quote($row['page_id'], 'integer') 12863 ); 12864 } 12865} 12866?> 12867<#4828> 12868<?php 12869//step 3/4 il_wiki_imp_pages adding primary key 12870 12871if ($ilDB->tableExists('il_wiki_imp_pages')) { 12872 $ilDB->addPrimaryKey('il_wiki_imp_pages', array('wiki_id', 'page_id')); 12873} 12874?> 12875<#4829> 12876<?php 12877//step 4/4 il_wiki_imp_pages removes temp table 12878 12879if ($ilDB->tableExists('wiki_imp_pages_tmp')) { 12880 $ilDB->dropTable('wiki_imp_pages_tmp'); 12881} 12882?> 12883<#4830> 12884<?php 12885//step 1/3 il_wiki_missing_page removes dublicates 12886 12887if ($ilDB->tableExists('il_wiki_missing_page')) { 12888 $res = $ilDB->query(" 12889 SELECT wiki_id, source_id, target_name 12890 FROM il_wiki_missing_page 12891 GROUP BY wiki_id, source_id, target_name 12892 HAVING COUNT(wiki_id) > 1 12893 "); 12894 12895 while ($row = $ilDB->fetchAssoc($res)) { 12896 $ilDB->manipulate( 12897 "DELETE FROM il_wiki_missing_page WHERE" . 12898 " wiki_id = " . $ilDB->quote($row['wiki_id'], 'integer') . 12899 " AND source_id = " . $ilDB->quote($row['source_id'], 'integer') . 12900 " AND target_name = " . $ilDB->quote($row['target_name'], 'text') 12901 ); 12902 12903 $ilDB->manipulate("INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name) " . 12904 "VALUES ( " . 12905 $ilDB->quote($row['wiki_id'], 'integer') . ', ' . 12906 $ilDB->quote($row['source_id'], 'integer') . ', ' . 12907 $ilDB->quote($row['target_name'], 'text') . 12908 ")"); 12909 } 12910} 12911?> 12912<#4831> 12913<?php 12914//step 2/3 il_wiki_missing_page drops not used indexes 12915 12916if ($ilDB->indexExistsByFields('il_wiki_missing_page', array('wiki_id'))) { 12917 $ilDB->dropIndexByFields('il_wiki_missing_page', array('wiki_id')); 12918} 12919?> 12920<#4832> 12921<?php 12922//step 3/3 il_wiki_missing_page adding primary key and removing index 12923if (!$ilDB->indexExistsByFields('il_wiki_missing_page', array('wiki_id', 'target_name'))) { 12924 $ilDB->addIndex('il_wiki_missing_page', array('wiki_id', 'target_name'), 'i1'); 12925} 12926 12927if ($ilDB->tableExists('il_wiki_missing_page')) { 12928 $ilDB->addPrimaryKey('il_wiki_missing_page', array('wiki_id', 'source_id', 'target_name')); 12929} 12930?> 12931<#4833> 12932<?php 12933//step 1/2 lo_access search for dublicates and remove them 12934/* 12935if ($ilDB->tableExists('lo_access')) 12936{ 12937 $res = $ilDB->query(" 12938 SELECT first.timestamp ts, first.usr_id ui, first.lm_id li, first.obj_id oi, first.lm_title lt 12939 FROM lo_access first 12940 WHERE EXISTS ( 12941 SELECT second.usr_id, second.lm_id 12942 FROM lo_access second 12943 WHERE first.usr_id = second.usr_id AND first.lm_id = second.lm_id 12944 GROUP BY second.usr_id, second.lm_id 12945 HAVING COUNT(second.lm_id) > 1 12946 ) 12947 "); 12948 $data = array(); 12949 12950 while($row = $ilDB->fetchAssoc($res)) 12951 { 12952 $data[$row['ui'] . '_' . $row['li']][] = $row; 12953 } 12954 12955 12956 foreach($data as $rows) { 12957 $newest = null; 12958 12959 foreach ($rows as $row) { 12960 12961 if($newest && ($newest['ts'] == $row['ts'] && $newest['oi'] == $row['oi'])) 12962 { 12963 $ilDB->manipulate("DELETE FROM lo_access WHERE" . 12964 " usr_id = " . $ilDB->quote($newest['ui'], 'integer') . 12965 " AND lm_id = " . $ilDB->quote($newest['li'], 'integer') . 12966 " AND timestamp = " . $ilDB->quote($newest['ts'], 'date') . 12967 " AND obj_id = " . $ilDB->quote($newest['oi'], 'integer') 12968 ); 12969 12970 $ilDB->manipulate("INSERT INTO lo_access (usr_id, lm_id, timestamp, obj_id) ". 12971 "VALUES ( ". 12972 $ilDB->quote($row['ui'] ,'integer').', '. 12973 $ilDB->quote($row['li'] ,'integer').', '. 12974 $ilDB->quote($row['ts'] ,'date').', '. 12975 $ilDB->quote($row['oi'] ,'integer'). 12976 ")"); 12977 } 12978 12979 if (!$newest || new DateTime($row["ts"]) > new DateTime($newest["ts"])) { 12980 $newest = $row; 12981 } 12982 } 12983 12984 $ilDB->manipulate("DELETE FROM lo_access WHERE" . 12985 " usr_id = " . $ilDB->quote($newest['ui'], 'integer') . 12986 " AND lm_id = " . $ilDB->quote($newest['li'], 'integer') . 12987 " AND (timestamp != " . $ilDB->quote($newest['ts'], 'date') . 12988 " XOR obj_id != " . $ilDB->quote($newest['oi'], 'integer') . ")" 12989 ); 12990 } 12991} 12992*/ 12993?> 12994<#4834> 12995<?php 12996 12997// fixes step 4833 12998 12999$set1 = $ilDB->query("SELECT DISTINCT usr_id, lm_id FROM lo_access ORDER BY usr_id"); 13000 13001while ($r1 = $ilDB->fetchAssoc($set1)) { 13002 $set2 = $ilDB->query("SELECT * FROM lo_access WHERE usr_id = " . $ilDB->quote($r1["usr_id"], "integer") . 13003 " AND lm_id = " . $ilDB->quote($r1["lm_id"], "integer") . " ORDER BY timestamp ASC"); 13004 $new_recs = array(); 13005 while ($r2 = $ilDB->fetchAssoc($set2)) { 13006 $new_recs[$r2["usr_id"] . ":" . $r2["lm_id"]] = $r2; 13007 } 13008 $ilDB->manipulate("DELETE FROM lo_access WHERE usr_id = " . $ilDB->quote($r1["usr_id"], "integer") . 13009 " AND lm_id = " . $ilDB->quote($r1["lm_id"], "integer")); 13010 foreach ($new_recs as $r) { 13011 $ilDB->manipulate("INSERT INTO lo_access " . 13012 "(timestamp, usr_id, lm_id, obj_id, lm_title) VALUES (" . 13013 $ilDB->quote($r["timestamp"], "timestamp") . "," . 13014 $ilDB->quote($r["usr_id"], "integer") . "," . 13015 $ilDB->quote($r["lm_id"], "integer") . "," . 13016 $ilDB->quote($r["obj_id"], "integer") . "," . 13017 $ilDB->quote($r["lm_title"], "text") . 13018 ")"); 13019 } 13020} 13021 13022 13023//step 2/2 lo_access adding primary key and removing indexes 13024 13025if ($ilDB->indexExistsByFields('lo_access', array('usr_id'))) { 13026 $ilDB->dropIndexByFields('lo_access', array('usr_id')); 13027} 13028 13029if ($ilDB->tableExists('lo_access')) { 13030 $ilDB->addPrimaryKey('lo_access', array('usr_id', 'lm_id')); 13031} 13032?> 13033<#4835> 13034<?php 13035//step 1/4 obj_stat search for dublicates and store it in obj_stat_tmp 13036 13037if ($ilDB->tableExists('obj_stat')) { 13038 $res = $ilDB->query(" 13039 SELECT obj_id, yyyy, mm, dd, hh 13040 FROM obj_stat 13041 GROUP BY obj_id, yyyy, mm, dd, hh 13042 HAVING COUNT(obj_id) > 1 13043 "); 13044 13045 if ($ilDB->numRows($res)) { 13046 if (!$ilDB->tableExists('obj_stat_tmpd')) { 13047 $ilDB->createTable('obj_stat_tmpd', array( 13048 'obj_id' => array( 13049 'type' => 'integer', 13050 'length' => 8, 13051 'notnull' => true, 13052 'default' => 0 13053 ), 13054 'yyyy' => array( 13055 'type' => 'integer', 13056 'length' => 8, 13057 'notnull' => true, 13058 'default' => 0 13059 ), 13060 'mm' => array( 13061 'type' => 'integer', 13062 'length' => 8, 13063 'notnull' => true, 13064 'default' => 0 13065 ), 13066 'dd' => array( 13067 'type' => 'integer', 13068 'length' => 8, 13069 'notnull' => true, 13070 'default' => 0 13071 ), 13072 'hh' => array( 13073 'type' => 'integer', 13074 'length' => 8, 13075 'notnull' => true, 13076 'default' => 0 13077 ) 13078 )); 13079 $ilDB->addPrimaryKey('obj_stat_tmpd', array('obj_id','yyyy','mm','dd','hh')); 13080 } 13081 13082 while ($row = $ilDB->fetchAssoc($res)) { 13083 $ilDB->replace('obj_stat_tmpd', array(), array( 13084 'obj_id' => array('integer', $row['obj_id']), 13085 'yyyy' => array('integer', $row['yyyy']), 13086 'mm' => array('integer', $row['mm']), 13087 'dd' => array('integer', $row['dd']), 13088 'hh' => array('integer', $row['hh']) 13089 )); 13090 } 13091 } 13092} 13093?> 13094<#4836> 13095<?php 13096//step 2/4 obj_stat deletes dublicates stored in obj_stat_tmpd 13097 13098if ($ilDB->tableExists('obj_stat_tmpd')) { 13099 $res = $ilDB->query(" 13100 SELECT obj_id, yyyy, mm, dd, hh 13101 FROM obj_stat_tmpd 13102 "); 13103 13104 while ($row = $ilDB->fetchAssoc($res)) { 13105 $res_data = $ilDB->query( 13106 " 13107 SELECT * 13108 FROM obj_stat 13109 WHERE 13110 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13111 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13112 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13113 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13114 hh = " . $ilDB->quote($row['hh'], 'integer') 13115 ); 13116 $data = $ilDB->fetchAssoc($res_data); 13117 13118 $ilDB->manipulate( 13119 " 13120 DELETE FROM obj_stat WHERE 13121 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13122 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13123 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13124 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13125 hh = " . $ilDB->quote($row['hh'], 'integer') 13126 ); 13127 13128 $ilDB->manipulate("INSERT INTO obj_stat " . 13129 "(obj_id, obj_type, yyyy, mm, dd, hh, read_count, childs_read_count, spent_seconds, childs_spent_seconds) " . 13130 "VALUES ( " . 13131 $ilDB->quote($data['obj_id'], 'integer') . ', ' . 13132 $ilDB->quote($data['obj_type'], 'text') . ', ' . 13133 $ilDB->quote($data['yyyy'], 'integer') . ', ' . 13134 $ilDB->quote($data['mm'], 'integer') . ', ' . 13135 $ilDB->quote($data['dd'], 'integer') . ', ' . 13136 $ilDB->quote($data['hh'], 'integer') . ', ' . 13137 $ilDB->quote($data['read_count'], 'integer') . ', ' . 13138 $ilDB->quote($data['childs_read_count'], 'integer') . ', ' . 13139 $ilDB->quote($data['spent_seconds'], 'integer') . ', ' . 13140 $ilDB->quote($data['childs_spent_seconds'], 'integer') . 13141 ")"); 13142 13143 $ilDB->manipulate( 13144 " 13145 DELETE FROM obj_stat_tmpd WHERE 13146 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13147 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13148 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13149 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13150 hh = " . $ilDB->quote($row['hh'], 'integer') 13151 ); 13152 } 13153} 13154?> 13155<#4837> 13156<?php 13157//step 3/4 obj_stat adding primary key 13158if ($ilDB->indexExistsByFields('obj_stat', array('obj_id','yyyy','mm'))) { 13159 $ilDB->dropIndexByFields('obj_stat', array('obj_id','yyyy','mm')); 13160} 13161 13162if ($ilDB->indexExistsByFields('obj_stat', array('obj_id'))) { 13163 $ilDB->dropIndexByFields('obj_stat', array('obj_id')); 13164} 13165 13166if ($ilDB->tableExists('obj_stat')) { 13167 $ilDB->addPrimaryKey('obj_stat', array('obj_id','yyyy','mm','dd','hh')); 13168} 13169?> 13170<#4838> 13171<?php 13172//step 4/4 obj_stat removes temp table 13173 13174if ($ilDB->tableExists('obj_stat_tmpd')) { 13175 $ilDB->dropTable('obj_stat_tmpd'); 13176} 13177?> 13178<#4839> 13179<?php 13180//step 1/4 obj_stat_log renames old table 13181 13182if ($ilDB->tableExists('obj_stat_log') && !$ilDB->tableExists('obj_stat_log_old')) { 13183 $ilDB->renameTable("obj_stat_log", "obj_stat_log_old"); 13184} 13185?> 13186<#4840> 13187<?php 13188//step 2/4 obj_stat_log creates new table with unique id and sequenz 13189 13190if (!$ilDB->tableExists('obj_stat_log')) { 13191 $ilDB->createTable('obj_stat_log', array( 13192 'log_id' => array( 13193 'type' => 'integer', 13194 'length' => 4, 13195 'notnull' => true 13196 ), 13197 'obj_id' => array( 13198 'type' => 'integer', 13199 'length' => 4, 13200 'notnull' => true 13201 ), 13202 'obj_type' => array( 13203 'type' => 'text', 13204 'length' => 10, 13205 'notnull' => true 13206 ), 13207 'tstamp' => array( 13208 'type' => 'integer', 13209 'length' => 4, 13210 'notnull' => false 13211 ), 13212 'yyyy' => array( 13213 'type' => 'integer', 13214 'length' => 2, 13215 'notnull' => false 13216 ), 13217 'mm' => array( 13218 'type' => 'integer', 13219 'length' => 1, 13220 'notnull' => false 13221 ), 13222 'dd' => array( 13223 'type' => 'integer', 13224 'length' => 1, 13225 'notnull' => false 13226 ), 13227 'hh' => array( 13228 'type' => 'integer', 13229 'length' => 1, 13230 'notnull' => false 13231 ), 13232 'read_count' => array( 13233 'type' => 'integer', 13234 'length' => 4, 13235 'notnull' => false 13236 ), 13237 'childs_read_count' => array( 13238 'type' => 'integer', 13239 'length' => 4, 13240 'notnull' => false 13241 ), 13242 'spent_seconds' => array( 13243 'type' => 'integer', 13244 'length' => 4, 13245 'notnull' => false 13246 ), 13247 'childs_spent_seconds' => array( 13248 'type' => 'integer', 13249 'length' => 4, 13250 'notnull' => false 13251 ), 13252 )); 13253 $ilDB->addPrimaryKey('obj_stat_log', array('log_id')); 13254 $ilDB->addIndex('obj_stat_log', array('tstamp'), 'i1'); 13255 $ilDB->createSequence('obj_stat_log'); 13256} 13257?> 13258<#4841> 13259<?php 13260//step 3/4 obj_stat_log moves all data to new table 13261 13262if ($ilDB->tableExists('obj_stat_log') && $ilDB->tableExists('obj_stat_log_old')) { 13263 $res = $ilDB->query(" 13264 SELECT * 13265 FROM obj_stat_log_old 13266 "); 13267 13268 while ($row = $ilDB->fetchAssoc($res)) { 13269 $id = $ilDB->nextId('obj_stat_log'); 13270 13271 $ilDB->manipulate( 13272 "INSERT INTO obj_stat_log " . 13273 "(log_id, obj_id, obj_type, tstamp, yyyy, mm, dd, hh, read_count, childs_read_count, spent_seconds, childs_spent_seconds) " . 13274 "VALUES ( " . 13275 $ilDB->quote($id, 'integer') . ', ' . 13276 $ilDB->quote($row['obj_id'], 'integer') . ', ' . 13277 $ilDB->quote($row['obj_type'], 'text') . ', ' . 13278 $ilDB->quote($row['tstamp'], 'integer') . ', ' . 13279 $ilDB->quote($row['yyyy'], 'integer') . ', ' . 13280 $ilDB->quote($row['mm'], 'integer') . ', ' . 13281 $ilDB->quote($row['dd'], 'integer') . ', ' . 13282 $ilDB->quote($row['hh'], 'integer') . ', ' . 13283 $ilDB->quote($row['read_count'], 'integer') . ', ' . 13284 $ilDB->quote($row['childs_read_count'], 'integer') . ', ' . 13285 $ilDB->quote($row['spent_seconds'], 'integer') . ', ' . 13286 $ilDB->quote($row['childs_spent_seconds'], 'integer') . 13287 ")" 13288 ); 13289 13290 $ilDB->manipulate( 13291 " 13292 DELETE FROM obj_stat_log_old WHERE 13293 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13294 obj_type = " . $ilDB->quote($row['obj_type'], 'integer') . " AND 13295 tstamp = " . $ilDB->quote($row['tstamp'], 'integer') . " AND 13296 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13297 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13298 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13299 hh = " . $ilDB->quote($row['hh'], 'integer') . " AND 13300 read_count = " . $ilDB->quote($row['read_count'], 'integer') . " AND 13301 childs_read_count = " . $ilDB->quote($row['childs_read_count'], 'integer') . " AND 13302 spent_seconds = " . $ilDB->quote($row['spent_seconds'], 'integer') . " AND 13303 childs_spent_seconds = " . $ilDB->quote($row['childs_spent_seconds'], 'integer') 13304 ); 13305 } 13306} 13307?> 13308<#4842> 13309<?php 13310//step 4/4 obj_stat_log removes old table 13311 13312if ($ilDB->tableExists('obj_stat_log_old')) { 13313 $ilDB->dropTable('obj_stat_log_old'); 13314} 13315?> 13316<#4843> 13317<?php 13318//step 1/4 obj_stat_tmp renames old table 13319 13320if ($ilDB->tableExists('obj_stat_tmp') && !$ilDB->tableExists('obj_stat_tmp_old')) { 13321 $ilDB->renameTable("obj_stat_tmp", "obj_stat_tmp_old"); 13322} 13323?> 13324<#4844> 13325<?php 13326//step 2/4 obj_stat_tmp creates new table with unique id 13327 13328if (!$ilDB->tableExists('obj_stat_tmp')) { 13329 $ilDB->createTable('obj_stat_tmp', array( 13330 'log_id' => array( 13331 'type' => 'integer', 13332 'length' => 4, 13333 'notnull' => true 13334 ), 13335 'obj_id' => array( 13336 'type' => 'integer', 13337 'length' => 4, 13338 'notnull' => true 13339 ), 13340 'obj_type' => array( 13341 'type' => 'text', 13342 'length' => 10, 13343 'notnull' => true 13344 ), 13345 'tstamp' => array( 13346 'type' => 'integer', 13347 'length' => 4, 13348 'notnull' => false 13349 ), 13350 'yyyy' => array( 13351 'type' => 'integer', 13352 'length' => 2, 13353 'notnull' => false 13354 ), 13355 'mm' => array( 13356 'type' => 'integer', 13357 'length' => 1, 13358 'notnull' => false 13359 ), 13360 'dd' => array( 13361 'type' => 'integer', 13362 'length' => 1, 13363 'notnull' => false 13364 ), 13365 'hh' => array( 13366 'type' => 'integer', 13367 'length' => 1, 13368 'notnull' => false 13369 ), 13370 'read_count' => array( 13371 'type' => 'integer', 13372 'length' => 4, 13373 'notnull' => false 13374 ), 13375 'childs_read_count' => array( 13376 'type' => 'integer', 13377 'length' => 4, 13378 'notnull' => false 13379 ), 13380 'spent_seconds' => array( 13381 'type' => 'integer', 13382 'length' => 4, 13383 'notnull' => false 13384 ), 13385 'childs_spent_seconds' => array( 13386 'type' => 'integer', 13387 'length' => 4, 13388 'notnull' => false 13389 ), 13390 )); 13391 $ilDB->addPrimaryKey('obj_stat_tmp', array('log_id')); 13392 $ilDB->addIndex('obj_stat_tmp', array('obj_id', 'obj_type', 'yyyy', 'mm', 'dd', 'hh'), 'i1'); 13393 $ilDB->createSequence('obj_stat_tmp'); 13394} 13395?> 13396<#4845> 13397<?php 13398//step 3/4 obj_stat_tmp moves all data to new table 13399 13400if ($ilDB->tableExists('obj_stat_tmp') && $ilDB->tableExists('obj_stat_tmp_old')) { 13401 $res = $ilDB->query(" 13402 SELECT * 13403 FROM obj_stat_tmp_old 13404"); 13405 13406 while ($row = $ilDB->fetchAssoc($res)) { 13407 $id = $ilDB->nextId('obj_stat_tmp'); 13408 13409 $ilDB->manipulate( 13410 "INSERT INTO obj_stat_tmp " . 13411 "(log_id, obj_id, obj_type, tstamp, yyyy, mm, dd, hh, read_count, childs_read_count, spent_seconds, childs_spent_seconds) " . 13412 "VALUES ( " . 13413 $ilDB->quote($id, 'integer') . ', ' . 13414 $ilDB->quote($row['obj_id'], 'integer') . ', ' . 13415 $ilDB->quote($row['obj_type'], 'text') . ', ' . 13416 $ilDB->quote($row['tstamp'], 'integer') . ', ' . 13417 $ilDB->quote($row['yyyy'], 'integer') . ', ' . 13418 $ilDB->quote($row['mm'], 'integer') . ', ' . 13419 $ilDB->quote($row['dd'], 'integer') . ', ' . 13420 $ilDB->quote($row['hh'], 'integer') . ', ' . 13421 $ilDB->quote($row['read_count'], 'integer') . ', ' . 13422 $ilDB->quote($row['childs_read_count'], 'integer') . ', ' . 13423 $ilDB->quote($row['spent_seconds'], 'integer') . ', ' . 13424 $ilDB->quote($row['childs_spent_seconds'], 'integer') . 13425 ")" 13426 ); 13427 13428 $ilDB->manipulate( 13429 " 13430 DELETE FROM obj_stat_tmp_old WHERE 13431 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13432 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13433 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13434 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13435 hh = " . $ilDB->quote($row['hh'], 'integer') . " AND 13436 read_count = " . $ilDB->quote($row['read_count'], 'integer') . " AND 13437 childs_read_count = " . $ilDB->quote($row['childs_read_count'], 'integer') . " AND 13438 spent_seconds = " . $ilDB->quote($row['spent_seconds'], 'integer') . " AND 13439 childs_spent_seconds = " . $ilDB->quote($row['childs_spent_seconds'], 'integer') 13440 ); 13441 } 13442} 13443?> 13444<#4846> 13445<?php 13446//step 4/4 obj_stat_tmp_old removes old table 13447 13448if ($ilDB->tableExists('obj_stat_tmp_old')) { 13449 $ilDB->dropTable('obj_stat_tmp_old'); 13450} 13451?> 13452<#4847> 13453<?php 13454//page_question adding primary key 13455 13456if ($ilDB->tableExists('page_question')) { 13457 $ilDB->addPrimaryKey('page_question', array('page_id', 'question_id')); 13458} 13459?> 13460<#4848> 13461<?php 13462//step 1/4 page_style_usage renames old table 13463 13464if ($ilDB->tableExists('page_style_usage') && !$ilDB->tableExists('page_style_usage_old')) { 13465 $ilDB->renameTable("page_style_usage", "page_style_usage_old"); 13466} 13467?> 13468<#4849> 13469<?php 13470//step 2/4 page_style_usage creates new table with unique id and sequenz 13471 13472if (!$ilDB->tableExists('page_style_usage')) { 13473 $ilDB->createTable('page_style_usage', array( 13474 'id' => array( 13475 'type' => 'integer', 13476 'length' => 4, 13477 'notnull' => true 13478 ), 13479 'page_id' => array( 13480 'type' => 'integer', 13481 'length' => 4, 13482 'notnull' => true 13483 ), 13484 'page_type' => array( 13485 'type' => 'text', 13486 'length' => 10, 13487 'fixed' => true, 13488 'notnull' => true 13489 ), 13490 'page_nr' => array( 13491 'type' => 'integer', 13492 'length' => 4, 13493 'notnull' => true 13494 ), 13495 'template' => array( 13496 'type' => 'integer', 13497 'length' => 1, 13498 'notnull' => true, 13499 'default' => 0 13500 ), 13501 'stype' => array( 13502 'type' => 'text', 13503 'length' => 30, 13504 'fixed' => false, 13505 'notnull' => false 13506 ), 13507 'sname' => array( 13508 'type' => 'text', 13509 'length' => 30, 13510 'fixed' => true, 13511 'notnull' => false 13512 ), 13513 'page_lang' => array( 13514 'type' => 'text', 13515 'length' => 2, 13516 'notnull' => true, 13517 'default' => "-") 13518 )); 13519 $ilDB->addPrimaryKey('page_style_usage', array('id')); 13520 $ilDB->createSequence('page_style_usage'); 13521} 13522?> 13523<#4850> 13524<?php 13525//step 3/4 page_style_usage moves all data to new table 13526 13527if ($ilDB->tableExists('page_style_usage') && $ilDB->tableExists('page_style_usage_old')) { 13528 $res = $ilDB->query(" 13529 SELECT * 13530 FROM page_style_usage_old 13531 "); 13532 13533 $ilDB->manipulate("DELETE FROM page_style_usage"); 13534 13535 while ($row = $ilDB->fetchAssoc($res)) { 13536 $id = $ilDB->nextId('page_style_usage'); 13537 13538 $ilDB->manipulate("INSERT INTO page_style_usage " . 13539 "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (" . 13540 $ilDB->quote($id, "integer") . "," . 13541 $ilDB->quote($row['page_id'], "integer") . "," . 13542 $ilDB->quote($row['page_type'], "text") . "," . 13543 $ilDB->quote($row['page_lang'], "text") . "," . 13544 $ilDB->quote($row['page_nr'], "integer") . "," . 13545 $ilDB->quote($row['template'], "integer") . "," . 13546 $ilDB->quote($row['stype'], "text") . "," . 13547 $ilDB->quote($row['sname'], "text") . 13548 ")"); 13549 } 13550} 13551?> 13552<#4851> 13553<?php 13554//step 4/4 page_style_usage removes old table 13555 13556if ($ilDB->tableExists('page_style_usage_old')) { 13557 $ilDB->dropTable('page_style_usage_old'); 13558} 13559?> 13560<#4852> 13561<?php 13562//page_question adding primary key 13563 13564// fixes duplicate entries 13565$set1 = $ilDB->query("SELECT DISTINCT user_id FROM personal_pc_clipboard ORDER BY user_id"); 13566 13567while ($r1 = $ilDB->fetchAssoc($set1)) { 13568 $set2 = $ilDB->query("SELECT * FROM personal_pc_clipboard WHERE user_id = " . $ilDB->quote($r1["user_id"], "integer") . 13569 " ORDER BY insert_time ASC"); 13570 $new_recs = array(); 13571 while ($r2 = $ilDB->fetchAssoc($set2)) { 13572 $new_recs[$r2["user_id"] . ":" . $r2["insert_time"] . ":" . $r2["order_nr"]] = $r2; 13573 } 13574 $ilDB->manipulate("DELETE FROM personal_pc_clipboard WHERE user_id = " . $ilDB->quote($r1["user_id"], "integer")); 13575 foreach ($new_recs as $r) { 13576 $ilDB->insert("personal_pc_clipboard", array( 13577 "user_id" => array("integer", $r["user_id"]), 13578 "content" => array("clob", $r["content"]), 13579 "insert_time" => array("timestamp", $r["insert_time"]), 13580 "order_nr" => array("integer", $r["order_nr"]) 13581 )); 13582 } 13583} 13584 13585if ($ilDB->indexExistsByFields('personal_pc_clipboard', array('user_id'))) { 13586 $ilDB->dropIndexByFields('obj_stat', array('user_id')); 13587} 13588 13589if ($ilDB->tableExists('personal_pc_clipboard')) { 13590 $ilDB->addPrimaryKey('personal_pc_clipboard', array('user_id', 'insert_time', 'order_nr')); 13591} 13592?> 13593<#4853> 13594<?php 13595//step 1/4 ut_lp_collections search for dublicates and store it in ut_lp_collections_tmp 13596 13597if ($ilDB->tableExists('ut_lp_collections')) { 13598 $res = $ilDB->query(" 13599 SELECT obj_id, item_id 13600 FROM ut_lp_collections 13601 GROUP BY obj_id, item_id 13602 HAVING COUNT(obj_id) > 1 13603 "); 13604 13605 if ($ilDB->numRows($res)) { 13606 if (!$ilDB->tableExists('ut_lp_collections_tmp')) { 13607 $ilDB->createTable('ut_lp_collections_tmp', array( 13608 'obj_id' => array( 13609 'type' => 'integer', 13610 'length' => 8, 13611 'notnull' => true, 13612 'default' => 0 13613 ), 13614 'item_id' => array( 13615 'type' => 'integer', 13616 'length' => 8, 13617 'notnull' => true, 13618 'default' => 0 13619 ) 13620 )); 13621 $ilDB->addPrimaryKey('ut_lp_collections_tmp', array('obj_id','item_id')); 13622 } 13623 13624 while ($row = $ilDB->fetchAssoc($res)) { 13625 $ilDB->replace('ut_lp_collections_tmp', array(), array( 13626 'obj_id' => array('integer', $row['obj_id']), 13627 'item_id' => array('integer', $row['item_id']) 13628 )); 13629 } 13630 } 13631} 13632?> 13633<#4854> 13634<?php 13635//step 2/4 ut_lp_collections deletes dublicates stored in ut_lp_collections_tmp 13636 13637if ($ilDB->tableExists('ut_lp_collections_tmp')) { 13638 $res = $ilDB->query(" 13639 SELECT obj_id, item_id 13640 FROM ut_lp_collections_tmp 13641 "); 13642 13643 while ($row = $ilDB->fetchAssoc($res)) { 13644 $res_data = $ilDB->query( 13645 " 13646 SELECT * 13647 FROM ut_lp_collections 13648 WHERE 13649 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13650 item_id = " . $ilDB->quote($row['item_id'], 'integer') 13651 ); 13652 $data = $ilDB->fetchAssoc($res_data); 13653 13654 $ilDB->manipulate( 13655 "DELETE FROM ut_lp_collections WHERE" . 13656 " obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . 13657 " AND item_id = " . $ilDB->quote($row['item_id'], 'integer') 13658 ); 13659 13660 $ilDB->manipulate("INSERT INTO ut_lp_collections (obj_id, item_id, grouping_id, num_obligatory, active, lpmode) " . 13661 "VALUES ( " . 13662 $ilDB->quote($data['obj_id'], 'integer') . ', ' . 13663 $ilDB->quote($data['item_id'], 'integer') . ', ' . 13664 $ilDB->quote($data['grouping_id'], 'integer') . ', ' . 13665 $ilDB->quote($data['num_obligatory'], 'integer') . ', ' . 13666 $ilDB->quote($data['active'], 'integer') . ', ' . 13667 $ilDB->quote($data['lpmode'], 'text') . 13668 ")"); 13669 13670 $ilDB->manipulate( 13671 "DELETE FROM ut_lp_collections_tmp WHERE" . 13672 " obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . 13673 " AND item_id = " . $ilDB->quote($row['item_id'], 'integer') 13674 ); 13675 } 13676} 13677?> 13678<#4855> 13679<?php 13680//step 3/4 ut_lp_collections adding primary key and removing indexes 13681 13682if ($ilDB->indexExistsByFields('ut_lp_collections', array('obj_id', 'item_id'))) { 13683 $ilDB->dropIndexByFields('ut_lp_collections', array('obj_id', 'item_id')); 13684} 13685 13686if ($ilDB->tableExists('ut_lp_collections')) { 13687 $ilDB->addPrimaryKey('ut_lp_collections', array('obj_id', 'item_id')); 13688} 13689?> 13690<#4856> 13691<?php 13692//step 4/4 ut_lp_collections removes temp table 13693 13694if ($ilDB->tableExists('ut_lp_collections_tmp')) { 13695 $ilDB->dropTable('ut_lp_collections_tmp'); 13696} 13697?> 13698<#4857> 13699<?php 13700//usr_session_stats adding primary key 13701$usr_session_stats_temp_num = " 13702SELECT COUNT(*) cnt 13703FROM ( 13704 SELECT slot_begin 13705 FROM usr_session_stats 13706 GROUP BY slot_begin 13707 HAVING COUNT(*) > 1 13708) duplicateSessionStats 13709"; 13710$res = $ilDB->query($usr_session_stats_temp_num); 13711$data = $ilDB->fetchAssoc($res); 13712if ($data['cnt']) { 13713 $usr_session_stats_dup_query = " 13714 SELECT * 13715 FROM usr_session_stats 13716 GROUP BY slot_begin 13717 HAVING COUNT(*) > 1 13718 "; 13719 $res = $ilDB->query($usr_session_stats_dup_query); 13720 13721 $stmt_del = $ilDB->prepareManip("DELETE FROM usr_session_stats WHERE slot_begin = ? ", array('integer')); 13722 $stmt_in = $ilDB->prepareManip( 13723 "INSERT INTO usr_session_stats (" 13724 . "slot_begin" 13725 . ",slot_end" 13726 . ",active_min" 13727 . ",active_max" 13728 . ",active_avg" 13729 . ",active_end" 13730 . ",opened" 13731 . ",closed_manual" 13732 . ",closed_expire" 13733 . ",closed_idle" 13734 . ",closed_idle_first" 13735 . ",closed_limit" 13736 . ",closed_login" 13737 . ",max_sessions" 13738 . ",closed_misc" 13739 . ") VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", 13740 array( 13741 'integer', 13742 'integer', 13743 'integer', 13744 'integer', 13745 'integer', 13746 'integer', 13747 'integer', 13748 'integer', 13749 'integer', 13750 'integer', 13751 'integer', 13752 'integer', 13753 'integer', 13754 'integer', 13755 'integer' 13756 ) 13757 ); 13758 13759 while ($row = $ilDB->fetchAssoc($res)) { 13760 $ilDB->execute($stmt_del, array($row['slot_begin'])); 13761 $ilDB->execute( 13762 $stmt_in, 13763 array( 13764 $row['slot_begin'], 13765 $row['slot_end'], 13766 $row['active_min'], 13767 $row['active_max'], 13768 $row['active_avg'], 13769 $row['active_end'], 13770 $row['opened'], 13771 $row['closed_manual'], 13772 $row['closed_expire'], 13773 $row['closed_idle'], 13774 $row['closed_idle_first'], 13775 $row['closed_limit'], 13776 $row['closed_login'], 13777 $row['max_sessions'], 13778 $row['closed_misc'] 13779 ) 13780 ); 13781 } 13782} 13783 13784$res = $ilDB->query($usr_session_stats_temp_num); 13785$data = $ilDB->fetchAssoc($res); 13786if ($data['cnt'] > 0) { 13787 setup_exit("There are still duplicate entries in table 'usr_session_stats'. Please execute this database update step again."); 13788} 13789 13790 13791if ($ilDB->tableExists('usr_session_stats')) { 13792 $ilDB->addPrimaryKey('usr_session_stats', array('slot_begin')); 13793} 13794?> 13795<#4858> 13796<?php 13797//step 1/2 usr_session_log search for dublicates and delete them 13798 13799if ($ilDB->tableExists('usr_session_log')) { 13800 $res = $ilDB->query(" 13801 SELECT tstamp, maxval, user_id 13802 FROM usr_session_log 13803 GROUP BY tstamp, maxval, user_id 13804 HAVING COUNT(tstamp) > 1 13805 "); 13806 13807 while ($row = $ilDB->fetchAssoc($res)) { 13808 $ilDB->manipulate( 13809 "DELETE FROM usr_session_log WHERE" . 13810 " tstamp = " . $ilDB->quote($row['tstamp'], 'integer') . 13811 " AND maxval = " . $ilDB->quote($row['maxval'], 'integer') . 13812 " AND user_id = " . $ilDB->quote($row['user_id'], 'integer') 13813 ); 13814 13815 $ilDB->manipulate("INSERT INTO usr_session_log (tstamp, maxval, user_id) " . 13816 "VALUES ( " . 13817 $ilDB->quote($row['tstamp'], 'integer') . ', ' . 13818 $ilDB->quote($row['maxval'], 'integer') . ', ' . 13819 $ilDB->quote($row['user_id'], 'integer') . 13820 ")"); 13821 } 13822} 13823?> 13824<#4859> 13825<?php 13826//step 2/2 usr_session_log adding primary key 13827 13828if ($ilDB->tableExists('usr_session_log')) { 13829 $ilDB->addPrimaryKey('usr_session_log', array('tstamp', 'maxval', 'user_id')); 13830} 13831?> 13832<#4860> 13833<?php 13834//step 1/2 style_template_class search for dublicates and delete them 13835 13836if ($ilDB->tableExists('style_template_class')) { 13837 $res = $ilDB->query(" 13838 SELECT template_id, class_type 13839 FROM style_template_class 13840 GROUP BY template_id, class_type 13841 HAVING COUNT(template_id) > 1 13842 "); 13843 13844 while ($row = $ilDB->fetchAssoc($res)) { 13845 $res_data = $ilDB->query( 13846 " 13847 SELECT * 13848 FROM style_template_class 13849 WHERE 13850 template_id = " . $ilDB->quote($row['template_id'], 'integer') . " AND 13851 class_type = " . $ilDB->quote($row['class_type'], 'integer') 13852 ); 13853 $data = $ilDB->fetchAssoc($res_data); 13854 13855 $ilDB->manipulate( 13856 "DELETE FROM style_template_class WHERE" . 13857 " template_id = " . $ilDB->quote($row['template_id'], 'integer') . 13858 " AND class_type = " . $ilDB->quote($row['class_type'], 'text') 13859 ); 13860 13861 $ilDB->manipulate("INSERT INTO style_template_class (template_id, class_type, class) " . 13862 "VALUES ( " . 13863 $ilDB->quote($row['template_id'], 'integer') . ', ' . 13864 $ilDB->quote($row['class_type'], 'text') . ', ' . 13865 $ilDB->quote($data['class'], 'text') . 13866 ")"); 13867 } 13868} 13869?> 13870<#4861> 13871<?php 13872//step 2/2 style_template_class adding primary key 13873 13874if ($ilDB->tableExists('style_template_class')) { 13875 $ilDB->addPrimaryKey('style_template_class', array('template_id', 'class_type', 'class')); 13876} 13877?> 13878<#4862> 13879<?php 13880//step 1/2 style_folder_styles search for dublicates and delete them 13881 13882if ($ilDB->tableExists('style_folder_styles')) { 13883 $res = $ilDB->query(" 13884 SELECT folder_id, style_id 13885 FROM style_folder_styles 13886 GROUP BY folder_id, style_id 13887 HAVING COUNT(folder_id) > 1 13888 "); 13889 13890 while ($row = $ilDB->fetchAssoc($res)) { 13891 $ilDB->manipulate( 13892 "DELETE FROM style_folder_styles WHERE" . 13893 " folder_id = " . $ilDB->quote($row['folder_id'], 'integer') . 13894 " AND style_id = " . $ilDB->quote($row['style_id'], 'integer') 13895 ); 13896 13897 $ilDB->manipulate("INSERT INTO style_folder_styles (folder_id, style_id) " . 13898 "VALUES ( " . 13899 $ilDB->quote($row['folder_id'], 'integer') . ', ' . 13900 $ilDB->quote($row['style_id'], 'integer') . 13901 ")"); 13902 } 13903} 13904?> 13905<#4863> 13906<?php 13907//step 2/2 style_folder_styles adding primary key 13908if ($ilDB->indexExistsByFields('style_folder_styles', array('folder_id'))) { 13909 $ilDB->dropIndexByFields('style_folder_styles', array('folder_id')); 13910} 13911 13912if ($ilDB->tableExists('style_folder_styles')) { 13913 $ilDB->addPrimaryKey('style_folder_styles', array('folder_id', 'style_id')); 13914} 13915?> 13916<#4864> 13917<?php 13918//step 1/4 mob_parameter search for dublicates and store it in mob_parameter_tmp 13919 13920if ($ilDB->tableExists('mob_parameter')) { 13921 $res = $ilDB->query(" 13922 SELECT med_item_id, name 13923 FROM mob_parameter 13924 GROUP BY med_item_id, name 13925 HAVING COUNT(med_item_id) > 1 13926 "); 13927 13928 if ($ilDB->numRows($res)) { 13929 if (!$ilDB->tableExists('mob_parameter_tmp')) { 13930 $ilDB->createTable('mob_parameter_tmp', array( 13931 'med_item_id' => array( 13932 'type' => 'integer', 13933 'length' => 8, 13934 'notnull' => true, 13935 'default' => 0 13936 ), 13937 'name' => array( 13938 'type' => 'text', 13939 'length' => 50, 13940 'notnull' => true, 13941 ) 13942 )); 13943 $ilDB->addPrimaryKey('mob_parameter_tmp', array('med_item_id','name')); 13944 } 13945 13946 while ($row = $ilDB->fetchAssoc($res)) { 13947 $ilDB->replace('mob_parameter_tmp', array(), array( 13948 'med_item_id' => array('integer', $row['med_item_id']), 13949 'name' => array('text', $row['name']) 13950 )); 13951 } 13952 } 13953} 13954?> 13955<#4865> 13956<?php 13957//step 2/4 mob_parameter deletes dublicates stored in mob_parameter_tmp 13958 13959if ($ilDB->tableExists('mob_parameter_tmp')) { 13960 $res = $ilDB->query(" 13961 SELECT med_item_id, name 13962 FROM mob_parameter_tmp 13963"); 13964 13965 while ($row = $ilDB->fetchAssoc($res)) { 13966 $res_data = $ilDB->query( 13967 " 13968 SELECT * 13969 FROM mob_parameter 13970 WHERE 13971 med_item_id = " . $ilDB->quote($row['med_item_id'], 'integer') . " AND 13972 name = " . $ilDB->quote($row['name'], 'text') 13973 ); 13974 $data = $ilDB->fetchAssoc($res_data); 13975 13976 $ilDB->manipulate( 13977 "DELETE FROM mob_parameter WHERE" . 13978 " med_item_id = " . $ilDB->quote($row['med_item_id'], 'integer') . 13979 " AND name = " . $ilDB->quote($row['name'], 'integer') 13980 ); 13981 13982 $ilDB->manipulate("INSERT INTO mob_parameter (med_item_id, name, value) " . 13983 "VALUES ( " . 13984 $ilDB->quote($data['med_item_id'], 'integer') . ', ' . 13985 $ilDB->quote($data['name'], 'text') . ', ' . 13986 $ilDB->quote($data['value'], 'text') . 13987 ")"); 13988 13989 $ilDB->manipulate( 13990 "DELETE FROM mob_parameter_tmp WHERE" . 13991 " med_item_id = " . $ilDB->quote($row['med_item_id'], 'integer') . 13992 " AND name = " . $ilDB->quote($row['name'], 'text') 13993 ); 13994 } 13995} 13996?> 13997<#4866> 13998<?php 13999//step 3/4 mob_parameter adding primary key 14000if ($ilDB->indexExistsByFields('mob_parameter', array('med_item_id'))) { 14001 $ilDB->dropIndexByFields('mob_parameter', array('med_item_id')); 14002} 14003 14004if ($ilDB->tableExists('mob_parameter')) { 14005 $ilDB->addPrimaryKey('mob_parameter', array('med_item_id', 'name')); 14006} 14007?> 14008<#4867> 14009<?php 14010//step 4/4 mob_parameter removes temp table 14011 14012if ($ilDB->tableExists('mob_parameter_tmp')) { 14013 $ilDB->dropTable('mob_parameter_tmp'); 14014} 14015?> 14016<#4868> 14017<?php 14018//step 1/4 link_check renames old table 14019 14020if ($ilDB->tableExists('link_check') && !$ilDB->tableExists('link_check_old')) { 14021 $ilDB->renameTable("link_check", "link_check_old"); 14022} 14023?> 14024<#4869> 14025<?php 14026//step 2/4 link_check creates new table with unique id and sequenz 14027 14028if (!$ilDB->tableExists('link_check')) { 14029 $ilDB->createTable('link_check', array( 14030 'id' => array( 14031 'type' => 'integer', 14032 'length' => 4, 14033 'notnull' => true 14034 ), 14035 'obj_id' => array( 14036 'type' => 'integer', 14037 'length' => 4, 14038 'notnull' => true 14039 ), 14040 'page_id' => array( 14041 'type' => 'integer', 14042 'length' => 4, 14043 'notnull' => true 14044 ), 14045 'url' => array( 14046 'type' => 'text', 14047 'length' => 255, 14048 'notnull' => false, 14049 'default' => null 14050 ), 14051 'parent_type' => array( 14052 'type' => 'text', 14053 'length' => 8, 14054 'notnull' => false, 14055 'default' => null 14056 ), 14057 'http_status_code' => array( 14058 'type' => 'integer', 14059 'length' => 4, 14060 'notnull' => true 14061 ), 14062 'last_check' => array( 14063 'type' => 'integer', 14064 'length' => 4, 14065 'notnull' => true 14066 ) 14067 )); 14068 $ilDB->addPrimaryKey('link_check', array('id')); 14069 $ilDB->addIndex('link_check', array('obj_id'), 'i1'); 14070 $ilDB->createSequence('link_check'); 14071} 14072?> 14073<#4870> 14074<?php 14075//step 3/4 link_check moves all data to new table 14076 14077if ($ilDB->tableExists('link_check') && $ilDB->tableExists('link_check_old')) { 14078 $res = $ilDB->query(" 14079 SELECT * 14080 FROM link_check_old 14081 "); 14082 14083 while ($row = $ilDB->fetchAssoc($res)) { 14084 $id = $ilDB->nextId('link_check'); 14085 14086 $ilDB->manipulate( 14087 "INSERT INTO link_check (id, obj_id, page_id, url, parent_type, http_status_code, last_check)" . 14088 " VALUES (" . 14089 $ilDB->quote($id, "integer") . 14090 "," . $ilDB->quote($row['obj_id'], "integer") . 14091 "," . $ilDB->quote($row['page_id'], "integer") . 14092 "," . $ilDB->quote($row['url'], "text") . 14093 "," . $ilDB->quote($row['parent_type'], "text") . 14094 "," . $ilDB->quote($row['http_status_code'], "integer") . 14095 "," . $ilDB->quote($row['last_check'], "integer") . 14096 ")" 14097 ); 14098 14099 $ilDB->manipulateF( 14100 "DELETE FROM link_check_old WHERE obj_id = %s AND page_id = %s AND url = %s AND parent_type = %s AND http_status_code = %s AND last_check = %s", 14101 array('integer', 'integer', 'text', 'text', 'integer', 'integer'), 14102 array($row['obj_id'], $row['page_id'], $row['url'], $row['parent_type'], $row['http_status_code'], $row['last_check']) 14103 ); 14104 } 14105} 14106?> 14107<#4871> 14108<?php 14109//step 4/4 link_check removes old table 14110 14111if ($ilDB->tableExists('link_check_old')) { 14112 $ilDB->dropTable('link_check_old'); 14113} 14114?> 14115<#4872> 14116<?php 14117//$num_query = " 14118// SELECT COUNT(*) cnt 14119// FROM ( 14120// SELECT tree, child 14121// FROM bookmark_tree 14122// GROUP BY tree, child 14123// HAVING COUNT(*) > 1 14124// ) duplicateBookmarkTree 14125//"; 14126//$res = $ilDB->query($num_query); 14127//$data = $ilDB->fetchAssoc($res); 14128// 14129//if($data['cnt'] > 0) 14130//{ 14131// echo "<pre> 14132// 14133// Dear Administrator, 14134// 14135// DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 14136// 14137// The update process has been stopped due to a data consistency issue in table 'bookmark_tree'. 14138// The values in field 'tree' and 'child' should be unique together, but there are dublicated values in these fields. 14139// You have to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 14140// 14141// SELECT * 14142// FROM bookmark_tree first 14143// WHERE EXISTS ( 14144// SELECT second.tree, second.child 14145// FROM bookmark_tree second 14146// WHERE first.tree = second.tree AND first.child = second.child 14147// GROUP BY second.tree, second.child 14148// HAVING COUNT(second.tree) > 1 14149// ); 14150// 14151// If you have fixed the Problem and try to rerun the update process, this warning will be skipped. 14152// 14153// Please ensure to backup your current database before fixing the database. 14154// Furthermore disable your client while fixing the database. 14155// 14156// For further questions use our <a href='http://mantis.ilias.de'>Bugtracker</a> or write a message to the responsible <a href='http://www.ilias.de/docu/goto_docu_pg_9985_42.html'>Maintainer</a>. 14157// 14158// Best regards, 14159// The Bookmark maintainer 14160// 14161// </pre>"; 14162// 14163// exit(); 14164//} 14165// 14166// 14167//if($ilDB->tableExists('bookmark_tree')) 14168//{ 14169// $ilDB->addPrimaryKey('bookmark_tree', array('tree', 'child')); 14170//} 14171 14172?> 14173<#4873> 14174<?php 14175$num_query = " 14176 SELECT COUNT(*) cnt 14177 FROM ( 14178 SELECT lm_id, child 14179 FROM lm_tree 14180 GROUP BY lm_id, child 14181 HAVING COUNT(*) > 1 14182 ) duplicateLMTree 14183"; 14184$res = $ilDB->query($num_query); 14185$data = $ilDB->fetchAssoc($res); 14186 14187if ($data['cnt'] > 0) { 14188 setup_exit(" 14189 14190 Dear Administrator, 14191 14192 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 14193 14194 The update process has been stopped due to a data consistency issue in table 'lm_tree'. 14195 The values in field 'lm_id' and 'child' should be unique together, but there are dublicated values in these fields. 14196 You have to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 14197 14198 SELECT * 14199 FROM lm_tree first 14200 WHERE EXISTS ( 14201 SELECT second.lm_id, second.child 14202 FROM lm_tree second 14203 WHERE first.lm_id = second.lm_id AND first.child = second.child 14204 GROUP BY second.lm_id, second.child 14205 HAVING COUNT(second.lm_id) > 1 14206 ); 14207 14208 If you have fixed the Problem and try to rerun the update process, this warning will be skipped. 14209 14210 Please ensure to backup your current database before fixing the database. 14211 Furthermore disable your client while fixing the database. 14212 14213 For further questions use our <a href='http://mantis.ilias.de'>Bugtracker</a> or write a message to the responsible <a href='http://www.ilias.de/docu/goto_docu_pg_9985_42.html'>Maintainer</a>. 14214 14215 Best regards, 14216 The Learning Modules maintainer 14217 14218 "); 14219} 14220 14221 14222if ($ilDB->tableExists('lm_tree')) { 14223 $ilDB->addPrimaryKey('lm_tree', array('lm_id', 'child')); 14224} 14225 14226?> 14227<#4874> 14228<?php 14229$num_query = " 14230 SELECT COUNT(*) cnt 14231 FROM ( 14232 SELECT mep_id, child 14233 FROM mep_tree 14234 GROUP BY mep_id, child 14235 HAVING COUNT(*) > 1 14236 ) duplicateMEPTree 14237"; 14238$res = $ilDB->query($num_query); 14239$data = $ilDB->fetchAssoc($res); 14240 14241if ($data['cnt'] > 0) { 14242 setup_exit(" 14243 14244 Dear Administrator, 14245 14246 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 14247 14248 The update process has been stopped due to a data consistency issue in table 'mep_tree'. 14249 The values in field 'mep_id' and 'child' should be unique together, but there are dublicated values in these fields. 14250 You have to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 14251 14252 SELECT * 14253 FROM mep_tree first 14254 WHERE EXISTS ( 14255 SELECT second.mep_id, second.child 14256 FROM mep_tree second 14257 WHERE first.mep_id = second.mep_id AND first.child = second.child 14258 GROUP BY second.mep_id, second.child 14259 HAVING COUNT(second.mep_id) > 1 14260 ); 14261 14262 If you have fixed the Problem and try to rerun the update process, this warning will be skipped. 14263 14264 Please ensure to backup your current database before fixing the database. 14265 Furthermore disable your client while fixing the database. 14266 14267 For further questions use our <a href='http://mantis.ilias.de'>Bugtracker</a> or write a message to the responsible <a href='http://www.ilias.de/docu/goto_docu_pg_9985_42.html'>Maintainer</a>. 14268 14269 Best regards, 14270 The Media Pool maintainer 14271 "); 14272} 14273 14274 14275if ($ilDB->tableExists('mep_tree')) { 14276 $ilDB->addPrimaryKey('mep_tree', array('mep_id', 'child')); 14277} 14278 14279?> 14280<#4875> 14281<?php 14282$num_query = " 14283 SELECT COUNT(*) cnt 14284 FROM ( 14285 SELECT skl_tree_id, child 14286 FROM skl_tree 14287 GROUP BY skl_tree_id, child 14288 HAVING COUNT(*) > 1 14289 ) duplicateSKLTree 14290"; 14291$res = $ilDB->query($num_query); 14292$data = $ilDB->fetchAssoc($res); 14293 14294if ($data['cnt'] > 0) { 14295 setup_exit(" 14296 14297 Dear Administrator, 14298 14299 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 14300 14301 The update process has been stopped due to a data consistency issue in table 'skl_tree'. 14302 The values in field 'skl_tree_id' and 'child' should be unique together, but there are dublicated values in these fields. 14303 You have to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 14304 14305 SELECT * 14306 FROM skl_tree first 14307 WHERE EXISTS ( 14308 SELECT second.skl_tree_id, second.child 14309 FROM skl_tree second 14310 WHERE first.skl_tree_id = second.skl_tree_id AND first.child = second.child 14311 GROUP BY second.skl_tree_id, second.child 14312 HAVING COUNT(second.skl_tree_id) > 1 14313 ); 14314 14315 If you have fixed the Problem and try to rerun the update process, this warning will be skipped. 14316 14317 Please ensure to backup your current database before fixing the database. 14318 Furthermore disable your client while fixing the database. 14319 14320 For further questions use our <a href='http://mantis.ilias.de'>Bugtracker</a> or write a message to the responsible <a href='http://www.ilias.de/docu/goto_docu_pg_9985_42.html'>Maintainer</a>. 14321 14322 Best regards, 14323 The Competence Managment maintainer 14324 "); 14325} 14326 14327 14328if ($ilDB->tableExists('skl_tree')) { 14329 $ilDB->addPrimaryKey('skl_tree', array('skl_tree_id', 'child')); 14330} 14331 14332?> 14333<#4876> 14334<?php 14335//step 1/4 benchmark renames old table 14336 14337if ($ilDB->tableExists('benchmark') && !$ilDB->tableExists('benchmark_old')) { 14338 $ilDB->renameTable("benchmark", "benchmark_old"); 14339} 14340?> 14341<#4877> 14342<?php 14343//step 2/4 benchmark creates new table with unique id and sequenz 14344 14345if (!$ilDB->tableExists('benchmark')) { 14346 $ilDB->createTable('benchmark', array( 14347 'id' => array( 14348 'type' => 'integer', 14349 'length' => 4, 14350 'notnull' => true 14351 ), 14352 "cdate" => array( 14353 "notnull" => false, 14354 "type" => "timestamp" 14355 ), 14356 "module" => array( 14357 "notnull" => false, 14358 "length" => 150, 14359 "fixed" => false, 14360 "type" => "text" 14361 ), 14362 "benchmark" => array( 14363 "notnull" => false, 14364 "length" => 150, 14365 "fixed" => false, 14366 "type" => "text" 14367 ), 14368 "duration" => array( 14369 "notnull" => false, 14370 "type" => "float" 14371 ), 14372 "sql_stmt" => array( 14373 "notnull" => false, 14374 "type" => "clob" 14375 ) 14376 )); 14377 $ilDB->addPrimaryKey('benchmark', array('id')); 14378 $ilDB->addIndex('benchmark', array("module","benchmark"), 'i1'); 14379 $ilDB->createSequence('benchmark'); 14380} 14381?> 14382<#4878> 14383<?php 14384//step 3/4 benchmark moves all data to new table 14385 14386if ($ilDB->tableExists('benchmark') && $ilDB->tableExists('benchmark_old')) { 14387 $res = $ilDB->query(" 14388 SELECT * 14389 FROM benchmark_old 14390 "); 14391 14392 while ($row = $ilDB->fetchAssoc($res)) { 14393 $id = $ilDB->nextId('benchmark'); 14394 14395 $ilDB->insert("benchmark", array( 14396 "id" => array("integer", $id), 14397 "cdate" => array("timestamp", $row['cdate']), 14398 "module" => array("text",$row['module']), 14399 "benchmark" => array("text", $row['benchmark']), 14400 "duration" => array("float", $row['duration']), 14401 "sql_stmt" => array("clob", $row['sql_stmt']) 14402 )); 14403 14404 $ilDB->manipulateF( 14405 "DELETE FROM benchmark_old WHERE cdate = %s AND module = %s AND benchmark = %s AND duration = %s ", 14406 array('timestamp', 'text', 'text', 'float'), 14407 array($row['cdate'], $row['module'], $row['benchmark'], $row['duration']) 14408 ); 14409 } 14410} 14411?> 14412<#4879> 14413<?php 14414//step 4/4 benchmark removes old table 14415 14416if ($ilDB->tableExists('benchmark_old')) { 14417 $ilDB->dropTable('benchmark_old'); 14418} 14419?> 14420<#4880> 14421<?php 14422//step skl_user_skill_level adding primary key 14423if ($ilDB->tableExists('skl_user_skill_level')) { 14424 // get rid of duplicates 14425 $set = $ilDB->query("SELECT * FROM skl_user_skill_level ORDER BY status_date ASC"); 14426 while ($rec = $ilDB->fetchAssoc($set)) { 14427 $q = "DELETE FROM skl_user_skill_level WHERE " . 14428 " skill_id = " . $ilDB->quote($rec["skill_id"], "integer") . " AND " . 14429 " tref_id = " . $ilDB->quote($rec["tref_id"], "integer") . " AND " . 14430 " user_id = " . $ilDB->quote($rec["user_id"], "integer") . " AND " . 14431 " status_date = " . $ilDB->quote($rec["status_date"], "datetime") . " AND " . 14432 " status = " . $ilDB->quote($rec["status"], "integer") . " AND " . 14433 " trigger_obj_id = " . $ilDB->quote($rec["trigger_obj_id"], "integer") . " AND " . 14434 " self_eval = " . $ilDB->quote($rec["self_eval"], "integer"); 14435 //echo "<br>".$q; 14436 $ilDB->manipulate($q); 14437 14438 $q = "INSERT INTO skl_user_skill_level " . 14439 "(skill_id, tref_id, user_id, status_date, status, trigger_obj_id, self_eval, level_id, valid, trigger_ref_id, trigger_title, trigger_obj_type, unique_identifier) VALUES (" . 14440 $ilDB->quote($rec["skill_id"], "integer") . ", " . 14441 $ilDB->quote($rec["tref_id"], "integer") . ", " . 14442 $ilDB->quote($rec["user_id"], "integer") . ", " . 14443 $ilDB->quote($rec["status_date"], "datetime") . ", " . 14444 $ilDB->quote($rec["status"], "integer") . ", " . 14445 $ilDB->quote($rec["trigger_obj_id"], "integer") . ", " . 14446 $ilDB->quote($rec["self_eval"], "integer") . ", " . 14447 $ilDB->quote($rec["level_id"], "integer") . ", " . 14448 $ilDB->quote($rec["valid"], "integer") . ", " . 14449 $ilDB->quote($rec["trigger_ref_id"], "integer") . ", " . 14450 $ilDB->quote($rec["trigger_title"], "text") . ", " . 14451 $ilDB->quote($rec["trigger_obj_type"], "text") . ", " . 14452 $ilDB->quote($rec["unique_identifier"], "text") . ")"; 14453 //echo "<br>".$q; 14454 $ilDB->manipulate($q); 14455 } 14456 14457 $ilDB->addPrimaryKey('skl_user_skill_level', array('skill_id', 'tref_id', 'user_id', 'status_date', 'status', 'trigger_obj_id', 'self_eval')); 14458} 14459 14460?> 14461<#4881> 14462<?php 14463 14464 14465$ilDB->manipulate( 14466 'update usr_data set passwd = ' . 14467 $ilDB->quote('', 'text') . ' , auth_mode = ' . 14468 $ilDB->quote('local', 'text') . ', active = ' . 14469 $ilDB->quote(0, 'integer') . ' WHERE auth_mode = ' . 14470 $ilDB->quote('openid', 'text') 14471); 14472 14473?> 14474<#4882> 14475<?php 14476if (!$ilDB->indexExistsByFields('il_qpl_qst_fq_unit', array('question_fi'))) { 14477 $ilDB->addIndex('il_qpl_qst_fq_unit', array('question_fi'), 'i2'); 14478} 14479?> 14480<#4883> 14481<?php 14482 14483$query = 'SELECT * FROM settings WHERE module = ' . $ilDB->quote('common', 'text') . ' AND keyword = ' . $ilDB->quote('mail_send_html', 'text'); 14484$res = $ilDB->query($query); 14485 14486$found = false; 14487while ($row = $ilDB->fetchAssoc($res)) { 14488 $found = true; 14489 break; 14490} 14491 14492if (!$found) { 14493 $setting = new ilSetting(); 14494 $setting->set('mail_send_html', 1); 14495} 14496?> 14497<#4884> 14498<?php 14499if (!$ilDB->tableExists('lng_log')) { 14500 $ilDB->createTable( 14501 'lng_log', 14502 array( 14503 'module' => array( 14504 'type' => 'text', 14505 'length' => 30, 14506 'notnull' => true 14507 ), 14508 'identifier' => array( 14509 'type' => 'text', 14510 'length' => 60, 14511 'notnull' => true 14512 ) 14513 ) 14514 ); 14515 $ilDB->addPrimaryKey('lng_log', array('module', 'identifier')); 14516} 14517?> 14518<#4885> 14519<?php 14520$ilCtrlStructureReader->getStructure(); 14521?> 14522<#4886> 14523<?php 14524$payment_tables = array( 14525 'payment_coupons', 'payment_coupons_codes', 'payment_coupons_obj', 'payment_coupons_track', 14526 'payment_currencies', 'payment_erp', 'payment_erps', 'payment_news', 14527 'payment_objects', 'payment_paymethods', 'payment_prices', 'payment_settings', 14528 'payment_shopping_cart', 'payment_statistic', 'payment_statistic_coup', 'payment_topics', 14529 'payment_topic_usr_sort', 'payment_trustees', 'payment_vats', 'payment_vendors' 14530); 14531 14532foreach ($payment_tables as $payment_table) { 14533 if ($ilDB->tableExists($payment_table)) { 14534 $ilDB->dropTable($payment_table); 14535 } 14536 14537 if ($ilDB->sequenceExists($payment_table)) { 14538 $ilDB->dropSequence($payment_table); 14539 } 14540} 14541?> 14542<#4887> 14543<?php 14544$res = $ilDB->queryF( 14545 'SELECT obj_id FROM object_data WHERE type = %s', 14546 array('text'), 14547 array('pays') 14548); 14549$row = $ilDB->fetchAssoc($res); 14550if (is_array($row) && isset($row['obj_id'])) { 14551 $obj_id = $row['obj_id']; 14552 14553 $ref_res = $ilDB->queryF( 14554 'SELECT ref_id FROM object_reference WHERE obj_id = %s', 14555 array('integer'), 14556 array($obj_id) 14557 ); 14558 while ($ref_row = $ilDB->fetchAssoc($ref_res)) { 14559 if (is_array($ref_row) && isset($ref_row['ref_id'])) { 14560 $ref_id = $ref_row['ref_id']; 14561 14562 $ilDB->manipulateF( 14563 'DELETE FROM tree WHERE child = %s', 14564 array('integer'), 14565 array($ref_id) 14566 ); 14567 } 14568 } 14569 14570 $ilDB->manipulateF( 14571 'DELETE FROM object_reference WHERE obj_id = %s', 14572 array('integer'), 14573 array($obj_id) 14574 ); 14575 14576 $ilDB->manipulateF( 14577 'DELETE FROM object_data WHERE obj_id = %s', 14578 array('integer'), 14579 array($obj_id) 14580 ); 14581} 14582?> 14583<#4888> 14584<?php 14585$res = $ilDB->queryF( 14586 'SELECT obj_id FROM object_data WHERE type = %s AND title = %s', 14587 array('text', 'text'), 14588 array('typ', 'pays') 14589); 14590$row = $ilDB->fetchAssoc($res); 14591if (is_array($row) && isset($row['obj_id'])) { 14592 $obj_id = $row['obj_id']; 14593 14594 $ilDB->manipulateF( 14595 'DELETE FROM rbac_ta WHERE typ_id = %s', 14596 array('integer'), 14597 array($obj_id) 14598 ); 14599 14600 $ilDB->manipulateF( 14601 'DELETE FROM object_data WHERE obj_id = %s', 14602 array('integer'), 14603 array($obj_id) 14604 ); 14605} 14606?> 14607<#4889> 14608<?php 14609$ilDB->manipulateF( 14610 'DELETE FROM cron_job WHERE job_id = %s', 14611 array('text'), 14612 array('pay_notification') 14613); 14614?> 14615<#4890> 14616<?php 14617$ilDB->manipulateF( 14618 'DELETE FROM page_style_usage WHERE page_type = %s', 14619 array('text'), 14620 array('shop') 14621); 14622 14623$ilDB->manipulateF( 14624 'DELETE FROM page_history WHERE parent_type = %s', 14625 array('text'), 14626 array('shop') 14627); 14628 14629$ilDB->manipulateF( 14630 'DELETE FROM page_object WHERE parent_type = %s', 14631 array('text'), 14632 array('shop') 14633); 14634?> 14635<#4891> 14636<?php 14637 14638if (!$ilDB->tableColumnExists('booking_settings', 'rsv_filter_period')) { 14639 $ilDB->addTableColumn('booking_settings', 'rsv_filter_period', array( 14640 'type' => 'integer', 14641 'length' => 2, 14642 'notnull' => false, 14643 'default' => null 14644 )); 14645} 14646 14647?> 14648<#4892> 14649<?php 14650$ilCtrlStructureReader->getStructure(); 14651?> 14652<#4893> 14653<?php 14654$ilDB->manipulateF( 14655 'DELETE FROM settings WHERE keyword = %s', 14656 array('text'), 14657 array('pear_mail_enable') 14658); 14659?> 14660<#4894> 14661<?php 14662 14663include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14664$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('copy'); 14665if ($tgt_ops_id) { 14666 $book_type_id = ilDBUpdateNewObjectType::getObjectTypeId('book'); 14667 if ($book_type_id) { 14668 // add "copy" to booking tool - returns false if already exists 14669 if (ilDBUpdateNewObjectType::addRBACOperation($book_type_id, $tgt_ops_id)) { 14670 // clone settings from "write" to "copy" 14671 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 14672 ilDBUpdateNewObjectType::cloneOperation('book', $src_ops_id, $tgt_ops_id); 14673 } 14674 } 14675} 14676 14677?> 14678<#4895> 14679<?php 14680 14681if (!$ilDB->tableColumnExists('webr_items', 'internal')) { 14682 $ilDB->addTableColumn('webr_items', 'internal', array( 14683 'type' => 'integer', 14684 'length' => 1, 14685 'notnull' => false, 14686 'default' => null 14687 )); 14688} 14689 14690?> 14691<#4896> 14692<?php 14693if (!$ilDB->indexExistsByFields('usr_data_multi', array('usr_id'))) { 14694 $ilDB->addIndex('usr_data_multi', array('usr_id'), 'i1'); 14695} 14696?> 14697<#4897> 14698<?php 14699if (!$ilDB->tableColumnExists('tst_tests', 'starting_time_tmp')) { 14700 $ilDB->addTableColumn('tst_tests', 'starting_time_tmp', array( 14701 'type' => 'integer', 14702 'length' => 4, 14703 'notnull' => true, 14704 'default' => 0 14705 )); 14706} 14707?> 14708<#4898> 14709<?php 14710if ($ilDB->tableColumnExists('tst_tests', 'starting_time_tmp')) { 14711 $stmp_up = $ilDB->prepareManip("UPDATE tst_tests SET starting_time_tmp = ? WHERE test_id = ?", array('integer', 'integer')); 14712 14713 $res = $ilDB->query("SELECT test_id, starting_time FROM tst_tests WHERE starting_time_tmp = " . $ilDB->quote(0, 'integer')); 14714 while ($row = $ilDB->fetchAssoc($res)) { 14715 $new_starting_time = 0; 14716 $starting_time = $row['starting_time']; 14717 14718 if (strlen($starting_time) > 0) { 14719 if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $starting_time, $matches)) { 14720 if (is_array($matches)) { 14721 if (checkdate($matches[2], $matches[3], $matches[1])) { 14722 $new_starting_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 14723 } 14724 } 14725 } 14726 } 14727 14728 $ilDB->execute($stmp_up, array((int) $new_starting_time, $row['test_id'])); 14729 } 14730} 14731?> 14732<#4899> 14733<?php 14734if ($ilDB->tableColumnExists('tst_tests', 'starting_time')) { 14735 $ilDB->dropTableColumn('tst_tests', 'starting_time'); 14736} 14737?> 14738<#4900> 14739<?php 14740if (!$ilDB->tableColumnExists('tst_tests', 'starting_time') && $ilDB->tableColumnExists('tst_tests', 'starting_time_tmp')) { 14741 $ilDB->renameTableColumn('tst_tests', 'starting_time_tmp', 'starting_time'); 14742} 14743?> 14744<#4901> 14745<?php 14746if (!$ilDB->tableColumnExists('tst_tests', 'ending_time_tmp')) { 14747 $ilDB->addTableColumn('tst_tests', 'ending_time_tmp', array( 14748 'type' => 'integer', 14749 'length' => 4, 14750 'notnull' => true, 14751 'default' => 0 14752 )); 14753} 14754?> 14755<#4902> 14756<?php 14757if ($ilDB->tableColumnExists('tst_tests', 'ending_time_tmp')) { 14758 $stmp_up = $ilDB->prepareManip("UPDATE tst_tests SET ending_time_tmp = ? WHERE test_id = ?", array('integer', 'integer')); 14759 14760 $res = $ilDB->query("SELECT test_id, ending_time FROM tst_tests WHERE ending_time_tmp = " . $ilDB->quote(0, 'integer')); 14761 while ($row = $ilDB->fetchAssoc($res)) { 14762 $new_ending_time = 0; 14763 $ending_time = $row['ending_time']; 14764 14765 if (strlen($ending_time) > 0) { 14766 if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $ending_time, $matches)) { 14767 if (is_array($matches)) { 14768 if (checkdate($matches[2], $matches[3], $matches[1])) { 14769 $new_ending_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 14770 } 14771 } 14772 } 14773 } 14774 14775 $ilDB->execute($stmp_up, array((int) $new_ending_time, $row['test_id'])); 14776 } 14777} 14778?> 14779<#4903> 14780<?php 14781if ($ilDB->tableColumnExists('tst_tests', 'ending_time')) { 14782 $ilDB->dropTableColumn('tst_tests', 'ending_time'); 14783} 14784?> 14785<#4904> 14786<?php 14787if (!$ilDB->tableColumnExists('tst_tests', 'ending_time') && $ilDB->tableColumnExists('tst_tests', 'ending_time_tmp')) { 14788 $ilDB->renameTableColumn('tst_tests', 'ending_time_tmp', 'ending_time'); 14789} 14790?> 14791<#4905> 14792<?php 14793require_once('./Modules/DataCollection/classes/Fields/Base/class.ilDclFieldProperty.php'); 14794 14795if (!$ilDB->tableColumnExists('il_dcl_field_prop', 'name')) { 14796 $backup_table_name = 'il_dcl_field_prop_b'; 14797 $ilDB->renameTable('il_dcl_field_prop', $backup_table_name); 14798 $ilDB->renameTable('il_dcl_field_prop_seq', 'il_dcl_field_prop_s_b'); 14799 14800 $ilDB->createTable(ilDclFieldProperty::returnDbTableName(), array( 14801 'id' => array( 14802 'type' => 'integer', 14803 'length' => 8, 14804 'notnull' => true, 14805 'default' => 0 14806 ), 14807 'field_id' => array( 14808 'type' => 'integer', 14809 'length' => 8, 14810 'notnull' => true, 14811 'default' => 0 14812 ), 14813 'name' => array( 14814 'type' => 'text', 14815 'length' => 4000, 14816 'notnull' => true 14817 ), 14818 'value' => array( 14819 'type' => 'text', 14820 'length' => 4000, 14821 ), 14822 )); 14823 14824 $ilDB->addPrimaryKey(ilDclFieldProperty::returnDbTableName(), array('id')); 14825 $ilDB->createSequence(ilDclFieldProperty::returnDbTableName()); 14826 14827 if ($ilDB->tableExists('il_dcl_datatype_prop')) { 14828 $query = "SELECT field_id, inputformat, title, " . $backup_table_name . ".value FROM " . $backup_table_name . " LEFT JOIN il_dcl_datatype_prop ON il_dcl_datatype_prop.id = " . $backup_table_name . ".datatype_prop_id WHERE " . $backup_table_name . ".value IS NOT NULL"; 14829 $result = $ilDB->query($query); 14830 14831 while ($row = $ilDB->fetchAssoc($result)) { 14832 $new_entry = new ilDclFieldProperty(); 14833 $new_entry->setFieldId($row['field_id']); 14834 $new_entry->setInputformat($row['inputformat']); 14835 $new_entry->setName($row['title']); 14836 $new_entry->setValue($row['value']); 14837 $new_entry->store(); 14838 } 14839 } else { 14840 throw new Exception("The table 'il_dcl_datatype_prop' is missing for proper migration. Please check if the migration is already completed."); 14841 } 14842} 14843 14844?> 14845 14846<#4906> 14847<?php 14848 14849$result = $ilDB->query("SELECT * FROM il_dcl_datatype WHERE id = 12"); 14850if ($ilDB->numRows($result) == 0) { 14851 $ilDB->insert('il_dcl_datatype', array( 14852 'id' => array('integer', 12), 14853 'title' => array('text', 'plugin'), 14854 'ildb_type' => array('text', 'text'), 14855 'storage_location' => array('integer', 0), 14856 'sort' => array('integer', 100) 14857 )); 14858} 14859 14860 14861$ilDB->update( 14862 'il_dcl_datatype', 14863 array( 14864 'title' => array('text', 'fileupload'), 14865 ), 14866 array( 14867 'id' => array('integer', 6), 14868 ) 14869); 14870 14871$ilDB->update( 14872 'il_dcl_datatype', 14873 array( 14874 'title' => array('text', 'ilias_reference'), 14875 ), 14876 array( 14877 'id' => array('integer', 8), 14878 ) 14879); 14880 14881$ilDB->update( 14882 'il_dcl_datatype', 14883 array( 14884 'title' => array('text', 'number'), 14885 ), 14886 array( 14887 'id' => array('integer', 1), 14888 ) 14889); 14890 14891?> 14892 14893<#4907> 14894<?php 14895 14896include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14897 14898$dcl_type_id = ilDBUpdateNewObjectType::getObjectTypeId('dcl'); 14899 14900if ($dcl_type_id) { 14901 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_content'); 14902 if ($src_ops_id) { 14903 ilDBUpdateNewObjectType::addRBACOperation($dcl_type_id, $src_ops_id); 14904 } 14905} 14906 14907?> 14908 14909<#4908> 14910<?php 14911 14912global $ilDB; 14913 14914if (!$ilDB->tableColumnExists('il_dcl_table', 'save_confirmation')) { 14915 $ilDB->addTableColumn( 14916 'il_dcl_table', 14917 'save_confirmation', 14918 array( 14919 "type" => "integer", 14920 "notnull" => true, 14921 "length" => 1, 14922 "default" => 0 14923 ) 14924 ); 14925} 14926 14927?> 14928<#4909> 14929<?php 14930 14931$ilCtrlStructureReader->getStructure(); 14932 14933?> 14934<#4910> 14935<?php 14936$ilCtrlStructureReader->getStructure(); 14937?> 14938 14939<#4911> 14940<?php 14941include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14942 14943$type_id = ilDBUpdateNewObjectType::getObjectTypeId('prg'); 14944$new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('manage_members', 'Manage Members', 'object', 2400); 14945if ($type_id && $new_ops_id) { 14946 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 14947} 14948?> 14949 14950<#4912> 14951<?php 14952 $ilCtrlStructureReader->getStructure(); 14953?> 14954<#4913> 14955<?php 14956 $ilCtrlStructureReader->getStructure(); 14957?> 14958 14959<#4914> 14960<?php 14961 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14962 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 14963 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 14964 ilDBUpdateNewObjectType::cloneOperation('prg', $src_ops_id, $tgt_ops_id); 14965?> 14966<#4915> 14967<?php 14968include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14969$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('copy'); 14970if ($tgt_ops_id) { 14971 $mep_type_id = ilDBUpdateNewObjectType::getObjectTypeId('mep'); 14972 if ($mep_type_id) { 14973 if (!ilDBUpdateNewObjectType::isRBACOperation($mep_type_id, $tgt_ops_id)) { 14974 // add "copy" to (external) feed 14975 ilDBUpdateNewObjectType::addRBACOperation($mep_type_id, $tgt_ops_id); 14976 14977 // clone settings from "write" to "copy" 14978 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 14979 ilDBUpdateNewObjectType::cloneOperation('mep', $src_ops_id, $tgt_ops_id); 14980 } 14981 } 14982} 14983?> 14984<#4916> 14985<?php 14986 $ilCtrlStructureReader->getStructure(); 14987?> 14988<#4917> 14989<?php 14990if (!$ilDB->tableColumnExists('il_dcl_table', 'import_enabled')) { 14991 $ilDB->addTableColumn('il_dcl_table', 'import_enabled', array( 14992 'type' => 'integer', 14993 'length' => 1, 14994 'notnull' => true, 14995 'default' => 1 14996 )); 14997} 14998?> 14999<#4918> 15000<?php 15001//tableview 15002$fields = array( 15003 'id' => array( 15004 'notnull' => '1', 15005 'type' => 'integer', 15006 'length' => '8', 15007 15008 ), 15009 'table_id' => array( 15010 'notnull' => '1', 15011 'type' => 'integer', 15012 'length' => '8', 15013 15014 ), 15015 'title' => array( 15016 'notnull' => '1', 15017 'type' => 'text', 15018 'length' => '128', 15019 15020 ), 15021 'roles' => array( 15022 'type' => 'clob', 15023 ), 15024 'description' => array( 15025 'type' => 'text', 15026 'length' => '128', 15027 15028 ), 15029 'tableview_order' => array( 15030 'type' => 'integer', 15031 'length' => '8', 15032 15033 ), 15034 15035); 15036if (!$ilDB->tableExists('il_dcl_tableview')) { 15037 $ilDB->createTable('il_dcl_tableview', $fields); 15038 $ilDB->addPrimaryKey('il_dcl_tableview', array( 'id' )); 15039 15040 if (!$ilDB->sequenceExists('il_dcl_tableview')) { 15041 $ilDB->createSequence('il_dcl_tableview'); 15042 } 15043 if (!$ilDB->indexExistsByFields('il_dcl_tableview', array('table_id'))) { 15044 $ilDB->addIndex('il_dcl_tableview', array('table_id'), 't1'); 15045 } 15046} 15047 15048//tableview_field_setting 15049$fields = array( 15050 'id' => array( 15051 'notnull' => '1', 15052 'type' => 'integer', 15053 'length' => '8', 15054 15055 ), 15056 'tableview_id' => array( 15057 'notnull' => '1', 15058 'type' => 'integer', 15059 'length' => '8', 15060 15061 ), 15062 'field' => array( 15063 'notnull' => '1', 15064 'type' => 'text', 15065 'length' => '128', 15066 15067 ), 15068 'visible' => array( 15069 'type' => 'integer', 15070 'length' => '1', 15071 15072 ), 15073 'in_filter' => array( 15074 'type' => 'integer', 15075 'length' => '1', 15076 15077 ), 15078 'filter_value' => array( 15079 'type' => 'clob', 15080 ), 15081 'filter_changeable' => array( 15082 'type' => 'integer', 15083 'length' => '1', 15084 15085 ), 15086 15087); 15088if (!$ilDB->tableExists('il_dcl_tview_set')) { 15089 $ilDB->createTable('il_dcl_tview_set', $fields); 15090 $ilDB->addPrimaryKey('il_dcl_tview_set', array( 'id' )); 15091 15092 if (!$ilDB->sequenceExists('il_dcl_tview_set')) { 15093 $ilDB->createSequence('il_dcl_tview_set'); 15094 } 15095} 15096 15097if (!$ilDB->tableExists('il_dcl_tview_set')) { 15098 $ilDB->createTable('il_dcl_tview_set', $fields); 15099 $ilDB->addPrimaryKey('il_dcl_tview_set', array( 'id' )); 15100 15101 if (!$ilDB->sequenceExists('il_dcl_tview_set')) { 15102 $ilDB->createSequence('il_dcl_tview_set'); 15103 } 15104 if (!$ilDB->indexExistsByFields('il_dcl_tview_set', array('tableview_id'))) { 15105 $ilDB->addIndex('il_dcl_tview_set', array('tableview_id'), 't1'); 15106 } 15107} 15108 15109$fields = array( 15110 'id' => array( 15111 'notnull' => '1', 15112 'type' => 'integer', 15113 'length' => '8', 15114 15115 ), 15116 'table_id' => array( 15117 'notnull' => '1', 15118 'type' => 'integer', 15119 'length' => '8', 15120 15121 ), 15122 'field' => array( 15123 'notnull' => '1', 15124 'type' => 'text', 15125 'length' => '128', 15126 15127 ), 15128 'field_order' => array( 15129 'type' => 'integer', 15130 'length' => '8', 15131 15132 ), 15133 'exportable' => array( 15134 'type' => 'integer', 15135 'length' => '1', 15136 15137 ), 15138 15139); 15140if (!$ilDB->tableExists('il_dcl_tfield_set')) { 15141 $ilDB->createTable('il_dcl_tfield_set', $fields); 15142 $ilDB->addPrimaryKey('il_dcl_tfield_set', array( 'id' )); 15143 15144 if (!$ilDB->sequenceExists('il_dcl_tfield_set')) { 15145 $ilDB->createSequence('il_dcl_tfield_set'); 15146 } 15147 if (!$ilDB->indexExistsByFields('il_dcl_tfield_set', array('table_id', 'field'))) { 15148 $ilDB->addIndex('il_dcl_tfield_set', array('table_id', 'field'), 't2'); 15149 } 15150} 15151?> 15152<#4919> 15153<?php 15154//migration for datacollections: 15155//ĉreate a standardview for each table, set visibility/filterability for each field 15156//and delete entries from old view tables 15157$roles = array(); 15158$query = $ilDB->query('SELECT rol_id FROM rbac_fa WHERE parent = ' . $ilDB->quote(ROLE_FOLDER_ID, 'integer') . " AND assign='y'"); 15159while ($global_role = $ilDB->fetchAssoc($query)) { 15160 $roles[] = $global_role['rol_id']; 15161} 15162 15163//set order of main tables, since main_table_id will be removed 15164if (!$ilDB->tableColumnExists('il_dcl_table', 'table_order')) { 15165 $ilDB->addTableColumn('il_dcl_table', 'table_order', array('type' => 'integer', 'length' => 8)); 15166} 15167 15168if ($ilDB->tableColumnExists('il_dcl_data', 'main_table_id')) { 15169 $main_table_query = $ilDB->query('SELECT main_table_id FROM il_dcl_data'); 15170 while ($rec = $ilDB->fetchAssoc($main_table_query)) { 15171 $ilDB->query('UPDATE il_dcl_table SET table_order = 10, is_visible = 1 WHERE id = ' . $ilDB->quote($rec['main_table_id'], 'integer')); 15172 } 15173 $ilDB->dropTableColumn('il_dcl_data', 'main_table_id'); 15174} 15175// 15176$table_query = $ilDB->query('SELECT id, ref_id FROM il_dcl_table 15177 INNER JOIN object_reference ON (object_reference.obj_id = il_dcl_table.obj_id)'); 15178 15179$mapping = array(); 15180while ($rec = $ilDB->fetchAssoc($table_query)) { 15181 $temp_sql = $ilDB->query('SELECT * FROM il_dcl_tableview WHERE table_id = ' . $ilDB->quote($rec['id'])); 15182 if ($ilDB->numRows($temp_sql)) { 15183 continue; 15184 } 15185 $query = $ilDB->query('SELECT rol_id FROM rbac_fa WHERE parent = ' . $ilDB->quote($rec['ref_id'], 'integer') . " AND assign='y'"); 15186 while ($local_role = $ilDB->fetchAssoc($query)) { 15187 $roles[] = $local_role['rol_id']; 15188 } 15189 //create standardviews for each DCL Table and set id mapping 15190 $next_id = $ilDB->nextId('il_dcl_tableview'); 15191 $ilDB->query('INSERT INTO il_dcl_tableview (id, table_id, title, roles, description, tableview_order) VALUES (' 15192 . $ilDB->quote($next_id, 'integer') . ', ' 15193 . $ilDB->quote($rec['id'], 'integer') . ', ' 15194 . $ilDB->quote('Standardview', 'text') . ', ' 15195 . $ilDB->quote(json_encode($roles), 'text') . ', ' 15196 . $ilDB->quote('', 'text') . ', ' 15197 . $ilDB->quote(10, 'integer') . ')'); 15198 $mapping[$rec['id']] = $next_id; 15199} 15200 15201if ($ilDB->tableExists('il_dcl_view') && $ilDB->tableExists('il_dcl_viewdefinition')) { 15202 15203 //fetch information about visibility/filterability 15204 $view_query = $ilDB->query( 15205 "SELECT il_dcl_view.table_id, tbl_visible.field, tbl_visible.is_set as visible, f.filterable 15206 FROM il_dcl_viewdefinition tbl_visible 15207 INNER JOIN il_dcl_view ON (il_dcl_view.id = tbl_visible.view_id 15208 AND il_dcl_view.type = 1) 15209 INNER JOIN 15210 (SELECT table_id, field, tbl_filterable.is_set as filterable 15211 FROM il_dcl_view 15212 INNER JOIN il_dcl_viewdefinition tbl_filterable ON (il_dcl_view.id = tbl_filterable.view_id 15213 AND il_dcl_view.type = 3)) f ON (f.field = tbl_visible.field AND f.table_id = il_dcl_view.table_id)" 15214 ); 15215 15216 //set visibility/filterability 15217 $view_id_cache = array(); 15218 while ($rec = $ilDB->fetchAssoc($view_query)) { 15219 if (!$mapping[$rec['table_id']]) { 15220 continue; 15221 } 15222 $next_id = $ilDB->nextId('il_dcl_tview_set'); 15223 $ilDB->query( 15224 'INSERT INTO il_dcl_tview_set (id, tableview_id, field, visible, in_filter, filter_value, 15225 filter_changeable) VALUES (' 15226 . $ilDB->quote($next_id, 'integer') . ', ' 15227 . $ilDB->quote($mapping[$rec['table_id']], 'integer') . ', ' 15228 . $ilDB->quote($rec['field'], 'text') . ', ' 15229 . $ilDB->quote($rec['visible'], 'integer') . ', ' 15230 . $ilDB->quote($rec['filterable'], 'integer') . ', ' 15231 . $ilDB->quote('', 'text') . ', ' 15232 . $ilDB->quote(1, 'integer') . ')' 15233 ); 15234 } 15235 15236 //fetch information about editability/exportability 15237 $view_query = $ilDB->query( 15238 "SELECT il_dcl_view.table_id, tbl_exportable.field, tbl_exportable.is_set as exportable, tbl_exportable.field_order 15239 FROM il_dcl_viewdefinition tbl_exportable 15240 INNER JOIN il_dcl_view ON (il_dcl_view.id = tbl_exportable.view_id 15241 AND il_dcl_view.type = 4)" 15242 ); 15243 15244 15245 //set editability/exportability 15246 while ($rec = $ilDB->fetchAssoc($view_query)) { 15247 $temp_sql = $ilDB->query('SELECT * FROM il_dcl_tfield_set 15248 WHERE table_id = ' . $ilDB->quote($rec['table_id'], 'integer') . ' 15249 AND field = ' . $ilDB->quote($rec['field'], 'text')); 15250 15251 if (!$ilDB->numRows($temp_sql)) { 15252 $next_id = $ilDB->nextId('il_dcl_tfield_set'); 15253 $ilDB->query( 15254 'INSERT INTO il_dcl_tfield_set (id, table_id, field, field_order, exportable) VALUES (' 15255 . $ilDB->quote($next_id, 'integer') . ', ' 15256 . $ilDB->quote($rec['table_id'], 'integer') . ', ' 15257 . $ilDB->quote($rec['field'], 'text') . ', ' 15258 . $ilDB->quote($rec['field_order'], 'integer') . ', ' 15259 . $ilDB->quote($rec['exportable'], 'integer') . ')' 15260 ); 15261 } 15262 } 15263 15264 //migrate page object 15265 $query = $ilDB->query('SELECT * 15266 FROM il_dcl_view 15267 INNER JOIN page_object on (il_dcl_view.id = page_object.page_id) 15268 WHERE il_dcl_view.type = 0 15269 AND page_object.parent_type = ' . $ilDB->quote('dclf', 'text')); 15270 15271 while ($rec = $ilDB->fetchAssoc($query)) { 15272 if (!$mapping[$rec['table_id']]) { 15273 continue; 15274 } 15275 15276 $temp_sql = $ilDB->query('SELECT * FROM page_object 15277 WHERE page_id = ' . $ilDB->quote($mapping[$rec['table_id']], 'integer') . ' 15278 AND parent_type = ' . $ilDB->quote('dclf', 'text')); 15279 15280 if ($ilDB->numRows($temp_sql)) { 15281 $ilDB->query('DELETE FROM page_object 15282 WHERE page_id = ' . $ilDB->quote($rec['id'], 'integer') . ' 15283 AND parent_type = ' . $ilDB->quote('dclf', 'text')); 15284 } else { 15285 $ilDB->query('UPDATE page_object 15286 SET page_id = ' . $ilDB->quote($mapping[$rec['table_id']], 'integer') . ' 15287 WHERE page_id = ' . $ilDB->quote($rec['id'], 'integer') . ' 15288 AND page_object.parent_type = ' . $ilDB->quote('dclf', 'text')); 15289 } 15290 } 15291 15292 //delete old tables 15293 $ilDB->dropTable('il_dcl_viewdefinition'); 15294 $ilDB->dropTable('il_dcl_view'); 15295} 15296 15297?> 15298<#4920> 15299<?php 15300$ilCtrlStructureReader->getStructure(); 15301?> 15302<#4921> 15303<?php 15304$ilCtrlStructureReader->getStructure(); 15305?> 15306<#4922> 15307<?php 15308require_once 'Services/Migration/DBUpdate_4922/classes/class.ilPasswordUtils.php'; 15309 15310$salt_location = CLIENT_DATA_DIR . '/pwsalt.txt'; 15311if (!is_file($salt_location) || !is_readable($salt_location)) { 15312 $result = @file_put_contents( 15313 $salt_location, 15314 substr(str_replace('+', '.', base64_encode(ilPasswordUtils::getBytes(16))), 0, 22) 15315 ); 15316 if (!$result) { 15317 setup_exit("Could not create the client salt for bcrypt password hashing."); 15318 } 15319} 15320 15321if (!is_file($salt_location) || !is_readable($salt_location)) { 15322 setup_exit("Could not determine the client salt for bcrypt password hashing."); 15323} 15324?> 15325<#4923> 15326<?php 15327$ilCtrlStructureReader->getStructure(); 15328?> 15329<#4924> 15330<?php 15331$ilCtrlStructureReader->getStructure(); 15332?> 15333<#4925> 15334<?php 15335 15336include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15337 15338$type_id = ilDBUpdateNewObjectType::getObjectTypeId('stys'); 15339if ($type_id) { 15340 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('sty_write_content', 'Edit Content Styles', 'object', 6101); 15341 if ($new_ops_id) { 15342 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 15343 15344 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 15345 if ($src_ops_id) { 15346 ilDBUpdateNewObjectType::cloneOperation('stys', $src_ops_id, $new_ops_id); 15347 } 15348 } 15349} 15350?> 15351<#4926> 15352<?php 15353 15354include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15355 15356$type_id = ilDBUpdateNewObjectType::getObjectTypeId('stys'); 15357if ($type_id) { 15358 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('sty_write_system', 'Edit System Styles', 'object', 6100); 15359 if ($new_ops_id) { 15360 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 15361 15362 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 15363 if ($src_ops_id) { 15364 ilDBUpdateNewObjectType::cloneOperation('stys', $src_ops_id, $new_ops_id); 15365 } 15366 } 15367} 15368?> 15369<#4927> 15370<?php 15371 15372include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15373 15374$type_id = ilDBUpdateNewObjectType::getObjectTypeId('stys'); 15375if ($type_id) { 15376 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('sty_write_page_layout', 'Edit Page Layouts', 'object', 6102); 15377 if ($new_ops_id) { 15378 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 15379 15380 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 15381 if ($src_ops_id) { 15382 ilDBUpdateNewObjectType::cloneOperation('stys', $src_ops_id, $new_ops_id); 15383 } 15384 } 15385} 15386?> 15387<#4928> 15388<?php 15389include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15390$ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 15391ilDBUpdateNewObjectType::deleteRBACOperation('stys', $ops_id); 15392?> 15393<#4929> 15394<?php 15395 $ilCtrlStructureReader->getStructure(); 15396?> 15397<#4930> 15398<?php 15399 if (!$ilDB->tableColumnExists('skl_tree_node', 'creation_date')) { 15400 $ilDB->addTableColumn('skl_tree_node', 'creation_date', array( 15401 "type" => "timestamp", 15402 "notnull" => false, 15403 )); 15404 } 15405?> 15406<#4931> 15407<?php 15408if (!$ilDB->tableColumnExists('skl_tree_node', 'import_id')) { 15409 $ilDB->addTableColumn('skl_tree_node', 'import_id', array( 15410 "type" => "text", 15411 "length" => 50, 15412 "notnull" => false 15413 )); 15414} 15415?> 15416<#4932> 15417<?php 15418if (!$ilDB->tableColumnExists('skl_level', 'creation_date')) { 15419 $ilDB->addTableColumn('skl_level', 'creation_date', array( 15420 "type" => "timestamp", 15421 "notnull" => false, 15422 )); 15423} 15424?> 15425<#4933> 15426<?php 15427if (!$ilDB->tableColumnExists('skl_level', 'import_id')) { 15428 $ilDB->addTableColumn('skl_level', 'import_id', array( 15429 "type" => "text", 15430 "length" => 50, 15431 "notnull" => false 15432 )); 15433} 15434?> 15435<#4934> 15436<?php 15437if (!$ilDB->tableColumnExists('qpl_qst_lome', 'min_auto_complete')) { 15438 $ilDB->addTableColumn( 15439 'qpl_qst_lome', 15440 'min_auto_complete', 15441 array( 15442 'type' => 'integer', 15443 'length' => 1, 15444 'default' => 1) 15445 ); 15446} 15447if ($ilDB->tableColumnExists('qpl_qst_lome', 'min_auto_complete')) { 15448 $ilDB->modifyTableColumn( 15449 'qpl_qst_lome', 15450 'min_auto_complete', 15451 array( 15452 'default' => 3) 15453 ); 15454} 15455?> 15456<#4935> 15457<?php 15458 15459if (!$ilDB->tableColumnExists('svy_svy', 'confirmation_mail')) { 15460 $ilDB->addTableColumn( 15461 'svy_svy', 15462 'confirmation_mail', 15463 array( 15464 'type' => 'integer', 15465 'length' => 1, 15466 'notnull' => false, 15467 'default' => null 15468 ) 15469 ); 15470} 15471 15472?> 15473<#4936> 15474<?php 15475 15476$ilDB->manipulate("UPDATE svy_svy" . 15477 " SET confirmation_mail = " . $ilDB->quote(1, "integer") . 15478 " WHERE own_results_mail = " . $ilDB->quote(1, "integer") . 15479 " AND confirmation_mail IS NULL"); 15480 15481?> 15482<#4937> 15483<?php 15484 15485if (!$ilDB->tableColumnExists('svy_svy', 'anon_user_list')) { 15486 $ilDB->addTableColumn( 15487 'svy_svy', 15488 'anon_user_list', 15489 array( 15490 'type' => 'integer', 15491 'length' => 1, 15492 'notnull' => false, 15493 'default' => 0 15494 ) 15495 ); 15496} 15497 15498?> 15499<#4938> 15500<?php 15501 15502 //Create new object type grpr 'Group Reference' 15503 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15504 15505 $grpr_type_id = ilDBUpdateNewObjectType::addNewType('grpr', 'Group Reference Object'); 15506 15507 $rbac_ops = array( 15508 ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS, 15509 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 15510 ilDBUpdateNewObjectType::RBAC_OP_READ, 15511 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 15512 ilDBUpdateNewObjectType::RBAC_OP_DELETE, 15513 ilDBUpdateNewObjectType::RBAC_OP_COPY 15514 ); 15515 ilDBUpdateNewObjectType::addRBACOperations($grpr_type_id, $rbac_ops); 15516 15517 $parent_types = array('root', 'cat', 'crs', 'fold', 'grp'); 15518 ilDBUpdateNewObjectType::addRBACCreate('create_grpr', 'Create Group Reference', $parent_types); 15519?> 15520<#4939> 15521<?php 15522$ilCtrlStructureReader->getStructure(); 15523?> 15524<#4940> 15525<?php 15526 $ilCtrlStructureReader->getStructure(); 15527?> 15528<#4941> 15529<?php 15530//step 1/2 il_request_token deletes old table 15531 15532if ($ilDB->tableExists('il_request_token')) { 15533 $ilDB->dropTable('il_request_token'); 15534} 15535 15536?> 15537<#4942> 15538<?php 15539//step 2/2 il_request_token creates table with primary key 15540 15541if (!$ilDB->tableExists('il_request_token')) { 15542 $fields = array( 15543 "user_id" => array( 15544 "notnull" => true 15545 , "length" => 4 15546 , "unsigned" => false 15547 , "default" => "0" 15548 , "type" => "integer" 15549 ) 15550 , "token" => array( 15551 "notnull" => false 15552 , "length" => 64 15553 , "fixed" => true 15554 , "type" => "text" 15555 ) 15556 , "stamp" => array( 15557 "notnull" => false 15558 , "type" => "timestamp" 15559 ) 15560 , "session_id" => array( 15561 "notnull" => false 15562 , "length" => 100 15563 , "fixed" => false 15564 , "type" => "text" 15565 ) 15566 ); 15567 15568 $ilDB->createTable("il_request_token", $fields); 15569 $ilDB->addPrimaryKey("il_request_token", array('token')); 15570 $ilDB->addIndex("il_request_token", array('user_id', 'session_id'), 'i1'); 15571 $ilDB->addIndex("il_request_token", array('user_id', 'stamp'), 'i2'); 15572} 15573?> 15574<#4943> 15575<?php 15576//step 1/3 il_event_handling deletes old table 15577if ($ilDB->tableExists('il_event_handling')) { 15578 $ilDB->dropTable('il_event_handling'); 15579} 15580 15581?> 15582<#4944> 15583<?php 15584//step 2/3 il_event_handling creates table with primary key 15585if (!$ilDB->tableExists('il_event_handling')) { 15586 $fields = array( 15587 'component' => array( 15588 'type' => 'text', 15589 'length' => 50, 15590 'notnull' => true, 15591 'fixed' => false 15592 ), 15593 'type' => array( 15594 'type' => 'text', 15595 'length' => 10, 15596 'notnull' => true, 15597 'fixed' => false 15598 ), 15599 'id' => array( 15600 'type' => 'text', 15601 'length' => 100, 15602 'notnull' => true, 15603 'fixed' => false 15604 )); 15605 $ilDB->createTable('il_event_handling', $fields); 15606 $ilDB->addPrimaryKey("il_event_handling", array('component', 'type', 'id')); 15607} 15608?> 15609<#4945> 15610<?php 15611//step 3/3 il_event_handling fill table 15612$ilCtrlStructureReader->getStructure(); 15613?> 15614<#4946> 15615<?php 15616//step 1/4 copg_section_timings renames old table 15617 15618if ($ilDB->tableExists('copg_section_timings') && !$ilDB->tableExists('copg_section_t_old')) { 15619 $ilDB->renameTable("copg_section_timings", "copg_section_t_old"); 15620} 15621?> 15622<#4947> 15623<?php 15624//step 2/4 copg_section_timings create new table with primary keys 15625if (!$ilDB->tableExists("copg_section_timings")) { 15626 $fields = array( 15627 "page_id" => array( 15628 "type" => "integer", 15629 "length" => 4, 15630 "notnull" => true 15631 ), 15632 "parent_type" => array( 15633 "type" => "text", 15634 "length" => 10, 15635 "notnull" => true 15636 ), 15637 "unix_ts" => array( 15638 "type" => "integer", 15639 "notnull" => true, 15640 "length" => 4, 15641 "default" => 0 15642 ) 15643 ); 15644 15645 $ilDB->createTable("copg_section_timings", $fields); 15646 $ilDB->addPrimaryKey("copg_section_timings", array('page_id', 'parent_type', 'unix_ts')); 15647} 15648?> 15649<#4948> 15650<?php 15651//step 3/4 copg_section_timings moves all data to new table 15652 15653if ($ilDB->tableExists('copg_section_timings') && $ilDB->tableExists('copg_section_t_old')) { 15654 $res = $ilDB->query(" 15655 SELECT * 15656 FROM copg_section_t_old 15657 "); 15658 15659 while ($row = $ilDB->fetchAssoc($res)) { 15660 $ilDB->replace("copg_section_timings", array( 15661 "page_id" => array("integer", $row['page_id']), 15662 "parent_type" => array("text", $row['parent_type']), 15663 "unix_ts" => array("integer",$row['unix_ts']) 15664 ), array()); 15665 15666 $ilDB->manipulateF( 15667 "DELETE FROM copg_section_t_old WHERE page_id = %s AND parent_type = %s AND unix_ts = %s ", 15668 array('integer', 'text', 'integer'), 15669 array($row['page_id'], $row['parent_type'], $row['unix_ts']) 15670 ); 15671 } 15672} 15673?> 15674<#4949> 15675<?php 15676//step 4/4 copg_section_timings removes old table 15677 15678if ($ilDB->tableExists('copg_section_t_old')) { 15679 $ilDB->dropTable('copg_section_t_old'); 15680} 15681?> 15682<#4950> 15683<?php 15684 15685include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15686ilDBUpdateNewObjectType::addAdminNode('bdga', 'Badge Settings'); 15687 15688?> 15689<#4951> 15690<?php 15691 15692if (!$ilDB->tableExists('badge_badge')) { 15693 $ilDB->createTable('badge_badge', array( 15694 'id' => array( 15695 'type' => 'integer', 15696 'length' => 4, 15697 'notnull' => true, 15698 'default' => 0 15699 ), 15700 'parent_id' => array( 15701 'type' => 'integer', 15702 'length' => 4, 15703 'notnull' => true, 15704 'default' => 0 15705 ), 15706 'type_id' => array( 15707 'type' => 'text', 15708 'length' => 255, 15709 'notnull' => false 15710 ), 15711 'active' => array( 15712 'type' => 'integer', 15713 'length' => 1, 15714 'notnull' => true, 15715 'default' => 0 15716 ), 15717 'title' => array( 15718 'type' => 'text', 15719 'length' => 255, 15720 'notnull' => false 15721 ), 15722 'descr' => array( 15723 'type' => 'text', 15724 'length' => 4000, 15725 'notnull' => false 15726 ), 15727 'conf' => array( 15728 'type' => 'text', 15729 'length' => 4000, 15730 'notnull' => false 15731 ) 15732 )); 15733 $ilDB->addPrimaryKey('badge_badge', array('id')); 15734 $ilDB->createSequence('badge_badge'); 15735} 15736 15737?> 15738<#4952> 15739<?php 15740 15741if (!$ilDB->tableExists('badge_image_template')) { 15742 $ilDB->createTable('badge_image_template', array( 15743 'id' => array( 15744 'type' => 'integer', 15745 'length' => 4, 15746 'notnull' => true, 15747 'default' => 0 15748 ), 15749 'title' => array( 15750 'type' => 'text', 15751 'length' => 255, 15752 'notnull' => false 15753 ), 15754 'image' => array( 15755 'type' => 'text', 15756 'length' => 255, 15757 'notnull' => false 15758 ) 15759 )); 15760 $ilDB->addPrimaryKey('badge_image_template', array('id')); 15761 $ilDB->createSequence('badge_image_template'); 15762} 15763 15764?> 15765<#4953> 15766<?php 15767 15768if (!$ilDB->tableColumnExists('badge_badge', 'image')) { 15769 $ilDB->addTableColumn( 15770 'badge_badge', 15771 'image', 15772 array( 15773 'type' => 'text', 15774 'length' => 255, 15775 'notnull' => false) 15776 ); 15777} 15778 15779?> 15780<#4954> 15781<?php 15782 15783if (!$ilDB->tableExists('badge_image_templ_type')) { 15784 $ilDB->createTable('badge_image_templ_type', array( 15785 'tmpl_id' => array( 15786 'type' => 'integer', 15787 'length' => 4, 15788 'notnull' => true, 15789 'default' => 0 15790 ), 15791 'type_id' => array( 15792 'type' => 'text', 15793 'length' => 255, 15794 'notnull' => true, 15795 'default' => "" 15796 ) 15797 )); 15798 $ilDB->addPrimaryKey('badge_image_templ_type', array('tmpl_id', 'type_id')); 15799} 15800 15801?> 15802<#4955> 15803<?php 15804 15805if (!$ilDB->tableExists('badge_user_badge')) { 15806 $ilDB->createTable('badge_user_badge', array( 15807 'badge_id' => array( 15808 'type' => 'integer', 15809 'length' => 4, 15810 'notnull' => true, 15811 'default' => 0 15812 ), 15813 'user_id' => array( 15814 'type' => 'integer', 15815 'length' => 4, 15816 'notnull' => true, 15817 'default' => 0 15818 ), 15819 'tstamp' => array( 15820 'type' => 'integer', 15821 'length' => 4, 15822 'notnull' => true, 15823 'default' => 0 15824 ), 15825 'awarded_by' => array( 15826 'type' => 'integer', 15827 'length' => 4, 15828 'notnull' => false 15829 ), 15830 'pos' => array( 15831 'type' => 'integer', 15832 'length' => 2, 15833 'notnull' => false 15834 ) 15835 )); 15836 $ilDB->addPrimaryKey('badge_user_badge', array('badge_id', 'user_id')); 15837} 15838 15839?> 15840<#4956> 15841<?php 15842 15843if (!$ilDB->tableColumnExists('badge_badge', 'valid')) { 15844 $ilDB->addTableColumn( 15845 'badge_badge', 15846 'valid', 15847 array( 15848 'type' => 'text', 15849 'length' => 255, 15850 'notnull' => false) 15851 ); 15852} 15853 15854?> 15855<#4957> 15856<?php 15857 15858if (!$ilDB->tableExists('object_data_del')) { 15859 $ilDB->createTable('object_data_del', array( 15860 'obj_id' => array( 15861 'type' => 'integer', 15862 'length' => 4, 15863 'notnull' => true, 15864 'default' => 0 15865 ), 15866 'title' => array( 15867 'type' => 'text', 15868 'length' => 255, 15869 'notnull' => false 15870 ), 15871 'tstamp' => array( 15872 'type' => 'integer', 15873 'length' => 4, 15874 'notnull' => true, 15875 'default' => 0 15876 ), 15877 )); 15878 $ilDB->addPrimaryKey('object_data_del', array('obj_id')); 15879} 15880 15881?> 15882<#4958> 15883<?php 15884 15885if (!$ilDB->tableColumnExists('object_data_del', 'type')) { 15886 $ilDB->addTableColumn( 15887 'object_data_del', 15888 'type', 15889 array( 15890 'type' => 'text', 15891 'length' => 4, 15892 'fixed' => true, 15893 'notnull' => false) 15894 ); 15895} 15896 15897?> 15898<#4959> 15899<?php 15900 15901if (!$ilDB->tableColumnExists('badge_badge', 'crit')) { 15902 $ilDB->addTableColumn( 15903 'badge_badge', 15904 'crit', 15905 array( 15906 'type' => 'text', 15907 'length' => 4000, 15908 'notnull' => false 15909 ) 15910 ); 15911} 15912 15913?> 15914<#4960> 15915<?php 15916 15917$ilCtrlStructureReader->getStructure(); 15918 15919?> 15920<#4961> 15921<?php 15922 15923if (!$ilDB->tableExists('ut_lp_defaults')) { 15924 $ilDB->createTable('ut_lp_defaults', array( 15925 'type_id' => array( 15926 'type' => 'text', 15927 'length' => 10, 15928 'notnull' => true, 15929 'default' => "" 15930 ), 15931 'lp_mode' => array( 15932 'type' => 'integer', 15933 'length' => 1, 15934 'notnull' => true, 15935 'default' => 0 15936 ), 15937 )); 15938 $ilDB->addPrimaryKey('ut_lp_defaults', array('type_id')); 15939} 15940 15941?> 15942<#4962> 15943<?php 15944 15945$dubs_sql = "SELECT * FROM (" . 15946 "SELECT tree, child " . 15947 "FROM bookmark_tree " . 15948 "GROUP BY tree, child " . 15949 "HAVING COUNT(*) > 1 ) " . 15950 "duplicateBookmarkTree"; 15951 15952$res = $ilDB->query($dubs_sql); 15953$dublicates = array(); 15954 15955while ($row = $ilDB->fetchAssoc($res)) { 15956 $dublicates[] = $row; 15957} 15958 15959if (count($dublicates)) { 15960 $ilSetting = new ilSetting(); 15961 $ilSetting->set('bookmark_tree_renumber', 1); 15962 15963 foreach ($dublicates as $key => $row) { 15964 $res = $ilDB->query("SELECT * FROM bookmark_tree WHERE tree = " . $ilDB->quote($row["tree"], "integer") . 15965 " AND child = " . $ilDB->quote($row["child"], "integer")); 15966 15967 $first = $ilDB->fetchAssoc($res); 15968 15969 $ilDB->manipulate("DELETE FROM bookmark_tree WHERE tree = " . $ilDB->quote($row["tree"], "integer") . 15970 " AND child = " . $ilDB->quote($row["child"], "integer")); 15971 15972 $ilDB->query( 15973 'INSERT INTO bookmark_tree (tree, child, parent, lft, rgt, depth) VALUES (' 15974 . $ilDB->quote($first['tree'], 'integer') . ', ' 15975 . $ilDB->quote($first['child'], 'integer') . ', ' 15976 . $ilDB->quote($first['parent'], 'integer') . ', ' 15977 . $ilDB->quote($first['lft'], 'integer') . ', ' 15978 . $ilDB->quote($first['rgt'], 'integer') . ', ' 15979 . $ilDB->quote($first['depth'], 'integer') . ')' 15980 ); 15981 } 15982} 15983 15984?> 15985<#4963> 15986<?php 15987$ilSetting = new ilSetting(); 15988if ($ilSetting->get('bookmark_tree_renumber', "0") == "1") { 15989 include_once('./Services/Migration/DBUpdate_4963/classes/class.ilDBUpdate4963.php'); 15990 ilDBUpdate4963::renumberBookmarkTree(); 15991 $ilSetting->delete('bookmark_tree_renumber'); 15992} 15993 15994?> 15995<#4964> 15996<?php 15997$manager = $ilDB->loadModule('Manager'); 15998 15999if (!$manager) { 16000 $manager = $ilDB->loadModule('Manager'); 16001} 16002 16003$const = $manager->listTableConstraints("bookmark_tree"); 16004if (!in_array("primary", $const)) { 16005 $ilDB->addPrimaryKey('bookmark_tree', array('tree', 'child')); 16006} 16007 16008?> 16009<#4965> 16010<?php 16011if (!$ilDB->tableExists('frm_posts_drafts')) { 16012 $fields = array( 16013 'draft_id' => array( 16014 'type' => 'integer', 16015 'length' => 4, 16016 'notnull' => true, 16017 'default' => 0 16018 ), 16019 'post_id' => array( 16020 'type' => 'integer', 16021 'length' => 8, 16022 'notnull' => true, 16023 'default' => 0 16024 ), 16025 'thread_id' => array( 16026 'type' => 'integer', 16027 'length' => 8, 16028 'notnull' => true, 16029 'default' => 0 16030 ), 16031 'forum_id' => array( 16032 'type' => 'integer', 16033 'length' => 8, 16034 'notnull' => true, 16035 'default' => 0 16036 ), 16037 'post_author_id' => array( 16038 'type' => 'integer', 16039 'length' => 4, 16040 'notnull' => true, 16041 'default' => 0 16042 ), 16043 'post_subject' => array( 16044 'type' => 'text', 16045 'length' => 4000, 16046 'notnull' => true 16047 ), 16048 'post_message' => array( 16049 'type' => 'clob', 16050 'notnull' => true 16051 ), 16052 'post_notify' => array( 16053 'type' => 'integer', 16054 'length' => 1, 16055 'notnull' => true, 16056 'default' => 0 16057 ), 16058 'post_date' => array( 16059 'type' => 'timestamp', 16060 'notnull' => true 16061 ), 16062 'post_update' => array( 16063 'type' => 'timestamp', 16064 'notnull' => true 16065 ), 16066 'update_user_id' => array( 16067 'type' => 'integer', 16068 'length' => 4, 16069 'notnull' => true, 16070 'default' => 0 16071 ), 16072 'post_user_alias' => array( 16073 'type' => 'text', 16074 'length' => 255, 16075 'notnull' => false 16076 ), 16077 'pos_display_usr_id' => array( 16078 'type' => 'integer', 16079 'length' => 4, 16080 'notnull' => true, 16081 'default' => 0 16082 ), 16083 'notify' => array( 16084 'type' => 'integer', 16085 'length' => 1, 16086 'notnull' => true, 16087 'default' => 0 16088 ) 16089 16090 ); 16091 16092 $ilDB->createTable('frm_posts_drafts', $fields); 16093 $ilDB->addPrimaryKey('frm_posts_drafts', array('draft_id')); 16094 $ilDB->createSequence('frm_posts_drafts'); 16095} 16096?> 16097<#4966> 16098<?php 16099if (!$ilDB->indexExistsByFields('frm_posts_drafts', array('post_id'))) { 16100 $ilDB->addIndex('frm_posts_drafts', array('post_id'), 'i1'); 16101} 16102?> 16103<#4967> 16104<?php 16105if (!$ilDB->indexExistsByFields('frm_posts_drafts', array('thread_id'))) { 16106 $ilDB->addIndex('frm_posts_drafts', array('thread_id'), 'i2'); 16107} 16108?> 16109<#4968> 16110<?php 16111if (!$ilDB->indexExistsByFields('frm_posts_drafts', array('forum_id'))) { 16112 $ilDB->addIndex('frm_posts_drafts', array('forum_id'), 'i3'); 16113} 16114?> 16115<#4969> 16116<?php 16117if (!$ilDB->tableExists('frm_drafts_history')) { 16118 $fields = array( 16119 'history_id' => array( 16120 'type' => 'integer', 16121 'length' => 4, 16122 'notnull' => true, 16123 'default' => 0 16124 ), 16125 'draft_id' => array( 16126 'type' => 'integer', 16127 'length' => 4, 16128 'notnull' => true, 16129 'default' => 0 16130 ), 16131 'post_subject' => array( 16132 'type' => 'text', 16133 'length' => 4000, 16134 'notnull' => true 16135 ), 16136 'post_message' => array( 16137 'type' => 'clob', 16138 'notnull' => true 16139 ), 16140 'draft_date' => array( 16141 'type' => 'timestamp', 16142 'notnull' => true 16143 ) 16144 ); 16145 16146 $ilDB->createTable('frm_drafts_history', $fields); 16147 $ilDB->addPrimaryKey('frm_drafts_history', array('history_id')); 16148 $ilDB->createSequence('frm_drafts_history'); 16149} 16150?> 16151<#4970> 16152<?php 16153 if (!$ilDB->indexExistsByFields('frm_drafts_history', array('draft_id'))) { 16154 $ilDB->addIndex('frm_drafts_history', array('draft_id'), 'i1'); 16155 } 16156?> 16157<#4971> 16158<?php 16159$ilCtrlStructureReader->getStructure(); 16160?> 16161<#4972> 16162<?php 16163if (!$ilDB->tableColumnExists('tst_tests', 'pass_waiting')) { 16164 $ilDB->addTableColumn( 16165 'tst_tests', 16166 'pass_waiting', 16167 array( 16168 'type' => 'text', 16169 'length' => 15, 16170 'notnull' => false, 16171 'default' => null) 16172 ); 16173} 16174?> 16175<#4973> 16176<?php 16177if (!$ilDB->tableColumnExists('tst_active', 'last_started_pass')) { 16178 $ilDB->addTableColumn('tst_active', 'last_started_pass', array( 16179 'type' => 'integer', 16180 'length' => 4, 16181 'notnull' => false, 16182 'default' => null 16183 )); 16184} 16185?> 16186<#4974> 16187<?php 16188if ($ilDB->tableExists('bookmark_social_bm')) { 16189 $ilDB->dropTable('bookmark_social_bm'); 16190} 16191?> 16192<#4975> 16193<?php 16194if ($ilDB->sequenceExists('bookmark_social_bm')) { 16195 $ilDB->dropSequence('bookmark_social_bm'); 16196} 16197?> 16198<#4976> 16199<?php 16200$sbm_path = realpath(CLIENT_WEB_DIR . DIRECTORY_SEPARATOR . 'social_bm_icons'); 16201if (file_exists($sbm_path) && is_dir($sbm_path)) { 16202 $iter = new RecursiveIteratorIterator( 16203 new RecursiveDirectoryIterator($sbm_path, RecursiveDirectoryIterator::SKIP_DOTS), 16204 RecursiveIteratorIterator::CHILD_FIRST 16205 ); 16206 foreach ($iter as $fileinfo) { 16207 if ($fileinfo->isDir()) { 16208 @rmdir($fileinfo->getRealPath()); 16209 } else { 16210 @unlink($fileinfo->getRealPath()); 16211 } 16212 } 16213 16214 @rmdir($sbm_path); 16215} 16216?> 16217<#4977> 16218<?php 16219$ilSetting = new ilSetting(); 16220$ilSetting->delete('passwd_auto_generate'); 16221?> 16222<#4978> 16223<?php 16224if ($ilDB->tableColumnExists('usr_data', 'im_icq')) { 16225 $ilDB->dropTableColumn('usr_data', 'im_icq'); 16226} 16227?> 16228<#4979> 16229<?php 16230if ($ilDB->tableColumnExists('usr_data', 'im_yahoo')) { 16231 $ilDB->dropTableColumn('usr_data', 'im_yahoo'); 16232} 16233?> 16234<#4980> 16235<?php 16236if ($ilDB->tableColumnExists('usr_data', 'im_msn')) { 16237 $ilDB->dropTableColumn('usr_data', 'im_msn'); 16238} 16239?> 16240<#4981> 16241<?php 16242if ($ilDB->tableColumnExists('usr_data', 'im_aim')) { 16243 $ilDB->dropTableColumn('usr_data', 'im_aim'); 16244} 16245?> 16246<#4982> 16247<?php 16248if ($ilDB->tableColumnExists('usr_data', 'im_skype')) { 16249 $ilDB->dropTableColumn('usr_data', 'im_skype'); 16250} 16251?> 16252<#4983> 16253<?php 16254if ($ilDB->tableColumnExists('usr_data', 'im_voip')) { 16255 $ilDB->dropTableColumn('usr_data', 'im_voip'); 16256} 16257?> 16258<#4984> 16259<?php 16260if ($ilDB->tableColumnExists('usr_data', 'im_jabber')) { 16261 $ilDB->dropTableColumn('usr_data', 'im_jabber'); 16262} 16263?> 16264<#4985> 16265<?php 16266if ($ilDB->tableColumnExists('usr_data', 'delicious')) { 16267 $ilDB->dropTableColumn('usr_data', 'delicious'); 16268} 16269?> 16270<#4986> 16271<?php 16272$pd_set = new ilSetting('pd'); 16273$pd_set->delete('osi_host'); 16274?> 16275<#4987> 16276<?php 16277$dset = new ilSetting('delicious'); 16278$dset->deleteAll(); 16279?> 16280<#4988> 16281<?php 16282$fields = array('im_icq', 'im_yahoo', 'im_msn', 'im_aim', 'im_skype', 'im_jabber', 'im_voip', 'delicious'); 16283foreach ($fields as $field) { 16284 $ilDB->manipulateF( 16285 'DELETE FROM usr_pref WHERE keyword = %s', 16286 array('text'), 16287 array('public_' . $field) 16288 ); 16289} 16290?> 16291<#4989> 16292<?php 16293foreach (array('instant_messengers', 'delicous') as $field) { 16294 foreach (array( 16295 'usr_settings_hide', 'usr_settings_disable', 'usr_settings_visib_reg', 'usr_settings_changeable_lua', 16296 'usr_settings_export', 'usr_settings_course_export', 'usr_settings_group_export', 'require' 16297 ) as $type) { 16298 $ilDB->manipulateF( 16299 "DELETE FROM settings WHERE keyword = %s", 16300 array("text"), 16301 array($type . "_" . $field) 16302 ); 16303 } 16304} 16305?> 16306<#4990> 16307<?php 16308if (!$ilDB->tableExists('glo_glossaries')) { 16309 $ilDB->createTable('glo_glossaries', array( 16310 'id' => array( 16311 'type' => 'integer', 16312 'length' => 4, 16313 'notnull' => true, 16314 'default' => 0 16315 ), 16316 'glo_id' => array( 16317 'type' => 'integer', 16318 'length' => 4, 16319 'notnull' => true, 16320 'default' => 0 16321 ) 16322 )); 16323} 16324?> 16325<#4991> 16326<?php 16327if (!$ilDB->tableExists('glo_term_reference')) { 16328 $ilDB->createTable('glo_term_reference', array( 16329 'glo_id' => array( 16330 'type' => 'integer', 16331 'length' => 4, 16332 'notnull' => true, 16333 'default' => 0 16334 ), 16335 'term_id' => array( 16336 'type' => 'integer', 16337 'length' => 4, 16338 'notnull' => true, 16339 'default' => 0 16340 ) 16341 )); 16342} 16343?> 16344<#4992> 16345<?php 16346 $ilDB->addPrimaryKey('glo_term_reference', array('glo_id', 'term_id')); 16347?> 16348<#4993> 16349<?php 16350 $ilCtrlStructureReader->getStructure(); 16351?> 16352<#4994> 16353<?php 16354 if (!$ilDB->tableColumnExists('svy_svy', 'reminder_tmpl')) { 16355 $ilDB->addTableColumn('svy_svy', 'reminder_tmpl', array( 16356 "type" => "integer", 16357 "notnull" => false, 16358 "length" => 4 16359 )); 16360 } 16361?> 16362<#4995> 16363<?php 16364 $ilCtrlStructureReader->getStructure(); 16365?> 16366<#4996> 16367<?php 16368 16369if (!$ilDB->tableExists('exc_idl')) { 16370 $ilDB->createTable('exc_idl', array( 16371 'ass_id' => array( 16372 'type' => 'integer', 16373 'length' => 4, 16374 'notnull' => true, 16375 'default' => 0 16376 ), 16377 'member_id' => array( 16378 'type' => 'integer', 16379 'length' => 4, 16380 'notnull' => true, 16381 'default' => 0 16382 ), 16383 'is_team' => array( 16384 'type' => 'integer', 16385 'length' => 1, 16386 'notnull' => true, 16387 'default' => 0 16388 ), 16389 'tstamp' => array( 16390 'type' => 'integer', 16391 'length' => 4, 16392 'notnull' => false, 16393 'default' => 0 16394 ) 16395 )); 16396 16397 $ilDB->addPrimaryKey('exc_idl', array('ass_id', 'member_id', 'is_team')); 16398} 16399 16400?> 16401<#4997> 16402<?php 16403 if (!$ilDB->tableColumnExists('exc_data', 'tfeedback')) { 16404 $ilDB->addTableColumn('exc_data', 'tfeedback', array( 16405 "type" => "integer", 16406 "notnull" => true, 16407 "length" => 1, 16408 "default" => 7 16409 )); 16410 } 16411?> 16412<#4998> 16413<?php 16414$ilDB->modifyTableColumn( 16415 "usr_pref", 16416 "value", 16417 array( 16418 "type" => "text", 16419 "length" => 4000, 16420 "fixed" => false, 16421 "notnull" => false, 16422 "default" => null 16423 ) 16424); 16425?> 16426<#4999> 16427<?php 16428 $ilCtrlStructureReader->getStructure(); 16429?> 16430<#5000> 16431<?php 16432 // 16433?> 16434<#5001> 16435<?php 16436 $ilCtrlStructureReader->getStructure(); 16437?> 16438<#5002> 16439<?php 16440if (!$ilDB->tableExists('wfe_workflows')) { 16441 $fields = array( 16442 'workflow_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16443 'workflow_type' => array('type' => 'text', 'length' => 255), 16444 'workflow_content' => array('type' => 'text', 'length' => 255), 16445 'workflow_class' => array('type' => 'text', 'length' => 255), 16446 'workflow_location' => array('type' => 'text', 'length' => 255), 16447 'subject_type' => array('type' => 'text', 'length' => 30), 16448 'subject_id' => array('type' => 'integer', 'length' => 4), 16449 'context_type' => array('type' => 'text', 'length' => 30), 16450 'context_id' => array('type' => 'integer', 'length' => 4), 16451 'workflow_instance' => array('type' => 'clob', 'notnull' => false, 'default' => null), 16452 'active' => array('type' => 'integer', 'length' => 4) 16453 ); 16454 16455 $ilDB->createTable('wfe_workflows', $fields); 16456 $ilDB->addPrimaryKey('wfe_workflows', array('workflow_id')); 16457 $ilDB->createSequence('wfe_workflows'); 16458} 16459 16460if (!$ilDB->tableExists('wfe_det_listening')) { 16461 $fields = array( 16462 'detector_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16463 'workflow_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16464 'type' => array('type' => 'text', 'length' => 255), 16465 'content' => array('type' => 'text', 'length' => 255), 16466 'subject_type' => array('type' => 'text', 'length' => 30), 16467 'subject_id' => array('type' => 'integer', 'length' => 4), 16468 'context_type' => array('type' => 'text', 'length' => 30), 16469 'context_id' => array('type' => 'integer', 'length' => 4), 16470 'listening_start' => array('type' => 'integer', 'length' => 4), 16471 'listening_end' => array('type' => 'integer', 'length' => 4) 16472 ); 16473 16474 $ilDB->createTable('wfe_det_listening', $fields); 16475 $ilDB->addPrimaryKey('wfe_det_listening', array('detector_id')); 16476 $ilDB->createSequence('wfe_det_listening'); 16477} 16478 16479if (!$ilDB->tableExists('wfe_startup_events')) { 16480 $fields = array( 16481 'event_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16482 'workflow_id' => array('type' => 'text', 'length' => 60, 'notnull' => true), 16483 'type' => array('type' => 'text', 'length' => 255), 16484 'content' => array('type' => 'text', 'length' => 255), 16485 'subject_type' => array('type' => 'text', 'length' => 30), 16486 'subject_id' => array('type' => 'integer', 'length' => 4), 16487 'context_type' => array('type' => 'text', 'length' => 30), 16488 'context_id' => array('type' => 'integer', 'length' => 4) 16489 ); 16490 16491 $ilDB->createTable('wfe_startup_events', $fields); 16492 $ilDB->addPrimaryKey('wfe_startup_events', array('event_id')); 16493 $ilDB->createSequence('wfe_startup_events'); 16494} 16495 16496if (!$ilDB->tableExists('wfe_static_inputs')) { 16497 $fields = array( 16498 'input_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16499 'event_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16500 'name' => array('type' => 'text', 'length' => 255), 16501 'value' => array('type' => 'clob') 16502 ); 16503 16504 $ilDB->createTable('wfe_static_inputs', $fields); 16505 $ilDB->addPrimaryKey('wfe_static_inputs', array('input_id')); 16506 $ilDB->createSequence('wfe_static_inputs'); 16507} 16508 16509require_once './Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 16510ilDBUpdateNewObjectType::addAdminNode('wfe', 'WorkflowEngine'); 16511 16512$ilCtrlStructureReader->getStructure(); 16513?> 16514<#5003> 16515<?php 16516//create il translation table to store translations for title and descriptions 16517if (!$ilDB->tableExists('il_translations')) { 16518 $fields = array( 16519 'id' => array( 16520 'type' => 'integer', 16521 'length' => 4, 16522 'notnull' => true 16523 ), 16524 'id_type' => array( 16525 'type' => 'text', 16526 'length' => 50, 16527 'notnull' => true 16528 ), 16529 'lang_code' => array( 16530 'type' => 'text', 16531 'length' => 2, 16532 'notnull' => true 16533 ), 16534 'title' => array( 16535 'type' => 'text', 16536 'length' => 256, 16537 'fixed' => false, 16538 ), 16539 'description' => array( 16540 'type' => 'text', 16541 'length' => 512, 16542 ), 16543 'lang_default' => array( 16544 'type' => 'integer', 16545 'length' => 1, 16546 'notnull' => true 16547 ) 16548 ); 16549 $ilDB->createTable('il_translations', $fields); 16550 $ilDB->addPrimaryKey("il_translations", array("id", "id_type", "lang_code")); 16551} 16552?> 16553<#5004> 16554<?php 16555//data migration didactic templates to il_translation 16556if ($ilDB->tableExists('didactic_tpl_settings') && $ilDB->tableExists('il_translations')) { 16557 $ini = new ilIniFile(ILIAS_ABSOLUTE_PATH . "/ilias.ini.php"); 16558 16559 $lang_default = $ini->readVariable("language", "default"); 16560 16561 $ilSetting = new ilSetting(); 16562 16563 if ($ilSetting->get("language") != "") { 16564 $lang_default = $ilSetting->get("language"); 16565 } 16566 16567 $set = $ilDB->query("SELECT id, title, description" . 16568 " FROM didactic_tpl_settings"); 16569 16570 while ($row = $ilDB->fetchAssoc($set)) { 16571 $fields = array("id" => array("integer", $row['id']), 16572 "id_type" => array("text", "dtpl"), 16573 "lang_code" => array("text", $lang_default), 16574 "title" => array("text", $row['title']), 16575 "description" => array("text", $row['description']), 16576 "lang_default" => array("integer", 1)); 16577 16578 $ilDB->insert("il_translations", $fields); 16579 } 16580} 16581 16582?> 16583<#5005> 16584<?php 16585//table to store "effective from" nodes for didactic templates 16586if (!$ilDB->tableExists('didactic_tpl_en')) { 16587 $fields = array( 16588 'id' => array( 16589 'type' => 'integer', 16590 'length' => 4, 16591 'notnull' => true 16592 ), 16593 'node' => array( 16594 'type' => 'integer', 16595 'length' => 4, 16596 'notnull' => true 16597 ) 16598 ); 16599 $ilDB->createTable('didactic_tpl_en', $fields); 16600 $ilDB->addPrimaryKey("didactic_tpl_en", array("id", "node")); 16601} 16602 16603?> 16604<#5006> 16605<?php 16606$ilCtrlStructureReader->getStructure(); 16607?> 16608<#5007> 16609<?php 16610if (!$ilDB->tableColumnExists('grp_settings', 'show_members')) { 16611 $ilDB->addTableColumn('grp_settings', 'show_members', array( 16612 "notnull" => true 16613 ,"length" => 1 16614 ,"unsigned" => false 16615 ,"default" => "1" 16616 ,"type" => "integer" 16617 )); 16618} 16619?> 16620<#5008> 16621<?php 16622include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16623 16624$type_id = ilDBUpdateNewObjectType::getObjectTypeId('crs'); 16625$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 16626 16627if ($type_id && $tgt_ops_id) { 16628 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 16629} 16630?> 16631<#5009> 16632<?php 16633include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16634 16635$type_id = ilDBUpdateNewObjectType::getObjectTypeId('grp'); 16636$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 16637 16638if ($type_id && $tgt_ops_id) { 16639 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 16640} 16641?> 16642<#5010> 16643<?php 16644 16645include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16646$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 16647$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 16648ilDBUpdateNewObjectType::cloneOperation('crs', $src_ops_id, $tgt_ops_id); 16649 16650?> 16651<#5011> 16652<?php 16653 16654include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16655$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 16656$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 16657ilDBUpdateNewObjectType::cloneOperation('grp', $src_ops_id, $tgt_ops_id); 16658 16659?> 16660<#5012> 16661<?php 16662if (!$ilDB->tableColumnExists('didactic_tpl_settings', 'auto_generated')) { 16663 $ilDB->addTableColumn('didactic_tpl_settings', 'auto_generated', array( 16664 "notnull" => true, 16665 "length" => 1, 16666 "default" => 0, 16667 "type" => "integer" 16668 )); 16669} 16670?> 16671<#5013> 16672<?php 16673if (!$ilDB->tableColumnExists('didactic_tpl_settings', 'exclusive_tpl')) { 16674 $ilDB->addTableColumn('didactic_tpl_settings', 'exclusive_tpl', array( 16675 "notnull" => true, 16676 "length" => 1, 16677 "default" => 0, 16678 "type" => "integer" 16679 )); 16680} 16681?> 16682 16683<#5014> 16684<?php 16685$id = $ilDB->nextId('didactic_tpl_settings'); 16686$query = 'INSERT INTO didactic_tpl_settings (id,enabled,type,title, description,info,auto_generated,exclusive_tpl) values( ' . 16687 $ilDB->quote($id, 'integer') . ', ' . 16688 $ilDB->quote(1, 'integer') . ', ' . 16689 $ilDB->quote(1, 'integer') . ', ' . 16690 $ilDB->quote('grp_closed', 'text') . ', ' . 16691 $ilDB->quote('grp_closed_info', 'text') . ', ' . 16692 $ilDB->quote('', 'text') . ', ' . 16693 $ilDB->quote(1, 'integer') . ', ' . 16694 $ilDB->quote(0, 'integer') . ' ' . 16695 ')'; 16696$ilDB->manipulate($query); 16697 16698$query = 'INSERT INTO didactic_tpl_sa (id, obj_type) values( ' . 16699 $ilDB->quote($id, 'integer') . ', ' . 16700 $ilDB->quote('grp', 'text') . 16701 ')'; 16702$ilDB->manipulate($query); 16703 16704 16705$aid = $ilDB->nextId('didactic_tpl_a'); 16706$query = 'INSERT INTO didactic_tpl_a (id, tpl_id, type_id) values( ' . 16707 $ilDB->quote($aid, 'integer') . ', ' . 16708 $ilDB->quote($id, 'integer') . ', ' . 16709 $ilDB->quote(1, 'integer') . 16710 ')'; 16711$ilDB->manipulate($query); 16712 16713$query = 'select obj_id from object_data where type = ' . $ilDB->quote('rolt', 'text') . ' and title = ' . $ilDB->quote('il_grp_status_closed', 'text'); 16714$res = $ilDB->query($query); 16715while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 16716 $closed_id = $row->obj_id; 16717} 16718 16719$query = 'INSERT INTO didactic_tpl_alp (action_id, filter_type, template_type, template_id) values( ' . 16720 $ilDB->quote($aid, 'integer') . ', ' . 16721 $ilDB->quote(3, 'integer') . ', ' . 16722 $ilDB->quote(2, 'integer') . ', ' . 16723 $ilDB->quote($closed_id, 'integer') . 16724 ')'; 16725$ilDB->manipulate($query); 16726 16727 16728$fid = $ilDB->nextId('didactic_tpl_fp'); 16729$query = 'INSERT INTO didactic_tpl_fp (pattern_id, pattern_type, pattern_sub_type, pattern, parent_id, parent_type ) values( ' . 16730 $ilDB->quote($fid, 'integer') . ', ' . 16731 $ilDB->quote(1, 'integer') . ', ' . 16732 $ilDB->quote(1, 'integer') . ', ' . 16733 $ilDB->quote('.*', 'text') . ', ' . 16734 $ilDB->quote($aid, 'integer') . ', ' . 16735 $ilDB->quote('action', 'text') . 16736 ')'; 16737$ilDB->manipulate($query); 16738 16739?> 16740<#5015> 16741<?php 16742$query = 16743 "SELECT id FROM didactic_tpl_settings " . 16744 "WHERE title = " . $ilDB->quote('grp_closed', 'text') . 16745 " AND description = " . $ilDB->quote('grp_closed_info', 'text') . 16746 " AND auto_generated = 1"; 16747 16748$closed_grp = $ilDB->query($query)->fetchRow(ilDBConstants::FETCHMODE_OBJECT)->id; 16749 16750$query = 16751 "SELECT objr.obj_id obj_id, objr.ref_id ref_id " . 16752 "FROM (grp_settings grps JOIN object_reference objr ON (grps.obj_id = objr.obj_id)) " . 16753 "LEFT JOIN didactic_tpl_objs dtplo ON (dtplo.obj_id = objr.obj_id) " . 16754 "WHERE grps.grp_type = 1 " . 16755 "AND (dtplo.tpl_id IS NULL OR dtplo.tpl_id = 0)"; 16756$res = $ilDB->query($query); 16757 16758while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 16759 $query = 'INSERT INTO didactic_tpl_objs (obj_id,tpl_id,ref_id) ' . 16760 'VALUES( ' . 16761 $ilDB->quote($row->obj_id, 'integer') . ', ' . 16762 $ilDB->quote($closed_grp, 'integer') . ', ' . 16763 $ilDB->quote($row->ref_id, 'integer') . 16764 ')'; 16765 $ilDB->manipulate($query); 16766} 16767 16768?> 16769<#5016> 16770<?php 16771 16772include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16773 16774$type_id = ilDBUpdateNewObjectType::getObjectTypeId('grp'); 16775if ($type_id) { 16776 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('news_add_news', 'Add News', 'object', 2100); 16777 if ($new_ops_id) { 16778 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 16779 } 16780} 16781?> 16782 16783<#5017> 16784<?php 16785if (!$ilDB->tableColumnExists('il_news_item', 'content_html')) { 16786 $ilDB->addTableColumn( 16787 'il_news_item', 16788 'content_html', 16789 array( 16790 "type" => "integer", 16791 "notnull" => true, 16792 "length" => 1, 16793 "default" => 0 16794 ) 16795 ); 16796} 16797?> 16798 16799<#5018> 16800<?php 16801if (!$ilDB->tableColumnExists('il_news_item', 'update_user_id')) { 16802 $ilDB->addTableColumn( 16803 'il_news_item', 16804 'update_user_id', 16805 array( 16806 "type" => "integer", 16807 "notnull" => true, 16808 "length" => 4, 16809 "default" => 0 16810 ) 16811 ); 16812} 16813?> 16814<#5019> 16815<?php 16816include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16817 16818$type_id = ilDBUpdateNewObjectType::getObjectTypeId('crs'); 16819if ($type_id) { 16820 $ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("news_add_news"); 16821 if ($ops_id) { 16822 ilDBUpdateNewObjectType::addRBACOperation($type_id, $ops_id); 16823 } 16824} 16825?> 16826 16827<#5020> 16828<?php 16829include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16830$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 16831$target_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('news_add_news'); 16832ilDBUpdateNewObjectType::cloneOperation("crs", $src_ops_id, $target_ops_id); 16833ilDBUpdateNewObjectType::cloneOperation("grp", $src_ops_id, $target_ops_id); 16834?> 16835<#5021> 16836<?php 16837 16838if (!$ilDB->tableExists('background_task')) { 16839 $ilDB->createTable('background_task', array( 16840 'id' => array( 16841 'type' => 'integer', 16842 'length' => 4, 16843 'notnull' => true, 16844 'default' => 0 16845 ), 16846 'user_id' => array( 16847 'type' => 'integer', 16848 'length' => 4, 16849 'notnull' => true, 16850 'default' => 0 16851 ), 16852 'handler' => array( 16853 'type' => 'text', 16854 'length' => 1000, 16855 'notnull' => false 16856 ), 16857 'steps' => array( 16858 'type' => 'integer', 16859 'length' => 3, 16860 'notnull' => true, 16861 'default' => 0 16862 ), 16863 'cstep' => array( 16864 'type' => 'integer', 16865 'length' => 3, 16866 'notnull' => false 16867 ), 16868 'start_date' => array( 16869 'type' => 'timestamp' 16870 ), 16871 'status' => array( 16872 'type' => 'text', 16873 'length' => 100, 16874 'notnull' => false 16875 ), 16876 'params' => array( 16877 'type' => 'text', 16878 'length' => 4000, 16879 'notnull' => false 16880 ) 16881 )); 16882 16883 $ilDB->addPrimaryKey('background_task', array('id')); 16884 $ilDB->createSequence('background_task'); 16885} 16886 16887?> 16888<#5022> 16889<?php 16890 $ilCtrlStructureReader->getStructure(); 16891?> 16892<#5023> 16893<?php 16894if (!$ilDB->tableColumnExists('qpl_qst_mc', 'selection_limit')) { 16895 $ilDB->addTableColumn('qpl_qst_mc', 'selection_limit', array( 16896 'type' => 'integer', 16897 'length' => 4, 16898 'notnull' => false, 16899 'default' => null 16900 )); 16901} 16902?> 16903 16904 16905<#5024> 16906 16907<?php 16908include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16909$obj_type_id = ilDBUpdateNewObjectType::addNewType("mass", "Manual Assessment"); 16910$existing_ops = array('visible', 'read', 'write', 'copy', 'delete' 16911 , 'edit_permission', 'read_learning_progress', 'edit_learning_progress'); 16912foreach ($existing_ops as $op) { 16913 $op_id = ilDBUpdateNewObjectType::getCustomRBACOperationId($op); 16914 ilDBUpdateNewObjectType::addRBACOperation($obj_type_id, $op_id); 16915} 16916$parent_types = array('root', 'cat', 'crs'); 16917ilDBUpdateNewObjectType::addRBACCreate('create_mass', 'Create Manuall Assessment', $parent_types); 16918 16919if (!$ilDB->tableExists("mass_settings")) { 16920 $fields = array( 16921 'obj_id' => array( 16922 'type' => 'integer', 16923 'length' => 4, 16924 'notnull' => true, 16925 'default' => 0 16926 ), 16927 'content' => array( 16928 'type' => 'text', 16929 'length' => 1000, 16930 'notnull' => false, 16931 'default' => null 16932 ), 16933 'record_template' => array( 16934 'type' => 'text', 16935 'length' => 1000, 16936 'notnull' => false, 16937 'default' => null 16938 ) 16939 ); 16940 $ilDB->createTable('mass_settings', $fields); 16941} 16942 16943if (!$ilDB->tableExists('mass_members')) { 16944 $fields = array( 16945 'obj_id' => array( 16946 'type' => 'integer', 16947 'length' => 4, 16948 'notnull' => true, 16949 'default' => 0 16950 ), 16951 'usr_id' => array( 16952 'type' => 'integer', 16953 'length' => 4, 16954 'notnull' => true, 16955 'default' => 0 16956 ), 16957 'examiner_id' => array( 16958 'type' => 'integer', 16959 'length' => 4, 16960 'notnull' => false, 16961 'default' => 0 16962 ), 16963 'record' => array( 16964 'type' => 'text', 16965 'length' => 1000, 16966 'notnull' => false, 16967 'default' => '' 16968 ), 16969 'internal_note' => array( 16970 'type' => 'text', 16971 'length' => 1000, 16972 'notnull' => false, 16973 'default' => '' 16974 ), 16975 'notify' => array( 16976 'type' => 'integer', 16977 'length' => 1, 16978 'notnull' => true, 16979 'default' => 0 16980 ), 16981 'notification_ts' => array( 16982 'type' => 'integer', 16983 'length' => 4, 16984 'notnull' => true, 16985 'default' => -1 16986 ), 16987 'learning_progress' => array( 16988 'type' => 'integer', 16989 'length' => 1, 16990 'notnull' => false, 16991 'default' => 0 16992 ), 16993 'finalized' => array( 16994 'type' => 'integer', 16995 'length' => 1, 16996 'notnull' => true, 16997 'default' => 0 16998 ) 16999 ); 17000 $ilDB->createTable('mass_members', $fields); 17001} 17002 17003$mass_type_id = ilDBUpdateNewObjectType::getObjectTypeId('mass'); 17004if ($mass_type_id) { 17005 $custom_ops = array('edit_members' => 'Manage members'); 17006 $counter = 1; 17007 foreach ($custom_ops as $ops_id => $ops_description) { 17008 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation( 17009 $ops_id, 17010 $ops_description, 17011 'object', 17012 8000 + $counter * 100 17013 ); 17014 $counter++; 17015 if ($new_ops_id) { 17016 ilDBUpdateNewObjectType::addRBACOperation($mass_type_id, $new_ops_id); 17017 } 17018 } 17019 $rolt_title = 'il_mass_member'; 17020 $rec = $ilDB->fetchAssoc( 17021 $ilDB->query("SELECT obj_id FROM object_data " 17022 . " WHERE type = 'rolt' AND title = " . $ilDB->quote($rolt_title, 'text')) 17023 ); 17024 if ($rec) { 17025 $mass_member_tpl_id = $rec['obj_id']; 17026 } else { 17027 $mass_member_tpl_id = $ilDB->nextId('object_data'); 17028 $ilDB->manipulateF( 17029 " 17030 INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 17031 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 17032 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 17033 array($mass_member_tpl_id, "rolt", $rolt_title, "Member of a manual assessment object", -1, ilUtil::now(), ilUtil::now()) 17034 ); 17035 } 17036 $ops = array(); 17037 $rec = $ilDB->fetchAssoc( 17038 $ilDB->query("SELECT ops_id FROM rbac_operations WHERE operation = 'visible'") 17039 ); 17040 $ops[] = $rec['ops_id']; 17041 $rec = $ilDB->fetchAssoc( 17042 $ilDB->query("SELECT ops_id FROM rbac_operations WHERE operation = 'read'") 17043 ); 17044 $ops[] = $rec['ops_id']; 17045 foreach ($ops as $op_id) { 17046 if (!$ilDB->fetchAssoc( 17047 $ilDB->query("SELECT * FROM rbac_templates " 17048 . " WHERE ops_id = " . $ilDB->quote($op_id, 'integer') 17049 . " AND rol_id = " . $ilDB->quote($mass_member_tpl_id, 'integer')) 17050 )) { 17051 $query = "INSERT INTO rbac_templates 17052 VALUES (" . $ilDB->quote($mass_member_tpl_id) . ", 'mass', " . $ilDB->quote($op_id) . ", 8)"; 17053 $ilDB->manipulate($query); 17054 } 17055 } 17056 $query = "INSERT INTO rbac_fa VALUES (" . $ilDB->quote($mass_member_tpl_id) . ", 8, 'n', 'n', 0)"; 17057 $ilDB->manipulate($query); 17058} 17059?> 17060 17061<#5025> 17062<?php 17063if (!$ilDB->tableExists("mass_info_settings")) { 17064 $fields = array( 17065 'obj_id' => array( 17066 'type' => 'integer', 17067 'length' => 4, 17068 'notnull' => true, 17069 'default' => 0 17070 ), 17071 'contact' => array( 17072 'type' => 'text', 17073 'length' => 100, 17074 'notnull' => false, 17075 'default' => null 17076 ), 17077 'responsibility' => array( 17078 'type' => 'text', 17079 'length' => 100, 17080 'notnull' => false, 17081 'default' => null 17082 ), 17083 'phone' => array( 17084 'type' => 'text', 17085 'length' => 100, 17086 'notnull' => false, 17087 'default' => null 17088 ), 17089 'mails' => array( 17090 'type' => 'text', 17091 'length' => 300, 17092 'notnull' => false, 17093 'default' => null 17094 ), 17095 'consultation_hours' => array( 17096 'type' => 'text', 17097 'length' => 500, 17098 'notnull' => false, 17099 'default' => null 17100 ), 17101 ); 17102 $ilDB->createTable('mass_info_settings', $fields); 17103} 17104?> 17105<#5026> 17106<?php 17107if (!$ilDB->indexExistsByFields('mass_settings', array('obj_id'))) { 17108 $ilDB->addPrimaryKey('mass_settings', array('obj_id')); 17109} 17110if (!$ilDB->indexExistsByFields('mass_info_settings', array('obj_id'))) { 17111 $ilDB->addPrimaryKey('mass_info_settings', array('obj_id')); 17112} 17113if (!$ilDB->indexExistsByFields('mass_members', array('obj_id','usr_id'))) { 17114 $ilDB->addPrimaryKey('mass_members', array('obj_id','usr_id')); 17115} 17116?> 17117<#5027> 17118<?php 17119 if (!$ilDB->indexExistsByFields('lng_data', array('local_change'))) { 17120 $ilDB->addIndex('lng_data', array('local_change'), 'i3'); 17121 } 17122?> 17123<#5028> 17124<?php 17125if (!$ilDB->tableExists('osc_activity')) { 17126 $ilDB->createTable( 17127 'osc_activity', 17128 array( 17129 'conversation_id' => array( 17130 'type' => 'text', 17131 'length' => 255, 17132 'notnull' => true 17133 ), 17134 'user_id' => array( 17135 'type' => 'integer', 17136 'length' => 4, 17137 'notnull' => true, 17138 'default' => 0 17139 ), 17140 'timestamp' => array( 17141 'type' => 'integer', 17142 'length' => 8, 17143 'notnull' => true, 17144 'default' => 0 17145 ) 17146 ) 17147 ); 17148 $ilDB->addPrimaryKey('osc_activity', array('conversation_id', 'user_id')); 17149} 17150?> 17151<#5029> 17152<?php 17153if (!$ilDB->tableExists('osc_messages')) { 17154 $ilDB->createTable( 17155 'osc_messages', 17156 array( 17157 'id' => array( 17158 'type' => 'text', 17159 'length' => 255, 17160 'notnull' => true 17161 ), 17162 'conversation_id' => array( 17163 'type' => 'text', 17164 'length' => 255, 17165 'notnull' => true 17166 ), 17167 'user_id' => array( 17168 'type' => 'integer', 17169 'length' => 4, 17170 'notnull' => true, 17171 'default' => 0 17172 ), 17173 'message' => array( 17174 'type' => 'clob', 17175 'notnull' => false, 17176 'default' => null 17177 ), 17178 'timestamp' => array( 17179 'type' => 'integer', 17180 'length' => 8, 17181 'notnull' => true, 17182 'default' => 0 17183 ) 17184 ) 17185 ); 17186 $ilDB->addPrimaryKey('osc_messages', array('id')); 17187} 17188?> 17189<#5030> 17190<?php 17191if (!$ilDB->tableExists('osc_conversation')) { 17192 $ilDB->createTable( 17193 'osc_conversation', 17194 array( 17195 'id' => array( 17196 'type' => 'text', 17197 'length' => 255, 17198 'notnull' => true 17199 ), 17200 'is_group' => array( 17201 'type' => 'integer', 17202 'length' => 1, 17203 'notnull' => true, 17204 'default' => 0 17205 ), 17206 'participants' => array( 17207 'type' => 'text', 17208 'length' => 4000, 17209 'notnull' => false, 17210 'default' => null 17211 ) 17212 ) 17213 ); 17214 $ilDB->addPrimaryKey('osc_conversation', array('id')); 17215} 17216?> 17217<#5031> 17218<?php 17219if (!$ilDB->tableColumnExists('osc_activity', 'is_closed')) { 17220 $ilDB->addTableColumn('osc_activity', 'is_closed', array( 17221 'type' => 'integer', 17222 'length' => 1, 17223 'notnull' => true, 17224 'default' => 0 17225 )); 17226} 17227?> 17228<#5032> 17229<?php 17230$ilCtrlStructureReader->getStructure(); 17231?> 17232<#5033> 17233<?php 17234if (!$ilDB->tableExists('user_action_activation')) { 17235 $ilDB->createTable('user_action_activation', array( 17236 'context_comp' => array( 17237 'type' => 'text', 17238 'length' => 30, 17239 'notnull' => true 17240 ), 17241 'context_id' => array( 17242 'type' => 'text', 17243 'length' => 30, 17244 'notnull' => true 17245 ), 17246 'action_comp' => array( 17247 'type' => 'text', 17248 'length' => 30, 17249 'notnull' => true 17250 ), 17251 'action_type' => array( 17252 'type' => 'text', 17253 'length' => 30, 17254 'notnull' => true 17255 ), 17256 'active' => array( 17257 'type' => 'integer', 17258 'length' => 1, 17259 'notnull' => true, 17260 'default' => 0 17261 ) 17262 )); 17263 17264 $ilDB->addPrimaryKey('user_action_activation', array('context_comp', 'context_id', 'action_comp', 'action_type')); 17265} 17266?> 17267<#5034> 17268<?php 17269$ilCtrlStructureReader->getStructure(); 17270?> 17271<#5035> 17272<?php 17273$fields = array( 17274 'ref_id' => array( 17275 'type' => 'integer', 17276 'length' => '8', 17277 17278 ), 17279 'obj_id' => array( 17280 'type' => 'integer', 17281 'length' => '8', 17282 17283 ), 17284 'path' => array( 17285 'type' => 'clob', 17286 17287 ), 17288 17289); 17290if (!$ilDB->tableExists('orgu_path_storage')) { 17291 $ilDB->createTable('orgu_path_storage', $fields); 17292 $ilDB->addPrimaryKey('orgu_path_storage', array( 'ref_id' )); 17293} 17294?> 17295<#5036> 17296<?php 17297$ilCtrlStructureReader->getStructure(); 17298?> 17299 17300<#5037> 17301<?php 17302 17303include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 17304ilDBUpdateNewObjectType::deleteRBACOperation('grpr', ilDBUpdateNewObjectType::RBAC_OP_READ); 17305 17306?> 17307<#5038> 17308<?php 17309$ilCtrlStructureReader->getStructure(); 17310?> 17311<#5039> 17312<?php 17313 17314// get badge administration ref_id 17315$set = $ilDB->query("SELECT oref.ref_id FROM object_reference oref" . 17316 " JOIN object_data od ON (od.obj_id = oref.obj_id)" . 17317 " WHERE od.type = " . $ilDB->quote("bdga")); 17318$bdga_ref_id = $ilDB->fetchAssoc($set); 17319$bdga_ref_id = (int) $bdga_ref_id["ref_id"]; 17320if ($bdga_ref_id) { 17321 // #18931 - check if ref_id can be found as child of admin node 17322 $set = $ilDB->query("SELECT parent FROM tree" . 17323 " WHERE child = " . $ilDB->quote($bdga_ref_id, "int") . 17324 " AND tree.tree = " . $ilDB->quote(1, "int")); 17325 $bdga_tree = $ilDB->fetchAssoc($set); 17326 $bdga_tree = (int) $bdga_tree["parent"]; 17327 if ($bdga_tree != SYSTEM_FOLDER_ID) { 17328 $tree = new ilTree(ROOT_FOLDER_ID); 17329 $tree->insertNode($bdga_ref_id, SYSTEM_FOLDER_ID); 17330 } 17331} 17332 17333?> 17334<#5040> 17335<?php 17336//step 1/5 il_verification removes dublicates 17337if ($ilDB->tableExists('il_verification')) { 17338 $res = $ilDB->query(" 17339 SELECT id, type 17340 FROM il_verification 17341 GROUP BY id, type 17342 HAVING COUNT(id) > 1 17343 "); 17344 17345 if ($ilDB->numRows($res)) { 17346 if (!$ilDB->tableExists('il_verification_tmp')) { 17347 $ilDB->createTable('il_verification_tmp', array( 17348 'id' => array( 17349 'type' => 'integer', 17350 'length' => 8, 17351 'notnull' => true, 17352 'default' => 0 17353 ) 17354 )); 17355 $ilDB->addPrimaryKey('il_verification_tmp', array('id', 'type')); 17356 } 17357 17358 while ($row = $ilDB->fetchAssoc($res)) { 17359 $ilDB->replace('il_verification_tmp', array(), array( 17360 'id' => array('integer', $row['id']), 17361 'type' => array('text', $row['type']) 17362 )); 17363 } 17364 } 17365} 17366?> 17367<#5041> 17368<?php 17369//step 2/5 il_verification deletes dublicates stored in il_verification_tmp 17370if ($ilDB->tableExists('il_verification_tmp')) { 17371 $res = $ilDB->query(" 17372 SELECT id, type 17373 FROM il_verification_tmp 17374 "); 17375 17376 while ($row = $ilDB->fetchAssoc($res)) { 17377 $res_data = $ilDB->query( 17378 " 17379 SELECT * 17380 FROM il_verification 17381 WHERE 17382 id = " . $ilDB->quote($row['id'], 'integer') . " AND 17383 type = " . $ilDB->quote($row['type'], 'text') 17384 ); 17385 $data = $ilDB->fetchAssoc($res_data); 17386 17387 $ilDB->manipulate( 17388 "DELETE FROM il_verification WHERE" . 17389 " id = " . $ilDB->quote($row['id'], 'integer') . 17390 " AND type = " . $ilDB->quote($row['type'], 'text') 17391 ); 17392 17393 $ilDB->manipulate("INSERT INTO il_verification (id, type, parameters, raw_data) " . 17394 "VALUES ( " . 17395 $ilDB->quote($data['id'], 'integer') . ', ' . 17396 $ilDB->quote($data['type'], 'text') . ', ' . 17397 $ilDB->quote($data['parameters'], 'text') . ', ' . 17398 $ilDB->quote($data['raw_data'], 'text') . 17399 ")"); 17400 17401 $ilDB->manipulate( 17402 "DELETE FROM il_verification_tmp WHERE" . 17403 " id = " . $ilDB->quote($row['id'], 'integer') . 17404 " AND type = " . $ilDB->quote($row['type'], 'text') 17405 ); 17406 } 17407} 17408?> 17409<#5042> 17410<?php 17411//step 3/5 il_verification drops not used indexes 17412if ($ilDB->indexExistsByFields('il_verification', array('id'))) { 17413 $ilDB->dropIndexByFields('il_verification', array('id')); 17414} 17415?> 17416<#5043> 17417<?php 17418//step 4/5 il_verification adding primary key 17419if ($ilDB->tableExists('il_verification')) { 17420 $ilDB->dropPrimaryKey('il_verification'); 17421 $ilDB->addPrimaryKey('il_verification', array('id', 'type')); 17422} 17423?> 17424<#5044> 17425<?php 17426//step 5/5 il_verification removes temp table 17427if ($ilDB->tableExists('il_verification_tmp')) { 17428 $ilDB->dropTable('il_verification_tmp'); 17429} 17430?> 17431<#5045> 17432<?php 17433$ilCtrlStructureReader->getStructure(); 17434?> 17435<#5046> 17436<?php 17437 $ilDB->addPrimaryKey('glo_glossaries', array('id', 'glo_id')); 17438?> 17439<#5047> 17440<?php 17441 $ilCtrlStructureReader->getStructure(); 17442?> 17443<#5048> 17444<?php 17445if ($ilDB->sequenceExists('mail_obj_data')) { 17446 $ilDB->dropSequence('mail_obj_data'); 17447} 17448 17449if ($ilDB->sequenceExists('mail_obj_data')) { 17450 setup_exit("Sequence could not be dropped!"); 17451} else { 17452 $res1 = $ilDB->query("SELECT MAX(child) max_id FROM mail_tree"); 17453 $row1 = $ilDB->fetchAssoc($res1); 17454 17455 $res2 = $ilDB->query("SELECT MAX(obj_id) max_id FROM mail_obj_data"); 17456 $row2 = $ilDB->fetchAssoc($res2); 17457 17458 $start = max($row1['max_id'], $row2['max_id']) + 2; // add + 2 to be save 17459 17460 $ilDB->createSequence('mail_obj_data', $start); 17461} 17462?> 17463<#5049> 17464<?php 17465 $ilCtrlStructureReader->getStructure(); 17466?> 17467<#5050> 17468<?php 17469 require_once 'Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 17470 17471 ilDBUpdateNewObjectType::updateOperationOrder("edit_members", 2400); 17472?> 17473<#5051> 17474<?php 17475 $ilCtrlStructureReader->getStructure(); 17476?> 17477<#5052> 17478<?php 17479 $ilCtrlStructureReader->getStructure(); 17480?> 17481<#5053> 17482<?php 17483 $ilCtrlStructureReader->getStructure(); 17484?> 17485<#5054> 17486<?php 17487 $ilCtrlStructureReader->getStructure(); 17488?> 17489<#5055> 17490<?php 17491// 1. Select all the questions of surveys 17492$q = "SELECT svy_question.question_id, svy_svy_qst.survey_fi FROM svy_question, svy_svy_qst WHERE svy_question.question_id = svy_svy_qst.question_fi"; 17493$res = $ilDB->query($q); 17494 17495while ($svy_data = $res->fetchAssoc()) { 17496 $question_id = $svy_data['question_id']; 17497 $svy_id = $svy_data['survey_fi']; 17498 17499 $q = "SELECT obj_fi FROM svy_svy WHERE survey_id = " . $ilDB->quote($svy_id, "integer"); 17500 $res2 = $ilDB->query($q); 17501 $row = $res2->fetchAssoc(); 17502 $obj_id = $row['obj_fi']; 17503 17504 $u = "UPDATE svy_question SET obj_fi = " . $ilDB->quote($obj_id, "integer") . " WHERE question_id = " . $ilDB->quote($question_id, "integer"); 17505 $ilDB->query($u); 17506} 17507?> 17508<#5056> 17509<?php 17510$ilDB->update( 17511 'il_dcl_datatype', 17512 array( 17513 "ildb_type" => array("text", "text"), 17514 "storage_location" => array("integer", 1) 17515 ), 17516 array( 17517 "title" => array("text", "reference") 17518 ) 17519); 17520?> 17521<#5057> 17522<?php 17523if (!$ilDB->tableColumnExists('qpl_qst_type', 'plugin_name')) { 17524 $ilDB->addTableColumn('qpl_qst_type', 'plugin_name', array( 17525 'type' => 'text', 17526 'length' => 40, 17527 'notnull' => false, 17528 'default' => null 17529 )); 17530} 17531?> 17532<#5058> 17533<?php 17534if (!$ilDB->tableColumnExists('qpl_a_ordering', 'order_position')) { 17535 $ilDB->addTableColumn('qpl_a_ordering', 'order_position', array( 17536 'type' => 'integer', 17537 'length' => 3, 17538 'notnull' => false, 17539 'default' => null 17540 )); 17541 17542 $ilDB->manipulate("UPDATE qpl_a_ordering SET order_position = solution_order"); 17543 $ilDB->renameTableColumn('qpl_a_ordering', 'solution_order', 'solution_keyvalue'); 17544} 17545?> 17546<#5059> 17547<?php 17548if ($ilDB->tableColumnExists('qpl_a_ordering', 'solution_keyvalue')) { 17549 $ilDB->renameTableColumn('qpl_a_ordering', 'solution_keyvalue', 'solution_key'); 17550} 17551?> 17552<#5060> 17553<?php 17554if ($ilDB->tableColumnExists('qpl_a_ordering', 'order_position')) { 17555 $ilDB->renameTableColumn('qpl_a_ordering', 'order_position', 'position'); 17556} 17557?> 17558<#5061> 17559<?php 17560 $ilCtrlStructureReader->getStructure(); 17561?> 17562 17563<#5062> 17564<?php 17565 //rename tables 17566 if ($ilDB->tableExists('mass_info_settings') && !$ilDB->tableExists('iass_info_settings')) { 17567 $ilDB->renameTable('mass_info_settings', 'iass_info_settings'); 17568 } 17569 17570 if ($ilDB->tableExists('mass_settings') && !$ilDB->tableExists('iass_settings')) { 17571 $ilDB->renameTable('mass_settings', 'iass_settings'); 17572 } 17573 17574 if ($ilDB->tableExists('mass_members') && !$ilDB->tableExists('iass_members')) { 17575 $ilDB->renameTable('mass_members', 'iass_members'); 17576 } 17577 17578 //change obj type 17579 $ilDB->manipulate('UPDATE object_data SET type = ' . $ilDB->quote('iass', 'text') 17580 . ' WHERE type = ' . $ilDB->quote('mass', 'text')); 17581 17582 //change name of role template for iass member 17583 $ilDB->manipulate('UPDATE object_data SET title = ' . $ilDB->quote('il_iass_member', 'text') 17584 . ' WHERE type = ' . $ilDB->quote('rolt', 'text') 17585 . ' AND title =' . $ilDB->quote('il_mass_member', 'text')); 17586 17587 //change names of existing iass member roles 17588 $ilDB->manipulate('UPDATE object_data SET title = REPLACE(title,' . $ilDB->quote('_mass_', 'text') . ',' . $ilDB->quote('_iass_', 'text') . ')' 17589 . ' WHERE type = ' . $ilDB->quote('role', 'text') 17590 . ' AND title LIKE ' . $ilDB->quote('il_mass_member_%', 'text')); 17591 17592 //change typ name 17593 $ilDB->manipulate('UPDATE object_data SET title = ' . $ilDB->quote('iass', 'text') 17594 . ' ,description = ' . $ilDB->quote('Individual Assessment', 'text') 17595 . ' WHERE type = ' . $ilDB->quote('typ', 'text') 17596 . ' AND title = ' . $ilDB->quote('mass', 'text')); 17597 17598 //adapt object declaration in rbac 17599 $ilDB->manipulate('UPDATE rbac_templates SET type = ' . $ilDB->quote('iass', 'text') 17600 . ' WHERE type = ' . $ilDB->quote('mass', 'text')); 17601 17602 //change op names 17603 $ilDB->manipulate('UPDATE rbac_operations SET operation = ' . $ilDB->quote('create_iass', 'text') 17604 . ' ,description = ' . $ilDB->quote('Create Individual Assessment', 'text') 17605 . ' WHERE operation = ' . $ilDB->quote('create_mass', 'text')); 17606 17607 $ilCtrlStructureReader->getStructure(); 17608?> 17609<#5063> 17610<?php 17611if ($ilDB->tableExists('svy_qst_oblig')) { 17612 $ilDB->manipulate("UPDATE svy_question" . 17613 " INNER JOIN svy_qst_oblig" . 17614 " ON svy_question.question_id = svy_qst_oblig.question_fi" . 17615 " SET svy_question.obligatory = svy_qst_oblig.obligatory"); 17616} 17617?> 17618<#5064> 17619<?php 17620$ilDB->modifyTableColumn( 17621 'mail_attachment', 17622 'path', 17623 array( 17624 "type" => "text", 17625 "length" => 500, 17626 "notnull" => false, 17627 'default' => null 17628 ) 17629); 17630?> 17631<#5065> 17632<?php 17633 $ilCtrlStructureReader->getStructure(); 17634?> 17635<#5066> 17636<?php 17637 $ilCtrlStructureReader->getStructure(); 17638?> 17639<#5067> 17640<?php 17641 17642 if (!$ilDB->tableColumnExists('qpl_a_mterm', 'ident')) { 17643 $ilDB->addTableColumn('qpl_a_mterm', 'ident', array( 17644 'type' => 'integer', 'length' => 4, 17645 'notnull' => false, 'default' => null 17646 )); 17647 17648 $ilDB->manipulate("UPDATE qpl_a_mterm SET ident = term_id WHERE ident IS NULL"); 17649 } 17650 17651 if (!$ilDB->tableColumnExists('qpl_a_mdef', 'ident')) { 17652 require_once 'Services/Database/classes/class.ilDBAnalyzer.php'; 17653 $ilDB->renameTableColumn('qpl_a_mdef', 'morder', 'ident'); 17654 } 17655 17656?> 17657<#5068> 17658<?php 17659$ilDB->modifyTableColumn( 17660 'exc_returned', 17661 'mimetype', 17662 array( 17663 'type' => 'text', 17664 'length' => 150, 17665 'notnull' => false) 17666); 17667?> 17668<#5069> 17669<?php 17670include_once('./Services/Migration/DBUpdate_5069/classes/class.ilDBUpdate5069.php'); 17671ilDBUpdate5069::fix19795(); 17672?> 17673 17674<#5070> 17675<?php 17676 17677// remove role entries in obj_members 17678$query = 'update obj_members set admin = ' . $ilDB->quote(0, 'integer') . ', ' . 17679 'tutor = ' . $ilDB->quote(0, 'integer') . ', member = ' . $ilDB->quote(0, 'integer'); 17680$ilDB->manipulate($query); 17681 17682// iterate through all courses 17683$offset = 0; 17684$limit = 100; 17685do { 17686 $ilDB->setLimit($limit, $offset); 17687 $query = 'SELECT obr.ref_id, obr.obj_id FROM object_reference obr ' . 17688 'join object_data obd on obr.obj_id = obd.obj_id where (type = ' . $ilDB->quote('crs', 'text') . ' or type = ' . $ilDB->quote('grp', 'text') . ') '; 17689 $res = $ilDB->query($query); 17690 17691 if (!$res->numRows()) { 17692 break; 17693 } 17694 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 17695 // find course members roles 17696 $query = 'select rol_id, title from rbac_fa ' . 17697 'join object_data on rol_id = obj_id ' . 17698 'where parent = ' . $ilDB->quote($row->ref_id, 'integer') . ' ' . 17699 'and assign = ' . $ilDB->quote('y', 'text'); 17700 $rol_res = $ilDB->query($query); 17701 while ($rol_row = $rol_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 17702 // find users which are not assigned to obj_members and create a default entry 17703 $query = 'select ua.usr_id from rbac_ua ua ' . 17704 'left join obj_members om on (ua.usr_id = om.usr_id and om.obj_id = ' . $ilDB->quote($row->obj_id, 'integer') . ') ' . 17705 'where om.usr_id IS NULL ' . 17706 'and rol_id = ' . $ilDB->quote($rol_row->rol_id, 'integer'); 17707 $ua_res = $ilDB->query($query); 17708 while ($ua_row = $ua_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 17709 $query = 'insert into obj_members (obj_id, usr_id) ' . 17710 'values(' . 17711 $ilDB->quote($row->obj_id, 'integer') . ', ' . 17712 $ilDB->quote($ua_row->usr_id, 'integer') . ' ' . 17713 ')'; 17714 $ilDB->manipulate($query); 17715 } 17716 17717 // find users which are assigned to obj_members and update their role assignment 17718 $query = 'select usr_id from rbac_ua ' . 17719 'where rol_id = ' . $ilDB->quote($rol_row->rol_id, 'integer'); 17720 17721 $ua_res = $ilDB->query($query); 17722 while ($ua_row = $ua_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 17723 $admin = $tutor = $member = 0; 17724 switch (substr($rol_row->title, 0, 8)) { 17725 case 'il_crs_a': 17726 case 'il_grp_a': 17727 $admin = 1; 17728 break; 17729 17730 case 'il_crs_t': 17731 $tutor = 1; 17732 break; 17733 17734 default: 17735 case 'il_grp_m': 17736 case 'il_crs_m': 17737 $member = 1; 17738 break; 17739 } 17740 17741 $query = 'update obj_members ' . 17742 'set admin = admin + ' . $ilDB->quote($admin, 'integer') . ', ' . 17743 'tutor = tutor + ' . $ilDB->quote($tutor, 'integer') . ', ' . 17744 'member = member + ' . $ilDB->quote($member, 'integer') . ' ' . 17745 'WHERE usr_id = ' . $ilDB->quote($ua_row->usr_id, 'integer') . ' ' . 17746 'AND obj_id = ' . $ilDB->quote($row->obj_id, 'integer'); 17747 $ilDB->manipulate($query); 17748 } 17749 } 17750 } 17751 // increase offset 17752 $offset += $limit; 17753} while (true); 17754?> 17755 17756<#5071> 17757<?php 17758 17759$ilDB->manipulate( 17760 'delete from obj_members where admin = ' . 17761 $ilDB->quote(0, 'integer') . ' and tutor = ' . 17762 $ilDB->quote(0, 'integer') . ' and member = ' . 17763 $ilDB->quote(0, 'integer') 17764); 17765?> 17766<#5072> 17767<?php 17768 $ilCtrlStructureReader->getStructure(); 17769?> 17770<#5073> 17771<?php 17772$ilDB->modifyTableColumn( 17773 'wiki_stat_page', 17774 'num_ratings', 17775 array( 17776 'type' => 'integer', 17777 'length' => 4, 17778 'notnull' => true, 17779 'default' => 0 17780 ) 17781); 17782?> 17783<#5074> 17784<?php 17785$ilDB->modifyTableColumn( 17786 'wiki_stat_page', 17787 'avg_rating', 17788 array( 17789 'type' => 'integer', 17790 'length' => 4, 17791 'notnull' => true, 17792 'default' => 0 17793 ) 17794); 17795?> 17796<#5075> 17797<?php 17798$query = "SELECT value FROM settings WHERE module = %s AND keyword = %s"; 17799$res = $ilDB->queryF($query, array('text', 'text'), array("mobs", "black_list_file_types")); 17800if (!$ilDB->fetchAssoc($res)) { 17801 $mset = new ilSetting("mobs"); 17802 $mset->set("black_list_file_types", "html"); 17803} 17804?> 17805<#5076> 17806<?php 17807// #0020342 17808$query = $ilDB->query('SELECT 17809 stloc.* 17810FROM 17811 il_dcl_stloc2_value stloc 17812 INNER JOIN 17813 il_dcl_record_field rf ON stloc.record_field_id = rf.id 17814 INNER JOIN 17815 il_dcl_field f ON rf.field_id = f.id 17816WHERE 17817 f.datatype_id = 3 17818ORDER BY stloc.id ASC'); 17819while ($row = $query->fetchAssoc()) { 17820 $query2 = $ilDB->query('SELECT * FROM il_dcl_stloc1_value WHERE record_field_id = ' . $ilDB->quote($row['record_field_id'], 'integer')); 17821 if ($ilDB->numRows($query2)) { 17822 $rec = $ilDB->fetchAssoc($query2); 17823 if ($rec['value'] != null) { 17824 continue; 17825 } 17826 } 17827 $id = $ilDB->nextId('il_dcl_stloc1_value'); 17828 $ilDB->insert('il_dcl_stloc1_value', array( 17829 'id' => array('integer', $id), 17830 'record_field_id' => array('integer', $row['record_field_id']), 17831 'value' => array('text', $row['value']), 17832 )); 17833 $ilDB->manipulate('DELETE FROM il_dcl_stloc2_value WHERE id = ' . $ilDB->quote($row['id'], 'integer')); 17834} 17835?> 17836<#5077> 17837<?php 17838 17839$ilDB->manipulate( 17840 'update grp_settings set registration_start = ' . $ilDB->quote(null, 'integer') . ', ' . 17841 'registration_end = ' . $ilDB->quote(null, 'integer') . ' ' . 17842 'where registration_unlimited = ' . $ilDB->quote(1, 'integer') 17843); 17844?> 17845 17846<#5078> 17847<?php 17848$ilDB->manipulate( 17849 'update crs_settings set ' 17850 . 'sub_start = ' . $ilDB->quote(null, 'integer') . ', ' 17851 . 'sub_end = ' . $ilDB->quote(null, 'integer') . ' ' 17852 . 'WHERE sub_limitation_type != ' . $ilDB->quote(2, 'integer') 17853); 17854 17855?> 17856<#5079> 17857<?php 17858if (!$ilDB->tableColumnExists('grp_settings', 'grp_start')) { 17859 $ilDB->addTableColumn( 17860 'grp_settings', 17861 'grp_start', 17862 array( 17863 "type" => "integer", 17864 "notnull" => false, 17865 "length" => 4 17866 ) 17867 ); 17868} 17869if (!$ilDB->tableColumnExists('grp_settings', 'grp_end')) { 17870 $ilDB->addTableColumn( 17871 'grp_settings', 17872 'grp_end', 17873 array( 17874 "type" => "integer", 17875 "notnull" => false, 17876 "length" => 4 17877 ) 17878 ); 17879} 17880?> 17881<#5080> 17882<?php 17883if (!$ilDB->tableColumnExists('frm_posts', 'pos_activation_date')) { 17884 $ilDB->addTableColumn( 17885 'frm_posts', 17886 'pos_activation_date', 17887 array('type' => 'timestamp', 'notnull' => false) 17888 ); 17889} 17890?> 17891<#5081> 17892<?php 17893if ($ilDB->tableColumnExists('frm_posts', 'pos_activation_date')) { 17894 $ilDB->manipulate( 17895 ' 17896 UPDATE frm_posts SET pos_activation_date = pos_date 17897 WHERE pos_status = ' . $ilDB->quote(1, 'integer') 17898 . ' AND pos_activation_date is NULL' 17899 ); 17900} 17901?> 17902<#5082> 17903<?php 17904if ($ilDB->tableExists('svy_answer')) { 17905 if ($ilDB->tableColumnExists('svy_answer', 'textanswer')) { 17906 $ilDB->modifyTableColumn('svy_answer', 'textanswer', array( 17907 'type' => 'clob', 17908 'notnull' => false 17909 )); 17910 } 17911} 17912?> 17913 17914<#5083> 17915<?php 17916 17917include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 17918 17919$rp_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("read_learning_progress"); 17920$ep_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 17921$w_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 17922if ($rp_ops_id && $ep_ops_id && $w_ops_id) { 17923 // see ilObjectLP 17924 $lp_types = array('file'); 17925 17926 foreach ($lp_types as $lp_type) { 17927 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId($lp_type); 17928 if ($lp_type_id) { 17929 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $rp_ops_id); 17930 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ep_ops_id); 17931 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $rp_ops_id); 17932 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $ep_ops_id); 17933 } 17934 } 17935} 17936?> 17937 17938<#5084> 17939<?php 17940// #0020342 17941$query = $ilDB->query('SELECT 17942 stloc.*, 17943 fp.value as fp_value, 17944 fp.name as fp_name 17945FROM 17946 il_dcl_stloc1_value stloc 17947 INNER JOIN 17948 il_dcl_record_field rf ON stloc.record_field_id = rf.id 17949 INNER JOIN 17950 il_dcl_field f ON rf.field_id = f.id 17951 INNER JOIN 17952 il_dcl_field_prop fp ON rf.field_id = fp.field_id 17953WHERE 17954 f.datatype_id = 3 17955 AND fp.name = ' . $ilDB->quote("multiple_selection", 'text') . ' 17956 AND fp.value = ' . $ilDB->quote("1", 'text') . ' 17957ORDER BY stloc.id ASC'); 17958 17959while ($row = $query->fetchAssoc()) { 17960 if (!is_numeric($row['value'])) { 17961 continue; 17962 } 17963 17964 $value_array = array($row['value']); 17965 17966 $query2 = $ilDB->query('SELECT * FROM il_dcl_stloc2_value WHERE record_field_id = ' . $ilDB->quote($row['record_field_id'], 'integer')); 17967 while ($row2 = $ilDB->fetchAssoc($query2)) { 17968 $value_array[] = $row2['value']; 17969 } 17970 17971 $ilDB->update('il_dcl_stloc1_value', array( 17972 'id' => array('integer', $row['id']), 17973 'record_field_id' => array('integer', $row['record_field_id']), 17974 'value' => array('text', json_encode($value_array)), 17975 ), array('id' => array('integer', $row['id']))); 17976 $ilDB->manipulate('DELETE FROM il_dcl_stloc2_value WHERE record_field_id = ' . $ilDB->quote($row['record_field_id'], 'integer')); 17977} 17978?> 17979<#5085> 17980<?php 17981$set = $ilDB->query( 17982 "SELECT * FROM mep_item JOIN mep_tree ON (mep_item.obj_id = mep_tree.child) " . 17983 " WHERE mep_item.type = " . $ilDB->quote("pg", "text") 17984); 17985while ($rec = $ilDB->fetchAssoc($set)) { 17986 $q = "UPDATE page_object SET " . 17987 " parent_id = " . $ilDB->quote($rec["mep_id"], "integer") . 17988 " WHERE parent_type = " . $ilDB->quote("mep", "text") . 17989 " AND page_id = " . $ilDB->quote($rec["obj_id"], "integer"); 17990 //echo "<br>".$q; 17991 $ilDB->manipulate($q); 17992} 17993?> 17994<#5086> 17995<?php 17996 // fix 20706 (and 22921) 17997 require_once('./Services/Database/classes/class.ilDBAnalyzer.php'); 17998 $analyzer = new ilDBAnalyzer(); 17999 $cons = $analyzer->getPrimaryKeyInformation('page_question'); 18000 if (is_array($cons["fields"]) && count($cons["fields"]) > 0) { 18001 $ilDB->dropPrimaryKey('page_question'); 18002 } 18003 $ilDB->addPrimaryKey('page_question', array('page_parent_type', 'page_id', 'question_id', 'page_lang')); 18004?> 18005<#5087> 18006<?php 18007 // fix 20409 and 20638 18008 $old = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; 18009 $new = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; 18010 18011 $ilDB->manipulateF( 18012 "UPDATE settings SET value=%s WHERE module='MathJax' AND keyword='path_to_mathjax' AND value=%s", 18013 array('text','text'), 18014 array($new, $old) 18015 ); 18016?> 18017<#5088> 18018<?php 18019 require_once('./Services/Component/classes/class.ilPluginAdmin.php'); 18020 require_once('./Services/Component/classes/class.ilPlugin.php'); 18021 require_once('./Services/UICore/classes/class.ilCtrl.php'); 18022 18023 // Mantis #17842 18024 /** @var $ilCtrl ilCtrl */ 18025 global $ilCtrl, $ilPluginAdmin, $DIC; 18026 if (is_null($ilPluginAdmin)) { 18027 $GLOBALS['ilPluginAdmin'] = new ilPluginAdmin(); 18028 $DIC["ilPluginAdmin"] = function ($c) { 18029 return $GLOBALS['ilPluginAdmin']; 18030 }; 18031 } 18032 if (is_null($ilCtrl)) { 18033 $GLOBALS['ilCtrl'] = new ilCtrl(); 18034 $DIC["ilCtrl"] = function ($c) { 18035 return $GLOBALS['ilCtrl']; 18036 }; 18037 } 18038 global $ilCtrl; 18039 18040 function writeCtrlClassEntry(ilPluginSlot $slot, array $plugin_data) 18041 { 18042 global $ilCtrl; 18043 $prefix = $slot->getPrefix() . '_' . $plugin_data['id']; 18044 $ilCtrl->insertCtrlCalls("ilobjcomponentsettingsgui", ilPlugin::getConfigureClassName($plugin_data), $prefix); 18045 } 18046 18047 include_once("./Services/Component/classes/class.ilModule.php"); 18048 $modules = ilModule::getAvailableCoreModules(); 18049 foreach ($modules as $m) { 18050 $plugin_slots = ilComponent::lookupPluginSlots(IL_COMP_MODULE, $m["subdir"]); 18051 foreach ($plugin_slots as $ps) { 18052 include_once("./Services/Component/classes/class.ilPluginSlot.php"); 18053 $slot = new ilPluginSlot(IL_COMP_MODULE, $m["subdir"], $ps["id"]); 18054 foreach ($slot->getPluginsInformation() as $p) { 18055 $plugin_db_data = ilPlugin::getPluginRecord($p["component_type"], $p["component_name"], $p["slot_id"], $p["name"]); 18056 if (ilPlugin::hasConfigureClass($slot->getPluginsDirectory(), $p, $plugin_db_data) && $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($p))) { 18057 writeCtrlClassEntry($slot, $p); 18058 } 18059 } 18060 } 18061 } 18062 include_once("./Services/Component/classes/class.ilService.php"); 18063 $services = ilService::getAvailableCoreServices(); 18064 foreach ($services as $s) { 18065 $plugin_slots = ilComponent::lookupPluginSlots(IL_COMP_SERVICE, $s["subdir"]); 18066 foreach ($plugin_slots as $ps) { 18067 $slot = new ilPluginSlot(IL_COMP_SERVICE, $s["subdir"], $ps["id"]); 18068 foreach ($slot->getPluginsInformation() as $p) { 18069 $plugin_db_data = ilPlugin::getPluginRecord($p["component_type"], $p["component_name"], $p["slot_id"], $p["name"]); 18070 if (ilPlugin::hasConfigureClass($slot->getPluginsDirectory(), $p, $plugin_db_data) && $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($p))) { 18071 writeCtrlClassEntry($slot, $p); 18072 } 18073 } 18074 } 18075 } 18076?> 18077<#5089> 18078<?php 18079$signature = "\n\n* * * * *\n"; 18080$signature .= "[CLIENT_NAME]\n"; 18081$signature .= "[CLIENT_DESC]\n"; 18082$signature .= "[CLIENT_URL]\n"; 18083 18084$ilSetting = new ilSetting(); 18085 18086$prevent_smtp_globally = $ilSetting->get('prevent_smtp_globally', 0); 18087$mail_system_sender_name = $ilSetting->get('mail_system_sender_name', ''); 18088$mail_external_sender_noreply = $ilSetting->get('mail_external_sender_noreply', ''); 18089$mail_system_return_path = $ilSetting->get('mail_system_return_path', ''); 18090 18091$ilSetting->set('mail_allow_external', !(int) $prevent_smtp_globally); 18092 18093$ilSetting->set('mail_system_usr_from_addr', $mail_external_sender_noreply); 18094$ilSetting->set('mail_system_usr_from_name', $mail_system_sender_name); 18095$ilSetting->set('mail_system_usr_env_from_addr', $mail_system_return_path); 18096 18097$ilSetting->set('mail_system_sys_from_addr', $mail_external_sender_noreply); 18098$ilSetting->set('mail_system_sys_from_name', $mail_system_sender_name); 18099$ilSetting->set('mail_system_sys_reply_to_addr', $mail_external_sender_noreply); 18100$ilSetting->set('mail_system_sys_env_from_addr', $mail_system_return_path); 18101 18102$ilSetting->set('mail_system_sys_signature', $signature); 18103 18104$ilSetting->delete('prevent_smtp_globally'); 18105$ilSetting->delete('mail_system_return_path'); 18106$ilSetting->delete('mail_system_sender_name'); 18107$ilSetting->delete('mail_external_sender_noreply'); 18108?> 18109<#5090> 18110<?php 18111$fields = array( 18112 'id' => array( 18113 'type' => 'integer', 18114 'length' => '8', 18115 18116 ), 18117 'user_id' => array( 18118 'type' => 'integer', 18119 'length' => '8', 18120 18121 ), 18122 'root_task_id' => array( 18123 'type' => 'integer', 18124 'length' => '8', 18125 18126 ), 18127 'current_task_id' => array( 18128 'type' => 'integer', 18129 'length' => '8', 18130 18131 ), 18132 'state' => array( 18133 'type' => 'integer', 18134 'length' => '2', 18135 18136 ), 18137 'total_number_of_tasks' => array( 18138 'type' => 'integer', 18139 'length' => '4', 18140 18141 ), 18142 'percentage' => array( 18143 'type' => 'integer', 18144 'length' => '2', 18145 18146 ), 18147 'title' => array( 18148 'type' => 'text', 18149 'length' => '255', 18150 18151 ), 18152 'description' => array( 18153 'type' => 'text', 18154 'length' => '255', 18155 18156 ), 18157 18158); 18159if (!$ilDB->tableExists('il_bt_bucket')) { 18160 $ilDB->createTable('il_bt_bucket', $fields); 18161 $ilDB->addPrimaryKey('il_bt_bucket', array( 'id' )); 18162 18163 if (!$ilDB->sequenceExists('il_bt_bucket')) { 18164 $ilDB->createSequence('il_bt_bucket'); 18165 } 18166} 18167 18168$fields = array( 18169 'id' => array( 18170 'type' => 'integer', 18171 'length' => '8', 18172 18173 ), 18174 'type' => array( 18175 'type' => 'text', 18176 'length' => '256', 18177 18178 ), 18179 'class_path' => array( 18180 'type' => 'text', 18181 'length' => '256', 18182 18183 ), 18184 'class_name' => array( 18185 'type' => 'text', 18186 'length' => '256', 18187 18188 ), 18189 'bucket_id' => array( 18190 'type' => 'integer', 18191 'length' => '8', 18192 18193 ), 18194 18195); 18196if (!$ilDB->tableExists('il_bt_task')) { 18197 $ilDB->createTable('il_bt_task', $fields); 18198 $ilDB->addPrimaryKey('il_bt_task', array( 'id' )); 18199 18200 if (!$ilDB->sequenceExists('il_bt_task')) { 18201 $ilDB->createSequence('il_bt_task'); 18202 } 18203} 18204 18205$fields = array( 18206 'id' => array( 18207 'type' => 'integer', 18208 'length' => '8', 18209 18210 ), 18211 'has_parent_task' => array( 18212 'type' => 'integer', 18213 'length' => '1', 18214 18215 ), 18216 'parent_task_id' => array( 18217 'type' => 'integer', 18218 'length' => '8', 18219 18220 ), 18221 'hash' => array( 18222 'type' => 'text', 18223 'length' => '256', 18224 18225 ), 18226 'type' => array( 18227 'type' => 'text', 18228 'length' => '256', 18229 18230 ), 18231 'class_path' => array( 18232 'type' => 'text', 18233 'length' => '256', 18234 18235 ), 18236 'class_name' => array( 18237 'type' => 'text', 18238 'length' => '256', 18239 18240 ), 18241 'serialized' => array( 18242 'type' => 'clob', 18243 18244 ), 18245 'bucket_id' => array( 18246 'type' => 'integer', 18247 'length' => '8', 18248 18249 ), 18250 18251); 18252if (!$ilDB->tableExists('il_bt_value')) { 18253 $ilDB->createTable('il_bt_value', $fields); 18254 $ilDB->addPrimaryKey('il_bt_value', array( 'id' )); 18255 18256 if (!$ilDB->sequenceExists('il_bt_value')) { 18257 $ilDB->createSequence('il_bt_value'); 18258 } 18259} 18260 18261$fields = array( 18262 'id' => array( 18263 'type' => 'integer', 18264 'length' => '8', 18265 18266 ), 18267 'task_id' => array( 18268 'type' => 'integer', 18269 'length' => '8', 18270 18271 ), 18272 'value_id' => array( 18273 'type' => 'integer', 18274 'length' => '8', 18275 18276 ), 18277 'bucket_id' => array( 18278 'type' => 'integer', 18279 'length' => '8', 18280 18281 ), 18282 18283); 18284if (!$ilDB->tableExists('il_bt_value_to_task')) { 18285 $ilDB->createTable('il_bt_value_to_task', $fields); 18286 $ilDB->addPrimaryKey('il_bt_value_to_task', array( 'id' )); 18287 18288 if (!$ilDB->sequenceExists('il_bt_value_to_task')) { 18289 $ilDB->createSequence('il_bt_value_to_task'); 18290 } 18291} 18292?> 18293<#5091> 18294<?php 18295 $ilCtrlStructureReader->getStructure(); 18296?> 18297<#5092> 18298<?php 18299if (!$ilDB->tableColumnExists('chatroom_settings', 'online_status')) { 18300 $ilDB->addTableColumn('chatroom_settings', 'online_status', array( 18301 'type' => 'integer', 18302 'length' => 1, 18303 'notnull' => true, 18304 'default' => 0 18305 )); 18306} 18307 18308$ilDB->manipulateF("UPDATE chatroom_settings SET online_status = %s", array('integer'), array(1)); 18309?> 18310<#5093> 18311<?php 18312if (!$ilDB->tableColumnExists('chatroom_bans', 'actor_id')) { 18313 $ilDB->addTableColumn( 18314 'chatroom_bans', 18315 'actor_id', 18316 array( 18317 'type' => 'integer', 18318 'length' => 4, 18319 'notnull' => false, 18320 'default' => null 18321 ) 18322 ); 18323} 18324?> 18325<#5094> 18326<?php 18327 $ilCtrlStructureReader->getStructure(); 18328?> 18329<#5095> 18330<?php 18331if (!$ilDB->tableColumnExists('usr_data', 'second_email')) { 18332 $ilDB->addTableColumn( 18333 'usr_data', 18334 'second_email', 18335 array('type' => 'text', 18336 'length' => 80, 18337 'notnull' => false 18338 ) 18339 ); 18340} 18341?> 18342<#5096> 18343<?php 18344if (!$ilDB->tableColumnExists('mail_options', 'mail_address_option')) { 18345 $ilDB->addTableColumn( 18346 'mail_options', 18347 'mail_address_option', 18348 array('type' => 'integer', 18349 'length' => 1, 18350 'notnull' => true, 18351 'default' => 3 18352 ) 18353 ); 18354} 18355?> 18356<#5097> 18357<?php 18358$ilCtrlStructureReader->getStructure(); 18359?> 18360<#5098> 18361<?php 18362include_once './Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 18363ilDBUpdateNewObjectType::addRBACTemplate( 18364 'sess', 18365 'il_sess_participant', 18366 'Session participant template', 18367 [ 18368 ilDBUpdateNewObjectType::getCustomRBACOperationId('visible'), 18369 ilDBUpdateNewObjectType::getCustomRBACOperationId('read') 18370 ] 18371); 18372?> 18373<#5099> 18374<?php 18375 18376// add new role entry for each session 18377$query = 'SELECT obd.obj_id,ref_id,owner FROM object_data obd ' . 18378 'join object_reference obr on obd.obj_id = obr.obj_id' . ' ' . 18379 'where type = ' . $ilDB->quote('sess', 'text'); 18380$res = $ilDB->query($query); 18381while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 18382 // add role entry 18383 $id = $ilDB->nextId("object_data"); 18384 $q = "INSERT INTO object_data " . 18385 "(obj_id,type,title,description,owner,create_date,last_update) " . 18386 "VALUES " . 18387 "(" . 18388 $ilDB->quote($id, "integer") . "," . 18389 $ilDB->quote('role', "text") . "," . 18390 $ilDB->quote('il_sess_participant_' . $row->ref_id, "text") . "," . 18391 $ilDB->quote('Participant of session obj_no.' . $row->obj_id, "text") . "," . 18392 $ilDB->quote($row->owner, "integer") . "," . 18393 $ilDB->now() . "," . 18394 $ilDB->now() . ")"; 18395 18396 $ilDB->manipulate($q); 18397 18398 // add role data 18399 $rd = 'INSERT INTO role_data (role_id) VALUES (' . $id . ')'; 18400 $ilDB->manipulate($rd); 18401 18402 // assign to session 18403 $fa = 'INSERT INTO rbac_fa (rol_id,parent,assign,protected,blocked ) VALUES(' . 18404 $ilDB->quote($id, 'integer') . ', ' . 18405 $ilDB->quote($row->ref_id, 'integer') . ', ' . 18406 $ilDB->quote('y', 'text') . ', ' . 18407 $ilDB->quote('n', 'text') . ', ' . 18408 $ilDB->quote(0, 'integer') . ' ' . 18409 ')'; 18410 18411 $ilDB->manipulate($fa); 18412 18413 // assign template permissions 18414 $temp = 'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES(' . 18415 $ilDB->quote($id, 'integer') . ', ' . 18416 $ilDB->quote('sess', 'text') . ', ' . 18417 $ilDB->quote(2, 'integer') . ', ' . 18418 $ilDB->quote($row->ref_id, 'integer') . ') '; 18419 $ilDB->manipulate($temp); 18420 18421 // assign template permissions 18422 $temp = 'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES(' . 18423 $ilDB->quote($id, 'integer') . ', ' . 18424 $ilDB->quote('sess', 'text') . ', ' . 18425 $ilDB->quote(3, 'integer') . ', ' . 18426 $ilDB->quote($row->ref_id, 'integer') . ') '; 18427 $ilDB->manipulate($temp); 18428 18429 // assign permission 18430 $pa = 'INSERT INTO rbac_pa (rol_id,ops_id,ref_id) VALUES(' . 18431 $ilDB->quote($id, 'integer') . ', ' . 18432 $ilDB->quote(serialize([2,3]), 'text') . ', ' . 18433 $ilDB->quote($row->ref_id, 'integer') . ')'; 18434 $ilDB->manipulate($pa); 18435 18436 // assign users 18437 $users = 'SELECT usr_id from event_participants WHERE event_id = ' . $ilDB->quote($row->obj_id, 'integer'); 18438 $user_res = $ilDB->query($users); 18439 while ($user_row = $user_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 18440 $ua = 'INSERT INTO rbac_ua (usr_id,rol_id) VALUES(' . 18441 $ilDB->quote($user_row->usr_id, 'integer') . ', ' . 18442 $ilDB->quote($id, 'integer') . ')'; 18443 $ilDB->manipulate($ua); 18444 } 18445} 18446?> 18447<#5100> 18448<?php 18449$id = $ilDB->nextId("object_data"); 18450$q = "INSERT INTO object_data " . 18451 "(obj_id,type,title,description,owner,create_date,last_update) " . 18452 "VALUES " . 18453 "(" . 18454 $ilDB->quote($id, "integer") . "," . 18455 $ilDB->quote('rolt', "text") . "," . 18456 $ilDB->quote('il_sess_status_closed', "text") . "," . 18457 $ilDB->quote('Closed session template', 'text') . ', ' . 18458 $ilDB->quote(0, "integer") . "," . 18459 $ilDB->now() . "," . 18460 $ilDB->now() . ")"; 18461 18462$ilDB->manipulate($q); 18463 18464$query = "INSERT INTO rbac_fa VALUES (" . $ilDB->quote($id) . ", 8, 'n', 'n', 0)"; 18465$ilDB->manipulate($query); 18466 18467?> 18468 18469<#5101> 18470<?php 18471$id = $ilDB->nextId('didactic_tpl_settings'); 18472$query = 'INSERT INTO didactic_tpl_settings (id,enabled,type,title, description,info,auto_generated,exclusive_tpl) values( ' . 18473 $ilDB->quote($id, 'integer') . ', ' . 18474 $ilDB->quote(1, 'integer') . ', ' . 18475 $ilDB->quote(1, 'integer') . ', ' . 18476 $ilDB->quote('sess_closed', 'text') . ', ' . 18477 $ilDB->quote('sess_closed_info', 'text') . ', ' . 18478 $ilDB->quote('', 'text') . ', ' . 18479 $ilDB->quote(1, 'integer') . ', ' . 18480 $ilDB->quote(0, 'integer') . ' ' . 18481 ')'; 18482$ilDB->manipulate($query); 18483 18484$query = 'INSERT INTO didactic_tpl_sa (id, obj_type) values( ' . 18485 $ilDB->quote($id, 'integer') . ', ' . 18486 $ilDB->quote('sess', 'text') . 18487 ')'; 18488$ilDB->manipulate($query); 18489 18490 18491$aid = $ilDB->nextId('didactic_tpl_a'); 18492$query = 'INSERT INTO didactic_tpl_a (id, tpl_id, type_id) values( ' . 18493 $ilDB->quote($aid, 'integer') . ', ' . 18494 $ilDB->quote($id, 'integer') . ', ' . 18495 $ilDB->quote(1, 'integer') . 18496 ')'; 18497$ilDB->manipulate($query); 18498 18499$query = 'select obj_id from object_data where type = ' . $ilDB->quote('rolt', 'text') . ' and title = ' . $ilDB->quote('il_sess_status_closed', 'text'); 18500$res = $ilDB->query($query); 18501while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 18502 $closed_id = $row->obj_id; 18503} 18504 18505$query = 'INSERT INTO didactic_tpl_alp (action_id, filter_type, template_type, template_id) values( ' . 18506 $ilDB->quote($aid, 'integer') . ', ' . 18507 $ilDB->quote(3, 'integer') . ', ' . 18508 $ilDB->quote(2, 'integer') . ', ' . 18509 $ilDB->quote($closed_id, 'integer') . 18510 ')'; 18511$ilDB->manipulate($query); 18512 18513 18514$fid = $ilDB->nextId('didactic_tpl_fp'); 18515$query = 'INSERT INTO didactic_tpl_fp (pattern_id, pattern_type, pattern_sub_type, pattern, parent_id, parent_type ) values( ' . 18516 $ilDB->quote($fid, 'integer') . ', ' . 18517 $ilDB->quote(1, 'integer') . ', ' . 18518 $ilDB->quote(1, 'integer') . ', ' . 18519 $ilDB->quote('.*', 'text') . ', ' . 18520 $ilDB->quote($aid, 'integer') . ', ' . 18521 $ilDB->quote('action', 'text') . 18522 ')'; 18523$ilDB->manipulate($query); 18524?> 18525<#5102> 18526<?php 18527 18528$sessions = []; 18529 18530$query = 'select obd.obj_id, title, od.description from object_data obd left join object_description od on od.obj_id = obd.obj_id where type = ' . $ilDB->quote('sess', 'text'); 18531$res = $ilDB->query($query); 18532while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 18533 $tmp['obj_id'] = $row->obj_id; 18534 $tmp['title'] = $row->title; 18535 $tmp['description'] = $row->description; 18536 18537 $sessions[] = $tmp; 18538} 18539 18540foreach ($sessions as $idx => $sess_info) { 18541 $meta_id = $ilDB->nextId('il_meta_general'); 18542 $insert = 'INSERT INTO il_meta_general (meta_general_id, rbac_id, obj_id, obj_type, general_structure, title, title_language, coverage, coverage_language) ' . 18543 'VALUES( ' . 18544 $ilDB->quote($meta_id, 'integer') . ', ' . 18545 $ilDB->quote($sess_info['obj_id'], 'integer') . ', ' . 18546 $ilDB->quote($sess_info['obj_id'], 'integer') . ', ' . 18547 $ilDB->quote('sess', 'text') . ', ' . 18548 $ilDB->quote('Hierarchical', 'text') . ', ' . 18549 $ilDB->quote($sess_info['title'], 'text') . ', ' . 18550 $ilDB->quote('en', 'text') . ', ' . 18551 $ilDB->quote('', 'text') . ', ' . 18552 $ilDB->quote('en', 'text') . ' ' . 18553 ')'; 18554 18555 $ilDB->manipulate($insert); 18556 18557 $meta_des_id = $ilDB->nextId('il_meta_description'); 18558 $insert = 'INSERT INTO il_meta_description (meta_description_id, rbac_id, obj_id, obj_type, parent_type, parent_id, description, description_language) ' . 18559 'VALUES( ' . 18560 $ilDB->quote($meta_des_id, 'integer') . ', ' . 18561 $ilDB->quote($sess_info['obj_id'], 'integer') . ', ' . 18562 $ilDB->quote($sess_info['obj_id'], 'integer') . ', ' . 18563 $ilDB->quote('sess', 'text') . ', ' . 18564 $ilDB->quote('meta_general', 'text') . ', ' . 18565 $ilDB->quote($meta_id, 'integer') . ', ' . 18566 $ilDB->quote($sess_info['description'], 'text') . ', ' . 18567 $ilDB->quote('en', 'text') . ' ' . 18568 ')'; 18569 $ilDB->manipulate($insert); 18570} 18571?> 18572<#5103> 18573<?php 18574 18575if (!$ilDB->tableExists('adv_md_record_scope')) { 18576 $ilDB->createTable('adv_md_record_scope', array( 18577 'scope_id' => array( 18578 'type' => 'integer', 18579 'length' => 4, 18580 'notnull' => true, 18581 'default' => 0 18582 ), 18583 'record_id' => array( 18584 'type' => 'integer', 18585 'length' => 4, 18586 'notnull' => true 18587 ), 18588 'ref_id' => array( 18589 'type' => 'integer', 18590 'length' => 4, 18591 'notnull' => true, 18592 ) 18593 )); 18594 $ilDB->addPrimaryKey('adv_md_record_scope', ['scope_id']); 18595 $ilDB->createSequence('adv_md_record_scope'); 18596} 18597?> 18598<#5104> 18599<?php 18600 18601if (!$ilDB->tableExists('adv_md_values_extlink')) { 18602 $ilDB->createTable('adv_md_values_extlink', array( 18603 'obj_id' => array( 18604 'type' => 'integer', 18605 'length' => 4, 18606 'notnull' => true, 18607 'default' => 0 18608 ), 18609 'sub_type' => array( 18610 'type' => 'text', 18611 'length' => 10, 18612 'notnull' => true, 18613 'default' => "-" 18614 ), 18615 'sub_id' => array( 18616 'type' => 'integer', 18617 'length' => 4, 18618 'notnull' => true, 18619 'default' => 0 18620 ), 18621 'field_id' => array( 18622 'type' => 'integer', 18623 'length' => 4, 18624 'notnull' => true, 18625 'default' => 0 18626 ), 18627 'value' => array( 18628 'type' => 'text', 18629 'length' => 500, 18630 'notnull' => false 18631 ), 18632 'title' => array( 18633 'type' => 'text', 18634 'length' => 500, 18635 'notnull' => false 18636 ), 18637 'disabled' => [ 18638 "type" => "integer", 18639 "length" => 1, 18640 "notnull" => true, 18641 "default" => 0 18642 ] 18643 18644 )); 18645 18646 $ilDB->addPrimaryKey('adv_md_values_extlink', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 18647} 18648?> 18649<#5105> 18650<?php 18651 18652if (!$ilDB->tableExists('adv_md_values_intlink')) { 18653 $ilDB->createTable('adv_md_values_intlink', array( 18654 'obj_id' => array( 18655 'type' => 'integer', 18656 'length' => 4, 18657 'notnull' => true, 18658 'default' => 0 18659 ), 18660 'sub_type' => array( 18661 'type' => 'text', 18662 'length' => 10, 18663 'notnull' => true, 18664 'default' => "-" 18665 ), 18666 'sub_id' => array( 18667 'type' => 'integer', 18668 'length' => 4, 18669 'notnull' => true, 18670 'default' => 0 18671 ), 18672 'field_id' => array( 18673 'type' => 'integer', 18674 'length' => 4, 18675 'notnull' => true, 18676 'default' => 0 18677 ), 18678 'value' => array( 18679 'type' => 'integer', 18680 'length' => 4, 18681 'notnull' => true 18682 ), 18683 'disabled' => [ 18684 "type" => "integer", 18685 "length" => 1, 18686 "notnull" => true, 18687 "default" => 0 18688 ] 18689 18690 )); 18691 18692 $ilDB->addPrimaryKey('adv_md_values_intlink', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 18693} 18694?> 18695<#5106> 18696<?php 18697 $ilCtrlStructureReader->getStructure(); 18698?> 18699<#5107> 18700<?php 18701if (!$ilDB->tableColumnExists('iass_settings', 'event_time_place_required')) { 18702 $ilDB->addTableColumn('iass_settings', 'event_time_place_required', array( 18703 "type" => "integer", 18704 "length" => 1, 18705 "notnull" => true, 18706 "default" => 0 18707 )); 18708} 18709?> 18710<#5108> 18711<?php 18712if (!$ilDB->tableColumnExists('iass_members', 'place')) { 18713 $ilDB->addTableColumn('iass_members', 'place', array( 18714 "type" => "text", 18715 "length" => 255 18716 )); 18717} 18718?> 18719<#5109> 18720<?php 18721if (!$ilDB->tableColumnExists('iass_members', 'event_time')) { 18722 $ilDB->addTableColumn('iass_members', 'event_time', array( 18723 "type" => "integer", 18724 "length" => 8 18725 )); 18726} 18727?> 18728<#5110> 18729<?php 18730 18731if (!$ilDB->tableColumnExists("il_object_def", "orgunit_permissions")) { 18732 $def = array( 18733 'type' => 'integer', 18734 'length' => 1, 18735 'notnull' => true, 18736 'default' => 0 18737 ); 18738 $ilDB->addTableColumn("il_object_def", "orgunit_permissions", $def); 18739} 18740 18741$ilCtrlStructureReader->getStructure(); 18742?> 18743<#5111> 18744<?php 18745if (!$ilDB->tableExists('orgu_obj_type_settings')) { 18746 $ilDB->createTable( 18747 'orgu_obj_type_settings', 18748 array( 18749 'obj_type' => array( 18750 'type' => 'text', 18751 'length' => 10, 18752 'notnull' => true 18753 ), 18754 'active' => array( 18755 'type' => 'integer', 18756 'length' => 1, 18757 'notnull' => false, 18758 'default' => 0 18759 ), 18760 'activation_default' => array( 18761 'type' => 'integer', 18762 'length' => 1, 18763 'notnull' => false, 18764 'default' => 0 18765 ), 18766 'changeable' => array( 18767 'type' => 'integer', 18768 'length' => 1, 18769 'notnull' => false, 18770 'default' => 0 18771 ) 18772 ) 18773 ); 18774 $ilDB->addPrimaryKey('orgu_obj_type_settings', array('obj_type')); 18775} 18776?> 18777<#5112> 18778<?php 18779 $ilCtrlStructureReader->getStructure(); 18780?> 18781<#5113> 18782<?php 18783if (!$ilDB->tableColumnExists('grp_settings', 'grp_start')) { 18784 $ilDB->addTableColumn('grp_settings', 'grp_start', array( 18785 "type" => "integer", 18786 "notnull" => false, 18787 "length" => 4 18788 )); 18789} 18790if (!$ilDB->tableColumnExists('grp_settings', 'grp_end')) { 18791 $ilDB->addTableColumn('grp_settings', 'grp_end', array( 18792 "type" => "integer", 18793 "notnull" => false, 18794 "length" => 4 18795 )); 18796} 18797?> 18798<#5114> 18799<?php 18800if (!$ilDB->tableExists("usr_starting_point")) { 18801 $ilDB->createTable("usr_starting_point", array( 18802 "id" => array( 18803 "type" => "integer", 18804 "length" => 4, 18805 "notnull" => true, 18806 "default" => 0 18807 ), 18808 "position" => array( 18809 "type" => "integer", 18810 "length" => 4, 18811 "notnull" => false, 18812 "default" => 0 18813 ), 18814 "starting_point" => array( 18815 "type" => "integer", 18816 "length" => 4, 18817 "notnull" => false, 18818 "default" => 0 18819 ), 18820 "starting_object" => array( 18821 "type" => "integer", 18822 "length" => 4, 18823 "notnull" => false, 18824 "default" => 0 18825 ), 18826 "rule_type" => array( 18827 "type" => "integer", 18828 "length" => 4, 18829 "notnull" => false, 18830 "default" => 0 18831 ), 18832 "rule_options" => array( 18833 "type" => "text", 18834 "length" => 4000, 18835 "notnull" => false, 18836 ) 18837 )); 18838 18839 $ilDB->addPrimaryKey('usr_starting_point', array('id')); 18840 $ilDB->createSequence('usr_starting_point'); 18841} 18842?> 18843<#5115> 18844<?php 18845$ilCtrlStructureReader->getStructure(); 18846?> 18847<#5116> 18848<?php 18849if ($ilDB->tableExists("exc_assignment")) { 18850 if (!$ilDB->tableColumnExists('exc_assignment', 'portfolio_template')) { 18851 $ilDB->addTableColumn("exc_assignment", "portfolio_template", array("type" => "integer", "length" => 4)); 18852 } 18853 if (!$ilDB->tableColumnExists('exc_assignment', 'min_char_limit')) { 18854 $ilDB->addTableColumn("exc_assignment", "min_char_limit", array("type" => "integer", "length" => 4)); 18855 } 18856 if (!$ilDB->tableColumnExists('exc_assignment', 'max_char_limit')) { 18857 $ilDB->addTableColumn("exc_assignment", "max_char_limit", array("type" => "integer", "length" => 4)); 18858 } 18859} 18860?> 18861<#5117> 18862<?php 18863if (!$ilDB->tableExists("exc_ass_file_order")) { 18864 $fields = array( 18865 "id" => array( 18866 "type" => "integer", 18867 "length" => 4, 18868 "notnull" => true, 18869 "default" => 0 18870 ), 18871 "assignment_id" => array( 18872 "type" => "integer", 18873 "length" => 4, 18874 "notnull" => true, 18875 "default" => 0 18876 ), 18877 "filename" => array( 18878 "type" => "text", 18879 "length" => 150, 18880 "notnull" => true, 18881 ), 18882 "order_nr" => array( 18883 "type" => "integer", 18884 "length" => 4, 18885 "notnull" => true, 18886 "default" => 0 18887 ), 18888 ); 18889 18890 $ilDB->createTable("exc_ass_file_order", $fields); 18891 $ilDB->addPrimaryKey('exc_ass_file_order', array('id')); 18892 18893 $ilDB->createSequence("exc_ass_file_order"); 18894} 18895?> 18896<#5118> 18897<?php 18898 // 18899?> 18900<#5119> 18901<?php 18902 if (!$ilDB->tableExists("obj_noti_settings")) { 18903 $fields = array( 18904 "obj_id" => array( 18905 "type" => "integer", 18906 "length" => 4, 18907 "notnull" => true, 18908 "default" => 0 18909 ), 18910 "noti_mode" => array( 18911 "type" => "integer", 18912 "length" => 1, 18913 "notnull" => true, 18914 "default" => 0 18915 ) 18916 ); 18917 18918 $ilDB->createTable("obj_noti_settings", $fields); 18919 $ilDB->addPrimaryKey('obj_noti_settings', array('obj_id')); 18920 } 18921?> 18922<#5120> 18923<?php 18924 $ilCtrlStructureReader->getStructure(); 18925?> 18926<#5121> 18927<?php 18928 18929if (!$ilDB->tableColumnExists('notification', 'activated')) { 18930 $ilDB->addTableColumn( 18931 'notification', 18932 'activated', 18933 array( 18934 'type' => 'integer', 18935 'length' => 1, 18936 'notnull' => false, 18937 'default' => 0 18938 ) 18939 ); 18940 18941 $ilDB->manipulate("UPDATE notification SET " . 18942 " activated = " . $this->db->quote(1, "integer")); 18943} 18944?> 18945<#5122> 18946<?php 18947 $ilCtrlStructureReader->getStructure(); 18948?> 18949<#5123> 18950<?php 18951 $ilCtrlStructureReader->getStructure(); 18952?> 18953<#5124> 18954<?php 18955 $ilCtrlStructureReader->getStructure(); 18956?> 18957<#5125> 18958<?php 18959if (!$ilDB->tableColumnExists('itgr_data', 'behaviour')) { 18960 $ilDB->addTableColumn( 18961 'itgr_data', 18962 'behaviour', 18963 array( 18964 'type' => 'integer', 18965 'length' => 1, 18966 'notnull' => false, 18967 'default' => 0 18968 ) 18969 ); 18970} 18971?> 18972<#5126> 18973<?php 18974 $ilSetting = new ilSetting(); 18975 $ilSetting->set('letter_avatars', 1); 18976?> 18977<#5127> 18978<?php 18979 18980 if (!$ilDB->tableExists('pdfgen_conf')) { 18981 $fields = array( 18982 'conf_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 18983 'renderer' => array('type' => 'text', 'length' => 255, 'notnull' => true), 18984 'service' => array('type' => 'text', 'length' => 255, 'notnull' => true), 18985 'purpose' => array('type' => 'text', 'length' => 255, 'notnull' => true), 18986 'config' => array('type' => 'clob') 18987 ); 18988 18989 $ilDB->createTable('pdfgen_conf', $fields); 18990 $ilDB->addPrimaryKey('pdfgen_conf', array('conf_id')); 18991 $ilDB->createSequence('pdfgen_conf'); 18992 } 18993 18994 if (!$ilDB->tableExists('pdfgen_map')) { 18995 $fields = array( 18996 'map_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 18997 'service' => array('type' => 'text', 'length' => 255, 'notnull' => true), 18998 'purpose' => array('type' => 'text', 'length' => 255, 'notnull' => true), 18999 'preferred' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19000 'selected' => array('type' => 'text', 'length' => 255, 'notnull' => true) 19001 ); 19002 19003 $ilDB->createTable('pdfgen_map', $fields); 19004 $ilDB->addPrimaryKey('pdfgen_map', array('map_id')); 19005 $ilDB->createSequence('pdfgen_map'); 19006 } 19007?> 19008<#5128> 19009 <?php 19010 if (!$ilDB->tableExists('pdfgen_purposes')) { 19011 $fields = array( 19012 'purpose_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 19013 'service' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19014 'purpose' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19015 ); 19016 19017 $ilDB->createTable('pdfgen_purposes', $fields); 19018 $ilDB->addPrimaryKey('pdfgen_purposes', array('purpose_id')); 19019 $ilDB->createSequence('pdfgen_purposes'); 19020 } 19021 ?> 19022<#5129> 19023<?php 19024 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19025 ilDBUpdateNewObjectType::addAdminNode('pdfg', 'PDFGeneration'); 19026?> 19027<#5130> 19028<?php 19029 $ilCtrlStructureReader->getStructure(); 19030?> 19031<#5131> 19032<?php 19033 if (!$ilDB->tableExists('pdfgen_renderer')) { 19034 $fields = array( 19035 'renderer_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 19036 'renderer' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19037 'path' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19038 ); 19039 19040 $ilDB->createTable('pdfgen_renderer', $fields); 19041 $ilDB->addPrimaryKey('pdfgen_renderer', array('renderer_id')); 19042 $ilDB->createSequence('pdfgen_renderer'); 19043 } 19044 19045 if (!$ilDB->tableExists('pdfgen_renderer_avail')) { 19046 $fields = array( 19047 'availability_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 19048 'service' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19049 'purpose' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19050 'renderer' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19051 ); 19052 19053 $ilDB->createTable('pdfgen_renderer_avail', $fields); 19054 $ilDB->addPrimaryKey('pdfgen_renderer_avail', array('availability_id')); 19055 $ilDB->createSequence('pdfgen_renderer_avail'); 19056 } 19057?> 19058<#5132> 19059<?php 19060 $ilCtrlStructureReader->getStructure(); 19061?> 19062<#5133> 19063<?php 19064 $ilDB->insert( 19065 'pdfgen_renderer', 19066 array( 19067 'renderer_id' => array('integer', $ilDB->nextId('pdfgen_renderer')), 19068 'renderer' => array('text', 'TCPDF'), 19069 'path' => array('text', 'Services/PDFGeneration/classes/renderer/tcpdf/class.ilTCPDFRenderer.php') 19070 ) 19071 ); 19072?> 19073<#5134> 19074<?php 19075 $ilDB->insert( 19076 'pdfgen_renderer', 19077 array( 19078 'renderer_id' => array('integer',$ilDB->nextId('pdfgen_renderer')), 19079 'renderer' => array('text','PhantomJS'), 19080 'path' => array('text','Services/PDFGeneration/classes/renderer/phantomjs/class.ilPhantomJSRenderer.php') 19081 ) 19082 ); 19083?> 19084<#5135> 19085<?php 19086 $ilDB->insert( 19087 'pdfgen_renderer_avail', 19088 array( 19089 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 19090 'service' => array('text', 'Test'), 19091 'purpose' => array('text', 'PrintViewOfQuestions'), 19092 'renderer' => array('text', 'PhantomJS') 19093 ) 19094 ); 19095?> 19096<#5136> 19097<?php 19098 $ilDB->insert( 19099 'pdfgen_renderer_avail', 19100 array( 19101 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 19102 'service' => array('text', 'Test'), 19103 'purpose' => array('text', 'UserResult'), 19104 'renderer' => array('text', 'PhantomJS') 19105 ) 19106 ); 19107?> 19108<#5137> 19109<?php 19110 $ilDB->insert( 19111 'pdfgen_renderer_avail', 19112 array( 19113 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 19114 'service' => array('text', 'Test'), 19115 'purpose' => array('text', 'PrintViewOfQuestions'), 19116 'renderer' => array('text', 'TCPDF') 19117 ) 19118 ); 19119?> 19120<#5138> 19121<?php 19122$ilDB->insert( 19123 'pdfgen_renderer_avail', 19124 array( 19125 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 19126 'service' => array('text', 'Test'), 19127 'purpose' => array('text', 'UserResult'), 19128 'renderer' => array('text', 'TCPDF') 19129 ) 19130); 19131?> 19132<#5139> 19133<?php 19134 $ilCtrlStructureReader->getStructure(); 19135?> 19136<#5140> 19137<?php 19138 $ilCtrlStructureReader->getStructure(); 19139?> 19140<#5141> 19141<?php 19142if (!$ilDB->tableColumnExists('lm_data', 'short_title')) { 19143 $ilDB->addTableColumn( 19144 'lm_data', 19145 'short_title', 19146 array( 19147 'type' => 'text', 19148 'length' => 200, 19149 'default' => '' 19150 ) 19151 ); 19152} 19153?> 19154<#5142> 19155<?php 19156if (!$ilDB->tableColumnExists('lm_data_transl', 'short_title')) { 19157 $ilDB->addTableColumn( 19158 'lm_data_transl', 19159 'short_title', 19160 array( 19161 'type' => 'text', 19162 'length' => 200, 19163 'default' => '' 19164 ) 19165 ); 19166} 19167?> 19168<#5143> 19169<?php 19170include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19171$iass_type_id = ilDBUpdateNewObjectType::getObjectTypeId('iass'); 19172if ($iass_type_id) { 19173 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation( 19174 'amend_grading', 19175 'Amend grading', 19176 'object', 19177 8200 19178 ); 19179 if ($new_ops_id) { 19180 ilDBUpdateNewObjectType::addRBACOperation($iass_type_id, $new_ops_id); 19181 } 19182} 19183?> 19184<#5144> 19185<?php 19186if (!$ilDB->tableExists('cont_skills')) { 19187 $ilDB->createTable('cont_skills', array( 19188 'id' => array( 19189 'type' => 'integer', 19190 'length' => 4, 19191 'notnull' => true, 19192 'default' => 0 19193 ), 19194 'skill_id' => array( 19195 'type' => 'integer', 19196 'length' => 4, 19197 'notnull' => true, 19198 'default' => 0 19199 ), 19200 'tref_id' => array( 19201 'type' => 'integer', 19202 'length' => 4, 19203 'notnull' => true, 19204 'default' => 0 19205 ) 19206 )); 19207 19208 $ilDB->addPrimaryKey('cont_skills', array('id','skill_id','tref_id')); 19209} 19210?> 19211<#5145> 19212<?php 19213if (!$ilDB->tableExists('cont_member_skills')) { 19214 $ilDB->createTable('cont_member_skills', array( 19215 'obj_id' => array( 19216 'type' => 'integer', 19217 'length' => 4, 19218 'notnull' => true, 19219 'default' => 0 19220 ), 19221 'user_id' => array( 19222 'type' => 'integer', 19223 'length' => 4, 19224 'notnull' => true, 19225 'default' => 0 19226 ), 19227 'tref_id' => array( 19228 'type' => 'integer', 19229 'length' => 4, 19230 'notnull' => true, 19231 'default' => 0 19232 ), 19233 'skill_id' => array( 19234 'type' => 'integer', 19235 'length' => 4, 19236 'notnull' => true, 19237 'default' => 0 19238 ), 19239 'level_id' => array( 19240 'type' => 'integer', 19241 'length' => 4, 19242 'notnull' => true, 19243 'default' => 0 19244 ), 19245 'published' => array( 19246 'type' => 'integer', 19247 'length' => 1, 19248 'notnull' => true, 19249 'default' => 0 19250 ) 19251 )); 19252 19253 $ilDB->addPrimaryKey('cont_member_skills', array('obj_id','user_id','skill_id', 'tref_id')); 19254} 19255?> 19256<#5146> 19257<?php 19258 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19259 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('grade', 'Grade', 'object', 2410); 19260 $type_id = ilDBUpdateNewObjectType::getObjectTypeId('crs'); 19261 if ($type_id && $new_ops_id) { 19262 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 19263 } 19264 $type_id2 = ilDBUpdateNewObjectType::getObjectTypeId('grp'); 19265 if ($type_id2 && $new_ops_id) { 19266 ilDBUpdateNewObjectType::addRBACOperation($type_id2, $new_ops_id); 19267 } 19268?> 19269<#5147> 19270<?php 19271include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19272 19273 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 19274 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('grade'); 19275 ilDBUpdateNewObjectType::cloneOperation('crs', $src_ops_id, $tgt_ops_id); 19276 ilDBUpdateNewObjectType::cloneOperation('grp', $src_ops_id, $tgt_ops_id); 19277?> 19278 19279<#5148> 19280<?php 19281include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19282 19283 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 19284 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('grade'); 19285 ilDBUpdateNewObjectType::cloneOperation('crs', $src_ops_id, $tgt_ops_id); 19286 ilDBUpdateNewObjectType::cloneOperation('grp', $src_ops_id, $tgt_ops_id); 19287?> 19288 19289<#5149> 19290<?php 19291if (!$ilDB->tableColumnExists('tst_rnd_quest_set_qpls', 'origin_tax_filter')) { 19292 $ilDB->addTableColumn( 19293 'tst_rnd_quest_set_qpls', 19294 'origin_tax_filter', 19295 array('type' => 'text', 'length' => 4000, 'notnull' => false, 'default' => null) 19296 ); 19297} 19298?> 19299 19300<#5150> 19301<?php 19302if (!$ilDB->tableColumnExists('tst_rnd_quest_set_qpls', 'mapped_tax_filter')) { 19303 $ilDB->addTableColumn( 19304 'tst_rnd_quest_set_qpls', 19305 'mapped_tax_filter', 19306 array('type' => 'text', 'length' => 4000, 'notnull' => false, 'default' => null) 19307 ); 19308} 19309?> 19310 19311<#5151> 19312<?php 19313$query = "SELECT * FROM tst_rnd_quest_set_qpls WHERE origin_tax_fi IS NOT NULL OR mapped_tax_fi IS NOT NULL"; 19314$result = $ilDB->query($query); 19315while ($row = $ilDB->fetchObject($result)) { 19316 if (!empty($row->origin_tax_fi)) { 19317 $origin_tax_filter = serialize(array((int) $row->origin_tax_fi => array((int) $row->origin_node_fi))); 19318 } else { 19319 $origin_tax_filter = null; 19320 } 19321 19322 if (!empty($row->mapped_tax_fi)) { 19323 $mapped_tax_filter = serialize(array((int) $row->mapped_tax_fi => array((int) $row->mapped_node_fi))); 19324 } else { 19325 $mapped_tax_filter = null; 19326 } 19327 19328 $update = "UPDATE tst_rnd_quest_set_qpls SET " 19329 . " origin_tax_fi = NULL, origin_node_fi = NULL, mapped_tax_fi = NULL, mapped_node_fi = NULL, " 19330 . " origin_tax_filter = " . $ilDB->quote($origin_tax_filter, 'text') . ", " 19331 . " mapped_tax_filter = " . $ilDB->quote($mapped_tax_filter, 'text') 19332 . " WHERE def_id = " . $ilDB->quote($row->def_id); 19333 19334 $ilDB->manipulate($update); 19335} 19336?> 19337<#5152> 19338<?php 19339if (!$ilDB->tableColumnExists('tst_rnd_quest_set_qpls', 'type_filter')) { 19340 $ilDB->addTableColumn( 19341 'tst_rnd_quest_set_qpls', 19342 'type_filter', 19343 array('type' => 'text', 'length' => 250, 'notnull' => false, 'default' => null) 19344 ); 19345} 19346?> 19347<#5153> 19348<?php 19349 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19350 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('edit_page_meta', 'Edit Page Metadata', 'object', 3050); 19351 $type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 19352 if ($type_id && $new_ops_id) { 19353 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 19354 } 19355?> 19356<#5154> 19357<?php 19358 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19359 19360 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 19361 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_page_meta'); 19362 ilDBUpdateNewObjectType::cloneOperation('wiki', $src_ops_id, $tgt_ops_id); 19363?> 19364<#5155> 19365<?php 19366 $ilCtrlStructureReader->getStructure(); 19367?> 19368<#5156> 19369<?php 19370if (!$ilDB->tableExists('saml_attribute_mapping')) { 19371 $ilDB->createTable( 19372 'saml_attribute_mapping', 19373 array( 19374 'idp_id' => array( 19375 'type' => 'integer', 19376 'length' => 4, 19377 'notnull' => true 19378 ), 19379 'attribute' => array( 19380 'type' => 'text', 19381 'length' => '75', 19382 'notnull' => true 19383 ), 19384 'idp_attribute' => array( 19385 'type' => 'text', 19386 'length' => '1000', 19387 'notnull' => false, 19388 'default' => null 19389 ), 19390 ) 19391 ); 19392} 19393?> 19394 19395<#5157> 19396<?php 19397$ilDB->addPrimaryKey('saml_attribute_mapping', array('idp_id', 'attribute')); 19398?> 19399<#5158> 19400<?php 19401if (!$ilDB->tableColumnExists('saml_attribute_mapping', 'idp_attribute')) { 19402 $ilDB->modifyTableColumn('saml_attribute_mapping', 'idp_attribute', array( 19403 'type' => 'text', 19404 'length' => '1000', 19405 'notnull' => false, 19406 'default' => null 19407 )); 19408} 19409?> 19410<#5159> 19411<?php 19412if (!$ilDB->tableColumnExists('saml_attribute_mapping', 'update_automatically')) { 19413 $ilDB->addTableColumn('saml_attribute_mapping', 'update_automatically', array( 19414 'type' => 'integer', 19415 'length' => 1, 19416 'notnull' => true, 19417 'default' => 0 19418 )); 19419} 19420?> 19421<#5160> 19422<?php 19423$ilCtrlStructureReader->getStructure(); 19424?> 19425<#5161> 19426<?php 19427if (!$ilDB->tableExists('saml_idp_settings')) { 19428 $ilDB->createTable( 19429 'saml_idp_settings', 19430 array( 19431 'idp_id' => array( 19432 'type' => 'integer', 19433 'length' => 4, 19434 'notnull' => true 19435 ), 19436 'is_active' => array( 19437 'type' => 'integer', 19438 'length' => 1, 19439 'notnull' => true 19440 ) 19441 ) 19442 ); 19443} 19444?> 19445<#5162> 19446<?php 19447$ilDB->addPrimaryKey('saml_idp_settings', array('idp_id')); 19448?> 19449<#5163> 19450<?php 19451if (!$ilDB->tableColumnExists('saml_idp_settings', 'allow_local_auth')) { 19452 $ilDB->addTableColumn( 19453 'saml_idp_settings', 19454 'allow_local_auth', 19455 array( 19456 'type' => 'integer', 19457 'length' => 1, 19458 'notnull' => true, 19459 'default' => 0 19460 ) 19461 ); 19462} 19463if (!$ilDB->tableColumnExists('saml_idp_settings', 'default_role_id')) { 19464 $ilDB->addTableColumn( 19465 'saml_idp_settings', 19466 'default_role_id', 19467 array( 19468 'type' => 'integer', 19469 'length' => 4, 19470 'notnull' => true, 19471 'default' => 0 19472 ) 19473 ); 19474} 19475if (!$ilDB->tableColumnExists('saml_idp_settings', 'uid_claim')) { 19476 $ilDB->addTableColumn( 19477 'saml_idp_settings', 19478 'uid_claim', 19479 array( 19480 'type' => 'text', 19481 'length' => 1000, 19482 'notnull' => false, 19483 'default' => null 19484 ) 19485 ); 19486} 19487if (!$ilDB->tableColumnExists('saml_idp_settings', 'login_claim')) { 19488 $ilDB->addTableColumn( 19489 'saml_idp_settings', 19490 'login_claim', 19491 array( 19492 'type' => 'text', 19493 'length' => 1000, 19494 'notnull' => false, 19495 'default' => null 19496 ) 19497 ); 19498} 19499if (!$ilDB->tableColumnExists('saml_idp_settings', 'sync_status')) { 19500 $ilDB->addTableColumn( 19501 'saml_idp_settings', 19502 'sync_status', 19503 array( 19504 'type' => 'integer', 19505 'length' => 1, 19506 'notnull' => true, 19507 'default' => 0 19508 ) 19509 ); 19510} 19511if (!$ilDB->tableColumnExists('saml_idp_settings', 'account_migr_status')) { 19512 $ilDB->addTableColumn( 19513 'saml_idp_settings', 19514 'account_migr_status', 19515 array( 19516 'type' => 'integer', 19517 'length' => 1, 19518 'notnull' => true, 19519 'default' => 0 19520 ) 19521 ); 19522} 19523?> 19524<#5164> 19525<?php 19526if (!$ilDB->tableExists('auth_ext_attr_mapping') && $ilDB->tableExists('saml_attribute_mapping')) { 19527 $ilDB->renameTable('saml_attribute_mapping', 'auth_ext_attr_mapping'); 19528} 19529?> 19530<#5165> 19531<?php 19532if (!$ilDB->tableColumnExists('auth_ext_attr_mapping', 'auth_src_id') && $ilDB->tableColumnExists('auth_ext_attr_mapping', 'idp_id')) { 19533 $ilDB->renameTableColumn('auth_ext_attr_mapping', 'idp_id', 'auth_src_id'); 19534} 19535?> 19536<#5166> 19537<?php 19538if (!$ilDB->tableColumnExists('auth_ext_attr_mapping', 'auth_mode')) { 19539 $ilDB->addTableColumn('auth_ext_attr_mapping', 'auth_mode', array( 19540 'type' => 'text', 19541 'notnull' => false, 19542 'length' => 50 19543 )); 19544} 19545?> 19546<#5167> 19547<?php 19548// This migrates existing records 19549$ilDB->manipulate('UPDATE auth_ext_attr_mapping SET auth_mode = ' . $ilDB->quote('saml', 'text')); 19550?> 19551<#5168> 19552<?php 19553$ilDB->dropPrimaryKey('auth_ext_attr_mapping'); 19554?> 19555<#5169> 19556<?php 19557$ilDB->addPrimaryKey('auth_ext_attr_mapping', array('auth_mode', 'auth_src_id', 'attribute')); 19558?> 19559<#5170> 19560<?php 19561if (!$ilDB->tableColumnExists('auth_ext_attr_mapping', 'ext_attribute') && $ilDB->tableColumnExists('auth_ext_attr_mapping', 'idp_attribute')) { 19562 $ilDB->renameTableColumn('auth_ext_attr_mapping', 'idp_attribute', 'ext_attribute'); 19563} 19564?> 19565<#5171> 19566<?php 19567if (!$ilDB->sequenceExists('saml_idp_settings')) { 19568 $ilDB->createSequence('saml_idp_settings'); 19569} 19570?> 19571<#5172> 19572<?php 19573if (!$ilDB->tableColumnExists('saml_idp_settings', 'entity_id')) { 19574 $ilDB->addTableColumn( 19575 'saml_idp_settings', 19576 'entity_id', 19577 array( 19578 'type' => 'text', 19579 'length' => 1000, 19580 'notnull' => false, 19581 'default' => null 19582 ) 19583 ); 19584} 19585?> 19586 19587<#5173> 19588<?php 19589if ($ilDB->tableExists('cal_categories_hidden')) { 19590 $ilDB->renameTable('cal_categories_hidden', 'cal_cat_visibility'); 19591 $ilDB->addTableColumn('cal_cat_visibility', 'obj_id', array( 19592 "type" => "integer", 19593 "length" => 4, 19594 "notnull" => true, 19595 "default" => 0 19596 )); 19597 $ilDB->addTableColumn('cal_cat_visibility', 'visible', array( 19598 "type" => "integer", 19599 "length" => 1, 19600 "notnull" => true, 19601 "default" => 0 19602 )); 19603} 19604?> 19605<#5174> 19606<?php 19607if ($ilDB->tableExists('cal_cat_visibility')) { 19608 $ilDB->dropPrimaryKey('cal_cat_visibility'); 19609 $ilDB->addPrimaryKey('cal_cat_visibility', array('user_id','cat_id','obj_id')); 19610} 19611?> 19612<#5175> 19613<?php 19614 $ilCtrlStructureReader->getStructure(); 19615?> 19616<#5176> 19617<?php 19618$fields = array( 19619 'id' => array( 19620 'type' => 'integer', 19621 'length' => '8', 19622 19623 ), 19624 'title' => array( 19625 'type' => 'text', 19626 'length' => '512', 19627 19628 ), 19629 'description' => array( 19630 'type' => 'text', 19631 'length' => '4000', 19632 19633 ), 19634 'core_position' => array( 19635 'type' => 'integer', 19636 'length' => '1', 19637 19638 ), 19639 'core_identifier' => array( 19640 'type' => 'integer', 19641 'length' => '1', 19642 ), 19643 19644); 19645if (!$ilDB->tableExists('il_orgu_positions')) { 19646 $ilDB->createTable('il_orgu_positions', $fields); 19647 $ilDB->addPrimaryKey('il_orgu_positions', array( 'id' )); 19648 19649 if (!$ilDB->sequenceExists('il_orgu_positions')) { 19650 $ilDB->createSequence('il_orgu_positions'); 19651 } 19652} 19653?> 19654<#5177> 19655<?php 19656$fields = array( 19657 'id' => array( 19658 'type' => 'integer', 19659 'length' => '8', 19660 19661 ), 19662 'over' => array( 19663 'type' => 'integer', 19664 'length' => '1', 19665 19666 ), 19667 'scope' => array( 19668 'type' => 'integer', 19669 'length' => '1', 19670 19671 ), 19672 'position_id' => array( 19673 'type' => 'integer', 19674 'length' => '1', 19675 19676 ), 19677 19678); 19679if (!$ilDB->tableExists('il_orgu_authority')) { 19680 $ilDB->createTable('il_orgu_authority', $fields); 19681 $ilDB->addPrimaryKey('il_orgu_authority', array( 'id' )); 19682 19683 if (!$ilDB->sequenceExists('il_orgu_authority')) { 19684 $ilDB->createSequence('il_orgu_authority'); 19685 } 19686} 19687?> 19688<#5178> 19689<?php 19690$fields = array( 19691 'id' => array( 19692 'type' => 'integer', 19693 'length' => '8', 19694 19695 ), 19696 'user_id' => array( 19697 'type' => 'integer', 19698 'length' => '8', 19699 19700 ), 19701 'position_id' => array( 19702 'type' => 'integer', 19703 'length' => '8', 19704 19705 ), 19706 'orgu_id' => array( 19707 'type' => 'integer', 19708 'length' => '8', 19709 19710 ), 19711 19712); 19713if (!$ilDB->tableExists('il_orgu_ua')) { 19714 $ilDB->createTable('il_orgu_ua', $fields); 19715 $ilDB->addPrimaryKey('il_orgu_ua', array( 'id' )); 19716 19717 if (!$ilDB->sequenceExists('il_orgu_ua')) { 19718 $ilDB->createSequence('il_orgu_ua'); 19719 } 19720} 19721?> 19722<#5179> 19723<?php 19724$fields = array( 19725 'operation_id' => array( 19726 'type' => 'integer', 19727 'length' => '8', 19728 19729 ), 19730 'operation_string' => array( 19731 'type' => 'text', 19732 'length' => '16', 19733 19734 ), 19735 'description' => array( 19736 'type' => 'text', 19737 'length' => '512', 19738 19739 ), 19740 'list_order' => array( 19741 'type' => 'integer', 19742 'length' => '8', 19743 19744 ), 19745 'context_id' => array( 19746 'type' => 'integer', 19747 'length' => '8', 19748 19749 ), 19750 19751); 19752if (!$ilDB->tableExists('il_orgu_operations')) { 19753 $ilDB->createTable('il_orgu_operations', $fields); 19754 $ilDB->addPrimaryKey('il_orgu_operations', array( 'operation_id' )); 19755 19756 if (!$ilDB->sequenceExists('il_orgu_operations')) { 19757 $ilDB->createSequence('il_orgu_operations'); 19758 } 19759} 19760?> 19761<#5180> 19762<?php 19763$fields = array( 19764 'id' => array( 19765 'type' => 'integer', 19766 'length' => '8', 19767 19768 ), 19769 'context' => array( 19770 'type' => 'text', 19771 'length' => '16', 19772 19773 ), 19774 'parent_context_id' => array( 19775 'type' => 'integer', 19776 'length' => '8', 19777 19778 ), 19779 19780); 19781if (!$ilDB->tableExists('il_orgu_op_contexts')) { 19782 $ilDB->createTable('il_orgu_op_contexts', $fields); 19783 $ilDB->addPrimaryKey('il_orgu_op_contexts', array( 'id' )); 19784 19785 if (!$ilDB->sequenceExists('il_orgu_op_contexts')) { 19786 $ilDB->createSequence('il_orgu_op_contexts'); 19787 } 19788} 19789?> 19790<#5181> 19791<?php 19792$fields = array( 19793 'id' => array( 19794 'type' => 'integer', 19795 'length' => '8', 19796 19797 ), 19798 'context_id' => array( 19799 'type' => 'integer', 19800 'length' => '8', 19801 19802 ), 19803 'operations' => array( 19804 'type' => 'text', 19805 'length' => '2048', 19806 19807 ), 19808 'parent_id' => array( 19809 'type' => 'integer', 19810 'length' => '8', 19811 19812 ), 19813 'position_id' => array( 19814 'type' => 'integer', 19815 'length' => '8', 19816 19817 ), 19818 19819); 19820if (!$ilDB->tableExists('il_orgu_permissions')) { 19821 $ilDB->createTable('il_orgu_permissions', $fields); 19822 $ilDB->addPrimaryKey('il_orgu_permissions', array( 'id' )); 19823 19824 if (!$ilDB->sequenceExists('il_orgu_permissions')) { 19825 $ilDB->createSequence('il_orgu_permissions'); 19826 } 19827} 19828?> 19829<#5182> 19830<?php 19831$ilOrgUnitPositionEmployee = new ilOrgUnitPosition(); 19832$ilOrgUnitPositionEmployee->setTitle("Employees"); 19833$ilOrgUnitPositionEmployee->setDescription("Employees of a OrgUnit"); 19834$ilOrgUnitPositionEmployee->setCorePosition(true); 19835$ilOrgUnitPositionEmployee->create(); 19836$employee_position_id = $ilOrgUnitPositionEmployee->getId(); 19837 19838$ilOrgUnitPositionSuperior = new ilOrgUnitPosition(); 19839$ilOrgUnitPositionSuperior->setTitle("Superiors"); 19840$ilOrgUnitPositionSuperior->setDescription("Superiors of a OrgUnit"); 19841$ilOrgUnitPositionSuperior->setCorePosition(true); 19842 19843// Authority 19844$Sup = new ilOrgUnitAuthority(); 19845$Sup->setScope(ilOrgUnitAuthority::SCOPE_SAME_ORGU); 19846$Sup->setOver($ilOrgUnitPositionEmployee->getId()); 19847$ilOrgUnitPositionSuperior->setAuthorities([ $Sup ]); 19848$ilOrgUnitPositionSuperior->create(); 19849$superiors_position_id = $ilOrgUnitPositionSuperior->getId(); 19850 19851?> 19852<#5183> 19853<?php 19854 19855try { 19856 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_OBJECT); 19857 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_IASS, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19858 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_CRS, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19859 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_GRP, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19860 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_TST, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19861 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_EXC, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19862 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_SVY, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19863 19864 // These actions will be registred in step 5186 19865// ilOrgUnitOperationQueries::registerNewOperationForMultipleContexts(ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, 'Read the learning Progress of a User', array( 19866// ilOrgUnitOperationContext::CONTEXT_CRS, 19867// ilOrgUnitOperationContext::CONTEXT_GRP, 19868// ilOrgUnitOperationContext::CONTEXT_IASS, 19869// ilOrgUnitOperationContext::CONTEXT_EXC, 19870// ilOrgUnitOperationContext::CONTEXT_SVY, 19871// )); 19872// 19873// ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_MANAGE_MEMBERS, 'Edit Members in a course', ilOrgUnitOperationContext::CONTEXT_CRS); 19874// ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_MANAGE_MEMBERS, 'Edit Members in a group', ilOrgUnitOperationContext::CONTEXT_GRP); 19875// ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_EDIT_SUBMISSION_GRADES, '', ilOrgUnitOperationContext::CONTEXT_EXC); 19876// ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_ACCESS_RESULTS, '', ilOrgUnitOperationContext::CONTEXT_SVY); 19877} catch (ilException $e) { 19878} 19879 19880 19881?> 19882 19883<#5184> 19884<?php 19885if (!$ilDB->tableColumnExists('prg_usr_progress', 'deadline')) { 19886 $ilDB->addTableColumn( 19887 'prg_usr_progress', 19888 'deadline', 19889 array('type' => 'text', 19890 'length' => 15, 19891 'notnull' => false 19892 ) 19893 ); 19894} 19895 19896?> 19897<#5185> 19898<?php 19899 if (!$ilDB->tableColumnExists('sahs_lm', 'id_setting')) { 19900 $ilDB->addTableColumn( 19901 'sahs_lm', 19902 'id_setting', 19903 array( 19904 'type' => 'integer', 19905 'length' => 1, 19906 'notnull' => true, 19907 'default' => 0 19908 ) 19909 ); 19910 $ilDB->query("UPDATE sahs_lm SET id_setting = 0"); 19911 } 19912?> 19913<#5186> 19914<?php 19915 19916$ilDB->modifyTableColumn( 19917 'il_orgu_operations', 19918 'operation_string', 19919 array( 19920 "length" => 127 19921 ) 19922 ); 19923 ilOrgUnitOperation::resetDB(); 19924 ilOrgUnitOperationQueries::registerNewOperationForMultipleContexts(ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, 'Read the learning Progress of a User', array( 19925 ilOrgUnitOperationContext::CONTEXT_CRS, 19926 ilOrgUnitOperationContext::CONTEXT_GRP, 19927 ilOrgUnitOperationContext::CONTEXT_IASS, 19928 ilOrgUnitOperationContext::CONTEXT_EXC, 19929 ilOrgUnitOperationContext::CONTEXT_SVY, 19930 )); 19931 19932 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_MANAGE_MEMBERS, 'Edit Members in a course', ilOrgUnitOperationContext::CONTEXT_CRS); 19933 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_MANAGE_MEMBERS, 'Edit Members in a group', ilOrgUnitOperationContext::CONTEXT_GRP); 19934 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_EDIT_SUBMISSION_GRADES, '', ilOrgUnitOperationContext::CONTEXT_EXC); 19935 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_ACCESS_RESULTS, '', ilOrgUnitOperationContext::CONTEXT_SVY); 19936?> 19937<#5187> 19938<?php 19939 if (!$ilDB->tableColumnExists('sahs_lm', 'name_setting')) { 19940 $ilDB->addTableColumn( 19941 'sahs_lm', 19942 'name_setting', 19943 array( 19944 'type' => 'integer', 19945 'length' => 1, 19946 'notnull' => true, 19947 'default' => 0 19948 ) 19949 ); 19950 $ilDB->query("UPDATE sahs_lm SET name_setting = 0"); 19951 } 19952?> 19953<#5188> 19954<?php 19955if (!$ilDB->tableExists('orgu_obj_type_settings')) { 19956 $ilDB->createTable( 19957 'orgu_obj_type_settings', 19958 array( 19959 'obj_type' => array( 19960 'type' => 'text', 19961 'length' => 10, 19962 'notnull' => true 19963 ), 19964 'active' => array( 19965 'type' => 'integer', 19966 'length' => 1, 19967 'notnull' => false, 19968 'default' => 0 19969 ), 19970 'activation_default' => array( 19971 'type' => 'integer', 19972 'length' => 1, 19973 'notnull' => false, 19974 'default' => 0 19975 ), 19976 'changeable' => array( 19977 'type' => 'integer', 19978 'length' => 1, 19979 'notnull' => false, 19980 'default' => 0 19981 ) 19982 ) 19983 ); 19984 $ilDB->addPrimaryKey('orgu_obj_type_settings', array('obj_type')); 19985} 19986?> 19987<#5189> 19988<?php 19989if (!$ilDB->tableExists('orgu_obj_pos_settings')) { 19990 $ilDB->createTable( 19991 'orgu_obj_pos_settings', 19992 array( 19993 'obj_id' => array( 19994 'type' => 'integer', 19995 'length' => 4, 19996 'notnull' => false 19997 ), 19998 'active' => array( 19999 'type' => 'integer', 20000 'length' => 1, 20001 'notnull' => false, 20002 'default' => 0 20003 ) 20004 ) 20005 ); 20006 $ilDB->addPrimaryKey('orgu_obj_pos_settings', array('obj_id')); 20007} 20008 20009?> 20010<#5190> 20011<?php 20012 20013ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_WRITE_LEARNING_PROGRESS, 'Write the learning Progress of a User', ilOrgUnitOperationContext::CONTEXT_IASS); 20014 20015?> 20016<#5191> 20017<?php 20018// "make place" for two new datatypes, text_selection comes after text, date_selection comes after datetime 20019$ilDB->manipulate("UPDATE il_dcl_datatype SET sort = (sort + 10) WHERE title in ('number', 'boolean', 'datetime')"); 20020$ilDB->manipulate("UPDATE il_dcl_datatype SET sort = (sort + 20) WHERE title not in ('text', 'number', 'boolean', 'datetime')"); 20021?> 20022<#5192> 20023<?php 20024// Datacollection: Add text_selection fieldtype 20025$ilDB->insert('il_dcl_datatype', array( 20026 'id' => array('integer', ilDclDatatype::INPUTFORMAT_TEXT_SELECTION), 20027 'title' => array('text', 'text_selection'), 20028 'ildb_type' => array('text', 'text'), 20029 'storage_location' => array('integer', 1), 20030 'sort' => array('integer', 10), 20031 )); 20032// Datacollection: Add date_selection fieldtype 20033$ilDB->insert('il_dcl_datatype', array( 20034 'id' => array('integer', ilDclDatatype::INPUTFORMAT_DATE_SELECTION), 20035 'title' => array('text', 'date_selection'), 20036 'ildb_type' => array('text', 'text'), 20037 'storage_location' => array('integer', 1), 20038 'sort' => array('integer', 50), 20039)); 20040?> 20041<#5193> 20042<?php 20043$fields = array( 20044 'id' => array( 20045 'notnull' => '1', 20046 'type' => 'integer', 20047 'length' => '8', 20048 20049 ), 20050 'field_id' => array( 20051 'notnull' => '1', 20052 'type' => 'integer', 20053 'length' => '8', 20054 20055 ), 20056 'opt_id' => array( 20057 'notnull' => '1', 20058 'type' => 'integer', 20059 'length' => '8', 20060 20061 ), 20062 'sorting' => array( 20063 'notnull' => '1', 20064 'type' => 'integer', 20065 'length' => '8', 20066 20067 ), 20068 'value' => array( 20069 'notnull' => '1', 20070 'type' => 'text', 20071 'length' => '128', 20072 20073 ), 20074 20075); 20076if (!$ilDB->tableExists('il_dcl_sel_opts')) { 20077 $ilDB->createTable('il_dcl_sel_opts', $fields); 20078 $ilDB->addPrimaryKey('il_dcl_sel_opts', array( 'id' )); 20079 20080 if (!$ilDB->sequenceExists('il_dcl_sel_opts')) { 20081 $ilDB->createSequence('il_dcl_sel_opts'); 20082 } 20083} 20084?> 20085<#5194> 20086<?php 20087 20088if (!$ilDB->tableColumnExists('il_orgu_positions', 'core_identifier')) { 20089 $ilDB->addTableColumn( 20090 'il_orgu_positions', 20091 'core_identifier', 20092 array( 20093 'type' => 'integer', 20094 'length' => 4, 20095 'default' => 0 20096 ) 20097 ); 20098 $ilDB->query("UPDATE il_orgu_positions SET core_identifier = 0"); 20099} 20100$employee = ilOrgUnitPosition::where(['title' => "Employees", 'core_position' => true])->first(); 20101$employee->setCoreIdentifier(ilOrgUnitPosition::CORE_POSITION_EMPLOYEE); 20102$employee->update(); 20103 20104$superior = ilOrgUnitPosition::where(['title' => "Superiors", 'core_position' => true])->first(); 20105$superior->setCoreIdentifier(ilOrgUnitPosition::CORE_POSITION_SUPERIOR); 20106$superior->update(); 20107 20108?> 20109 20110 20111<#5195> 20112<?php 20113$ilDB->insert( 20114 'pdfgen_renderer_avail', 20115 array( 20116 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 20117 'service' => array('text', 'Wiki'), 20118 'purpose' => array('text', 'ContentExport'), 20119 'renderer' => array('text', 'PhantomJS') 20120 ) 20121); 20122?> 20123<#5196> 20124<?php 20125$ilDB->insert( 20126 'pdfgen_renderer_avail', 20127 array( 20128 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 20129 'service' => array('text', 'Portfolio'), 20130 'purpose' => array('text', 'ContentExport'), 20131 'renderer' => array('text', 'PhantomJS') 20132 ) 20133); 20134?> 20135<#5197> 20136<?php 20137 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_ACCESS_ENROLMENTS, 'Access Enrolments in a course', ilOrgUnitOperationContext::CONTEXT_CRS); 20138?> 20139<#5198> 20140<?php 20141if (!$ilDB->tableColumnExists('crs_settings', 'show_members_export')) { 20142 $ilDB->addTableColumn('crs_settings', 'show_members_export', array( 20143 "type" => "integer", 20144 "notnull" => false, 20145 "length" => 4 20146 )); 20147} 20148?> 20149<#5199> 20150<?php 20151 $ilCtrlStructureReader->getStructure(); 20152?> 20153 20154<#5200> 20155<?php 20156include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 20157ilDBUpdateNewObjectType::addAdminNode('ltis', 'LTI Settings'); 20158 20159if (!$ilDB->tableExists('lti_ext_consumer')) { 20160 $ilDB->createTable('lti_ext_consumer', array( 20161 'id' => array( 20162 'type' => 'integer', 20163 'length' => 4, 20164 'notnull' => true, 20165 'default' => 0 20166 ), 20167 'title' => array( 20168 'type' => 'text', 20169 'length' => 255, 20170 'notnull' => true, 20171 ), 20172 'description' => array( 20173 'type' => 'text', 20174 'length' => 255, 20175 'notnull' => true, 20176 ), 20177 'prefix' => array( 20178 'type' => 'text', 20179 'length' => 255, 20180 'notnull' => true, 20181 ), 20182 'consumer_key' => array( 20183 'type' => 'text', 20184 'length' => 255, 20185 'notnull' => true, 20186 ), 20187 'consumer_secret' => array( 20188 'type' => 'text', 20189 'length' => 255, 20190 'notnull' => true, 20191 ), 20192 'user_language' => array( 20193 'type' => 'text', 20194 'length' => 255, 20195 'notnull' => true, 20196 ), 20197 'role' => array( 20198 'type' => 'integer', 20199 'length' => 4, 20200 'notnull' => true, 20201 'default' => 0 20202 ), 20203 'active' => array( 20204 'type' => 'integer', 20205 'length' => 1, 20206 'notnull' => true, 20207 'default' => 0 20208 ) 20209 )); 20210 $ilDB->addPrimaryKey('lti_ext_consumer', array('id')); 20211 $ilDB->createSequence('lti_ext_consumer'); 20212} 20213 20214if (!$ilDB->tableExists('lti_ext_consumer_otype')) { 20215 $ilDB->createTable('lti_ext_consumer_otype', array( 20216 'consumer_id' => array( 20217 'type' => 'integer', 20218 'length' => 4, 20219 'notnull' => true, 20220 'default' => 0 20221 ), 20222 'object_type' => array( 20223 'type' => 'text', 20224 'length' => 255, 20225 'notnull' => true 20226 ), 20227 )); 20228 $ilDB->addPrimaryKey('lti_ext_consumer_otype', array('consumer_id', 'object_type')); 20229} 20230?> 20231<#5201> 20232<?php 20233if (!$ilDB->tableExists('lti2_consumer')) { 20234 $ilDB->createTable('lti2_consumer', array( 20235 'consumer_pk' => array( 20236 'type' => 'integer', 20237 'length' => 4, 20238 'notnull' => true 20239 ), 20240 'name' => array( 20241 'type' => 'text', 20242 'length' => 50, 20243 'notnull' => true 20244 ), 20245 'consumer_key256' => array( 20246 'type' => 'text', 20247 'length' => 256, 20248 'notnull' => true 20249 ), 20250 'consumer_key' => array( 20251 'type' => 'blob', 20252 'default' => null 20253 ), 20254 'secret' => array( 20255 'type' => 'text', 20256 'length' => 1024, 20257 'notnull' => true 20258 ), 20259 'lti_version' => array( 20260 'type' => 'text', 20261 'length' => 10, 20262 'default' => null 20263 ), 20264 'consumer_name' => array( 20265 'type' => 'text', 20266 'length' => 255, 20267 'default' => null 20268 ), 20269 'consumer_version' => array( 20270 'type' => 'text', 20271 'length' => 255, 20272 'default' => null 20273 ), 20274 'consumer_guid' => array( 20275 'type' => 'text', 20276 'length' => 1024, 20277 'default' => null 20278 ), 20279 'profile' => array( 20280 'type' => 'blob', 20281 'default' => null 20282 ), 20283 'tool_proxy' => array( 20284 'type' => 'blob', 20285 'default' => null 20286 ), 20287 'settings' => array( 20288 'type' => 'blob', 20289 'default' => null 20290 ), 20291 'protected' => array( 20292 'type' => 'integer', 20293 'length' => 1, 20294 'notnull' => true 20295 ), 20296 'enabled' => array( 20297 'type' => 'integer', 20298 'length' => 1, 20299 'notnull' => true 20300 ), 20301 'enable_from' => array( 20302 'type' => 'timestamp', 20303 'default' => null 20304 ), 20305 'enable_until' => array( 20306 'type' => 'timestamp', 20307 'default' => null 20308 ), 20309 'last_access' => array( 20310 'type' => 'timestamp', 20311 'default' => null 20312 ), 20313 'created' => array( 20314 'type' => 'timestamp', 20315 'notnull' => true 20316 ), 20317 'updated' => array( 20318 'type' => 'timestamp', 20319 'notnull' => true 20320 ) 20321 )); 20322 $ilDB->addPrimaryKey('lti2_consumer', array('consumer_pk')); 20323 $ilDB->createSequence('lti2_consumer'); 20324} 20325?> 20326<#5202> 20327<?php 20328if (!$ilDB->tableExists('lti2_tool_proxy')) { 20329 $ilDB->createTable('lti2_tool_proxy', array( 20330 'tool_proxy_pk' => array( 20331 'type' => 'integer', 20332 'length' => 4, 20333 'notnull' => true 20334 ), 20335 'tool_proxy_id' => array( 20336 'type' => 'text', 20337 'length' => 32, 20338 'notnull' => true 20339 ), 20340 'consumer_pk' => array( 20341 'type' => 'integer', 20342 'length' => 4, 20343 'notnull' => true 20344 ), 20345 'tool_proxy' => array( 20346 'type' => 'blob', 20347 'notnull' => true 20348 ), 20349 'created' => array( 20350 'type' => 'timestamp', 20351 'notnull' => true 20352 ), 20353 'updated' => array( 20354 'type' => 'timestamp', 20355 'notnull' => true 20356 ) 20357 )); 20358 $ilDB->addPrimaryKey('lti2_tool_proxy', array('tool_proxy_pk')); 20359 $ilDB->addIndex('lti2_tool_proxy', array('consumer_pk'), 'i1'); 20360 $ilDB->addUniqueConstraint('lti2_tool_proxy', array('tool_proxy_id'), 'u1'); 20361 $ilDB->createSequence('lti2_tool_proxy'); 20362} 20363?> 20364<#5203> 20365<?php 20366if (!$ilDB->tableExists('lti2_nonce')) { 20367 $ilDB->createTable('lti2_nonce', array( 20368 'consumer_pk' => array( 20369 'type' => 'integer', 20370 'length' => 4, 20371 'notnull' => true 20372 ), 20373 'value' => array( 20374 'type' => 'text', 20375 'length' => 32, 20376 'notnull' => true 20377 ), 20378 'expires' => array( 20379 'type' => 'timestamp', 20380 'notnull' => true 20381 ) 20382 )); 20383 $ilDB->addPrimaryKey('lti2_nonce', array('consumer_pk','value')); 20384} 20385?> 20386<#5204> 20387<?php 20388if (!$ilDB->tableExists('lti2_context')) { 20389 $ilDB->createTable('lti2_context', array( 20390 'context_pk' => array( 20391 'type' => 'integer', 20392 'length' => 4, 20393 'notnull' => true 20394 ), 20395 'consumer_pk' => array( 20396 'type' => 'integer', 20397 'length' => 4, 20398 'notnull' => true 20399 ), 20400 'lti_context_id' => array( 20401 'type' => 'text', 20402 'length' => 255, 20403 'notnull' => true 20404 ), 20405 'settings' => array( 20406 'type' => 'blob', 20407 'default' => null 20408 ), 20409 'created' => array( 20410 'type' => 'timestamp', 20411 'notnull' => true 20412 ), 20413 'updated' => array( 20414 'type' => 'timestamp', 20415 'notnull' => true 20416 ) 20417 )); 20418 $ilDB->addPrimaryKey('lti2_context', array('context_pk')); 20419 $ilDB->addIndex('lti2_context', array('consumer_pk'), 'i1'); 20420 $ilDB->createSequence('lti2_context'); 20421} 20422?> 20423<#5205> 20424<?php 20425if (!$ilDB->tableExists('lti2_resource_link')) { 20426 $ilDB->createTable('lti2_resource_link', array( 20427 'resource_link_pk' => array( 20428 'type' => 'integer', 20429 'length' => 4 20430 ), 20431 'context_pk' => array( 20432 'type' => 'integer', 20433 'length' => 4, 20434 'default' => null 20435 ), 20436 'consumer_pk' => array( 20437 'type' => 'integer', 20438 'length' => 4, 20439 'default' => null 20440 ), 20441 'lti_resource_link_id' => array( 20442 'type' => 'text', 20443 'length' => 255, 20444 'notnull' => true 20445 ), 20446 'settings' => array( 20447 'type' => 'blob' 20448 ), 20449 'primary_resource_link_pk' => array( 20450 'type' => 'integer', 20451 'length' => 4, 20452 'default' => null 20453 ), 20454 'share_approved' => array( 20455 'type' => 'integer', 20456 'length' => 1, 20457 'default' => null 20458 ), 20459 'created' => array( 20460 'type' => 'timestamp', 20461 'notnull' => true 20462 ), 20463 'updated' => array( 20464 'type' => 'timestamp', 20465 'notnull' => true 20466 ) 20467 )); 20468 $ilDB->addPrimaryKey('lti2_resource_link', array('resource_link_pk')); 20469 $ilDB->addIndex('lti2_resource_link', array('consumer_pk'), 'i1'); 20470 $ilDB->addIndex('lti2_resource_link', array('context_pk'), 'i2'); 20471 $ilDB->createSequence('lti2_resource_link'); 20472} 20473?> 20474<#5206> 20475<?php 20476if (!$ilDB->tableExists('lti2_user_result')) { 20477 $ilDB->createTable('lti2_user_result', array( 20478 'user_pk' => array( 20479 'type' => 'integer', 20480 'length' => 4 20481 ), 20482 'resource_link_pk' => array( 20483 'type' => 'integer', 20484 'length' => 4, 20485 'notnull' => true 20486 ), 20487 'lti_user_id' => array( 20488 'type' => 'text', 20489 'length' => 255, 20490 'notnull' => true 20491 ), 20492 'lti_result_sourcedid' => array( 20493 'type' => 'text', 20494 'length' => 1024, 20495 'notnull' => true 20496 ), 20497 'created' => array( 20498 'type' => 'timestamp', 20499 'notnull' => true 20500 ), 20501 'updated' => array( 20502 'type' => 'timestamp', 20503 'notnull' => true 20504 ) 20505 )); 20506 $ilDB->addPrimaryKey('lti2_user_result', array('user_pk')); 20507 $ilDB->addIndex('lti2_user_result', array('resource_link_pk'), 'i1'); 20508 $ilDB->createSequence('lti2_user_result'); 20509} 20510?> 20511<#5207> 20512<?php 20513if (!$ilDB->tableExists('lti2_share_key')) { 20514 $ilDB->createTable('lti2_share_key', array( 20515 'share_key_id' => array( 20516 'type' => 'text', 20517 'length' => 32, 20518 'notnull' => true 20519 ), 20520 'resource_link_pk' => array( 20521 'type' => 'integer', 20522 'length' => 4, 20523 'notnull' => true 20524 ), 20525 'auto_approve' => array( 20526 'type' => 'integer', 20527 'length' => 1, 20528 'notnull' => true 20529 ), 20530 'expires' => array( 20531 'type' => 'timestamp', 20532 'notnull' => true 20533 ) 20534 )); 20535 $ilDB->addPrimaryKey('lti2_share_key', array('share_key_id')); 20536 $ilDB->addIndex('lti2_share_key', array('resource_link_pk'), 'i1'); 20537} 20538?> 20539<#5208> 20540<?php 20541if (!$ilDB->tableColumnExists('lti_ext_consumer', 'local_role_always_member')) { 20542 $ilDB->addTableColumn('lti_ext_consumer', 'local_role_always_member', array( 20543 'type' => 'integer', 20544 'length' => 1, 20545 'notnull' => true, 20546 'default' => 0 20547 )); 20548} 20549?> 20550<#5209> 20551<?php 20552if (!$ilDB->tableColumnExists('lti_ext_consumer', 'default_skin')) { 20553 $ilDB->addTableColumn('lti_ext_consumer', 'default_skin', array( 20554 'type' => 'text', 20555 'length' => 50, 20556 'default' => null 20557 )); 20558} 20559?> 20560<#5210> 20561<?php 20562if ($ilDB->tableColumnExists('lti_ext_consumer', 'consumer_key')) { 20563 $ilDB->dropTableColumn('lti_ext_consumer', 'consumer_key'); 20564} 20565if ($ilDB->tableColumnExists('lti_ext_consumer', 'consumer_secret')) { 20566 $ilDB->dropTableColumn('lti_ext_consumer', 'consumer_secret'); 20567} 20568if ($ilDB->tableColumnExists('lti_ext_consumer', 'active')) { 20569 $ilDB->dropTableColumn('lti_ext_consumer', 'active'); 20570} 20571?> 20572<#5211> 20573<?php 20574if (!$ilDB->tableExists('lti_int_provider_obj')) { 20575 $ilDB->createTable('lti_int_provider_obj', array( 20576 'ref_id' => array( 20577 'type' => 'integer', 20578 'length' => 4, 20579 'notnull' => false 20580 ), 20581 'consumer_id' => array( 20582 'type' => 'integer', 20583 'length' => 4, 20584 'notnull' => false 20585 ), 20586 20587 'enabled' => array( 20588 'type' => 'integer', 20589 'length' => 1, 20590 'notnull' => false 20591 ), 20592 'admin' => array( 20593 'type' => 'integer', 20594 'length' => 1, 20595 'notnull' => false 20596 ), 20597 'tutor' => array( 20598 'type' => 'integer', 20599 'length' => 1, 20600 'notnull' => false 20601 ), 20602 'member' => array( 20603 'type' => 'integer', 20604 'length' => 1, 20605 'notnull' => false 20606 ) 20607 )); 20608 $ilDB->addPrimaryKey('lti_int_provider_obj', array('ref_id','consumer_id')); 20609} 20610?> 20611<#5212> 20612<?php 20613if ($ilDB->tableExists('lti_int_provider_obj')) { 20614 $ilDB->dropTable('lti_int_provider_obj'); 20615} 20616?> 20617<#5213> 20618<?php 20619include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 20620$type_id = ilDBUpdateNewObjectType::getObjectTypeId('ltis'); 20621 20622$ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('release_objects', 'Release objects', 'object', 500); 20623if ($ops_id && $type_id) { 20624 ilDBUpdateNewObjectType::addRBACOperation($type_id, $ops_id); 20625} 20626?> 20627<#5214> 20628<?php 20629if (!$ilDB->tableColumnExists("il_object_def", "lti_provider")) { 20630 $def = array( 20631 'type' => 'integer', 20632 'length' => 1, 20633 'notnull' => true, 20634 'default' => 0 20635 ); 20636 $ilDB->addTableColumn("il_object_def", "lti_provider", $def); 20637} 20638?> 20639<#5215> 20640<?php 20641if (!$ilDB->tableColumnExists('lti2_consumer', 'ext_consumer_id')) { 20642 $ilDB->addTableColumn( 20643 'lti2_consumer', 20644 'ext_consumer_id', 20645 array( 20646 "type" => "integer", 20647 "notnull" => true, 20648 "length" => 4 20649 ) 20650 ); 20651} 20652?> 20653 20654<#5216> 20655<?php 20656if (!$ilDB->tableColumnExists('lti2_consumer', 'ref_id')) { 20657 $ilDB->addTableColumn( 20658 'lti2_consumer', 20659 'ref_id', 20660 array( 20661 "type" => "integer", 20662 "notnull" => true, 20663 "length" => 4 20664 ) 20665 ); 20666} 20667?> 20668<#5217> 20669<?php 20670if (!$ilDB->tableColumnExists('lti_ext_consumer', 'active')) { 20671 $ilDB->addTableColumn( 20672 'lti_ext_consumer', 20673 'active', 20674 [ 20675 'type' => 'integer', 20676 'length' => 1, 20677 'notnull' => true, 20678 'default' => 0 20679 ] 20680 ); 20681} 20682?> 20683<#5218> 20684<?php 20685if (!$ilDB->tableExists('lti_int_provider_obj')) { 20686 $ilDB->createTable('lti_int_provider_obj', array( 20687 'ref_id' => array( 20688 'type' => 'integer', 20689 'length' => 4, 20690 'notnull' => false 20691 ), 20692 'ext_consumer_id' => [ 20693 'type' => 'integer', 20694 'length' => 4, 20695 'notnull' => false 20696 ], 20697 'admin' => array( 20698 'type' => 'integer', 20699 'length' => 4, 20700 'notnull' => false 20701 ), 20702 'tutor' => array( 20703 'type' => 'integer', 20704 'length' => 4, 20705 'notnull' => false 20706 ), 20707 'member' => array( 20708 'type' => 'integer', 20709 'length' => 4, 20710 'notnull' => false 20711 ) 20712 )); 20713 $ilDB->addPrimaryKey('lti_int_provider_obj', array('ref_id','ext_consumer_id')); 20714} 20715?> 20716<#5219> 20717<?php 20718 $ilCtrlStructureReader->getStructure(); 20719?> 20720<#5220> 20721<?php 20722if (!$ilDB->tableColumnExists('file_data', 'page_count')) { 20723 $ilDB->addTableColumn( 20724 'file_data', 20725 'page_count', 20726 array( 20727 'type' => 'integer', 20728 'length' => 8, 20729 ) 20730 ); 20731} 20732?> 20733<#5221> 20734<?php 20735if (!$ilDB->tableColumnExists('il_blog', 'nav_list_mon_with_post')) { 20736 $ilDB->addTableColumn( 20737 'il_blog', 20738 'nav_list_mon_with_post', 20739 array( 20740 'type' => 'integer', 20741 'length' => 4, 20742 'default' => 3 20743 ) 20744 ); 20745} 20746?> 20747 20748<#5222> 20749<?php 20750 if (!$ilDB->tableColumnExists('iass_settings', 'file_required')) { 20751 $ilDB->addTableColumn('iass_settings', 'file_required', array( 20752 "type" => "integer", 20753 "length" => 1, 20754 "notnull" => true, 20755 "default" => 0 20756 )); 20757 } 20758?> 20759 20760<#5223> 20761<?php 20762 if (!$ilDB->tableColumnExists('iass_members', 'file_name')) { 20763 $ilDB->addTableColumn('iass_members', 'file_name', array( 20764 "type" => "text", 20765 "length" => 255 20766 )); 20767 } 20768 if (!$ilDB->tableColumnExists('iass_members', 'user_view_file')) { 20769 $ilDB->addTableColumn('iass_members', 'user_view_file', array( 20770 "type" => "integer", 20771 "length" => 1 20772 )); 20773 } 20774?> 20775<#5224> 20776<?php 20777$ilCtrlStructureReader->getStructure(); 20778?> 20779<#5225> 20780<?php 20781if ($ilDB->tableColumnExists('reg_registration_codes', 'generated')) { 20782 $ilDB->renameTableColumn('reg_registration_codes', "generated", 'generated_on'); 20783} 20784?> 20785<#5226> 20786<?php 20787if ($ilDB->tableColumnExists('il_orgu_operations', 'operation_string')) { 20788 $ilDB->modifyTableColumn( 20789 'il_orgu_operations', 20790 'operation_string', 20791 array( 20792 "length" => 127 20793 ) 20794 ); 20795} 20796?> 20797<#5227> 20798<?php 20799 $ilCtrlStructureReader->getStructure(); 20800?> 20801<#5228> 20802<?php 20803 $ilCtrlStructureReader->getStructure(); 20804?> 20805<#5229> 20806<?php 20807 if (!$ilDB->tableColumnExists('il_bt_bucket', 'last_heartbeat')) { 20808 $ilDB->addTableColumn('il_bt_bucket', 'last_heartbeat', array( 20809 "type" => "integer", 20810 "length" => 4 20811 )); 20812 } 20813?> 20814<#5230> 20815<?php 20816 $ilCtrlStructureReader->getStructure(); 20817?> 20818<#5231> 20819<?php 20820if (!$ilDB->indexExistsByFields('style_parameter', array('style_id'))) { 20821 $ilDB->addIndex('style_parameter', array('style_id'), 'i1'); 20822} 20823?> 20824<#5232> 20825<?php 20826include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 20827ilDBUpdate3136::addStyleClass( 20828 "OrderListHorizontal", 20829 "qordul", 20830 "ul", 20831 array("margin" => "0px", 20832 "padding" => "0px", 20833 "list-style" => "none", 20834 "list-style-position" => "outside" 20835 ) 20836); 20837ilDBUpdate3136::addStyleClass( 20838 "OrderListItemHorizontal", 20839 "qordli", 20840 "li", 20841 array( 20842 "float" => "left", 20843 "margin-top" => "5px", 20844 "margin-bottom" => "5px", 20845 "margin-right" => "10px", 20846 "border-width" => "1px", 20847 "border-style" => "solid", 20848 "border-color" => "#D0D0FF", 20849 "padding" => "10px", 20850 "cursor" => "move" 20851 ) 20852); 20853?> 20854<#5233> 20855<?php 20856 $ilCtrlStructureReader->getStructure(); 20857?> 20858<#5234> 20859<?php 20860if ($ilDB->tableColumnExists('wiki_stat', 'del_pages')) { 20861 $ilDB->modifyTableColumn('wiki_stat', 'del_pages', array( 20862 'type' => 'integer', 20863 'length' => 4, 20864 'notnull' => true, 20865 'default' => 0 20866 )); 20867} 20868?> 20869<#5235> 20870<?php 20871if ($ilDB->tableColumnExists('wiki_stat', 'avg_rating')) { 20872 $ilDB->modifyTableColumn('wiki_stat', 'avg_rating', array( 20873 'type' => 'integer', 20874 'length' => 4, 20875 'notnull' => true, 20876 'default' => 0 20877 )); 20878} 20879?> 20880<#5236> 20881<?php 20882 20883 $ilDB->dropPrimaryKey('loc_rnd_qpl'); 20884?> 20885 20886<#5237> 20887<?php 20888 20889 $ilDB->addPrimaryKey('loc_rnd_qpl', ['container_id', 'objective_id', 'tst_type', 'tst_id', 'qp_seq']); 20890 20891?> 20892<#5238> 20893<?php 20894 $ilCtrlStructureReader->getStructure(); 20895?> 20896<#5239> 20897<?php 20898$ilDB->modifyTableColumn( 20899 'adv_md_record', 20900 'record_id', 20901 array( 20902 "type" => "integer", 20903 "length" => 4, 20904 "notnull" => true 20905 ) 20906 ); 20907?> 20908<#5240> 20909<?php 20910$ilDB->modifyTableColumn( 20911 'adv_md_record_objs', 20912 'record_id', 20913 array( 20914 "type" => "integer", 20915 "length" => 4, 20916 "notnull" => true 20917 ) 20918 ); 20919?> 20920<#5241> 20921<?php 20922 $ilCtrlStructureReader->getStructure(); 20923?> 20924<#5242> 20925<?php 20926 20927/** 20928 * This will move all the exercise instruction files from outside document root to inside. 20929 */ 20930 20931$result = $ilDB->query("SELECT id,exc_id FROM exc_assignment"); 20932 20933while ($row = $ilDB->fetchAssoc($result)) { 20934 include_once("./Services/Migration/DBUpdate_5242/classes/class.ilFSStorageExc5242.php"); 20935 $storage = new ilFSStorageExc5242($row['exc_id'], $row['id']); 20936 20937 $files = $storage->getFiles(); 20938 if (!empty($files)) { 20939 foreach ($files as $file) { 20940 $file_name = $file['name']; 20941 $file_full_path = $file['fullpath']; 20942 $file_relative_path = str_replace(ILIAS_DATA_DIR, "", $file_full_path); 20943 $directory_relative_path = str_replace($file_name, "", $file_relative_path); 20944 20945 if (!is_dir(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . $directory_relative_path)) { 20946 //echo "<br> makeDirParents: ".ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR.$directory_relative_path; 20947 ilUtil::makeDirParents(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . $directory_relative_path); 20948 } 20949 if (!file_exists(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . $file_relative_path) && 20950 file_exists($file_full_path)) { 20951 //echo "<br> rename: $file_full_path TO ".ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR.$file_relative_path; 20952 rename($file_full_path, ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . $file_relative_path); 20953 } 20954 } 20955 } 20956} 20957?> 20958<#5243> 20959<?php 20960if (!$ilDB->tableColumnExists('usr_session', 'context')) { 20961 $ilDB->addTableColumn( 20962 'usr_session', 20963 'context', 20964 array( 20965 'type' => 'text', 20966 'length' => '80', 20967 'notnull' => false) 20968 ); 20969} 20970?> 20971<#5244> 20972<?php 20973 //add table column 20974 if (!$ilDB->tableColumnExists('iass_members', 'changer_id')) { 20975 $ilDB->addTableColumn("iass_members", "changer_id", array( 20976 'type' => 'integer', 20977 'length' => 4, 20978 'notnull' => false 20979 )); 20980 } 20981?> 20982<#5245> 20983<?php 20984 //add table column 20985 if (!$ilDB->tableColumnExists('iass_members', 'change_time')) { 20986 $ilDB->addTableColumn("iass_members", "change_time", array( 20987 'type' => 'text', 20988 'length' => 20, 20989 'notnull' => false 20990 )); 20991 } 20992?> 20993 20994<#5246> 20995<?php 20996 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 20997 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('edit_submissions_grades', 'Edit Submissions Grades', 'object', 3800); 20998 $type_id = ilDBUpdateNewObjectType::getObjectTypeId('exc'); 20999 if ($type_id && $new_ops_id) { 21000 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 21001 } 21002?> 21003<#5247> 21004<?php 21005include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 21006 21007 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 21008 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_submissions_grades'); 21009 ilDBUpdateNewObjectType::cloneOperation('exc', $src_ops_id, $tgt_ops_id); 21010?> 21011<#5248> 21012<?php 21013$ilCtrlStructureReader->getStructure(); 21014?> 21015<#5249> 21016<?php 21017 21018$ilSetting = new ilSetting(); 21019 21020if (!$ilSetting->get('dbupwarn_tstfixqstseq', 0)) { 21021 $res = $ilDB->query(" 21022 SELECT COUNT(DISTINCT test_fi) num_tst, COUNT(test_question_id) num_qst 21023 FROM tst_test_question WHERE test_fi IN( 21024 SELECT test_fi FROM tst_test_question 21025 GROUP BY test_fi HAVING COUNT(test_fi) < MAX(sequence) 21026 ) 21027 "); 21028 21029 $row = $ilDB->fetchAssoc($res); 21030 21031 if ($row) { 21032 $numTests = $row['num_tst']; 21033 $numQuestions = $row['num_qst']; 21034 $ilSetting->set('dbupwarn_tstfixqstseq', 1); 21035 setup_exit(" 21036 21037 DEAR ADMINISTRATOR !! 21038 21039 Please read the following instructions CAREFULLY! 21040 21041 -> Due to a bug in almost all earlier versions of ILIAS question orderings 21042 from the assessment component are broken but repairable. 21043 21044 -> The following dbupdate step can exhaust any php enviroment settings like 21045 max_execution_time or memory_limit for example. 21046 21047 -> In the case of any php fatal error during the following dbupdate step 21048 that is about exhausting any ressource or time restriction you just need 21049 to refresh the page by using F5 for example. 21050 21051 => To proceed the update process you now need to refresh the page as well (F5) 21052 21053 Mantis Bug Report: https://ilias.de/mantis/view.php?id=20382 21054 21055 In your database there were > {$numTests} tests < detected having > {$numQuestions} questions < overall, 21056 that are stored with gaps in the ordering index. 21057 "); 21058 } 21059 21060 $ilSetting->set('dbupwarn_tstfixqstseq', 1); 21061} 21062 21063?> 21064<#5250> 21065<?php 21066 21067$res = $ilDB->query(" 21068 SELECT test_fi, test_question_id 21069 FROM tst_test_question WHERE test_fi IN( 21070 SELECT test_fi FROM tst_test_question 21071 GROUP BY test_fi HAVING COUNT(test_fi) < MAX(sequence) 21072 ) ORDER BY test_fi ASC, sequence ASC 21073"); 21074 21075$tests = array(); 21076 21077while ($row = $ilDB->fetchAssoc($res)) { 21078 if (!isset($tests[ $row['test_fi'] ])) { 21079 $tests[ $row['test_fi'] ] = array(); 21080 } 21081 21082 $tests[ $row['test_fi'] ][] = $row['test_question_id']; 21083} 21084 21085foreach ($tests as $testFi => $testQuestions) { 21086 for ($i = 0, $m = count($testQuestions); $i <= $m; $i++) { 21087 $testQuestionId = $testQuestions[$i]; 21088 21089 $position = $i + 1; 21090 21091 $ilDB->update( 21092 'tst_test_question', 21093 array( 'sequence' => array('integer', $position) ), 21094 array( 'test_question_id' => array('integer', $testQuestionId) ) 21095 ); 21096 } 21097} 21098 21099?> 21100<#5251> 21101<?php 21102$set = $ilDB->query(" 21103 SELECT obj_id, title, description, role_id, usr_id FROM object_data 21104 INNER JOIN role_data role ON role.role_id = object_data.obj_id 21105 INNER JOIN rbac_ua on role.role_id = rol_id 21106 WHERE title LIKE '%il_orgu_superior%' OR title LIKE '%il_orgu_employee%' 21107"); 21108$assigns = []; 21109$superior_position_id = ilOrgUnitPosition::getCorePositionId(ilOrgUnitPosition::CORE_POSITION_SUPERIOR); 21110$employee_position_id = ilOrgUnitPosition::getCorePositionId(ilOrgUnitPosition::CORE_POSITION_EMPLOYEE); 21111 21112while ($res = $ilDB->fetchAssoc($set)) { 21113 $user_id = $res['usr_id']; 21114 21115 $tmp = explode("_", $res['title']); 21116 $orgu_ref_id = (int) $tmp[3]; 21117 if ($orgu_ref_id == 0) { 21118 //$ilLog->write("User $user_id could not be assigned to position. Role description does not contain object id of orgu. Skipping."); 21119 continue; 21120 } 21121 21122 $tmp = explode("_", $res['title']); //il_orgu_[superior|employee]_[$ref_id] 21123 $role_type = $tmp[2]; // [superior|employee] 21124 21125 if ($role_type == 'superior') { 21126 $position_id = $superior_position_id; 21127 } elseif ($role_type == 'employee') { 21128 $position_id = $employee_position_id; 21129 } else { 21130 //$ilLog->write("User $user_id could not be assigned to position. Role type seems to be neither superior nor employee. Skipping."); 21131 continue; 21132 } 21133 if (!ilOrgUnitUserAssignment::findOrCreateAssignment( 21134 $user_id, 21135 $position_id, 21136 $orgu_ref_id 21137 )) { 21138 //$ilLog->write("User $user_id could not be assigned to position $position_id, in orgunit $orgu_ref_id . One of the ids might not actually exist in the db. Skipping."); 21139 } 21140} 21141?> 21142<#5252> 21143<?php 21144$ilDB->query(" 21145UPDATE il_dcl_stloc1_value 21146SET value = NULL 21147WHERE value = '[]' 21148 AND record_field_id IN ( 21149 SELECT rf.id 21150 FROM il_dcl_record_field rf 21151 INNER JOIN il_dcl_field f ON f.id = rf.field_id 21152 WHERE f.datatype_id = 14 21153 ) 21154"); 21155?> 21156<#5253> 21157<?php 21158 21159$query = " 21160 SELECT qpl.question_id qid, 21161 qpl.points qpl_points, 21162 answ.points answ_points 21163 21164 FROM qpl_questions qpl 21165 21166 INNER JOIN qpl_qst_essay qst 21167 ON qst.question_fi = qpl.question_id 21168 21169 INNER JOIN qpl_a_essay answ 21170 ON answ.question_fi = qst.question_fi 21171 21172 WHERE qpl.question_id IN( 21173 21174 SELECT keywords.question_fi 21175 21176 FROM qpl_a_essay keywords 21177 21178 INNER JOIN qpl_qst_essay question 21179 ON question.question_fi = keywords.question_fi 21180 AND question.keyword_relation = {$ilDB->quote('', 'text')} 21181 21182 WHERE keywords.answertext = {$ilDB->quote('', 'text')} 21183 GROUP BY keywords.question_fi 21184 HAVING COUNT(keywords.question_fi) = {$ilDB->quote(1, 'integer')} 21185 21186 ) 21187"; 21188 21189$res = $ilDB->query($query); 21190 21191while ($row = $ilDB->fetchAssoc($res)) { 21192 if ($row['answ_points'] > $row['qpl_points']) { 21193 $ilDB->update( 21194 'qpl_questions', 21195 array('points' => array('float', $row['answ_points'])), 21196 array('question_id' => array('integer', $row['qid'])) 21197 ); 21198 } 21199 21200 $ilDB->manipulateF( 21201 "DELETE FROM qpl_a_essay WHERE question_fi = %s", 21202 array('integer'), 21203 array($row['qid']) 21204 ); 21205 21206 $ilDB->update( 21207 'qpl_qst_essay', 21208 array('keyword_relation' => array('text', 'non')), 21209 array('question_fi' => array('integer', $row['qid'])) 21210 ); 21211} 21212 21213?> 21214<#5254> 21215<?php 21216$ilCtrlStructureReader->getStructure(); 21217?> 21218<#5255> 21219<?php 21220if (!$ilDB->tableColumnExists(ilOrgUnitPermission::TABLE_NAME, 'protected')) { 21221 $ilDB->addTableColumn(ilOrgUnitPermission::TABLE_NAME, 'protected', [ 21222 "type" => "integer", 21223 "length" => 1, 21224 "default" => 0, 21225 ]); 21226} 21227$ilDB->manipulate("UPDATE il_orgu_permissions SET protected = 1 WHERE parent_id = -1"); 21228?> 21229<#5256> 21230<?php 21231if ($ilDB->indexExistsByFields('cmi_objective', array('id'))) { 21232 $ilDB->dropIndexByFields('cmi_objective', array('id')); 21233} 21234?> 21235<#5257> 21236<?php 21237if (!$ilDB->indexExistsByFields('page_style_usage', array('page_id', 'page_type', 'page_lang', 'page_nr'))) { 21238 $ilDB->addIndex('page_style_usage', array('page_id', 'page_type', 'page_lang', 'page_nr'), 'i1'); 21239} 21240?> 21241<#5258> 21242<?php 21243 21244include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 21245 21246$rp_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("read_learning_progress"); 21247$ep_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 21248$w_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 21249if ($rp_ops_id && $ep_ops_id && $w_ops_id) { 21250 // see ilObjectLP 21251 $lp_types = array('mcst'); 21252 21253 foreach ($lp_types as $lp_type) { 21254 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId($lp_type); 21255 if ($lp_type_id) { 21256 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $rp_ops_id); 21257 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ep_ops_id); 21258 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $rp_ops_id); 21259 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $ep_ops_id); 21260 } 21261 } 21262} 21263?> 21264<#5259> 21265<?php 21266 $ilDB->manipulate('UPDATE exc_mem_ass_status SET status=' . $ilDB->quote('notgraded', 'text') . ' WHERE status = ' . $ilDB->quote('', 'text')); 21267?> 21268<#5260> 21269<?php 21270$ilCtrlStructureReader->getStructure(); 21271?> 21272<#5261> 21273<?php 21274$ilCtrlStructureReader->getStructure(); 21275?> 21276<#5262> 21277<?php 21278 21279$query = 'select id from adm_settings_template ' . 21280 'where title = ' . $ilDB->quote('il_astpl_loc_initial', 'text') . 21281 'or title = ' . $ilDB->quote('il_astpl_loc_qualified', 'text'); 21282$res = $ilDB->query($query); 21283while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 21284 $ilDB->replace( 21285 'adm_set_templ_value', 21286 [ 21287 'template_id' => ['integer', $row->id], 21288 'setting' => ['text', 'pass_scoring'] 21289 ], 21290 [ 21291 'value' => ['integer',0], 21292 'hide' => ['integer',1] 21293 ] 21294 ); 21295} 21296?> 21297<#5263> 21298<?php 21299$ilDB->modifyTableColumn('il_dcl_tableview', 'roles', array('type' => 'clob')); 21300?> 21301<#5264> 21302<?php 21303// get tst type id 21304$row = $ilDB->fetchAssoc($ilDB->queryF( 21305 "SELECT obj_id tst_type_id FROM object_data WHERE type = %s AND title = %s", 21306 array('text', 'text'), 21307 array('typ', 'tst') 21308)); 21309$tstTypeId = $row['tst_type_id']; 21310 21311// get 'write' operation id 21312$row = $ilDB->fetchAssoc($ilDB->queryF( 21313 "SELECT ops_id FROM rbac_operations WHERE operation = %s AND class = %s", 21314 array('text', 'text'), 21315 array('write', 'general') 21316)); 21317$writeOperationId = $row['ops_id']; 21318 21319// register new 'object' rbac operation for tst 21320$resultsOperationId = $ilDB->nextId('rbac_operations'); 21321$ilDB->insert('rbac_operations', array( 21322 'ops_id' => array('integer', $resultsOperationId), 21323 'operation' => array('text', 'tst_results'), 21324 'description' => array('text', 'view the results of test participants'), 21325 'class' => array('text', 'object'), 21326 'op_order' => array('integer', 7050) 21327)); 21328$ilDB->insert('rbac_ta', array( 21329 'typ_id' => array('integer', $tstTypeId), 21330 'ops_id' => array('integer', $resultsOperationId) 21331)); 21332 21333// update existing role templates and grant new operation for all templates having 'write' granted 21334$res = $ilDB->queryF( 21335 "SELECT rol_id, parent FROM rbac_templates WHERE type = %s AND ops_id = %s", 21336 array('text', 'integer'), 21337 array('tst', $writeOperationId) 21338); 21339$stmt = $ilDB->prepareManip( 21340 " 21341 INSERT INTO rbac_templates (rol_id, type, ops_id, parent) VALUES (?, ?, ?, ?) 21342 ", 21343 array('integer', 'text', 'integer', 'integer') 21344); 21345while ($row = $ilDB->fetchAssoc($res)) { 21346 $ilDB->execute($stmt, array($row['rol_id'], 'tst', $resultsOperationId, $row['parent'])); 21347} 21348?> 21349<#5265> 21350<?php 21351// get 'write' operation id 21352$row = $ilDB->fetchAssoc($ilDB->queryF( 21353 "SELECT ops_id FROM rbac_operations WHERE operation = %s AND class = %s", 21354 array('text', 'text'), 21355 array('tst_results', 'object') 21356)); 21357$resultsOperationId = $row['ops_id']; 21358 21359// get 'write' operation id 21360$row = $ilDB->fetchAssoc($ilDB->queryF( 21361 "SELECT ops_id FROM rbac_operations WHERE operation = %s AND class = %s", 21362 array('text', 'text'), 21363 array('write', 'general') 21364)); 21365$writeOperationId = $row['ops_id']; 21366 21367// get roles (not rolts) having 'tst_results' registered in rbac_template 21368$res = $ilDB->queryF( 21369 " 21370 SELECT rol_id FROM rbac_templates INNER JOIN object_data 21371 ON obj_id = rol_id AND object_data.type = %s WHERE rbac_templates.type = %s AND ops_id = %s 21372 ", 21373 array('text', 'text', 'integer'), 21374 array('role', 'tst', $resultsOperationId) 21375); 21376$roleIds = array(); 21377while ($row = $ilDB->fetchAssoc($res)) { 21378 $roleIds[] = $row['rol_id']; 21379} 21380 21381// get existing test object references 21382$res = $ilDB->queryF( 21383 " 21384 SELECT oref.ref_id FROM object_data odat INNER JOIN object_reference oref 21385 ON oref.obj_id = odat.obj_id WHERE odat.type = %s 21386 ", 21387 array('text'), 21388 array('tst') 21389); 21390$tstRefs = array(); 21391while ($row = $ilDB->fetchAssoc($res)) { 21392 $tstRefs[] = $row['ref_id']; 21393} 21394 21395// complete 'tst_results' permission for all existing role/reference combination that have 'write' permission 21396$stmt = $ilDB->prepareManip( 21397 " 21398 UPDATE rbac_pa SET ops_id = ? WHERE rol_id = ? AND ref_id = ? 21399 ", 21400 array('text', 'integer', 'integer') 21401); 21402$IN_roles = $ilDB->in('rol_id', $roleIds, false, 'integer'); 21403$IN_tstrefs = $ilDB->in('ref_id', $tstRefs, false, 'integer'); 21404$res = $ilDB->query("SELECT * FROM rbac_pa WHERE {$IN_roles} AND {$IN_tstrefs}"); 21405while ($row = $ilDB->fetchAssoc($res)) { 21406 $perms = unserialize($row['ops_id']); 21407 21408 if (in_array($writeOperationId, $perms) && !in_array($resultsOperationId, $perms)) { 21409 $perms[] = $resultsOperationId; 21410 $ilDB->execute($stmt, array(serialize($perms), $row['rol_id'], $row['ref_id'])); 21411 } 21412} 21413?> 21414<#5266> 21415<?php 21416$ilCtrlStructureReader->getStructure(); 21417?> 21418<#5267> 21419<?php 21420$ilCtrlStructureReader->getStructure(); 21421?> 21422<#5268> 21423<?php 21424$fields = array( 21425 'id' => array( 21426 'notnull' => '1', 21427 'type' => 'integer', 21428 'length' => '4', 21429 21430 ), 21431 'identifier' => array( 21432 'notnull' => '1', 21433 'type' => 'text', 21434 'length' => '50', 21435 21436 ), 21437 'data_type' => array( 21438 'notnull' => '1', 21439 'type' => 'integer', 21440 'length' => '1', 21441 21442 ), 21443 'position' => array( 21444 'type' => 'integer', 21445 'length' => '3', 21446 21447 ), 21448 'is_standard_field' => array( 21449 'notnull' => '1', 21450 'type' => 'integer', 21451 'length' => '1', 21452 21453 ), 21454 'object_id' => array( 21455 'notnull' => '1', 21456 'type' => 'integer', 21457 'length' => '4', 21458 21459 ), 21460); 21461global $ilDB; 21462if (!$ilDB->tableExists('il_bibl_field')) { 21463 $ilDB->createTable('il_bibl_field', $fields); 21464 $ilDB->addPrimaryKey('il_bibl_field', array( 'id' )); 21465 21466 if (!$ilDB->sequenceExists('il_bibl_field')) { 21467 $ilDB->createSequence('il_bibl_field'); 21468 } 21469} 21470?> 21471<#5269> 21472<?php 21473$fields = array( 21474 'id' => array( 21475 'notnull' => '1', 21476 'type' => 'integer', 21477 'length' => '4', 21478 21479 ), 21480 'field_id' => array( 21481 'notnull' => '1', 21482 'type' => 'integer', 21483 'length' => '4', 21484 21485 ), 21486 'object_id' => array( 21487 'notnull' => '1', 21488 'type' => 'integer', 21489 'length' => '4', 21490 21491 ), 21492 'filter_type' => array( 21493 'type' => 'integer', 21494 'length' => '1', 21495 21496 ), 21497 21498); 21499if (!$ilDB->tableExists('il_bibl_filter')) { 21500 $ilDB->createTable('il_bibl_filter', $fields); 21501 $ilDB->addPrimaryKey('il_bibl_filter', array( 'id' )); 21502 21503 if (!$ilDB->sequenceExists('il_bibl_filter')) { 21504 $ilDB->createSequence('il_bibl_filter'); 21505 } 21506} 21507?> 21508<#5270> 21509<?php 21510if (!$ilDB->tableColumnExists("il_bibl_data", "file_type")) { 21511 $ilDB->addTableColumn("il_bibl_data", "file_type", [ 21512 "type" => "integer", 21513 "notnull" => true, 21514 "length" => 1, 21515 "default" => 1 21516 ]); 21517} 21518 21519$type = function ($filename) { 21520 if (strtolower(substr($filename, -6)) == "bibtex" 21521 || strtolower(substr($filename, -3)) == "bib") { 21522 return 2; 21523 } 21524 return 1; 21525}; 21526 21527$res = $ilDB->query("SELECT * FROM il_bibl_data"); 21528while ($d = $ilDB->fetchObject($res)) { 21529 $type_id = (int) $type($d->filname); 21530 $ilDB->update("il_bibl_data", [ 21531 "file_type" => [ "integer", $type_id ] 21532 ], [ "id" => $d->id ]); 21533} 21534?> 21535<#5271> 21536<?php 21537$fields = array( 21538 'id' => array( 21539 'notnull' => '1', 21540 'type' => 'integer', 21541 'length' => '4', 21542 21543 ), 21544 'field_id' => array( 21545 'notnull' => '1', 21546 'type' => 'integer', 21547 'length' => '8', 21548 21549 ), 21550 'language_key' => array( 21551 'notnull' => '1', 21552 'type' => 'text', 21553 'length' => '2', 21554 21555 ), 21556 'translation' => array( 21557 'type' => 'text', 21558 'length' => '256', 21559 21560 ), 21561 'description' => array( 21562 'type' => 'clob', 21563 21564 ), 21565 21566); 21567if (!$ilDB->tableExists('il_bibl_translation')) { 21568 $ilDB->createTable('il_bibl_translation', $fields); 21569 $ilDB->addPrimaryKey('il_bibl_translation', array( 'id' )); 21570 21571 if (!$ilDB->sequenceExists('il_bibl_translation')) { 21572 $ilDB->createSequence('il_bibl_translation'); 21573 } 21574} 21575?> 21576<#5272> 21577<?php 21578$ilCtrlStructureReader->getStructure(); 21579?> 21580<#5273> 21581<?php 21582// TODO fill filetype_id with the correct values 21583if ($ilDB->tableExists('il_bibl_overview_model')) { 21584 if ($ilDB->tableColumnExists('il_bibl_overview_model', 'filetype')) { 21585 $type = function ($filetype_string) { 21586 if (strtolower($filetype_string) == "bib" 21587 || strtolower($filetype_string) == "bibtex" 21588 ) { 21589 return 2; // see ilBiblTypeFactoryInterface::DATA_TYPE_BIBTEX 21590 } 21591 21592 return 1; // ilBiblTypeFactoryInterface::DATA_TYPE_RIS 21593 }; 21594 21595 if (!$ilDB->tableColumnExists('il_bibl_overview_model', 'file_type_id')) { 21596 $ilDB->addTableColumn('il_bibl_overview_model', 'file_type_id', array("type" => "integer", 'length' => 4)); 21597 } 21598 21599 $res = $ilDB->query("SELECT * FROM il_bibl_overview_model"); 21600 while ($d = $ilDB->fetchObject($res)) { 21601 $type_id = (int) $type($d->filetype); 21602 $ilDB->update( 21603 "il_bibl_overview_model", 21604 [ 21605 "file_type_id" => ["integer", $type_id], 21606 ], 21607 ["ovm_id" => ["integer", $d->ovm_id]] 21608 ); 21609 } 21610 21611 $ilDB->dropTableColumn('il_bibl_overview_model', 'filetype'); 21612 } 21613} 21614?> 21615<#5274> 21616<?php 21617/* 21618* This hotfix removes org unit assignments of user who don't exist anymore 21619* select all user_ids from usr_data and remove all il_orgu_ua entries which have an user_id from an user who doesn't exist anymore 21620*/ 21621global $ilDB; 21622$q = "DELETE FROM il_orgu_ua WHERE user_id NOT IN (SELECT usr_id FROM usr_data)"; 21623$ilDB->manipulate($q); 21624?> 21625<#5275> 21626<?php 21627$ilCtrlStructureReader->getStructure(); 21628?> 21629<#5276> 21630<?php 21631if (!$ilDB->tableColumnExists('qpl_qst_lome', 'identical_scoring')) { 21632 $ilDB->addTableColumn('qpl_qst_lome', 'identical_scoring', array( 21633 'type' => 'integer', 21634 'length' => 1, 21635 'default' => 1 21636 )); 21637} 21638?> 21639<#5277> 21640<?php 21641$ilSetting = new ilSetting(); 21642 21643if ($ilSetting->get('show_mail_settings', false) === false) { 21644 $ilSetting->set('show_mail_settings', 1); 21645} 21646?> 21647<#5278> 21648<?php 21649require_once './Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 21650 21651$type_id = ilDBUpdateNewObjectType::addNewType('copa', 'Content Page Object'); 21652 21653ilDBUpdateNewObjectType::addRBACOperations($type_id, [ 21654 ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS, 21655 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 21656 ilDBUpdateNewObjectType::RBAC_OP_READ, 21657 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 21658 ilDBUpdateNewObjectType::RBAC_OP_DELETE, 21659 ilDBUpdateNewObjectType::RBAC_OP_COPY 21660]); 21661 21662ilDBUpdateNewObjectType::addRBACCreate('create_copa', 'Create Content Page Object', [ 21663 'root', 21664 'cat', 21665 'crs', 21666 'fold', 21667 'grp' 21668]); 21669?> 21670<#5279> 21671<?php 21672require_once 'Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 21673 21674$rp_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("read_learning_progress"); 21675$ep_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 21676$w_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 21677if ($rp_ops_id && $ep_ops_id && $w_ops_id) { 21678 $lp_types = array('copa'); 21679 21680 foreach ($lp_types as $lp_type) { 21681 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId($lp_type); 21682 21683 if ($lp_type_id) { 21684 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $rp_ops_id); 21685 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ep_ops_id); 21686 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $rp_ops_id); 21687 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $ep_ops_id); 21688 } 21689 } 21690} 21691?> 21692<#5280> 21693<?php 21694$ilCtrlStructureReader->getStructure(); 21695?> 21696<#5281> 21697<?php 21698require_once 'Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 21699ilDBUpdateNewObjectType::applyInitialPermissionGuideline('copa', true); 21700?> 21701<#5282> 21702<?php 21703$ilCtrlStructureReader->getStructure(); 21704?> 21705<#5283> 21706<?php 21707if (!$ilDB->tableExists('content_page_data')) { 21708 $fields = array( 21709 'content_page_id' => array( 21710 'type' => 'integer', 21711 'length' => 4, 21712 'notnull' => true, 21713 'default' => 0 21714 ), 21715 'stylesheet' => array( 21716 'type' => 'integer', 21717 'notnull' => true, 21718 'length' => 4, 21719 'default' => 0 21720 ) 21721 ); 21722 21723 $ilDB->createTable('content_page_data', $fields); 21724 $ilDB->addPrimaryKey('content_page_data', array('content_page_id')); 21725} 21726?> 21727<#5284> 21728<?php 21729$res = $ilDB->queryF( 21730 'SELECT * FROM object_data WHERE type = %s', 21731 ['text'], 21732 ['copa'] 21733); 21734 21735while ($data = $ilDB->fetchAssoc($res)) { 21736 $ilDB->replace( 21737 'content_page_data', 21738 [ 21739 'content_page_id' => ['integer', (int) $data['obj_id']] 21740 ], 21741 [] 21742 ); 21743} 21744?> 21745<#5285> 21746<?php 21747if (!$ilDB->tableColumnExists('qpl_fb_specific', 'question')) { 21748 // add new table column for indexing different question gaps in assClozeTest 21749 $ilDB->addTableColumn('qpl_fb_specific', 'question', array( 21750 'type' => 'integer', 'length' => 4, 'notnull' => false, 'default' => null 21751 )); 21752 21753 // give all other qtypes having a single subquestion the question index 0 21754 $ilDB->manipulateF( 21755 "UPDATE qpl_fb_specific SET question = %s WHERE question_fi NOT IN( 21756 SELECT question_id FROM qpl_questions 21757 INNER JOIN qpl_qst_type ON question_type_id = question_type_fi 21758 WHERE type_tag = %s 21759 )", 21760 array('integer', 'text'), 21761 array(0, 'assClozeTest') 21762 ); 21763 21764 // for all assClozeTest entries - migrate the gap feedback indexes from answer field to questin field 21765 $ilDB->manipulateF( 21766 "UPDATE qpl_fb_specific SET question = answer WHERE question_fi IN( 21767 SELECT question_id FROM qpl_questions 21768 INNER JOIN qpl_qst_type ON question_type_id = question_type_fi 21769 WHERE type_tag = %s 21770 )", 21771 array('text'), 21772 array('assClozeTest') 21773 ); 21774 21775 // for all assClozeTest entries - initialize the answer field with 0 for the formaly stored gap feedback 21776 $ilDB->manipulateF( 21777 "UPDATE qpl_fb_specific SET answer = %s WHERE question_fi IN( 21778 SELECT question_id FROM qpl_questions 21779 INNER JOIN qpl_qst_type ON question_type_id = question_type_fi 21780 WHERE type_tag = %s 21781 )", 21782 array('integer', 'text'), 21783 array(0, 'assClozeTest') 21784 ); 21785 21786 // finaly set the question index field to notnull = true (not nullable) as it is now initialized 21787 $ilDB->modifyTableColumn('qpl_fb_specific', 'question', array( 21788 'notnull' => true, 'default' => 0 21789 )); 21790 21791 // add unique constraint on qid and the two specific feedback indentification index fields 21792 $ilDB->addUniqueConstraint('qpl_fb_specific', array( 21793 'question_fi', 'question', 'answer' 21794 )); 21795} 21796 21797if (!$ilDB->tableColumnExists('qpl_qst_cloze', 'feedback_mode')) { 21798 $ilDB->addTableColumn('qpl_qst_cloze', 'feedback_mode', array( 21799 'type' => 'text', 'length' => 16, 'notnull' => false, 'default' => null 21800 )); 21801 21802 $ilDB->manipulateF( 21803 "UPDATE qpl_qst_cloze SET feedback_mode = %s", 21804 array('text'), 21805 array('gapQuestion') 21806 ); 21807 21808 $ilDB->modifyTableColumn('qpl_qst_cloze', 'feedback_mode', array( 21809 'notnull' => true, 'default' => 'gapQuestion' 21810 )); 21811} 21812?> 21813<#5286> 21814<?php 21815if (!$ilDB->tableColumnExists('tst_tests', 'follow_qst_answer_fixation')) { 21816 $ilDB->addTableColumn('tst_tests', 'follow_qst_answer_fixation', array( 21817 'type' => 'integer', 'notnull' => false, 'length' => 1, 'default' => 0 21818 )); 21819 21820 $ilDB->manipulateF( 21821 'UPDATE tst_tests SET follow_qst_answer_fixation = %s', 21822 array('integer'), 21823 array(0) 21824 ); 21825} 21826 21827if (!$ilDB->tableExists('tst_seq_qst_presented')) { 21828 $ilDB->createTable('tst_seq_qst_presented', array( 21829 'active_fi' => array( 21830 'type' => 'integer', 21831 'length' => 4, 21832 'notnull' => true, 21833 'default' => 0 21834 ), 21835 'pass' => array( 21836 'type' => 'integer', 21837 'length' => 4, 21838 'notnull' => true, 21839 'default' => 0 21840 ), 21841 'question_fi' => array( 21842 'type' => 'integer', 21843 'length' => 4, 21844 'notnull' => true, 21845 'default' => 0 21846 ) 21847 )); 21848 21849 $ilDB->addPrimaryKey('tst_seq_qst_presented', array( 21850 'active_fi','pass', 'question_fi' 21851 )); 21852} 21853?> 21854<#5287> 21855<?php 21856if ($ilDB->tableColumnExists('qpl_fb_specific', 'answer')) { 21857 $ilDB->manipulateF( 21858 " 21859 UPDATE qpl_fb_specific SET answer = %s WHERE question_fi IN( 21860 SELECT question_fi FROM qpl_qst_cloze WHERE feedback_mode = %s 21861 ) 21862 ", 21863 array('integer', 'text'), 21864 array(-10, 'gapQuestion') 21865 ); 21866} 21867?> 21868<#5288> 21869<?php 21870$setting = new ilSetting(); 21871$ilrqtix = $setting->get('iloscmsgidx1', 0); 21872if (!$ilrqtix) { 21873 $ilDB->addIndex('osc_messages', array('user_id'), 'i1'); 21874 $setting->set('iloscmsgidx1', 1); 21875} 21876?> 21877<#5289> 21878<?php 21879$setting = new ilSetting(); 21880$ilrqtix = $setting->get('iloscmsgidx2', 0); 21881if (!$ilrqtix) { 21882 $ilDB->addIndex('osc_messages', array('conversation_id'), 'i2'); 21883 $setting->set('iloscmsgidx2', 1); 21884} 21885?> 21886<#5290> 21887<?php 21888$setting = new ilSetting(); 21889$ilrqtix = $setting->get('iloscmsgidx3', 0); 21890if (!$ilrqtix) { 21891 $ilDB->addIndex('osc_messages', array('conversation_id', 'user_id', 'timestamp'), 'i3'); 21892 $setting->set('iloscmsgidx3', 1); 21893} 21894?> 21895<#5291> 21896<?php 21897$ilCtrlStructureReader->getStructure(); 21898?> 21899<#5292> 21900<?php 21901try { 21902 require_once 'Modules/OrgUnit/classes/Positions/Operation/class.ilOrgUnitOperationQueries.php'; 21903 21904 ilOrgUnitOperationQueries::registerNewOperation( 21905 ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, 21906 'Read Test Participants Learning Progress', 21907 ilOrgUnitOperationContext::CONTEXT_TST 21908 ); 21909 21910 ilOrgUnitOperationQueries::registerNewOperation( 21911 ilOrgUnitOperation::OP_ACCESS_RESULTS, 21912 'Access Test Participants Results', 21913 ilOrgUnitOperationContext::CONTEXT_TST 21914 ); 21915 21916 ilOrgUnitOperationQueries::registerNewOperation( 21917 ilOrgUnitOperation::OP_MANAGE_PARTICIPANTS, 21918 'Manage Test Participants', 21919 ilOrgUnitOperationContext::CONTEXT_TST 21920 ); 21921 21922 ilOrgUnitOperationQueries::registerNewOperation( 21923 ilOrgUnitOperation::OP_SCORE_PARTICIPANTS, 21924 'Score Test Participants', 21925 ilOrgUnitOperationContext::CONTEXT_TST 21926 ); 21927} catch (ilException $e) { 21928} 21929?> 21930<#5293> 21931<?php 21932$ilCtrlStructureReader->getStructure(); 21933?> 21934<#5294> 21935<?php 21936$setting = new ilSetting(); 21937 21938if (!$setting->get('tst_score_rep_consts_cleaned', 0)) { 21939 $ilDB->queryF( 21940 "UPDATE tst_tests SET score_reporting = %s WHERE score_reporting = %s", 21941 array('integer', 'integer'), 21942 array(0, 4) 21943 ); 21944 21945 $setting->set('tst_score_rep_consts_cleaned', 1); 21946} 21947?> 21948<#5295> 21949<?php 21950if (!$ilDB->tableColumnExists('tst_result_cache', 'passed_once')) { 21951 $ilDB->addTableColumn('tst_result_cache', 'passed_once', array( 21952 'type' => 'integer', 'length' => 1, 'notnull' => false, 'default' => 0 21953 )); 21954} 21955?> 21956<#5296> 21957<?php 21958if (!$ilDB->tableColumnExists('exc_assignment', 'fb_date_custom')) { 21959 $ilDB->addTableColumn('exc_assignment', 'fb_date_custom', [ 21960 "type" => "integer", 21961 "length" => 4, 21962 "default" => null, 21963 ]); 21964} 21965if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_submit_status')) { 21966 $ilDB->addTableColumn('exc_assignment', 'rmd_submit_status', [ 21967 "type" => "integer", 21968 "length" => 1, 21969 "default" => null, 21970 ]); 21971} 21972if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_submit_start')) { 21973 $ilDB->addTableColumn('exc_assignment', 'rmd_submit_start', [ 21974 "type" => "integer", 21975 "length" => 4, 21976 "default" => null, 21977 ]); 21978} 21979if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_submit_end')) { 21980 $ilDB->addTableColumn('exc_assignment', 'rmd_submit_end', [ 21981 "type" => "integer", 21982 "length" => 4, 21983 "default" => null, 21984 ]); 21985} 21986if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_submit_freq')) { 21987 $ilDB->addTableColumn('exc_assignment', 'rmd_submit_freq', [ 21988 "type" => "integer", 21989 "length" => 4, 21990 "default" => null, 21991 ]); 21992} 21993if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_grade_status')) { 21994 $ilDB->addTableColumn('exc_assignment', 'rmd_grade_status', [ 21995 "type" => "integer", 21996 "length" => 1, 21997 "default" => null, 21998 ]); 21999} 22000if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_grade_start')) { 22001 $ilDB->addTableColumn('exc_assignment', 'rmd_grade_start', [ 22002 "type" => "integer", 22003 "length" => 4, 22004 "default" => null, 22005 ]); 22006} 22007if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_grade_end')) { 22008 $ilDB->addTableColumn('exc_assignment', 'rmd_grade_end', [ 22009 "type" => "integer", 22010 "length" => 4, 22011 "default" => null, 22012 ]); 22013} 22014if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_grade_freq')) { 22015 $ilDB->addTableColumn('exc_assignment', 'rmd_grade_freq', [ 22016 "type" => "integer", 22017 "length" => 4, 22018 "default" => null, 22019 ]); 22020} 22021if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rmd_status')) { 22022 $ilDB->addTableColumn('exc_assignment', 'peer_rmd_status', [ 22023 "type" => "integer", 22024 "length" => 1, 22025 "default" => null, 22026 ]); 22027} 22028if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rmd_start')) { 22029 $ilDB->addTableColumn('exc_assignment', 'peer_rmd_start', [ 22030 "type" => "integer", 22031 "length" => 4, 22032 "default" => null, 22033 ]); 22034} 22035if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rmd_end')) { 22036 $ilDB->addTableColumn('exc_assignment', 'peer_rmd_end', [ 22037 "type" => "integer", 22038 "length" => 4, 22039 "default" => null, 22040 ]); 22041} 22042if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rmd_freq')) { 22043 $ilDB->addTableColumn('exc_assignment', 'peer_rmd_freq', [ 22044 "type" => "integer", 22045 "length" => 4, 22046 "default" => null, 22047 ]); 22048} 22049if (!$ilDB->tableExists('exc_ass_reminders')) { 22050 $ilDB->createTable('exc_ass_reminders', array( 22051 'type' => array( 22052 'type' => 'text', 22053 'length' => 32, 22054 ), 22055 'ass_id' => array( 22056 "type" => "integer", 22057 "length" => 4, 22058 "default" => null 22059 ), 22060 'exc_id' => array( 22061 "type" => "integer", 22062 "length" => 4, 22063 "default" => null 22064 ), 22065 'status' => array( 22066 "type" => "integer", 22067 "length" => 1, 22068 "default" => null 22069 ), 22070 'start' => array( 22071 "type" => "integer", 22072 "length" => 4, 22073 "default" => null 22074 ), 22075 'end' => array( 22076 "type" => "integer", 22077 "length" => 4, 22078 "default" => null 22079 ), 22080 'freq' => array( 22081 "type" => "integer", 22082 "length" => 4, 22083 "default" => null 22084 ), 22085 'last_send' => array( 22086 "type" => "integer", 22087 "length" => 4, 22088 "default" => null 22089 ), 22090 'template_id' => array( 22091 "type" => "integer", 22092 "length" => 4, 22093 "default" => null 22094 ) 22095 )); 22096 $ilDB->addPrimaryKey("exc_ass_reminders", array("ass_id", "exc_id", "type")); 22097} 22098?> 22099<#5297> 22100<?php 22101if ($ilDB->tableColumnExists('svy_svy', 'mode_360')) { 22102 $ilDB->renameTableColumn('svy_svy', 'mode_360', 'mode'); 22103} 22104?> 22105<#5298> 22106<?php 22107if (!$ilDB->tableColumnExists('svy_svy', 'mode_self_eval_results')) { 22108 $ilDB->addTableColumn( 22109 'svy_svy', 22110 'mode_self_eval_results', 22111 array( 22112 'type' => 'integer', 22113 'length' => 1, 22114 'notnull' => false, 22115 'default' => 0 22116 ) 22117 ); 22118} 22119?> 22120<#5299> 22121<?php 22122if ($ilDB->tableColumnExists('svy_svy', 'mode_360_skill_service')) { 22123 $ilDB->renameTableColumn('svy_svy', 'mode_360_skill_service', 'mode_skill_service'); 22124} 22125?> 22126<#5300> 22127<?php 22128$ilCtrlStructureReader->getStructure(); 22129?> 22130<#5301> 22131<?php 22132if (!$ilDB->tableColumnExists('file_data', 'max_version')) { 22133 $ilDB->addTableColumn('file_data', 'max_version', array( 22134 'type' => 'integer', 22135 'length' => 4 22136 )); 22137} 22138?> 22139<#5302> 22140<?php 22141include_once './Services/Migration/DBUpdate_5295/classes/class.ilMD5295Creator.php'; 22142include_once './Services/Migration/DBUpdate_5295/classes/class.ilMD5295.php'; 22143 22144ilMD5295::_deleteAllByType('grp'); 22145 22146$group_ids = []; 22147$query = 'SELECT obd.obj_id, title, od.description FROM object_data obd ' . 22148 'JOIN object_description od on obd.obj_id = od.obj_id ' . 22149 'WHERE type = ' . $ilDB->quote('grp', 'text'); 22150$res = $ilDB->query($query); 22151while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 22152 $md_creator = new ilMD5295Creator($row->obj_id, $row->obj_id, 'grp'); 22153 $md_creator->setTitle($row->title); 22154 $md_creator->setTitleLanguage('en'); 22155 $md_creator->setDescription($row->description); 22156 $md_creator->setDescriptionLanguage('en'); 22157 $md_creator->setKeywordLanguage('en'); 22158 $md_creator->setLanguage('en'); 22159 22160 $md_creator->create(); 22161} 22162?> 22163<#5303> 22164<?php 22165$ilCtrlStructureReader->getStructure(); 22166?> 22167<#5304> 22168<?php 22169$ilCtrlStructureReader->getStructure(); 22170?> 22171<#5305> 22172<?php 22173$ilCtrlStructureReader->getStructure(); 22174?> 22175<#5306> 22176<?php 22177if (!$ilDB->tableColumnExists('mail_man_tpl', 'is_default')) { 22178 $ilDB->addTableColumn( 22179 'mail_man_tpl', 22180 'is_default', 22181 [ 22182 'type' => 'integer', 22183 'length' => 1, 22184 'notnull' => true, 22185 'default' => 0, 22186 ] 22187 ); 22188} 22189?> 22190<#5307> 22191<?php 22192$ilCtrlStructureReader->getStructure(); 22193?> 22194<#5308> 22195<?php 22196if ($ilDB->tableExists('object_data_del')) { 22197 if (!$ilDB->tableColumnExists('object_data_del', 'description')) { 22198 $ilDB->addTableColumn( 22199 'object_data_del', 22200 'description', 22201 [ 22202 'type' => 'clob', 22203 'notnull' => false, 22204 'default' => null, 22205 ] 22206 ); 22207 } 22208} 22209?> 22210<#5309> 22211<?php 22212$ilCtrlStructureReader->getStructure(); 22213?> 22214<#5310> 22215<?php 22216 $ilCtrlStructureReader->getStructure(); 22217?> 22218<#5311> 22219<?php 22220if (!$ilDB->tableExists("exc_ass_wiki_team")) { 22221 $fields = array( 22222 "id" => array( 22223 "type" => "integer", 22224 "notnull" => true, 22225 "length" => 4, 22226 "default" => 0 22227 ), 22228 "container_ref_id" => array( 22229 "type" => "integer", 22230 "notnull" => true, 22231 "length" => 4, 22232 "default" => 0 22233 ), 22234 "template_ref_id" => array( 22235 "type" => "integer", 22236 "notnull" => true, 22237 "length" => 4, 22238 "default" => 0 22239 ) 22240 ); 22241 $ilDB->createTable("exc_ass_wiki_team", $fields); 22242 $ilDB->addPrimaryKey("exc_ass_wiki_team", array("id")); 22243} 22244?> 22245<#5312> 22246<?php 22247 $ilCtrlStructureReader->getStructure(); 22248?> 22249<#5313> 22250<?php 22251 22252 if (!$ilDB->tableColumnExists('exc_returned', 'team_id')) { 22253 $ilDB->addTableColumn('exc_returned', 'team_id', array( 22254 "type" => "integer", 22255 "notnull" => true, 22256 "length" => 4, 22257 "default" => 0 22258 )); 22259 } 22260 22261?> 22262<#5314> 22263<?php 22264if ($ilDB->tableExists('object_data_del')) { 22265 if (!$ilDB->tableColumnExists('object_data_del', 'description')) { 22266 $ilDB->addTableColumn( 22267 'object_data_del', 22268 'description', 22269 [ 22270 'type' => 'clob', 22271 'notnull' => false, 22272 'default' => null, 22273 ] 22274 ); 22275 } 22276} 22277?> 22278<#5315> 22279<?php 22280if (!$ilDB->tableExists('tos_documents')) { 22281 $fields = [ 22282 'id' => [ 22283 'type' => 'integer', 22284 'length' => 4, 22285 'notnull' => true, 22286 'default' => 0 22287 ], 22288 'title' => [ 22289 'type' => 'text', 22290 'length' => 255, 22291 'notnull' => false, 22292 'default' => null 22293 ], 22294 'creation_ts' => [ 22295 'type' => 'integer', 22296 'length' => 4, 22297 'notnull' => true, 22298 'default' => 0 22299 ], 22300 'modification_ts' => [ 22301 'type' => 'integer', 22302 'length' => 4, 22303 'notnull' => true, 22304 'default' => 0 22305 ], 22306 'sorting' => [ 22307 'type' => 'integer', 22308 'length' => 4, 22309 'notnull' => true, 22310 'default' => 0 22311 ], 22312 'owner_usr_id' => [ 22313 'type' => 'integer', 22314 'length' => 4, 22315 'notnull' => true, 22316 'default' => 0 22317 ], 22318 'last_modified_usr_id' => [ 22319 'type' => 'integer', 22320 'length' => 4, 22321 'notnull' => true, 22322 'default' => 0 22323 ] 22324 ]; 22325 22326 $ilDB->createTable('tos_documents', $fields); 22327 $ilDB->addPrimaryKey('tos_documents', ['id']); 22328 $ilDB->createSequence('tos_documents'); 22329} 22330?> 22331<#5316> 22332<?php 22333if (!$ilDB->tableColumnExists('tos_documents', 'text')) { 22334 $ilDB->addTableColumn('tos_documents', 'text', [ 22335 'type' => 'clob', 22336 'notnull' => false, 22337 'default' => null 22338 ]); 22339} 22340?> 22341<#5317> 22342<?php 22343if (!$ilDB->tableExists('tos_criterion_to_doc')) { 22344 $fields = [ 22345 'id' => [ 22346 'type' => 'integer', 22347 'length' => 4, 22348 'notnull' => true, 22349 'default' => 0 22350 ], 22351 'doc_id' => [ 22352 'type' => 'integer', 22353 'length' => 4, 22354 'notnull' => true, 22355 'default' => 0 22356 ], 22357 'criterion_id' => [ 22358 'type' => 'text', 22359 'length' => 50, 22360 'notnull' => true 22361 ], 22362 'criterion_value' => [ 22363 'type' => 'text', 22364 'length' => 255, 22365 'notnull' => false, 22366 'default' => null, 22367 ], 22368 'assigned_ts' => [ 22369 'type' => 'integer', 22370 'length' => 4, 22371 'notnull' => true, 22372 'default' => 0 22373 ], 22374 'modification_ts' => [ 22375 'type' => 'integer', 22376 'length' => 4, 22377 'notnull' => true, 22378 'default' => 0 22379 ], 22380 'owner_usr_id' => [ 22381 'type' => 'integer', 22382 'length' => 4, 22383 'notnull' => true, 22384 'default' => 0 22385 ], 22386 'last_modified_usr_id' => [ 22387 'type' => 'integer', 22388 'length' => 4, 22389 'notnull' => true, 22390 'default' => 0 22391 ] 22392 ]; 22393 22394 $ilDB->createTable('tos_criterion_to_doc', $fields); 22395 $ilDB->addPrimaryKey('tos_criterion_to_doc', ['id']); 22396 $ilDB->createSequence('tos_criterion_to_doc'); 22397} 22398?> 22399<#5318> 22400<?php 22401if (!$ilDB->tableColumnExists('tos_versions', 'doc_id')) { 22402 $ilDB->addTableColumn('tos_versions', 'doc_id', [ 22403 'type' => 'integer', 22404 'length' => 4, 22405 'notnull' => true, 22406 'default' => 0 22407 ]); 22408} 22409 22410if (!$ilDB->tableColumnExists('tos_versions', 'title')) { 22411 $ilDB->addTableColumn('tos_versions', 'title', [ 22412 'type' => 'text', 22413 'notnull' => false, 22414 'default' => null 22415 ]); 22416} 22417 22418if (!$ilDB->tableColumnExists('tos_acceptance_track', 'criteria')) { 22419 $ilDB->addTableColumn('tos_acceptance_track', 'criteria', [ 22420 'type' => 'clob', 22421 'notnull' => false, 22422 'default' => null 22423 ]); 22424} 22425?> 22426<#5319> 22427<?php 22428if ($ilDB->indexExistsByFields('tos_versions', ['hash', 'lng'])) { 22429 $ilDB->dropIndexByFields('tos_versions', ['hash', 'lng']); 22430} 22431?> 22432<#5320> 22433<?php 22434if (!$ilDB->indexExistsByFields('tos_versions', ['hash', 'doc_id'])) { 22435 $ilDB->addIndex('tos_versions', ['hash', 'doc_id'], 'i1'); 22436} 22437?> 22438<#5321> 22439<?php 22440$dbStep = $nr; 22441$globalAgreementPath = './Customizing/global/agreement'; 22442$clientAgreementPath = './Customizing/clients/' . basename(CLIENT_DATA_DIR) . '/agreement'; 22443 22444$ilSetting = new \ilSetting(); 22445 22446$documentDirectoriesExist = false; 22447if ( 22448 (file_exists($globalAgreementPath) && is_dir($globalAgreementPath) && is_readable($globalAgreementPath)) || 22449 (file_exists($clientAgreementPath) && is_dir($clientAgreementPath) && is_readable($clientAgreementPath)) 22450) { 22451 $documentDirectoriesExist = true; 22452} 22453 22454if ($documentDirectoriesExist && !$ilSetting->get('dbupwarn_tos_migr_54x', 0)) { 22455 $ilSetting->set('dbupwarn_tos_migr_54x', 1); 22456 setup_exit(" 22457 22458 DEAR ADMINISTRATOR !! 22459 22460 Because of the ILIAS 5.4.x feature 'User: Criteria-based »User Agreement« documents' 22461 (see: https://www.ilias.de/docu/goto_docu_wiki_wpage_5225_1357.html) the file system 22462 based user agreements in '{$globalAgreementPath}' and '{$clientAgreementPath}' will 22463 be migrated according to https://www.ilias.de/docu/goto_docu_wiki_wpage_5225_1357.html#ilPageTocA27 . 22464 22465 The client-independent user agreements will be abandoned at all and migrated to 22466 client-related documents. 22467 22468 With ILIAS 5.4.x user agreement documents can be managed in the global ILIAS administration. 22469 The contents of a document can be uploaded as text or HTML file and will be stored (after purification) in the database. 22470 22471 If you reload this page (e.g. by pressing the F5 key), the migration process will be started. The agreement files will NOT be deleted. 22472 "); 22473} elseif (!$documentDirectoriesExist) { 22474 $ilSetting->set('dbupwarn_tos_migr_54x', 1); 22475} 22476 22477if (!$ilDB->tableExists('agreement_migr')) { 22478 $fields = [ 22479 'agr_type' => [ 22480 'type' => 'text', 22481 'length' => 20, 22482 'notnull' => true 22483 ], 22484 'agr_lng' => [ 22485 'type' => 'text', 22486 'length' => 2, 22487 'notnull' => true 22488 ] 22489 ]; 22490 22491 $ilDB->createTable('agreement_migr', $fields); 22492 $ilDB->addPrimaryKey('agreement_migr', ['agr_type', 'agr_lng']); 22493 $GLOBALS['ilLog']->info(sprintf( 22494 'Created agreement migration table: agreement_migr' 22495 )); 22496} 22497 22498// Determine system language 22499$ilIliasIniFile = new \ilIniFile(ILIAS_ABSOLUTE_PATH . '/ilias.ini.php'); 22500$ilIliasIniFile->read(); 22501 22502$language = $ilIliasIniFile->readVariable('language', 'default'); 22503$ilSetting = new \ilSetting(); 22504if ($ilSetting->get('language') != '') { 22505 $language = $ilSetting->get('language'); 22506} 22507 22508$docTitlePrefix = 'Document'; 22509if ('de' === strtolower($language)) { 22510 $docTitlePrefix = 'Dokument'; 22511} 22512 22513$res = $ilDB->query("SELECT * FROM agreement_migr"); 22514$i = (int) $ilDB->numRows($res); 22515 22516if ($documentDirectoriesExist) { 22517 foreach ([ 22518 'client-independent' => $globalAgreementPath, 22519 'client-related' => $clientAgreementPath, 22520 ] as $type => $path) { 22521 if (!file_exists($path) || !is_dir($path)) { 22522 $GLOBALS['ilLog']->info(sprintf( 22523 "DB Step %s: Skipped 'Terms of Service' migration, path '%s' not found or not a directory", 22524 $dbStep, 22525 $path 22526 )); 22527 continue; 22528 } 22529 22530 if (!is_readable($path)) { 22531 $GLOBALS['ilLog']->error(sprintf( 22532 "DB Step %s: Skipped 'Terms of Service' migration, path '%s' is not readable", 22533 $dbStep, 22534 $path 22535 )); 22536 continue; 22537 } 22538 22539 try { 22540 foreach (new \RegexIterator( 22541 new \DirectoryIterator($path), 22542 '/agreement_[a-zA-Z]{2,2}\.(html)$/i' 22543 ) as $file) { 22544 $GLOBALS['ilLog']->info(sprintf( 22545 "DB Step %s: Started migration of %s user agreement file '%s'", 22546 $dbStep, 22547 $type, 22548 $file->getPathname() 22549 )); 22550 22551 $matches = null; 22552 if (!preg_match('/agreement_([a-zA-Z]{2,2})\.html/', $file->getBasename(), $matches)) { 22553 $GLOBALS['ilLog']->info(sprintf( 22554 "DB Step %s: Ignored migration of %s user agreement file '%s' because the basename is not valid", 22555 $dbStep, 22556 $type, 22557 $file->getPathname() 22558 )); 22559 continue; 22560 } 22561 $languageValue = $matches[1]; 22562 22563 $res = $ilDB->queryF( 22564 "SELECT * FROM agreement_migr WHERE agr_type = %s AND agr_lng = %s", 22565 ['text', 'text'], 22566 [$type, $languageValue] 22567 ); 22568 if ($ilDB->numRows($res) > 0) { 22569 $GLOBALS['ilLog']->info(sprintf( 22570 "DB Step %s: Ignored migration of %s user agreement file '%s' because it has been already migrated", 22571 $dbStep, 22572 $type, 22573 $file->getPathname() 22574 )); 22575 continue; 22576 } 22577 22578 $i++; 22579 22580 $sorting = $i; 22581 $docTitle = $docTitlePrefix . ' ' . $i; 22582 22583 $text = file_get_contents($file->getPathname()); 22584 if (strip_tags($text) === $text) { 22585 $text = nl2br($text); 22586 } 22587 22588 $docId = $ilDB->nextId('tos_documents'); 22589 $ilDB->insert( 22590 'tos_documents', 22591 [ 22592 'id' => ['integer', $docId], 22593 'sorting' => ['integer', $sorting], 22594 'title' => ['text', $docTitle], 22595 'owner_usr_id' => ['integer', -1], 22596 'creation_ts' => ['integer', $file->getMTime() > 0 ? $file->getMTime() : 0], 22597 'text' => ['clob', $text], 22598 ] 22599 ); 22600 $GLOBALS['ilLog']->info(sprintf( 22601 "DB Step %s: Created new document with id %s and title '%s' for file '%s'", 22602 $dbStep, 22603 $docId, 22604 $docTitle, 22605 $file->getPathname() 22606 )); 22607 22608 $assignmentId = $ilDB->nextId('tos_criterion_to_doc'); 22609 $ilDB->insert( 22610 'tos_criterion_to_doc', 22611 [ 22612 'id' => ['integer', $assignmentId], 22613 'doc_id' => ['integer', $docId], 22614 'criterion_id' => ['text', 'usr_language'], 22615 'criterion_value' => ['text', json_encode(['lng' => $languageValue])], 22616 'owner_usr_id' => ['integer', -1], 22617 'assigned_ts' => ['integer', $file->getMTime() > 0 ? $file->getMTime() : 0] 22618 ] 22619 ); 22620 $GLOBALS['ilLog']->info(sprintf( 22621 "DB Step %s: Created new language criterion assignment with id %s and value '%s' to document with id %s for file '%s'", 22622 $dbStep, 22623 $assignmentId, 22624 $languageValue, 22625 $docId, 22626 $file->getPathname() 22627 )); 22628 22629 // Determine all accepted version with lng = $criterion and hash = hash and src = file 22630 $docTypeIn = ' AND ' . $ilDB->like('src', 'text', '%%/client/%%', false); 22631 if ($type === 'client-independent') { 22632 $docTypeIn = ' AND ' . $ilDB->like('src', 'text', '%%/global/%%', false); 22633 } 22634 22635 $ilDB->manipulateF( 22636 'UPDATE tos_versions SET doc_id = %s, title = %s WHERE lng = %s AND hash = %s' . $docTypeIn, 22637 ['integer', 'text', 'text', 'text'], 22638 [$docId, $docTitle, $languageValue, md5($text)] 22639 ); 22640 $GLOBALS['ilLog']->info(sprintf( 22641 "DB Step %s: Migrated %s user agreement file '%s'", 22642 $dbStep, 22643 $type, 22644 $file->getPathname() 22645 )); 22646 22647 $ilDB->replace( 22648 'agreement_migr', 22649 [ 22650 'agr_type' => ['text', $type], 22651 'agr_lng' => ['text', $languageValue], 22652 ], 22653 [] 22654 ); 22655 } 22656 } catch (\Exception $e) { 22657 $GLOBALS['ilLog']->error(sprintf( 22658 "DB Step %s: %s", 22659 $dbStep, 22660 $e->getMessage() 22661 )); 22662 } 22663 } 22664} 22665 22666// Migrate title for all tos_version entries without a doc_id 22667$numDocumentsData = $ilDB->fetchAssoc( 22668 $ilDB->query('SELECT COUNT(id) num_docs FROM tos_documents') 22669); 22670 22671$numDocs = 0; 22672if (is_array($numDocumentsData) && $numDocumentsData['num_docs']) { 22673 $numDocs = $numDocumentsData['num_docs']; 22674} 22675 22676$res = $ilDB->query('SELECT lng, src FROM tos_versions WHERE title IS NULL GROUP BY lng, src'); 22677$i = 0; 22678while ($row = $ilDB->fetchAssoc($res)) { 22679 $docTitle = $docTitlePrefix . ' ' . ($numDocs + (++$i)); 22680 $ilDB->manipulateF( 22681 'UPDATE tos_versions SET title = %s WHERE lng = %s AND src = %s AND title IS NULL', 22682 ['text', 'text', 'text'], 22683 [$docTitle, $row['lng'], $row['src']] 22684 ); 22685} 22686?> 22687<#5322> 22688<?php 22689/** @var $ilDB ilDBInterface */ 22690if (in_array($ilDB->getDBType(), [ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES])) { 22691 // Migrate accepted criteria for missing documents (file did not exists during migration) 22692 $res = $ilDB->query( 22693 " 22694 SELECT tos_acceptance_track.* 22695 FROM tos_acceptance_track 22696 INNER JOIN tos_versions ON tos_versions.id = tos_acceptance_track.tosv_id 22697 WHERE tos_versions.doc_id = 0 AND tos_acceptance_track.criteria IS NULL AND tos_versions.lng IS NOT NULL 22698 " 22699 ); 22700 while ($row = $ilDB->fetchAssoc($res)) { 22701 $ilDB->manipulateF( 22702 " 22703 UPDATE tos_acceptance_track 22704 SET tos_acceptance_track.criteria = CONCAT(%s, CONCAT(tos_versions.lng, %s)) 22705 WHERE tos_acceptance_track.tosv_id = %s AND tos_acceptance_track.usr_id = %s AND tos_acceptance_track.ts = %s 22706 ", 22707 ['text', 'text', 'integer', 'integer', 'integer'], 22708 ['[{"id":"usr_language","value":{"lng":"', '"}}]', $row['tosv_id'], $row['usr_id'], $row['ts']] 22709 ); 22710 } 22711 22712 // Migrate accepted criteria for already migrated documents 22713 $res = $ilDB->queryF( 22714 " 22715 SELECT tos_acceptance_track.* 22716 FROM tos_acceptance_track 22717 INNER JOIN tos_versions 22718 ON tos_versions.id = tos_acceptance_track.tosv_id 22719 INNER JOIN tos_documents 22720 ON tos_documents.id = tos_versions.doc_id 22721 INNER JOIN tos_criterion_to_doc 22722 ON tos_criterion_to_doc.doc_id = tos_documents.id AND criterion_id = %s 22723 WHERE tos_versions.lng IS NOT NULL AND tos_acceptance_track.criteria IS NULL 22724 ", 22725 ['text'], 22726 ['usr_language'] 22727 ); 22728 while ($row = $ilDB->fetchAssoc($res)) { 22729 $ilDB->manipulateF( 22730 " 22731 UPDATE tos_acceptance_track 22732 SET tos_acceptance_track.criteria = CONCAT(%s, CONCAT(tos_versions.lng, %s)) 22733 WHERE tos_acceptance_track.tosv_id = %s AND tos_acceptance_track.usr_id = %s AND tos_acceptance_track.ts = %s 22734 ", 22735 ['text', 'text', 'integer', 'integer', 'integer'], 22736 ['[{"id":"usr_language","value":', '}]', $row['tosv_id'], $row['usr_id'], $row['ts']] 22737 ); 22738 } 22739} else { 22740 // Migrate accepted criteria for missing documents (file did not exists during migration) 22741 $ilDB->manipulateF( 22742 " 22743 UPDATE tos_acceptance_track 22744 INNER JOIN tos_versions 22745 ON tos_versions.id = tos_acceptance_track.tosv_id 22746 SET tos_acceptance_track.criteria = CONCAT(%s, CONCAT(tos_versions.lng, %s)) 22747 WHERE tos_versions.doc_id = 0 AND tos_acceptance_track.criteria IS NULL AND tos_versions.lng IS NOT NULL 22748 ", 22749 ['text', 'text'], 22750 ['[{"id":"usr_language","value":{"lng":"', '"}}]'] 22751 ); 22752 22753 // Migrate accepted criteria for already migrated documents 22754 $ilDB->manipulateF( 22755 " 22756 UPDATE tos_acceptance_track 22757 INNER JOIN tos_versions 22758 ON tos_versions.id = tos_acceptance_track.tosv_id 22759 INNER JOIN tos_documents 22760 ON tos_documents.id = tos_versions.doc_id 22761 INNER JOIN tos_criterion_to_doc 22762 ON tos_criterion_to_doc.doc_id = tos_documents.id AND criterion_id = %s 22763 SET tos_acceptance_track.criteria = CONCAT(%s, CONCAT(tos_criterion_to_doc.criterion_value, %s)) 22764 WHERE tos_versions.lng IS NOT NULL AND tos_acceptance_track.criteria IS NULL 22765 ", 22766 ['text', 'text', 'text'], 22767 ['usr_language', '[{"id":"usr_language","value":', '}]'] 22768 ); 22769} 22770?> 22771<#5323> 22772<?php 22773if ($ilDB->tableColumnExists('tos_versions', 'lng')) { 22774 $ilDB->dropTableColumn('tos_versions', 'lng'); 22775} 22776 22777if ($ilDB->tableColumnExists('tos_versions', 'src_type')) { 22778 $ilDB->dropTableColumn('tos_versions', 'src_type'); 22779} 22780 22781if ($ilDB->tableColumnExists('tos_versions', 'src')) { 22782 $ilDB->dropTableColumn('tos_versions', 'src'); 22783} 22784?> 22785<#5324> 22786<?php 22787if ($ilDB->tableExists('agreement_migr')) { 22788 $ilDB->dropTable('agreement_migr'); 22789 $GLOBALS['ilLog']->info(sprintf( 22790 'Dropped agreement migration table: agreement_migr' 22791 )); 22792} 22793?> 22794<#5325> 22795<?php 22796$ilCtrlStructureReader->getStructure(); 22797?> 22798<#5326> 22799<?php 22800if (!$ilDB->tableExists('like_data')) { 22801 $ilDB->createTable('like_data', array( 22802 'user_id' => array( 22803 'type' => 'integer', 22804 'length' => 4, 22805 'notnull' => true, 22806 'default' => 0 22807 ), 22808 'obj_id' => array( 22809 'type' => 'integer', 22810 'length' => 4, 22811 'notnull' => true, 22812 'default' => 0 22813 ), 22814 'obj_type' => array( 22815 'type' => 'text', 22816 'length' => 40, 22817 'notnull' => true 22818 ), 22819 'sub_obj_id' => array( 22820 'type' => 'integer', 22821 'length' => 4, 22822 'notnull' => true, 22823 'default' => 0 22824 ), 22825 'sub_obj_type' => array( 22826 'type' => 'text', 22827 'length' => 40, 22828 'notnull' => true 22829 ), 22830 'news_id' => array( 22831 'type' => 'integer', 22832 'length' => 4, 22833 'notnull' => true, 22834 'default' => 0 22835 ), 22836 'like_type' => array( 22837 'type' => 'integer', 22838 'length' => 4, 22839 'notnull' => true, 22840 'default' => 0 22841 ) 22842 )); 22843 22844 $ilDB->addPrimaryKey('like_data', array('user_id','obj_id','obj_type','sub_obj_id','sub_obj_type','news_id','like_type')); 22845 22846 $ilDB->addIndex('like_data', array('obj_id'), 'i1'); 22847} 22848?> 22849<#5327> 22850<?php 22851if (!$ilDB->tableColumnExists('like_data', 'exp_ts')) { 22852 $ilDB->addTableColumn('like_data', 'exp_ts', array( 22853 'type' => 'timestamp', 22854 'notnull' => true 22855 )); 22856} 22857?> 22858<#5328> 22859<?php 22860if (!$ilDB->tableColumnExists('note', 'news_id')) { 22861 $ilDB->addTableColumn('note', 'news_id', array( 22862 'type' => 'integer', 22863 'length' => 4, 22864 'notnull' => true, 22865 'default' => 0 22866 )); 22867} 22868?> 22869<#5329> 22870<?php 22871$ilCtrlStructureReader->getStructure(); 22872?> 22873<#5330> 22874<?php 22875 22876if (!$ilDB->tableColumnExists('media_item', 'upload_hash')) { 22877 $ilDB->addTableColumn('media_item', 'upload_hash', array( 22878 "type" => "text", 22879 "length" => 100 22880 )); 22881} 22882 22883?> 22884<#5331> 22885<?php 22886 if (!$ilDB->tableColumnExists('booking_settings', 'reminder_status')) { 22887 $ilDB->addTableColumn('booking_settings', 'reminder_status', array( 22888 "type" => "integer", 22889 "notnull" => true, 22890 "length" => 1, 22891 "default" => 0 22892 )); 22893 } 22894?> 22895<#5332> 22896<?php 22897 if (!$ilDB->tableColumnExists('booking_settings', 'reminder_day')) { 22898 $ilDB->addTableColumn('booking_settings', 'reminder_day', array( 22899 "type" => "integer", 22900 "notnull" => true, 22901 "length" => 4, 22902 "default" => 0 22903 )); 22904 } 22905?> 22906<#5333> 22907<?php 22908 $ilCtrlStructureReader->getStructure(); 22909?> 22910<#5334> 22911<?php 22912 if (!$ilDB->tableColumnExists('booking_settings', 'last_remind_ts')) { 22913 $ilDB->addTableColumn('booking_settings', 'last_remind_ts', array( 22914 "type" => "integer", 22915 "notnull" => true, 22916 "length" => 4, 22917 "default" => 0 22918 )); 22919 } 22920?> 22921<#5335> 22922<?php 22923 $ilCtrlStructureReader->getStructure(); 22924?> 22925<#5336> 22926<?php 22927 22928if ($ilDB->indexExistsByFields('read_event', array('usr_id'))) { 22929 $ilDB->dropIndexByFields('read_event', array('usr_id')); 22930} 22931$ilDB->addIndex('read_event', array('usr_id'), 'i1'); 22932 22933if (!$ilDB->tableColumnExists('usr_data', 'first_login')) { 22934 $ilDB->addTableColumn('usr_data', 'first_login', array( 22935 "type" => "timestamp", 22936 "notnull" => false 22937 )); 22938 22939 // since we do not have this date for existing users we take the minimum of last login 22940 // and first access to any repo object 22941 $set = $ilDB->queryF( 22942 "SELECT u.usr_id, u.last_login, min(r.first_access) first_access FROM usr_data u LEFT JOIN read_event r ON (u.usr_id = r.usr_id) GROUP BY u.usr_id, u.last_login", 22943 array(), 22944 array() 22945 ); 22946 while ($rec = $ilDB->fetchAssoc($set)) { 22947 $first_login = $rec["last_login"]; 22948 if ($rec["first_access"] != "" && ($rec["first_access"] < $rec["last_login"])) { 22949 $first_login = $rec["first_access"]; 22950 } 22951 22952 if ($first_login != "") { 22953 $ilDB->update("usr_data", array( 22954 "first_login" => array("timestamp", $first_login) 22955 ), array( // where 22956 "usr_id" => array("integer", $rec["usr_id"]) 22957 )); 22958 } 22959 } 22960} 22961?> 22962<#5337> 22963<?php 22964if (!$ilDB->tableColumnExists('usr_data', 'last_profile_prompt')) { 22965 $ilDB->addTableColumn('usr_data', 'last_profile_prompt', array( 22966 "type" => "timestamp", 22967 "notnull" => false 22968 )); 22969} 22970?> 22971<#5338> 22972<?php 22973 $ilCtrlStructureReader->getStructure(); 22974?> 22975<#5339> 22976<?php 22977if (!$ilDB->tableExists('certificate_template')) { 22978 $ilDB->createTable('certificate_template', array( 22979 'id' => array( 22980 'type' => 'integer', 22981 'length' => 4, 22982 'notnull' => true, 22983 'default' => 0 22984 ), 22985 'obj_id' => array( 22986 'type' => 'integer', 22987 'length' => 4, 22988 'notnull' => true, 22989 'default' => 0 22990 ), 22991 'obj_type' => array( 22992 'type' => 'text', 22993 'length' => 255, 22994 'notnull' => true, 22995 'default' => '' 22996 ), 22997 'certificate_content' => array( 22998 'type' => 'clob', 22999 'notnull' => true, 23000 ), 23001 'certificate_hash' => array( 23002 'type' => 'text', 23003 'length' => 255, 23004 'notnull' => true 23005 ), 23006 'template_values' => array( 23007 'type' => 'clob', 23008 'notnull' => true, 23009 ), 23010 'background_image_path' => array( 23011 'type' => 'text', 23012 'notnull' => false, 23013 'length' => 255 23014 ), 23015 'version' => array( 23016 'type' => 'text', 23017 'length' => 255, 23018 'notnull' => true, 23019 'default' => 'v1' 23020 ), 23021 'ilias_version' => array( 23022 'type' => 'text', 23023 'length' => 255, 23024 'notnull' => true, 23025 'default' => 'v5.4.0' 23026 ), 23027 'created_timestamp' => array( 23028 'type' => 'integer', 23029 'length' => 4, 23030 'notnull' => true, 23031 'default' => 0 23032 ), 23033 'currently_active' => array( 23034 'type' => 'integer', 23035 'length' => 1, 23036 'notnull' => true, 23037 'default' => 0 23038 ), 23039 )); 23040 23041 $ilDB->addPrimaryKey('certificate_template', array('id')); 23042 $ilDB->createSequence('certificate_template'); 23043 $ilDB->addIndex('certificate_template', array('obj_id'), 'i1'); 23044} 23045 23046if (!$ilDB->tableExists('user_certificates')) { 23047 $ilDB->createTable('user_certificates', array( 23048 'id' => array( 23049 'type' => 'integer', 23050 'length' => 4, 23051 'notnull' => true, 23052 'default' => 0 23053 ), 23054 'pattern_certificate_id' => array( 23055 'type' => 'integer', 23056 'length' => 4, 23057 'notnull' => true, 23058 'default' => 0 23059 ), 23060 'obj_id' => array( 23061 'type' => 'integer', 23062 'length' => 4, 23063 'notnull' => true, 23064 'default' => 0 23065 ), 23066 'obj_type' => array( 23067 'type' => 'text', 23068 'length' => 255, 23069 'notnull' => true, 23070 'default' => 0 23071 ), 23072 'user_id' => array( 23073 'type' => 'integer', 23074 'length' => 4, 23075 'notnull' => true, 23076 'default' => 0 23077 ), 23078 'user_name' => array( 23079 'type' => 'text', 23080 'length' => 255, 23081 'notnull' => true, 23082 'default' => 0 23083 ), 23084 'acquired_timestamp' => array( 23085 'type' => 'integer', 23086 'length' => 4, 23087 'notnull' => true, 23088 'default' => 0 23089 ), 23090 'certificate_content' => array( 23091 'type' => 'clob', 23092 'notnull' => true, 23093 ), 23094 'template_values' => array( 23095 'type' => 'clob', 23096 'notnull' => true, 23097 ), 23098 'valid_until' => array( 23099 'type' => 'integer', 23100 'length' => 4, 23101 'notnull' => false, 23102 'default' => null 23103 ), 23104 'background_image_path' => array( 23105 'type' => 'text', 23106 'notnull' => false, 23107 'length' => 255 23108 ), 23109 'version' => array( 23110 'type' => 'text', 23111 'length' => 255, 23112 'notnull' => true, 23113 'default' => '1' 23114 ), 23115 'ilias_version' => array( 23116 'type' => 'text', 23117 'length' => 255, 23118 'notnull' => true, 23119 'default' => 'v5.4.0' 23120 ), 23121 'currently_active' => array( 23122 'type' => 'integer', 23123 'length' => 1, 23124 'notnull' => true, 23125 'default' => 0 23126 ), 23127 )); 23128 23129 $ilDB->addPrimaryKey('user_certificates', array('id')); 23130 $ilDB->createSequence('user_certificates'); 23131 $ilDB->addIndex('user_certificates', array('obj_id', 'pattern_certificate_id'), 'i1'); 23132} 23133 23134if (!$ilDB->tableExists('certificate_cron_queue')) { 23135 $ilDB->createTable('certificate_cron_queue', array( 23136 'id' => array( 23137 'type' => 'integer', 23138 'length' => 4, 23139 'notnull' => true, 23140 'default' => 0 23141 ), 23142 'obj_id' => array( 23143 'type' => 'integer', 23144 'length' => 4, 23145 'notnull' => true, 23146 'default' => 0 23147 ), 23148 'usr_id' => array( 23149 'type' => 'integer', 23150 'length' => 4, 23151 'notnull' => true, 23152 'default' => 0 23153 ), 23154 'adapter_class' => array( 23155 'type' => 'text', 23156 'length' => '255', 23157 'notnull' => true, 23158 ), 23159 'state' => array( 23160 'type' => 'text', 23161 'length' => '255', 23162 'notnull' => true 23163 ), 23164 'started_timestamp' => array( 23165 'type' => 'integer', 23166 'length' => 4, 23167 'notnull' => true, 23168 'default' => 0 23169 ), 23170 )); 23171 23172 $ilDB->addPrimaryKey('certificate_cron_queue', array('id')); 23173 $ilDB->createSequence('certificate_cron_queue'); 23174 $ilDB->addIndex('certificate_cron_queue', array('obj_id', 'usr_id'), 'i1'); 23175} 23176?> 23177<#5340> 23178<?php 23179$ilCtrlStructureReader->getStructure(); 23180?> 23181<#5341> 23182<?php 23183if ($ilDB->tableExists('certificate_template')) { 23184 $web_path = CLIENT_WEB_DIR; 23185 23186 $directories = array( 23187 'exc' => '/exercise/certificates/', 23188 'crs' => '/course/certificates/', 23189 'tst' => '/assessment/certificates/', 23190 'sahs' => '/certificates/scorm/', 23191 'lti' => '/lti_data/certficates/', 23192 'cmix' => '/cmix_data/certficates/', 23193 ); 23194 23195 $GLOBALS['ilLog']->info(sprintf( 23196 "Started certificate template XML file migration" 23197 )); 23198 23199 $migratedObjectIds = []; 23200 $has_errors = false; 23201 $stmtSelectObjCertWithTemplate = $ilDB->prepare( 23202 " 23203 SELECT od.obj_id, COUNT(certificate_template.obj_id) as num_migrated_cer_templates 23204 FROM object_data od 23205 LEFT JOIN certificate_template ON certificate_template.obj_id = od.obj_id 23206 WHERE od.obj_id = ? 23207 GROUP BY od.obj_id 23208 ", 23209 ['integer'] 23210 ); 23211 23212 foreach ($directories as $type => $relativePath) { 23213 try { 23214 $directory = $web_path . $relativePath; 23215 23216 if (!is_dir($directory)) { 23217 continue; 23218 } 23219 23220 $GLOBALS['ilLog']->info(sprintf( 23221 "Started migration for object type directory: %s", 23222 $directory 23223 )); 23224 23225 $iter = new \RegExIterator( 23226 new \RecursiveIteratorIterator( 23227 new \RecursiveDirectoryIterator( 23228 $directory, 23229 \RecursiveDirectoryIterator::SKIP_DOTS 23230 ), 23231 \RecursiveIteratorIterator::CHILD_FIRST 23232 ), 23233 '/certificate\.xml$/' 23234 ); 23235 23236 foreach ($iter as $certificateFile) { 23237 /** @var $certificateFile \SplFileInfo */ 23238 $pathToFile = $certificateFile->getPathname(); 23239 23240 $GLOBALS['ilLog']->info(sprintf( 23241 "Found certificate template XML file (type: %s): %s", 23242 $type, 23243 $pathToFile 23244 )); 23245 23246 $objectId = basename($certificateFile->getPathInfo()); 23247 if (!is_numeric($objectId) || !($objectId > 0)) { 23248 $GLOBALS['ilLog']->warning(sprintf( 23249 "Could not extract valid obj_id, cannot migrate certificate XML template file: %s", 23250 $pathToFile 23251 )); 23252 continue; 23253 } 23254 23255 $GLOBALS['ilLog']->info(sprintf( 23256 "Extracted obj_id %s from certificate file: %s", 23257 $objectId, 23258 $pathToFile 23259 )); 23260 23261 if (isset($migratedObjectIds[$objectId])) { 23262 $GLOBALS['ilLog']->warning(sprintf( 23263 "Already created a database based certificate template for obj_id %s, cannot migrate file: %s", 23264 $objectId, 23265 $pathToFile 23266 )); 23267 continue; 23268 } 23269 23270 $res = $ilDB->execute($stmtSelectObjCertWithTemplate, [$objectId]); 23271 if (0 === (int) $ilDB->numRows($res)) { 23272 $GLOBALS['ilLog']->warning(sprintf( 23273 "Could not find an existing ILIAS object for obj_id %s, cannot migrate file: %s", 23274 $objectId, 23275 $pathToFile 23276 )); 23277 continue; 23278 } 23279 23280 $row = $ilDB->fetchAssoc($res); 23281 if ((int) $row['num_migrated_cer_templates'] > 0) { 23282 $GLOBALS['ilLog']->warning(sprintf( 23283 "Already created a database based certificate template for obj_id %s, cannot migrate file: %s", 23284 $objectId, 23285 $pathToFile 23286 )); 23287 continue; 23288 } 23289 23290 $content = file_get_contents($pathToFile); 23291 $timestamp = $certificateFile->getMTime(); 23292 23293 if (false !== $content) { 23294 $backgroundImagePath = ''; 23295 23296 if (file_exists($web_path . $relativePath . $objectId . '/background.jpg')) { 23297 $backgroundImagePath = $relativePath . $objectId . '/background.jpg'; 23298 } 23299 23300 if ('' === $backgroundImagePath && file_exists($web_path . '/certificates/default/background.jpg')) { 23301 $backgroundImagePath = '/certificates/default/background.jpg'; 23302 } 23303 23304 $id = $ilDB->nextId('certificate_template'); 23305 $columns = [ 23306 'id' => ['integer', $id], 23307 'obj_id' => ['integer', $objectId], 23308 'obj_type' => ['text', $type], 23309 'certificate_content' => ['text', $content], 23310 'certificate_hash' => ['text', md5($content)], 23311 'template_values' => ['text', ''], 23312 'version' => ['text', '1'], 23313 'ilias_version' => ['text', ILIAS_VERSION_NUMERIC], 23314 'created_timestamp' => ['integer', $timestamp], 23315 'currently_active' => ['integer', 1], 23316 'background_image_path' => ['text', $backgroundImagePath], 23317 ]; 23318 23319 $ilDB->insert('certificate_template', $columns); 23320 $migratedObjectIds[$objectId] = true; 23321 23322 $GLOBALS['ilLog']->info(sprintf( 23323 "Successfully migrated certificate template XML file for obj_id: %s/type: %s/id: %s", 23324 $objectId, 23325 $type, 23326 $id 23327 )); 23328 } else { 23329 $GLOBALS['ilLog']->warning(sprintf( 23330 "Empty content, cannot migrate certificate XML template file: %s", 23331 $pathToFile 23332 )); 23333 } 23334 } 23335 23336 $GLOBALS['ilLog']->info(sprintf( 23337 "Finished migration for directory: %s", 23338 $directory 23339 )); 23340 } catch (\Exception $e) { 23341 $has_errors = true; 23342 $GLOBALS['ilLog']->error(sprintf( 23343 "Cannot migrate directory, exception raised: %s", 23344 $e->getMessage() 23345 )); 23346 } catch (\Throwable $e) { 23347 $has_errors = true; 23348 $GLOBALS['ilLog']->error(sprintf( 23349 "Cannot migrate directory, exception raised: %s", 23350 $e->getMessage() 23351 )); 23352 } 23353 } 23354 23355 $GLOBALS['ilLog']->info(sprintf( 23356 "Finished certificate template (%s templates created) XML file migration%s", 23357 count($migratedObjectIds), 23358 ($has_errors ? ' with errors' : '') 23359 )); 23360} 23361?> 23362<#5342> 23363<?php 23364if (!$ilDB->tableExists('bgtask_cert_migration')) { 23365 $ilDB->createTable('bgtask_cert_migration', array( 23366 'id' => array( 23367 'type' => 'integer', 23368 'length' => 4, 23369 'notnull' => true, 23370 'default' => 0 23371 ), 23372 'usr_id' => array( 23373 'type' => 'integer', 23374 'length' => 4, 23375 'notnull' => true, 23376 'default' => 0 23377 ), 23378 'lock' => array( 23379 'type' => 'integer', 23380 'length' => 4, 23381 'notnull' => true, 23382 'default' => 0 23383 ), 23384 'found_items' => array( 23385 'type' => 'integer', 23386 'length' => 4, 23387 'notnull' => true, 23388 'default' => 0 23389 ), 23390 'processed_items' => array( 23391 'type' => 'integer', 23392 'length' => 4, 23393 'notnull' => true, 23394 'default' => 0 23395 ), 23396 'migrated_items' => array( 23397 'type' => 'integer', 23398 'length' => 4, 23399 'notnull' => true, 23400 'default' => 0 23401 ), 23402 'progress' => array( 23403 'type' => 'integer', 23404 'length' => 4, 23405 'notnull' => true, 23406 'default' => 0 23407 ), 23408 'state' => array( 23409 'type' => 'text', 23410 'length' => '255', 23411 'notnull' => true 23412 ), 23413 'started_ts' => array( 23414 'type' => 'integer', 23415 'length' => 4, 23416 'notnull' => false, 23417 'default' => 0 23418 ), 23419 'finished_ts' => array( 23420 'type' => 'integer', 23421 'length' => 4, 23422 'notnull' => false, 23423 ), 23424 )); 23425 $ilDB->addPrimaryKey('bgtask_cert_migration', array('id')); 23426 $ilDB->createSequence('bgtask_cert_migration'); 23427 $ilDB->addUniqueConstraint('bgtask_cert_migration', array('id', 'usr_id')); 23428} 23429$ilCtrlStructureReader->getStructure(); 23430?> 23431<#5343> 23432<?php 23433$ilCtrlStructureReader->getStructure(); 23434?> 23435<#5344> 23436<?php 23437if (!$ilDB->tableColumnExists('certificate_template', 'deleted')) { 23438 $ilDB->addTableColumn( 23439 'certificate_template', 23440 'deleted', 23441 array( 23442 'type' => 'integer', 23443 'length' => 1, 23444 'notnull' => true, 23445 'default' => 0 23446 ) 23447 ); 23448} 23449?> 23450<#5345> 23451<?php 23452if (!$ilDB->tableColumnExists('certificate_cron_queue', 'template_id')) { 23453 $ilDB->addTableColumn( 23454 'certificate_cron_queue', 23455 'template_id', 23456 array( 23457 'type' => 'integer', 23458 'length' => 4, 23459 'notnull' => true, 23460 'default' => 0 23461 ) 23462 ); 23463} 23464?> 23465<#5346> 23466<?php 23467/** @var \ilDBInterface $ilDB */ 23468if ($ilDB->tableExists('certificate_cron_queue') && !$ilDB->tableExists('il_cert_cron_queue')) { 23469 $ilDB->renameTable('certificate_cron_queue', 'il_cert_cron_queue'); 23470} 23471if ($ilDB->sequenceExists('certificate_cron_queue')) { 23472 $ilDB->dropSequence('certificate_cron_queue'); 23473} 23474if (!$ilDB->sequenceExists('il_cert_cron_queue')) { 23475 $query = "SELECT MAX(id) AS max_id FROM il_cert_cron_queue"; 23476 $row = $ilDB->fetchAssoc($ilDB->query($query)); 23477 $ilDB->createSequence('il_cert_cron_queue', (int) $row['max_id'] + 1); 23478} 23479?> 23480<#5347> 23481<?php 23482if ($ilDB->tableExists('certificate_template') && !$ilDB->tableExists('il_cert_template')) { 23483 $ilDB->renameTable('certificate_template', 'il_cert_template'); 23484} 23485if ($ilDB->sequenceExists('certificate_template')) { 23486 $ilDB->dropSequence('certificate_template'); 23487} 23488if (!$ilDB->sequenceExists('il_cert_template')) { 23489 $query = "SELECT MAX(id) AS max_id FROM il_cert_template"; 23490 $row = $ilDB->fetchAssoc($ilDB->query($query)); 23491 $ilDB->createSequence('il_cert_template', (int) $row['max_id'] + 1); 23492} 23493?> 23494<#5348> 23495<?php 23496if ($ilDB->tableExists('user_certificates') && !$ilDB->tableExists('il_cert_user_cert')) { 23497 $ilDB->renameTable('user_certificates', 'il_cert_user_cert'); 23498} 23499if ($ilDB->sequenceExists('user_certificates')) { 23500 $ilDB->dropSequence('user_certificates'); 23501} 23502if (!$ilDB->sequenceExists('il_cert_user_cert')) { 23503 $query = "SELECT MAX(id) AS max_id FROM il_cert_user_cert"; 23504 $row = $ilDB->fetchAssoc($ilDB->query($query)); 23505 $ilDB->createSequence('il_cert_user_cert', (int) $row['max_id'] + 1); 23506} 23507?> 23508<#5349> 23509<?php 23510if ($ilDB->tableExists('bgtask_cert_migration') && !$ilDB->tableExists('il_cert_bgtask_migr')) { 23511 $ilDB->renameTable('bgtask_cert_migration', 'il_cert_bgtask_migr'); 23512} 23513if ($ilDB->sequenceExists('bgtask_cert_migration')) { 23514 $ilDB->dropSequence('bgtask_cert_migration'); 23515} 23516if (!$ilDB->sequenceExists('il_cert_bgtask_migr')) { 23517 $query = "SELECT MAX(id) AS max_id FROM il_cert_bgtask_migr"; 23518 $row = $ilDB->fetchAssoc($ilDB->query($query)); 23519 $ilDB->createSequence('il_cert_bgtask_migr', (int) $row['max_id'] + 1); 23520} 23521?> 23522<#5350> 23523<?php 23524$ilCtrlStructureReader->getStructure(); 23525?> 23526<#5351> 23527<?php 23528$ilCtrlStructureReader->getStructure(); 23529?> 23530<#5352> 23531<?php 23532if (!$ilDB->tableColumnExists('il_cert_template', 'thumbnail_image_path')) { 23533 $ilDB->addTableColumn( 23534 'il_cert_template', 23535 'thumbnail_image_path', 23536 array( 23537 'type' => 'text', 23538 'notnull' => false, 23539 'length' => 255 23540 ) 23541 ); 23542} 23543 23544if (!$ilDB->tableColumnExists('il_cert_user_cert', 'thumbnail_image_path')) { 23545 $ilDB->addTableColumn( 23546 'il_cert_user_cert', 23547 'thumbnail_image_path', 23548 array( 23549 'type' => 'text', 23550 'notnull' => false, 23551 'length' => 255 23552 ) 23553 ); 23554} 23555?> 23556<#5353> 23557<?php 23558if ($ilDB->tableColumnExists('svy_svy', 'mode_360')) { 23559 $ilDB->renameTableColumn('svy_svy', 'mode_360', 'mode'); 23560} 23561?> 23562<#5354> 23563<?php 23564if (!$ilDB->tableColumnExists('svy_svy', 'mode_self_eval_results')) { 23565 $ilDB->addTableColumn( 23566 'svy_svy', 23567 'mode_self_eval_results', 23568 array( 23569 'type' => 'integer', 23570 'length' => 1, 23571 'notnull' => false, 23572 'default' => 0 23573 ) 23574 ); 23575} 23576?> 23577<#5355> 23578<?php 23579if ($ilDB->tableColumnExists('svy_svy', 'mode_360_skill_service')) { 23580 $ilDB->renameTableColumn('svy_svy', 'mode_360_skill_service', 'mode_skill_service'); 23581} 23582?> 23583<#5356> 23584<?php 23585if (!$ilDB->indexExistsByFields('il_cert_template', ['obj_id', 'deleted'])) { 23586 $ilDB->addIndex('il_cert_template', ['obj_id', 'deleted'], 'i2'); 23587} 23588?> 23589<#5357> 23590<?php 23591if (!$ilDB->indexExistsByFields('il_cert_template', ['obj_id', 'currently_active', 'deleted'])) { 23592 $ilDB->addIndex('il_cert_template', ['obj_id', 'currently_active', 'deleted'], 'i3'); 23593} 23594?> 23595<#5358> 23596<?php 23597if (!$ilDB->indexExistsByFields('il_cert_template', ['obj_type'])) { 23598 $ilDB->addIndex('il_cert_template', ['obj_type'], 'i4'); 23599} 23600?> 23601<#5359> 23602<?php 23603if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['user_id', 'currently_active'])) { 23604 $ilDB->addIndex('il_cert_user_cert', ['user_id', 'currently_active'], 'i2'); 23605} 23606?> 23607<#5360> 23608<?php 23609if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['user_id', 'currently_active', 'acquired_timestamp'])) { 23610 $ilDB->addIndex('il_cert_user_cert', ['user_id', 'currently_active', 'acquired_timestamp'], 'i3'); 23611} 23612?> 23613<#5361> 23614<?php 23615if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['user_id', 'obj_type', 'currently_active'])) { 23616 $ilDB->addIndex('il_cert_user_cert', ['user_id', 'obj_type', 'currently_active'], 'i4'); 23617} 23618?> 23619<#5362> 23620<?php 23621if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['obj_id', 'currently_active'])) { 23622 $ilDB->addIndex('il_cert_user_cert', ['obj_id', 'currently_active'], 'i5'); 23623} 23624?> 23625<#5363> 23626<?php 23627if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['user_id', 'obj_id', 'currently_active'])) { 23628 $ilDB->addIndex('il_cert_user_cert', ['user_id', 'obj_id', 'currently_active'], 'i6'); 23629} 23630?> 23631<#5364> 23632<?php 23633if (!$ilDB->tableColumnExists('exc_assignment', 'deadline_mode')) { 23634 $ilDB->addTableColumn( 23635 'exc_assignment', 23636 'deadline_mode', 23637 array( 23638 'type' => 'integer', 23639 'length' => 1, 23640 'notnull' => false, 23641 'default' => 0 23642 ) 23643 ); 23644} 23645?> 23646<#5365> 23647<?php 23648if (!$ilDB->tableColumnExists('exc_assignment', 'relative_deadline')) { 23649 $ilDB->addTableColumn( 23650 'exc_assignment', 23651 'relative_deadline', 23652 array( 23653 'type' => 'integer', 23654 'length' => 4, 23655 'notnull' => false, 23656 'default' => 0 23657 ) 23658 ); 23659} 23660?> 23661<#5366> 23662<?php 23663if (!$ilDB->tableColumnExists('exc_idl', 'starting_ts')) { 23664 $ilDB->addTableColumn( 23665 'exc_idl', 23666 'starting_ts', 23667 array( 23668 'type' => 'integer', 23669 'length' => 4, 23670 'notnull' => false, 23671 'default' => 0 23672 ) 23673 ); 23674} 23675?> 23676<#5367> 23677<?php 23678// BEGIN MME 23679$fields = array( 23680 'identification' => array( 23681 'type' => 'text', 23682 'length' => '64', 23683 23684 ), 23685 'active' => array( 23686 'type' => 'integer', 23687 'length' => '1', 23688 23689 ), 23690 'position' => array( 23691 'type' => 'integer', 23692 'length' => '4', 23693 23694 ), 23695 'parent_identification' => array( 23696 'type' => 'text', 23697 'length' => '255', 23698 23699 ) 23700); 23701if (!$ilDB->tableExists('il_mm_items')) { 23702 $ilDB->createTable('il_mm_items', $fields); 23703 $ilDB->addPrimaryKey('il_mm_items', array( 'identification' )); 23704} 23705?> 23706<#5368> 23707<?php 23708$fields = array( 23709 'id' => array( 23710 'type' => 'text', 23711 'length' => '255', 23712 23713 ), 23714 'identification' => array( 23715 'type' => 'text', 23716 'length' => '255', 23717 ), 23718 'translation' => array( 23719 'type' => 'text', 23720 'length' => '4000', 23721 23722 ), 23723 'language_key' => array( 23724 'type' => 'text', 23725 'length' => '8', 23726 23727 ), 23728); 23729if (!$ilDB->tableExists('il_mm_translation')) { 23730 $ilDB->createTable('il_mm_translation', $fields); 23731 $ilDB->addPrimaryKey('il_mm_translation', array( 'id' )); 23732} 23733?> 23734<#5369> 23735<?php 23736// $fields = array( 23737// 'provider_class' => array( 23738// 'type' => 'text', 23739// 'length' => '255', 23740// 23741// ), 23742// 'purpose' => array( 23743// 'type' => 'text', 23744// 'length' => '255', 23745// 23746// ), 23747// 'dynamic' => array( 23748// 'type' => 'integer', 23749// 'length' => '1', 23750// 23751// ), 23752// 23753// ); 23754// if (!$ilDB->tableExists('il_gs_providers')) { 23755// $ilDB->createTable('il_gs_providers', $fields); 23756// $ilDB->addPrimaryKey('il_gs_providers', array('provider_class')); 23757// } 23758?> 23759<#5370> 23760<?php 23761// $fields = array( 23762// 'identification' => array( 23763// 'type' => 'text', 23764// 'length' => '64', 23765// 23766// ), 23767// 'provider_class' => array( 23768// 'type' => 'text', 23769// 'length' => '255', 23770// 23771// ), 23772// 'active' => array( 23773// 'type' => 'integer', 23774// 'length' => '1', 23775// 23776// ), 23777// 23778// ); 23779// if (!$ilDB->tableExists('il_gs_identifications')) { 23780// $ilDB->createTable('il_gs_identifications', $fields); 23781// $ilDB->addPrimaryKey('il_gs_identifications', array('identification')); 23782// } 23783?> 23784<#5371> 23785<?php 23786$fields = array( 23787 'identifier' => array( 23788 'type' => 'text', 23789 'length' => '255', 23790 23791 ), 23792 'type' => array( 23793 'type' => 'text', 23794 'length' => '128', 23795 23796 ), 23797 'action' => array( 23798 'type' => 'text', 23799 'length' => '4000', 23800 23801 ), 23802 'top_item' => array( 23803 'type' => 'integer', 23804 'length' => '1', 23805 23806 ), 23807 'default_title' => array( 23808 'type' => 'text', 23809 'length' => '4000', 23810 23811 ), 23812 23813); 23814if (!$ilDB->tableExists('il_mm_custom_items')) { 23815 $ilDB->createTable('il_mm_custom_items', $fields); 23816 $ilDB->addPrimaryKey('il_mm_custom_items', array( 'identifier' )); 23817} 23818?> 23819<#5372> 23820<?php 23821$fields = array( 23822 'identification' => array( 23823 'type' => 'text', 23824 'length' => '255', 23825 23826 ), 23827 'action' => array( 23828 'type' => 'text', 23829 'length' => '4000', 23830 23831 ), 23832 'external' => array( 23833 'type' => 'integer', 23834 'length' => '1', 23835 23836 ) 23837); 23838if (!$ilDB->tableExists('il_mm_actions')) { 23839 $ilDB->createTable('il_mm_actions', $fields); 23840 $ilDB->addPrimaryKey('il_mm_actions', array( 'identification' )); 23841} 23842?> 23843<#5373> 23844<?php 23845require_once './Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 23846ilDBUpdateNewObjectType::addAdminNode('mme', 'Main Menu'); 23847 23848$ilCtrlStructureReader->getStructure(); 23849// END MME 23850?> 23851<#5374> 23852<?php 23853if (!$ilDB->tableColumnExists("il_object_def", "offline_handling")) { 23854 $def = array( 23855 'type' => 'integer', 23856 'length' => 1, 23857 'notnull' => true, 23858 'default' => 0 23859 ); 23860 $ilDB->addTableColumn("il_object_def", "offline_handling", $def); 23861} 23862?> 23863<#5375> 23864<?php 23865$ilCtrlStructureReader->getStructure(); 23866?> 23867<#5376> 23868<?php 23869if (!$ilDB->tableColumnExists('object_data', 'offline')) { 23870 $def = [ 23871 'type' => 'integer', 23872 'length' => 1, 23873 'notnull' => false, 23874 'default' => null 23875 ]; 23876 $ilDB->addTableColumn('object_data', 'offline', $def); 23877} 23878?> 23879 23880<#5377> 23881<?php 23882 23883// migration of course offline status 23884$query = 'update object_data od set offline = ' . 23885 '(select if( activation_type = 0,1,0) from crs_settings ' . 23886 'where obj_id = od.obj_id) where type = ' . $ilDB->quote('crs', 'text'); 23887$ilDB->manipulate($query); 23888?> 23889 23890<#5378> 23891<?php 23892 23893// migration of lm offline status 23894$query = 'update object_data od set offline = ' . 23895 '(select if( is_online = ' . $ilDB->quote('n', 'text') . ',1,0) from content_object ' . 23896 'where id = od.obj_id) where type = ' . $ilDB->quote('lm', 'text'); 23897$ilDB->manipulate($query); 23898 23899?> 23900<#5379> 23901<?php 23902 23903// migration of lm offline status 23904$query = 'update object_data od set offline = ' . 23905 '(select if( is_online = ' . $ilDB->quote('n', 'text') . ',1,0) from file_based_lm ' . 23906 'where id = od.obj_id) where type = ' . $ilDB->quote('htlm', 'text'); 23907$ilDB->manipulate($query); 23908 23909?> 23910<#5380> 23911<?php 23912 23913// migration of svy offline status 23914$query = 'update object_data od set offline = ' . 23915 '(select if( status = 0,1,0) from svy_svy ' . 23916 'where obj_fi = od.obj_id) where type = ' . $ilDB->quote('svy', 'text'); 23917$ilDB->manipulate($query); 23918?> 23919<#5381> 23920<?php 23921$ilCtrlStructureReader->getStructure(); 23922?> 23923 23924<#5382> 23925<?php 23926include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23927 23928$type_id = ilDBUpdateNewObjectType::getObjectTypeId('sess'); 23929$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 23930 23931if ($type_id && $tgt_ops_id) { 23932 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 23933} 23934?> 23935<#5383> 23936<?php 23937 23938include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23939$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 23940$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 23941ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 23942 23943?> 23944 23945<#5384> 23946<?php 23947include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23948ilDBUpdateNewObjectType::addCustomRBACOperation( 23949 'manage_materials', 23950 'Manage Materials', 23951 'object', 23952 6500 23953); 23954?> 23955<#5385> 23956<?php 23957 23958include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23959$type_id = ilDBUpdateNewObjectType::getObjectTypeId('sess'); 23960$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_materials'); 23961 23962if ($tgt_ops_id && $type_id) { 23963 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 23964} 23965 23966?> 23967<#5386> 23968<?php 23969include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23970$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 23971$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_materials'); 23972ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 23973?> 23974 23975 23976<#5387> 23977<?php 23978include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23979ilDBUpdateNewObjectType::addCustomRBACOperation( 23980 'edit_metadata', 23981 'Edit Metadata', 23982 'object', 23983 5800 23984); 23985?> 23986 23987 23988<#5388> 23989<?php 23990 23991include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23992$type_id = ilDBUpdateNewObjectType::getObjectTypeId('sess'); 23993$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_metadata'); 23994 23995if ($tgt_ops_id && $type_id) { 23996 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 23997} 23998 23999?> 24000<#5389> 24001<?php 24002include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24003$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 24004$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_metadata'); 24005ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 24006?> 24007 24008<#5390> 24009<?php 24010if (!$ilDB->tableColumnExists('adv_md_record', 'gpos')) { 24011 $ilDB->addTableColumn( 24012 'adv_md_record', 24013 'gpos', 24014 array( 24015 "type" => "integer", 24016 "notnull" => false, 24017 "length" => 4 24018 ) 24019 ); 24020} 24021?> 24022<#5391> 24023<?php 24024if (!$ilDB->tableExists('adv_md_record_obj_ord')) { 24025 $ilDB->createTable( 24026 'adv_md_record_obj_ord', 24027 [ 24028 'record_id' => [ 24029 'type' => 'integer', 24030 'length' => 4, 24031 'notnull' => true 24032 ], 24033 'obj_id' => [ 24034 'type' => 'integer', 24035 'length' => 4, 24036 'notnull' => true 24037 ], 24038 'position' => [ 24039 'type' => 'integer', 24040 'length' => 4, 24041 'notnull' => true 24042 ] 24043 ] 24044 ); 24045 $ilDB->addPrimaryKey( 24046 'adv_md_record_obj_ord', 24047 [ 24048 'record_id', 24049 'obj_id' 24050 ] 24051 ); 24052} 24053?> 24054 24055<#5392> 24056<?php 24057if (!$ilDB->tableColumnExists('event', 'show_members')) { 24058 $ilDB->addTableColumn( 24059 'event', 24060 'show_members', 24061 [ 24062 "notnull" => true, 24063 "length" => 1, 24064 "type" => "integer", 24065 'default' => 0 24066 ] 24067 ); 24068} 24069?> 24070 24071<#5393> 24072<?php 24073$ilCtrlStructureReader->getStructure(); 24074?> 24075 24076<#5394> 24077<?php 24078if (!$ilDB->tableColumnExists('event', 'mail_members')) { 24079 $ilDB->addTableColumn( 24080 'event', 24081 'mail_members', 24082 [ 24083 "notnull" => true, 24084 "length" => 1, 24085 "type" => "integer", 24086 'default' => 0 24087 ] 24088 ); 24089} 24090?> 24091 24092<#5395> 24093<?php 24094if (!$ilDB->tableColumnExists('event_participants', 'contact')) { 24095 $ilDB->addTableColumn( 24096 'event_participants', 24097 'contact', 24098 [ 24099 "notnull" => true, 24100 "length" => 1, 24101 "type" => "integer", 24102 'default' => 0 24103 ] 24104 ); 24105} 24106?> 24107<#5396> 24108<?php 24109if (!$ilDB->tableExists('post_conditions')) { 24110 $ilDB->createTable('post_conditions', array( 24111 'ref_id' => array( 24112 "type" => "integer", 24113 "length" => 4, 24114 'notnull' => true 24115 ), 24116 'condition_type' => array( 24117 "type" => "integer", 24118 "length" => 4, 24119 'notnull' => true 24120 ), 24121 'value' => array( 24122 "type" => "integer", 24123 "length" => 4, 24124 "default" => null 24125 ) 24126 )); 24127 $ilDB->addPrimaryKey("post_conditions", array("ref_id", "condition_type", "value")); 24128} 24129?> 24130 24131<#5397> 24132<?php 24133$ilSetting = new ilSetting('certificate'); 24134$setting = $ilSetting->set('persisting_cers_introduced_ts', time()); 24135?> 24136 24137<#5398> 24138<?php 24139// migration of svy offline status 24140$query = 'update object_data od set offline = ' . 24141 '(select if( online_status = 0,1,0) from tst_tests ' . 24142 'where obj_fi = od.obj_id) where type = ' . $ilDB->quote('tst', 'text'); 24143$ilDB->manipulate($query); 24144?> 24145 24146<#5399> 24147<?php 24148if (!$ilDB->tableExists('lso_states')) { 24149 $ilDB->createTable('lso_states', array( 24150 'lso_ref_id' => array( 24151 "type" => "integer", 24152 "length" => 4, 24153 'notnull' => true 24154 ), 24155 'usr_id' => array( 24156 "type" => "integer", 24157 "length" => 4, 24158 'notnull' => true 24159 ), 24160 'current_item' => array( 24161 "type" => "integer", 24162 "length" => 4, 24163 "default" => null 24164 ), 24165 'states' => array( 24166 "type" => "clob" 24167 ) 24168 )); 24169 $ilDB->addPrimaryKey("lso_states", array("lso_ref_id", "usr_id")); 24170} 24171?> 24172 24173<#5400> 24174<?php 24175global $ilDB; 24176 24177include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24178 24179$lso_type_id = ilDBUpdateNewObjectType::addNewType('lso', 'Learning Sequence'); 24180 24181$rbac_ops = array( 24182 ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS, 24183 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 24184 ilDBUpdateNewObjectType::RBAC_OP_READ, 24185 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 24186 ilDBUpdateNewObjectType::RBAC_OP_DELETE, 24187 ilDBUpdateNewObjectType::RBAC_OP_COPY 24188); 24189ilDBUpdateNewObjectType::addRBACOperations($lso_type_id, $rbac_ops); 24190 24191$parent_types = array('root', 'cat', 'crs', 'fold', 'grp'); 24192ilDBUpdateNewObjectType::addRBACCreate('create_lso', 'Create Learning Sequence', $parent_types); 24193ilDBUpdateNewObjectType::applyInitialPermissionGuideline('lso', true); 24194 24195if ($lso_type_id) { 24196 ilDBUpdateNewObjectType::addRBACTemplate( 24197 'lso', 24198 'il_lso_admin', 24199 'Admin template for learning sequences', 24200 array( 24201 ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS, 24202 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 24203 ilDBUpdateNewObjectType::RBAC_OP_READ, 24204 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 24205 ilDBUpdateNewObjectType::RBAC_OP_DELETE, 24206 ilDBUpdateNewObjectType::RBAC_OP_COPY, 24207 $lso_type_id 24208 ) 24209 ); 24210 ilDBUpdateNewObjectType::addRBACTemplate( 24211 'lso', 24212 'il_lso_member', 24213 'Member template for learning sequences', 24214 array( 24215 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 24216 ilDBUpdateNewObjectType::RBAC_OP_READ, 24217 $lso_type_id 24218 ) 24219 ); 24220} 24221?> 24222 24223<#5401> 24224<?php 24225if (!$ilDB->tableExists('lso_settings')) { 24226 $ilDB->createTable('lso_settings', array( 24227 'obj_id' => array( 24228 "type" => "integer", 24229 "length" => 4, 24230 'notnull' => true 24231 ), 24232 'abstract' => array( 24233 "type" => "clob" 24234 ), 24235 'extro' => array( 24236 "type" => "clob" 24237 ), 24238 'abstract_image' => array( 24239 'type' => 'text', 24240 'length' => 128, 24241 'default' => null, 24242 ), 24243 'extro_image' => array( 24244 'type' => 'text', 24245 'length' => 128, 24246 'default' => null, 24247 ) 24248 )); 24249 $ilDB->addPrimaryKey("lso_settings", array("obj_id")); 24250} 24251?> 24252 24253<#5402> 24254<?php 24255if (!$ilDB->tableColumnExists('lso_settings', 'online')) { 24256 $ilDB->addTableColumn('lso_settings', 'online', array( 24257 "type" => "integer", 24258 "notnull" => true, 24259 "length" => 1, 24260 "default" => 0 24261 )); 24262} 24263?> 24264 24265<#5403> 24266<?php 24267if (!$ilDB->tableColumnExists('lso_settings', 'gallery')) { 24268 $ilDB->addTableColumn('lso_settings', 'gallery', array( 24269 "type" => "integer", 24270 "notnull" => true, 24271 "length" => 1, 24272 "default" => 0 24273 )); 24274} 24275?> 24276 24277<#5404> 24278<?php 24279include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24280$lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId("lso"); 24281if ($lp_type_id) { 24282 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation( 24283 'participate', 24284 'Participate to Learning Sequence', 24285 'object', 24286 9950 24287 ); 24288 if ($new_ops_id) { 24289 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $new_ops_id); 24290 } 24291 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation( 24292 'unparticipate', 24293 'Unparticipate from Learning Sequence', 24294 'object', 24295 9960 24296 ); 24297 if ($new_ops_id) { 24298 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $new_ops_id); 24299 } 24300 24301 $ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("manage_members"); 24302 if ($ops_id) { 24303 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ops_id); 24304 } 24305 24306 $ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("edit_learning_progress"); 24307 if ($ops_id) { 24308 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ops_id); 24309 } 24310} 24311?> 24312 24313<#5405> 24314<?php 24315if (!$ilDB->tableColumnExists('lso_states', 'first_access')) { 24316 $ilDB->addTableColumn('lso_states', 'first_access', array( 24317 "type" => "text", 24318 "notnull" => false, 24319 "length" => 32, 24320 )); 24321} 24322?> 24323 24324<#5406> 24325<?php 24326if (!$ilDB->tableColumnExists('lso_states', 'last_access')) { 24327 $ilDB->addTableColumn('lso_states', 'last_access', array( 24328 "type" => "text", 24329 "notnull" => false, 24330 "length" => 32, 24331 )); 24332} 24333?> 24334 24335<#5407> 24336<?php 24337include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24338$lso_type_id = ilDBUpdateNewObjectType::getObjectTypeId("lso"); 24339 24340$op_ids = [ 24341 ilDBUpdateNewObjectType::getCustomRBACOperationId("manage_members"), 24342 ilDBUpdateNewObjectType::getCustomRBACOperationId("edit_learning_progress"), 24343 ilDBUpdateNewObjectType::getCustomRBACOperationId("unparticipate"), 24344 ilDBUpdateNewObjectType::getCustomRBACOperationId("participate") 24345]; 24346 24347foreach ($op_ids as $op_id) { 24348 $ilDB->manipulateF( 24349 "INSERT INTO rbac_templates (rol_id, type, ops_id, parent)" . PHP_EOL 24350 . "VALUES (%s, %s, %s, %s)", 24351 array("integer", "text", "integer", "integer"), 24352 array($lso_type_id, "lso", $op_id, 8) 24353 ) 24354 ; 24355} 24356 24357$ilCtrlStructureReader->getStructure(); 24358?> 24359<#5408> 24360<?php 24361$ilCtrlStructureReader->getStructure(); 24362// migration of scorm offline status 24363$query = 'update object_data od set offline = ' . 24364 '(select if( c_online = ' . $ilDB->quote('n', 'text') . ',1,0) from sahs_lm ' . 24365 'where id = od.obj_id) where type = ' . $ilDB->quote('sahs', 'text'); 24366$ilDB->manipulate($query); 24367 24368?> 24369 24370<#5409> 24371<?php 24372 24373if (!$ilDB->tableExists('il_meta_oer_stat')) { 24374 $ilDB->createTable('il_meta_oer_stat', array( 24375 'obj_id' => array( 24376 'type' => 'integer', 24377 'length' => 4, 24378 'notnull' => true, 24379 ), 24380 'href_id' => array( 24381 'type' => 'integer', 24382 'length' => 4, 24383 'notnull' => true 24384 ), 24385 'blocked' => array( 24386 'type' => 'integer', 24387 'length' => 1, 24388 'notnull' => true, 24389 'default' => 0 24390 ) 24391 )); 24392} 24393?> 24394<#5410> 24395<?php 24396 24397if ($ilDB->tableExists('il_md_cpr_selections')) { 24398 if (!$ilDB->tableColumnExists('il_md_cpr_selections', 'is_default')) { 24399 $ilDB->addTableColumn('il_md_cpr_selections', 'is_default', array( 24400 'type' => 'integer', 24401 'length' => 1, 24402 'notnull' => true, 24403 'default' => 0 24404 )); 24405 } 24406 24407 $id = $ilDB->nextId('il_md_cpr_selections'); 24408 $ilDB->insert( 24409 "il_md_cpr_selections", 24410 array( 24411 'entry_id' => array('integer',$id), 24412 'title' => array('text', 'All rights reserved'), 24413 'description' => array('clob', ''), 24414 'copyright' => array('clob', 'This work has all rights reserved by the owner.'), 24415 'language' => array('text', 'en'), 24416 'costs' => array('integer', '0'), 24417 'cpr_restrictions' => array('integer', '1'), 24418 'is_default' => array('integer', '1') 24419 ) 24420 ); 24421} 24422?> 24423<#5411> 24424<?php 24425if ($ilDB->tableExists('il_md_cpr_selections')) { 24426 if (!$ilDB->tableColumnExists('il_md_cpr_selections', 'outdated')) { 24427 $ilDB->addTableColumn('il_md_cpr_selections', 'outdated', array( 24428 'type' => 'integer', 24429 'length' => 1, 24430 'notnull' => true, 24431 'default' => 0 24432 )); 24433 } 24434} 24435?> 24436<#5412> 24437<?php 24438if ($ilDB->tableExists('il_md_cpr_selections')) { 24439 if (!$ilDB->tableColumnExists('il_md_cpr_selections', 'position')) { 24440 $ilDB->addTableColumn('il_md_cpr_selections', 'position', array( 24441 'type' => 'integer', 24442 'length' => 1, 24443 'notnull' => true, 24444 'default' => 0 24445 )); 24446 } 24447} 24448?> 24449<#5413> 24450<?php 24451if (!$ilDB->tableColumnExists('crs_settings', 'timing_mode')) { 24452 $ilDB->addTableColumn( 24453 'crs_settings', 24454 'timing_mode', 24455 array( 24456 'type' => 'integer', 24457 'length' => 1, 24458 'notnull' => false, 24459 'default' => 0 24460 ) 24461 ); 24462} 24463?> 24464<#5414> 24465<?php 24466if (!$ilDB->tableColumnExists('crs_items', 'suggestion_start_rel')) { 24467 $ilDB->addTableColumn( 24468 'crs_items', 24469 'suggestion_start_rel', 24470 array( 24471 'type' => 'integer', 24472 'length' => 4, 24473 'notnull' => false, 24474 'default' => 0 24475 ) 24476 ); 24477} 24478?> 24479<#5415> 24480<?php 24481 24482if (!$ilDB->tableColumnExists('crs_items', 'suggestion_end_rel')) { 24483 $ilDB->addTableColumn( 24484 'crs_items', 24485 'suggestion_end_rel', 24486 array( 24487 'type' => 'integer', 24488 'length' => 4, 24489 'notnull' => false, 24490 'default' => 0 24491 ) 24492 ); 24493} 24494?> 24495<#5416> 24496<?php 24497 24498if (!$ilDB->tableColumnExists('crs_items', 'earliest_start_rel')) { 24499 $ilDB->addTableColumn( 24500 'crs_items', 24501 'earliest_start_rel', 24502 array( 24503 'type' => 'integer', 24504 'length' => 4, 24505 'notnull' => false, 24506 'default' => 0 24507 ) 24508 ); 24509} 24510?> 24511<#5417> 24512<?php 24513 24514if (!$ilDB->tableColumnExists('crs_items', 'latest_end_rel')) { 24515 $ilDB->addTableColumn( 24516 'crs_items', 24517 'latest_end_rel', 24518 array( 24519 'type' => 'integer', 24520 'length' => 4, 24521 'notnull' => false, 24522 'default' => 0 24523 ) 24524 ); 24525} 24526?> 24527 24528<#5418> 24529<?php 24530 24531if ($ilDB->tableColumnExists('crs_items', 'earliest_start')) { 24532 $ilDB->dropTableColumn('crs_items', 'earliest_start'); 24533} 24534if ($ilDB->tableColumnExists('crs_items', 'latest_end')) { 24535 $ilDB->dropTableColumn('crs_items', 'latest_end'); 24536} 24537if ($ilDB->tableColumnExists('crs_items', 'earliest_start_rel')) { 24538 $ilDB->dropTableColumn('crs_items', 'earliest_start_rel'); 24539} 24540if ($ilDB->tableColumnExists('crs_items', 'latest_end_rel')) { 24541 $ilDB->dropTableColumn('crs_items', 'latest_end_rel'); 24542} 24543?> 24544<#5419> 24545<?php 24546if (!$ilDB->tableExists('crs_timings_user')) { 24547 $ilDB->createTable('crs_timings_user', array( 24548 'ref_id' => array( 24549 'type' => 'integer', 24550 'length' => 4, 24551 'notnull' => true, 24552 'default' => 0 24553 ), 24554 'usr_id' => array( 24555 'type' => 'integer', 24556 'length' => 4, 24557 'notnull' => true, 24558 'default' => 0 24559 ), 24560 'sstart' => array( 24561 'type' => 'integer', 24562 'length' => 4, 24563 'notnull' => true, 24564 'default' => 0 24565 ), 24566 'ssend' => array( 24567 'type' => 'integer', 24568 'length' => 4, 24569 'notnull' => true, 24570 'default' => 0 24571 ) 24572 )); 24573 $ilDB->addPrimaryKey('crs_timings_user', array('ref_id', 'usr_id')); 24574} 24575?> 24576<#5420> 24577<?php 24578 24579include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24580$new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('read_results', 'Access Results', 'object', 2500); 24581$type_id = ilDBUpdateNewObjectType::getObjectTypeId('svy'); 24582if ($type_id && $new_ops_id) { 24583 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 24584} 24585?> 24586 24587<#5421> 24588<?php 24589include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24590 24591$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 24592$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('read_results'); 24593ilDBUpdateNewObjectType::cloneOperation('svy', $src_ops_id, $tgt_ops_id); 24594?> 24595<#5422> 24596<?php 24597 $ilCtrlStructureReader->getStructure(); 24598?> 24599<#5423> 24600<?php 24601// Possibly missing primaries 24602// $ilDB->modifyTableColumn('il_mm_translation', 'identification', array( 24603// 'length' => 255 24604// )); 24605// 24606// $ilDB->modifyTableColumn('il_gs_providers', 'provider_class', array( 24607// 'length' => 255 24608// )); 24609// 24610// $ilDB->modifyTableColumn('il_gs_providers', 'purpose', array( 24611// 'length' => 255 24612// )); 24613// 24614// $ilDB->modifyTableColumn('il_gs_identifications', 'provider_class', array( 24615// 'length' => 255 24616// )); 24617// 24618// $ilDB->modifyTableColumn('il_mm_custom_items', 'identifier', array( 24619// 'length' => 255 24620// )); 24621// 24622// $ilDB->modifyTableColumn('il_mm_actions', 'identification', array( 24623// 'length' => 255 24624// )); 24625// 24626// 24627// $manager = $ilDB->loadModule('Manager'); 24628// 24629// $const = $manager->listTableConstraints("il_mm_translation"); 24630// if(!in_array("primary", $const)) { 24631// $ilDB->addPrimaryKey('il_mm_translation', array( 'id' )); 24632// } 24633// $const = $manager->listTableConstraints("il_gs_providers"); 24634// if(!in_array("primary", $const)) { 24635// $ilDB->addPrimaryKey('il_gs_providers', array('provider_class')); 24636// } 24637// $const = $manager->listTableConstraints("il_gs_identifications"); 24638// if(!in_array("primary", $const)) { 24639// $ilDB->addPrimaryKey('il_gs_identifications', array('identification')); 24640// } 24641// $const = $manager->listTableConstraints("il_mm_custom_items"); 24642// if(!in_array("primary", $const)) { 24643// $ilDB->addPrimaryKey('il_mm_custom_items', array( 'identifier' )); 24644// } 24645// $const = $manager->listTableConstraints("il_mm_actions"); 24646// if(!in_array("primary", $const)) { 24647// $ilDB->addPrimaryKey('il_mm_actions', array( 'identification' )); 24648// } 24649// 24650?> 24651<#5424> 24652<?php 24653if (!$ilDB->tableExists('booking_member')) { 24654 $ilDB->createTable('booking_member', array( 24655 'participant_id' => array( 24656 'type' => 'integer', 24657 'length' => 4, 24658 'notnull' => true, 24659 'default' => 0 24660 ), 24661 'user_id' => array( 24662 'type' => 'integer', 24663 'length' => 4, 24664 'notnull' => true, 24665 'default' => 0 24666 ), 24667 'booking_pool_id' => array( 24668 'type' => 'text', 24669 'length' => 255, 24670 'notnull' => true 24671 ), 24672 'assigner_user_id' => array( 24673 'type' => 'integer', 24674 'length' => 4, 24675 'notnull' => true, 24676 'default' => 0 24677 ) 24678 )); 24679 $ilDB->addPrimaryKey('booking_member', array('participant_id', 'user_id', 'booking_pool_id')); 24680 $ilDB->createSequence('booking_member'); 24681} 24682?> 24683<#5425> 24684<?php 24685if (!$ilDB->tableColumnExists('booking_reservation', 'assigner_id')) { 24686 $ilDB->addTableColumn("booking_reservation", "assigner_id", array("type" => "integer", "length" => 4, "notnull" => true, "default" => 0)); 24687} 24688?> 24689<#5426> 24690<?php 24691$ilCtrlStructureReader->getStructure(); 24692?> 24693<#5427> 24694<?php 24695$setting = new ilSetting(); 24696$media_cont_mig = $setting->get('sty_media_cont_mig', 0); 24697if ($media_cont_mig == 0) { 24698 $setting->set('sty_media_cont_mig', 1); 24699 setup_exit(" 24700 24701 DEAR ADMINISTRATOR !! 24702 24703 Please read the following instructions CAREFULLY! 24704 24705 -> If you are using content styles (e.g. for learning modules) style settings related 24706 to media container have been lost when migrating from ILIAS 5.0/5.1 to ILIAS 5.2/5.3/5.4. 24707 24708 -> The following dbupdate step will fix this issue and set the media container properties to values 24709 before the upgrade to ILIAS 5.2/5.3/5.4. 24710 24711 -> If this issue has already been fixed manually in your content styles you may want to skip 24712 this step. If you are running ILIAS 5.2/5.3/5.4 for a longer time period you may also not want to 24713 restore old values anymore and skip this step. 24714 If you would like to skip this step you need to modify the file setup/sql/dbupdate_04.php 24715 Search for 'RUN_CONTENT_STYLE_MIGRATION' (around line 25205) and follow the instructions. 24716 24717 => To proceed the update process you now need to refresh the page (F5) 24718 24719 Mantis Bug Report: https://ilias.de/mantis/view.php?id=23299 24720 24721 "); 24722} 24723if ($media_cont_mig == 1) { 24724 // 24725 // RUN_CONTENT_STYLE_MIGRATION 24726 // 24727 // If you want to skip the migration of former style properties for the media container style classes 24728 // set the following value of $run_migration from 'true' to 'false'. 24729 // 24730 24731 $run_migration = true; 24732 24733 if ($run_migration) { 24734 $set = $ilDB->queryF( 24735 "SELECT * FROM style_parameter " . 24736 " WHERE type = %s AND tag = %s ", 24737 array("text", "text"), 24738 array("media_cont", "table") 24739 ); 24740 while ($rec = $ilDB->fetchAssoc($set)) { 24741 $set2 = $ilDB->queryF( 24742 "SELECT * FROM style_parameter " . 24743 " WHERE style_id = %s " . 24744 " AND tag = %s " . 24745 " AND class = %s " . 24746 " AND parameter = %s " . 24747 " AND type = %s " . 24748 " AND mq_id = %s ", 24749 array("integer", "text", "text", "text", "text", "integer"), 24750 array($rec["style_id"], "figure", $rec["class"], $rec["parameter"], "media_cont", $rec["mq_id"]) 24751 ); 24752 if (!($rec2 = $ilDB->fetchAssoc($set2))) { 24753 $id = $ilDB->nextId("style_parameter"); 24754 $ilDB->insert("style_parameter", array( 24755 "id" => array("integer", $id), 24756 "style_id" => array("integer", $rec["style_id"]), 24757 "tag" => array("text", "figure"), 24758 "class" => array("text", $rec["class"]), 24759 "parameter" => array("text", $rec["parameter"]), 24760 "value" => array("text", $rec["value"]), 24761 "type" => array("text", $rec["type"]), 24762 "mq_id" => array("integer", $rec["mq_id"]), 24763 "custom" => array("integer", $rec["custom"]), 24764 )); 24765 } 24766 } 24767 } 24768 $setting->set('sty_media_cont_mig', 2); 24769} 24770?> 24771<#5428> 24772<?php 24773include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 24774ilDBUpdate3136::addStyleClass( 24775 "CodeInline", 24776 "code_inline", 24777 "code", 24778 array() 24779); 24780?> 24781<#5429> 24782<?php 24783include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 24784ilDBUpdate3136::addStyleClass( 24785 "Code", 24786 "code_block", 24787 "pre", 24788 array() 24789); 24790?> 24791<#5430> 24792<?php 24793$ilDB->update("style_data", array( 24794 "uptodate" => array("integer", 0) 24795), array( 24796 "1" => array("integer", 1) 24797)); 24798?> 24799<#5431> 24800<?php 24801 $ilCtrlStructureReader->getStructure(); 24802 // FILE ENDS HERE, DO NOT ADD ANY ADDITIONAL STEPS 24803 // 24804 // USE dbupdate_05.php INSTEAD 24805?> 24806