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 echo "<pre> 233 Dear Administrator, 234 235 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 236 237 The update process has been stopped due to data security reasons. 238 A Bug has let to duplicate datasets in tst_pass_result table. 239 Duplicates have been detected in your installation. 240 241 Please have a look at: http://www.ilias.de/mantis/view.php?id=12904 242 243 You have the opportunity to review the data in question and apply 244 manual fixes on your own risk. 245 246 If you try to rerun the update process, this warning will be skipped. 247 The duplicates will be removed automatically by the criteria documented at Mantis #12904 248 249 Best regards, 250 The Test Maintainers 251 </pre>"; 252 253 $ilSetting->set('tst_passres_dupl_del_warning', 1); 254 exit; 255 } 256 257 $dataRes = $ilDB->queryF( 258 "SELECT * FROM tst_pass_result WHERE active_fi = %s AND pass = %s ORDER BY tstamp ASC", 259 array('integer', 'integer'), 260 array($groupRow['active_fi'], $groupRow['pass']) 261 ); 262 263 $passResults = array(); 264 $latestTimstamp = 0; 265 266 while ($dataRow = $ilDB->fetchAssoc($dataRes)) { 267 if ($latestTimstamp < $dataRow['tstamp']) { 268 $latestTimstamp = $dataRow['tstamp']; 269 $passResults = array(); 270 } 271 272 $passResults[] = $dataRow; 273 } 274 275 $bestPointsRatio = 0; 276 $bestPassResult = null; 277 278 foreach ($passResults as $passResult) { 279 if ($passResult['maxpoints'] > 0) { 280 $pointsRatio = $passResult['points'] / $passResult['maxpoints']; 281 } else { 282 $pointsRatio = 0; 283 } 284 285 if ($bestPointsRatio <= $pointsRatio) { 286 $bestPointsRatio = $pointsRatio; 287 $bestPassResult = $passResult; 288 } 289 } 290 291 $dataRes = $ilDB->manipulateF( 292 "DELETE FROM tst_pass_result WHERE active_fi = %s AND pass = %s", 293 array('integer', 'integer'), 294 array($groupRow['active_fi'], $groupRow['pass']) 295 ); 296 297 $ilDB->insert('tst_pass_result', array( 298 'active_fi' => array('integer', $bestPassResult['active_fi']), 299 'pass' => array('integer', $bestPassResult['pass']), 300 'points' => array('float', $bestPassResult['points']), 301 'maxpoints' => array('float', $bestPassResult['maxpoints']), 302 'questioncount' => array('integer', $bestPassResult['questioncount']), 303 'answeredquestions' => array('integer', $bestPassResult['answeredquestions']), 304 'workingtime' => array('integer', $bestPassResult['workingtime']), 305 'tstamp' => array('integer', $bestPassResult['tstamp']), 306 'hint_count' => array('integer', $bestPassResult['hint_count']), 307 'hint_points' => array('float', $bestPassResult['hint_points']), 308 'obligations_answered' => array('integer', $bestPassResult['obligations_answered']), 309 'exam_id' => array('text', $bestPassResult['exam_id']) 310 )); 311 } 312 313 $ilDB->addUniqueConstraint('tst_pass_result', array('active_fi', 'pass')); 314} 315 316?> 317 318<#4193> 319<?php 320if (!$ilDB->uniqueConstraintExists('tst_sequence', array('active_fi', 'pass'))) { 321 $groupRes = $ilDB->query(" 322 SELECT COUNT(*), active_fi, pass FROM tst_sequence GROUP BY active_fi, pass HAVING COUNT(*) > 1 323 "); 324 325 $ilSetting = new ilSetting(); 326 327 $setting = $ilSetting->get('tst_seq_dupl_del_warning', 0); 328 329 while ($groupRow = $ilDB->fetchAssoc($groupRes)) { 330 if (!$setting) { 331 echo "<pre> 332 Dear Administrator, 333 334 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 335 336 The update process has been stopped due to data security reasons. 337 A Bug has let to duplicate datasets in tst_sequence table. 338 Duplicates have been detected in your installation. 339 340 Please have a look at: http://www.ilias.de/mantis/view.php?id=12904 341 342 You have the opportunity to review the data in question and apply 343 manual fixes on your own risk. 344 345 If you try to rerun the update process, this warning will be skipped. 346 The duplicates will be removed automatically by the criteria documented at Mantis #12904 347 348 Best regards, 349 The Test Maintainers 350 </pre>"; 351 352 $ilSetting->set('tst_seq_dupl_del_warning', 1); 353 exit; 354 } 355 356 $dataRes = $ilDB->queryF( 357 "SELECT * FROM tst_sequence WHERE active_fi = %s AND pass = %s ORDER BY tstamp DESC", 358 array('integer', 'integer'), 359 array($groupRow['active_fi'], $groupRow['pass']) 360 ); 361 362 while ($dataRow = $ilDB->fetchAssoc($dataRes)) { 363 $ilDB->manipulateF( 364 "DELETE FROM tst_sequence WHERE active_fi = %s AND pass = %s", 365 array('integer', 'integer'), 366 array($groupRow['active_fi'], $groupRow['pass']) 367 ); 368 369 $ilDB->insert('tst_sequence', array( 370 'active_fi' => array('integer', $dataRow['active_fi']), 371 'pass' => array('integer', $dataRow['pass']), 372 'sequence' => array('text', $dataRow['sequence']), 373 'postponed' => array('text', $dataRow['postponed']), 374 'hidden' => array('text', $dataRow['hidden']), 375 'tstamp' => array('integer', $dataRow['tstamp']) 376 )); 377 378 break; 379 } 380 } 381 382 $ilDB->addUniqueConstraint('tst_sequence', array('active_fi', 'pass')); 383} 384?> 385 386<#4194> 387<?php 388 389 $ilDB->dropIndexByFields('cal_auth_token', array('user_id')); 390 391?> 392 393<#4195> 394<?php 395 396 if (!$ilDB->indexExistsByFields('cal_shared', array('obj_id','obj_type'))) { 397 $ilDB->addIndex('cal_shared', array('obj_id','obj_type'), 'i1'); 398 } 399?> 400<#4196> 401<?php 402 403 $ilDB->dropIndexByFields('cal_entry_responsible', array('cal_id','user_id')); 404 $ilDB->addPrimaryKey('cal_entry_responsible', array('cal_id','user_id')); 405?> 406<#4197> 407<?php 408 409 $ilDB->dropIndexByFields('cal_entry_responsible', array('cal_id')); 410 $ilDB->dropIndexByFields('cal_entry_responsible', array('user_id')); 411 412?> 413<#4198> 414<?php 415 416 $ilDB->dropIndexByFields('cal_cat_assignments', array('cal_id','cat_id')); 417 $ilDB->addPrimaryKey('cal_cat_assignments', array('cal_id','cat_id')); 418 419?> 420 421<#4199> 422<?php 423 if (!$ilDB->indexExistsByFields('cal_entries', array('last_update'))) { 424 $ilDB->addIndex('cal_entries', array('last_update'), 'i1'); 425 } 426?> 427<#4200> 428<?php 429 430 $query = 'SELECT value from settings where module = ' . $ilDB->quote('common', 'text') . 431 'AND keyword = ' . $ilDB->quote('main_tree_impl', 'text'); 432 $res = $ilDB->query($query); 433 434 $tree_impl = 'ns'; 435 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 436 $tree_impl = $row->value; 437 } 438 439 if ($tree_impl == 'mp') { 440 if (!$ilDB->indexExistsByFields('tree', array('path'))) { 441 $ilDB->dropIndexByFields('tree', array('lft')); 442 $ilDB->addIndex('tree', array('path'), 'i4'); 443 } 444 } 445?> 446<#4201> 447<?php 448 if (!$ilDB->indexExistsByFields('booking_reservation', array('user_id'))) { 449 $ilDB->addIndex('booking_reservation', array('user_id'), 'i1'); 450 } 451?> 452<#4202> 453<?php 454 if (!$ilDB->indexExistsByFields('booking_reservation', array('object_id'))) { 455 $ilDB->addIndex('booking_reservation', array('object_id'), 'i2'); 456 } 457?> 458<#4203> 459<?php 460 if (!$ilDB->indexExistsByFields('cal_entries', array('context_id'))) { 461 $ilDB->addIndex('cal_entries', array('context_id'), 'i2'); 462 } 463?> 464<#4204> 465<?php 466if (!$ilDB->tableColumnExists('il_poll', 'show_results_as')) { 467 $ilDB->addTableColumn('il_poll', 'show_results_as', array( 468 'type' => 'integer', 469 'length' => 1, 470 'notnull' => true, 471 'default' => 1 472 )); 473} 474if (!$ilDB->tableColumnExists('il_poll', 'show_comments')) { 475 $ilDB->addTableColumn('il_poll', 'show_comments', array( 476 'type' => 'integer', 477 'length' => 1, 478 'notnull' => true, 479 'default' => 0 480 )); 481} 482?> 483<#4205> 484<?php 485 486 $ilDB->modifyTableColumn( 487 'usr_data', 488 'ext_account', 489 array( 490 "type" => "text", 491 "length" => 250, 492 "notnull" => false, 493 'fixed' => false 494 ) 495 ); 496?> 497<#4206> 498 499<?php 500 501 $ilDB->modifyTableColumn( 502 'usr_session', 503 'session_id', 504 array( 505 "type" => "text", 506 "length" => 250, 507 "notnull" => true, 508 'fixed' => false 509 ) 510 ); 511?> 512<#4207> 513 <?php 514 // Get defective active-id sequences by finding active ids lower than zero. The abs of the low-pass is the count of the holes 515 // in the sequence. 516 $result = $ilDB->query('SELECT active_fi, min(pass) pass FROM tst_pass_result WHERE pass < 0 GROUP BY active_fi'); 517 $broken_sequences = array(); 518 519 while ($row = $ilDB->fetchAssoc($result)) { 520 $broken_sequences[] = array('active' => $row['active'], 'holes' => abs($row['pass'])); 521 } 522 523 $stmt_inc_pass_res = $ilDB->prepareManip('UPDATE tst_pass_result SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 524 $stmt_inc_man_fb = $ilDB->prepareManip('UPDATE tst_manual_fb SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 525 $stmt_inc_seq = $ilDB->prepareManip('UPDATE tst_sequence SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 526 $stmt_inc_sol = $ilDB->prepareManip('UPDATE tst_solutions SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 527 $stmt_inc_times = $ilDB->prepareManip('UPDATE tst_times SET pass = pass + 1 WHERE active_fi = ?', array('integer')); 528 529 $stmt_sel_passes = $ilDB->prepare('SELECT pass FROM tst_pass_result WHERE active_fi = ? ORDER BY pass', array('integer')); 530 531 $stmt_dec_pass_res = $ilDB->prepareManip('UPDATE tst_pass_result SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 532 $stmt_dec_man_fb = $ilDB->prepareManip('UPDATE tst_manual_fb SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 533 $stmt_dec_seq = $ilDB->prepareManip('UPDATE tst_sequence SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 534 $stmt_dec_sol = $ilDB->prepareManip('UPDATE tst_solutions SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 535 $stmt_dec_times = $ilDB->prepareManip('UPDATE tst_times SET pass = pass - 1 WHERE active_fi = ? AND pass > ?', array('integer', 'integer')); 536 537 // Iterate over affected passes 538 foreach ($broken_sequences as $broken_sequence) { 539 // Recreate the unbroken, pre-renumbering state by incrementing all passes on all affected tables for the detected broken active_fi. 540 for ($i = 1; $i <= $broken_sequence['holes']; $i++) { 541 $ilDB->execute($stmt_inc_pass_res, array($broken_sequence['active'])); 542 $ilDB->execute($stmt_inc_man_fb, array($broken_sequence['active'])); 543 $ilDB->execute($stmt_inc_seq, array($broken_sequence['active'])); 544 $ilDB->execute($stmt_inc_sol, array($broken_sequence['active'])); 545 $ilDB->execute($stmt_inc_times, array($broken_sequence['active'])); 546 } 547 548 // Detect the holes and renumber correctly on all affected tables. 549 for ($i = 1; $i <= $broken_sequence['holes']; $i++) { 550 $result = $ilDB->execute($stmt_sel_passes, array($broken_sequence['active'])); 551 $index = 0; 552 while ($row = $ilDB->fetchAssoc($result)) { 553 if ($row['pass'] == $index) { 554 $index++; 555 continue; 556 } 557 558 // Reaching here, there is a missing index, now decrement all higher passes, preserving additional holes. 559 $ilDB->execute($stmt_dec_pass_res, array($broken_sequence['active'], $index)); 560 $ilDB->execute($stmt_dec_man_fb, array($broken_sequence['active'], $index)); 561 $ilDB->execute($stmt_dec_seq, array($broken_sequence['active'], $index)); 562 $ilDB->execute($stmt_dec_sol, array($broken_sequence['active'], $index)); 563 $ilDB->execute($stmt_dec_times, array($broken_sequence['active'], $index)); 564 break; 565 // Hole detection will start over. 566 } 567 } 568 } 569 ?> 570<#4208> 571<?php 572 573if (!$ilDB->tableExists('tmp_tst_to_recalc')) { 574 $ilDB->createTable('tmp_tst_to_recalc', array( 575 'active_fi' => array( 576 'type' => 'integer', 577 'length' => 4, 578 'notnull' => true, 579 'default' => 0 580 ), 581 'pass' => array( 582 'type' => 'integer', 583 'length' => 4, 584 'notnull' => true, 585 'default' => -1 586 ) 587 )); 588 589 $ilDB->addUniqueConstraint('tmp_tst_to_recalc', array('active_fi', 'pass')); 590} 591 592$groupQuery = " 593 SELECT tst_test_result.active_fi, 594 tst_test_result.question_fi, 595 tst_test_result.pass, 596 MAX(test_result_id) keep_id 597 598 FROM tst_test_result 599 600 INNER JOIN tst_active 601 ON tst_active.active_id = tst_test_result.active_fi 602 603 INNER JOIN tst_tests 604 ON tst_tests.test_id = tst_active.test_fi 605 606 INNER JOIN object_data 607 ON object_data.obj_id = tst_tests.obj_fi 608 609 WHERE object_data.type = %s 610 611 GROUP BY tst_test_result.active_fi, 612 tst_test_result.question_fi, 613 tst_test_result.pass 614 615 HAVING COUNT(*) > 1 616 "; 617 618$numQuery = "SELECT COUNT(*) num FROM ($groupQuery) tbl"; 619$numRes = $ilDB->queryF($numQuery, array('text'), array('tst')); 620$numRow = $ilDB->fetchAssoc($numRes); 621 622$ilSetting = new ilSetting(); 623$setting = $ilSetting->get('tst_test_results_dupl_del_warn', 0); 624 625if ((int) $numRow['num'] && !(int) $setting) { 626 echo "<pre> 627 628 Dear Administrator, 629 630 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 631 632 The update process has been stopped due to data security reasons. 633 A Bug has let to duplicate datasets in \"tst_test_result\" table. 634 Duplicates have been detected in your installation. 635 636 Please have a look at: http://www.ilias.de/mantis/view.php?id=8992#c27369 637 638 You have the opportunity to review the data in question and apply 639 manual fixes on your own risk. 640 If you change any data manually, make sure to also add an entry in the table \"tmp_tst_to_recalc\" 641 for each active_fi/pass combination that is involved. 642 The required re-calculation of related result aggregations won't be triggered otherwise. 643 644 If you try to rerun the update process, this warning will be skipped. 645 The remaining duplicates will be removed automatically by the criteria documented at Mantis #8992 646 647 Best regards, 648 The Test Maintainers 649 650 </pre>"; 651 652 $ilSetting->set('tst_test_results_dupl_del_warn', 1); 653 exit; 654} 655 656if ((int) $numRow['num']) { 657 $groupRes = $ilDB->queryF($groupQuery, array('text'), array('tst')); 658 659 $deleteStmt = $ilDB->prepareManip( 660 "DELETE FROM tst_test_result WHERE active_fi = ? AND pass = ? AND question_fi = ? AND test_result_id != ?", 661 array('integer', 'integer', 'integer', 'integer') 662 ); 663 664 while ($groupRow = $ilDB->fetchAssoc($groupRes)) { 665 $pkCols = array( 666 'active_fi' => array('integer', $groupRow['active_fi']), 667 'pass' => array('integer', $groupRow['pass']) 668 ); 669 670 $ilDB->replace('tmp_tst_to_recalc', $pkCols, array()); 671 672 $ilDB->execute($deleteStmt, array( 673 $groupRow['active_fi'], $groupRow['pass'], $groupRow['question_fi'], $groupRow['keep_id'] 674 )); 675 } 676} 677 678?> 679<#4209> 680<?php 681 682if ($ilDB->tableExists('tmp_tst_to_recalc')) { 683 $deleteStmt = $ilDB->prepareManip( 684 "DELETE FROM tmp_tst_to_recalc WHERE active_fi = ? AND pass = ?", 685 array('integer', 'integer') 686 ); 687 688 $res = $ilDB->query(" 689 SELECT tmp_tst_to_recalc.*, 690 tst_tests.obligations_enabled, 691 tst_tests.question_set_type, 692 tst_tests.obj_fi, 693 tst_tests.pass_scoring 694 695 FROM tmp_tst_to_recalc 696 697 INNER JOIN tst_active 698 ON tst_active.active_id = tmp_tst_to_recalc.active_fi 699 700 INNER JOIN tst_tests 701 ON tst_tests.test_id = tst_active.test_fi 702 "); 703 704 require_once 'Services/Migration/DBUpdate_4209/classes/class.DBUpdateTestResultCalculator.php'; 705 706 while ($row = $ilDB->fetchAssoc($res)) { 707 DBUpdateTestResultCalculator::_updateTestPassResults( 708 $row['active_fi'], 709 $row['pass'], 710 $row['obligations_enabled'], 711 $row['question_set_type'], 712 $row['obj_fi'] 713 ); 714 715 DBUpdateTestResultCalculator::_updateTestResultCache( 716 $row['active_fi'], 717 $row['pass_scoring'] 718 ); 719 720 $ilDB->execute($deleteStmt, array($row['active_fi'], $row['pass'])); 721 } 722 723 $ilDB->dropTable('tmp_tst_to_recalc'); 724} 725 726?> 727<#4210> 728<?php 729$ilSetting = new ilSetting(); 730if ((int) $ilSetting->get('lm_qst_imap_migr_run') == 0) { 731 // get all imagemap questions in ILIAS learning modules or scorm learning modules 732 $set = $ilDB->query( 733 "SELECT pq.question_id FROM page_question pq JOIN qpl_qst_imagemap im ON (pq.question_id = im.question_fi) " . 734 " WHERE pq.page_parent_type = " . $ilDB->quote("lm", "text") . 735 " OR pq.page_parent_type = " . $ilDB->quote("sahs", "text") 736 ); 737 while ($rec = $ilDB->fetchAssoc($set)) { 738 // now cross-check against qpl_questions to ensure that this is neither a test nor a question pool question 739 $set2 = $ilDB->query( 740 "SELECT obj_fi FROM qpl_questions " . 741 " WHERE question_id = " . $ilDB->quote($rec["question_id"], "integer") 742 ); 743 if ($rec2 = $ilDB->fetchAssoc($set2)) { 744 // this should not be the case for question pool or test questions 745 if ($rec2["obj_fi"] == 0) { 746 $q = "UPDATE qpl_qst_imagemap SET " . 747 " is_multiple_choice = " . $ilDB->quote(1, "integer") . 748 " WHERE question_fi = " . $ilDB->quote($rec["question_id"], "integer"); 749 $ilDB->manipulate($q); 750 } 751 } 752 } 753 $ilSetting = new ilSetting(); 754 $setting = $ilSetting->set('lm_qst_imap_migr_run', 1); 755} 756?> 757<#4211> 758<?php 759if (!$ilDB->tableColumnExists('qpl_a_cloze', 'gap_size')) { 760 $ilDB->addTableColumn('qpl_a_cloze', 'gap_size', array( 761 'type' => 'integer', 762 'length' => 4, 763 'notnull' => true, 764 'default' => 0 765 )); 766} 767?> 768<#4212> 769<?php 770if (!$ilDB->tableColumnExists('qpl_qst_cloze', 'cloze_text')) { 771 $ilDB->addTableColumn('qpl_qst_cloze', 'cloze_text', array('type' => 'clob')); 772 773 $clean_qst_txt = $ilDB->prepareManip('UPDATE qpl_questions SET question_text = " " WHERE question_id = ?', array('integer')); 774 775 $result = $ilDB->query('SELECT question_id, question_text FROM qpl_questions WHERE question_type_fi = 3'); 776 777 /** @noinspection PhpAssignmentInConditionInspection */ 778 while ($row = $ilDB->fetchAssoc($result)) { 779 $ilDB->update( 780 'qpl_qst_cloze', 781 array( 782 'cloze_text' => array('clob', $row['question_text'] ) 783 ), 784 array( 785 'question_fi' => array('integer', $row['question_id'] ) 786 ) 787 ); 788 $ilDB->execute($clean_qst_txt, array($row['question_id'])); 789 } 790} 791?> 792<#4213> 793<?php 794$ilCtrlStructureReader->getStructure(); 795?> 796<#4214> 797<?php 798if (!$ilDB->tableColumnExists('qpl_qst_matching', 'matching_mode')) { 799 $ilDB->addTableColumn('qpl_qst_matching', 'matching_mode', array( 800 'type' => 'text', 801 'length' => 3, 802 'notnull' => false, 803 'default' => null 804 )); 805 806 $ilDB->manipulateF( 807 'UPDATE qpl_qst_matching SET matching_mode = %s', 808 array('text'), 809 array('1:1') 810 ); 811} 812 813if ($ilDB->tableColumnExists('qpl_qst_matching', 'element_height')) { 814 $ilDB->dropTableColumn('qpl_qst_matching', 'element_height'); 815} 816?> 817<#4215> 818<?php 819$ilCtrlStructureReader->getStructure(); 820?> 821<#4216> 822<?php 823// REMOVED: is done at #4220 in an abstracted way 824// Bibliographic Module: Increase the allowed text-size for attributes from 512 to 4000 825// $ilDB->query('ALTER TABLE il_bibl_attribute MODIFY value VARCHAR(4000)'); 826?> 827<#4217> 828<?php 829 /* Introduce new DataCollection features 830 - Comments on records 831 - Default sort-field & sort-order 832 */ 833 if (!$ilDB->tableColumnExists('il_dcl_table', 'default_sort_field_id')) { 834 $ilDB->addTableColumn( 835 'il_dcl_table', 836 'default_sort_field_id', 837 array( 838 'type' => 'text', 839 'length' => 16, 840 'notnull' => true, 841 'default' => '0', 842 ) 843 ); 844 } 845 if (!$ilDB->tableColumnExists('il_dcl_table', 'default_sort_field_order')) { 846 $ilDB->addTableColumn( 847 'il_dcl_table', 848 'default_sort_field_order', 849 array( 850 'type' => 'text', 851 'length' => 4, 852 'notnull' => true, 853 'default' => 'asc', 854 ) 855 ); 856 } 857 if (!$ilDB->tableColumnExists('il_dcl_table', 'public_comments')) { 858 $ilDB->addTableColumn( 859 'il_dcl_table', 860 'public_comments', 861 array( 862 'type' => 'integer', 863 'length' => 4, 864 'notnull' => true, 865 'default' => 0, 866 ) 867 ); 868 } 869?> 870<#4218> 871<?php 872if (!$ilDB->tableColumnExists('il_dcl_table', 'view_own_records_perm')) { 873 $ilDB->addTableColumn( 874 'il_dcl_table', 875 'view_own_records_perm', 876 array( 877 'type' => 'integer', 878 'length' => 4, 879 'notnull' => true, 880 'default' => 0, 881 ) 882 ); 883} 884?> 885<#4219> 886<?php 887$ilCtrlStructureReader->getStructure(); 888?> 889<#4220> 890<?php 891// Bibliographic Module: Increase the allowed text-size for attributes from 512 to 4000 892$ilDB->modifyTableColumn("il_bibl_attribute", "value", array("type" => "text", "length" => 4000)); 893?> 894<#4221> 895<?php 896 897if (!$ilDB->tableExists('adv_md_values_text')) { 898 $ilDB->renameTable('adv_md_values', 'adv_md_values_text'); 899} 900 901?> 902<#4222> 903<?php 904 905if (!$ilDB->tableExists('adv_md_values_int')) { 906 $ilDB->createTable('adv_md_values_int', array( 907 'obj_id' => array( 908 'type' => 'integer', 909 'length' => 4, 910 'notnull' => true, 911 'default' => 0 912 ), 913 'sub_type' => array( 914 'type' => 'text', 915 'length' => 10, 916 'notnull' => true, 917 'default' => "-" 918 ), 919 'sub_id' => array( 920 'type' => 'integer', 921 'length' => 4, 922 'notnull' => true, 923 'default' => 0 924 ), 925 'field_id' => array( 926 'type' => 'integer', 927 'length' => 4, 928 'notnull' => true, 929 'default' => 0 930 ), 931 'value' => array( 932 'type' => 'integer', 933 'length' => 4, 934 'notnull' => false 935 ) 936 )); 937 938 $ilDB->addPrimaryKey('adv_md_values_int', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 939} 940 941?> 942<#4223> 943<?php 944 945if (!$ilDB->tableExists('adv_md_values_float')) { 946 $ilDB->createTable('adv_md_values_float', array( 947 'obj_id' => array( 948 'type' => 'integer', 949 'length' => 4, 950 'notnull' => true, 951 'default' => 0 952 ), 953 'sub_type' => array( 954 'type' => 'text', 955 'length' => 10, 956 'notnull' => true, 957 'default' => "-" 958 ), 959 'sub_id' => array( 960 'type' => 'integer', 961 'length' => 4, 962 'notnull' => true, 963 'default' => 0 964 ), 965 'field_id' => array( 966 'type' => 'integer', 967 'length' => 4, 968 'notnull' => true, 969 'default' => 0 970 ), 971 'value' => array( 972 'type' => 'float', 973 'notnull' => false 974 ) 975 )); 976 977 $ilDB->addPrimaryKey('adv_md_values_float', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 978} 979 980?> 981<#4224> 982<?php 983 984if (!$ilDB->tableExists('adv_md_values_date')) { 985 $ilDB->createTable('adv_md_values_date', array( 986 'obj_id' => array( 987 'type' => 'integer', 988 'length' => 4, 989 'notnull' => true, 990 'default' => 0 991 ), 992 'sub_type' => array( 993 'type' => 'text', 994 'length' => 10, 995 'notnull' => true, 996 'default' => "-" 997 ), 998 'sub_id' => array( 999 'type' => 'integer', 1000 'length' => 4, 1001 'notnull' => true, 1002 'default' => 0 1003 ), 1004 'field_id' => array( 1005 'type' => 'integer', 1006 'length' => 4, 1007 'notnull' => true, 1008 'default' => 0 1009 ), 1010 'value' => array( 1011 'type' => 'date', 1012 'notnull' => false 1013 ) 1014 )); 1015 1016 $ilDB->addPrimaryKey('adv_md_values_date', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 1017} 1018 1019?> 1020<#4225> 1021<?php 1022 1023if (!$ilDB->tableExists('adv_md_values_datetime')) { 1024 $ilDB->createTable('adv_md_values_datetime', array( 1025 'obj_id' => array( 1026 'type' => 'integer', 1027 'length' => 4, 1028 'notnull' => true, 1029 'default' => 0 1030 ), 1031 'sub_type' => array( 1032 'type' => 'text', 1033 'length' => 10, 1034 'notnull' => true, 1035 'default' => "-" 1036 ), 1037 'sub_id' => array( 1038 'type' => 'integer', 1039 'length' => 4, 1040 'notnull' => true, 1041 'default' => 0 1042 ), 1043 'field_id' => array( 1044 'type' => 'integer', 1045 'length' => 4, 1046 'notnull' => true, 1047 'default' => 0 1048 ), 1049 'value' => array( 1050 'type' => 'timestamp', 1051 'notnull' => false 1052 ) 1053 )); 1054 1055 $ilDB->addPrimaryKey('adv_md_values_datetime', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 1056} 1057 1058?> 1059<#4226> 1060<?php 1061 1062if (!$ilDB->tableExists('adv_md_values_location')) { 1063 $ilDB->createTable('adv_md_values_location', array( 1064 'obj_id' => array( 1065 'type' => 'integer', 1066 'length' => 4, 1067 'notnull' => true, 1068 'default' => 0 1069 ), 1070 'sub_type' => array( 1071 'type' => 'text', 1072 'length' => 10, 1073 'notnull' => true, 1074 'default' => "-" 1075 ), 1076 'sub_id' => array( 1077 'type' => 'integer', 1078 'length' => 4, 1079 'notnull' => true, 1080 'default' => 0 1081 ), 1082 'field_id' => array( 1083 'type' => 'integer', 1084 'length' => 4, 1085 'notnull' => true, 1086 'default' => 0 1087 ), 1088 'loc_lat' => array( 1089 'type' => 'float', 1090 'notnull' => false 1091 ), 1092 'loc_long' => array( 1093 'type' => 'float', 1094 'notnull' => false 1095 ), 1096 'loc_zoom' => array( 1097 'type' => 'integer', 1098 'length' => 1, 1099 'notnull' => false 1100 ) 1101 )); 1102 1103 $ilDB->addPrimaryKey('adv_md_values_location', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 1104} 1105 1106?> 1107<#4227> 1108<?php 1109 1110 if (!$ilDB->tableColumnExists('adv_md_values_location', 'disabled')) { 1111 $ilDB->addTableColumn('adv_md_values_location', 'disabled', array( 1112 "type" => "integer", 1113 "length" => 1, 1114 "notnull" => true, 1115 "default" => 0 1116 )); 1117 } 1118 if (!$ilDB->tableColumnExists('adv_md_values_datetime', 'disabled')) { 1119 $ilDB->addTableColumn('adv_md_values_datetime', 'disabled', array( 1120 "type" => "integer", 1121 "length" => 1, 1122 "notnull" => true, 1123 "default" => 0 1124 )); 1125 } 1126 if (!$ilDB->tableColumnExists('adv_md_values_date', 'disabled')) { 1127 $ilDB->addTableColumn('adv_md_values_date', 'disabled', array( 1128 "type" => "integer", 1129 "length" => 1, 1130 "notnull" => true, 1131 "default" => 0 1132 )); 1133 } 1134 if (!$ilDB->tableColumnExists('adv_md_values_float', 'disabled')) { 1135 $ilDB->addTableColumn('adv_md_values_float', 'disabled', array( 1136 "type" => "integer", 1137 "length" => 1, 1138 "notnull" => true, 1139 "default" => 0 1140 )); 1141 } 1142 if (!$ilDB->tableColumnExists('adv_md_values_int', 'disabled')) { 1143 $ilDB->addTableColumn('adv_md_values_int', 'disabled', array( 1144 "type" => "integer", 1145 "length" => 1, 1146 "notnull" => true, 1147 "default" => 0 1148 )); 1149 } 1150 1151?> 1152<#4228> 1153<?php 1154$ilCtrlStructureReader->getStructure(); 1155?> 1156<#4229> 1157<?php 1158 1159// moving date/datetime to proper adv_md-tables 1160$field_map = array(); 1161 1162$set = $ilDB->query("SELECT field_id,field_type FROM adv_mdf_definition" . 1163 " WHERE " . $ilDB->in("field_type", array(3,4), "", "integer")); 1164while ($row = $ilDB->fetchAssoc($set)) { 1165 $field_map[$row["field_id"]] = $row["field_type"]; 1166} 1167 1168if (sizeof($field_map)) { 1169 $set = $ilDB->query("SELECT * FROM adv_md_values_text" . 1170 " WHERE " . $ilDB->in("field_id", array_keys($field_map), "", "integer")); 1171 while ($row = $ilDB->fetchAssoc($set)) { 1172 if ($row["value"]) { 1173 // date 1174 if ($field_map[$row["field_id"]] == 3) { 1175 $table = "adv_md_values_date"; 1176 $value = date("Y-m-d", $row["value"]); 1177 $type = "date"; 1178 } 1179 // datetime 1180 else { 1181 $table = "adv_md_values_datetime"; 1182 $value = date("Y-m-d H:i:s", $row["value"]); 1183 $type = "timestamp"; 1184 } 1185 1186 $fields = array( 1187 "obj_id" => array("integer", $row["obj_id"]) 1188 ,"sub_type" => array("text", $row["sub_type"]) 1189 ,"sub_id" => array("integer", $row["sub_id"]) 1190 ,"field_id" => array("integer", $row["field_id"]) 1191 ,"disabled" => array("integer", $row["disabled"]) 1192 ,"value" => array($type, $value) 1193 ); 1194 1195 $ilDB->insert($table, $fields); 1196 } 1197 } 1198 1199 $ilDB->manipulate("DELETE FROM adv_md_values_text" . 1200 " WHERE " . $ilDB->in("field_id", array_keys($field_map), "", "integer")); 1201} 1202 1203?> 1204<#4230> 1205<?php 1206 1207if (!$ilDB->tableColumnExists('il_blog', 'keywords')) { 1208 $ilDB->addTableColumn('il_blog', 'keywords', array( 1209 "type" => "integer", 1210 "length" => 1, 1211 "notnull" => true, 1212 "default" => 1 1213 )); 1214 $ilDB->addTableColumn('il_blog', 'authors', array( 1215 "type" => "integer", 1216 "length" => 1, 1217 "notnull" => true, 1218 "default" => 1 1219 )); 1220 $ilDB->addTableColumn('il_blog', 'nav_mode', array( 1221 "type" => "integer", 1222 "length" => 1, 1223 "notnull" => true, 1224 "default" => 1 1225 )); 1226 $ilDB->addTableColumn('il_blog', 'nav_list_post', array( 1227 "type" => "integer", 1228 "length" => 2, 1229 "notnull" => true, 1230 "default" => 10 1231 )); 1232 $ilDB->addTableColumn('il_blog', 'nav_list_mon', array( 1233 "type" => "integer", 1234 "length" => 2, 1235 "notnull" => false, 1236 "default" => 0 1237 )); 1238 $ilDB->addTableColumn('il_blog', 'ov_post', array( 1239 "type" => "integer", 1240 "length" => 2, 1241 "notnull" => false, 1242 "default" => 0 1243 )); 1244} 1245 1246?> 1247<#4231> 1248<?php 1249 1250if (!$ilDB->tableColumnExists('il_blog', 'nav_order')) { 1251 $ilDB->addTableColumn('il_blog', 'nav_order', array( 1252 "type" => "text", 1253 "length" => 255, 1254 "notnull" => false 1255 )); 1256} 1257 1258?> 1259<#4232> 1260<?php 1261 1262if (!$ilDB->tableColumnExists('svy_svy', 'own_results_view')) { 1263 $ilDB->addTableColumn('svy_svy', 'own_results_view', array( 1264 "type" => "integer", 1265 "length" => 1, 1266 "notnull" => false, 1267 "default" => 0 1268 )); 1269} 1270if (!$ilDB->tableColumnExists('svy_svy', 'own_results_mail')) { 1271 $ilDB->addTableColumn('svy_svy', 'own_results_mail', array( 1272 "type" => "integer", 1273 "length" => 1, 1274 "notnull" => false, 1275 "default" => 0 1276 )); 1277} 1278 1279?> 1280<#4233> 1281<?php 1282 1283if (!$ilDB->tableColumnExists('exc_data', 'add_desktop')) { 1284 $ilDB->addTableColumn('exc_data', 'add_desktop', array( 1285 "type" => "integer", 1286 "length" => 1, 1287 "notnull" => true, 1288 "default" => 1 1289 )); 1290} 1291 1292?> 1293<#4234> 1294<?php 1295if (!$ilDB->tableColumnExists('tst_dyn_quest_set_cfg', 'answer_filter_enabled')) { 1296 $ilDB->addTableColumn('tst_dyn_quest_set_cfg', 'answer_filter_enabled', array( 1297 'type' => 'integer', 1298 'length' => 1, 1299 'notnull' => false, 1300 'default' => null 1301 )); 1302} 1303if (!$ilDB->tableColumnExists('tst_active', 'answerstatusfilter')) { 1304 $ilDB->addTableColumn('tst_active', 'answerstatusfilter', array( 1305 'type' => 'text', 1306 'length' => 16, 1307 'notnull' => false, 1308 'default' => null 1309 )); 1310} 1311?> 1312<#4235> 1313<?php 1314$ilCtrlStructureReader->getStructure(); 1315?> 1316<#4236> 1317<?php 1318$ilCtrlStructureReader->getStructure(); 1319?> 1320<#4237> 1321<?php 1322 1323if (!$ilDB->tableExists('pg_amd_page_list')) { 1324 $ilDB->createTable('pg_amd_page_list', array( 1325 'id' => array( 1326 'type' => 'integer', 1327 'length' => 4, 1328 'notnull' => true, 1329 'default' => 0 1330 ), 1331 'field_id' => array( 1332 'type' => 'integer', 1333 'length' => 4, 1334 'notnull' => true, 1335 'default' => 0 1336 ), 1337 'data' => array( 1338 'type' => 'text', 1339 'length' => 4000, 1340 'notnull' => false 1341 ), 1342 )); 1343 1344 $ilDB->addPrimaryKey('pg_amd_page_list', array('id', 'field_id')); 1345 $ilDB->createSequence('pg_amd_page_list'); 1346} 1347 1348?> 1349<#4238> 1350<?php 1351$ilCtrlStructureReader->getStructure(); 1352?> 1353<#4239> 1354<?php 1355$ilCtrlStructureReader->getStructure(); 1356?> 1357<#4240> 1358<?php 1359if (!$ilDB->tableColumnExists('tst_tests', 'skill_service')) { 1360 $ilDB->addTableColumn('tst_tests', 'skill_service', array( 1361 'type' => 'integer', 1362 'length' => 1, 1363 'notnull' => false, 1364 'default' => null 1365 )); 1366 1367 $ilDB->manipulateF( 1368 'UPDATE tst_tests SET skill_service = %s', 1369 array('integer'), 1370 array(0) 1371 ); 1372} 1373 1374if (!$ilDB->tableExists('tst_skl_qst_assigns')) { 1375 $ilDB->createTable('tst_skl_qst_assigns', array( 1376 'test_fi' => array( 1377 'type' => 'integer', 1378 'length' => 4, 1379 'notnull' => true, 1380 'default' => 0 1381 ), 1382 'question_fi' => array( 1383 'type' => 'integer', 1384 'length' => 4, 1385 'notnull' => true, 1386 'default' => 0 1387 ), 1388 'skill_base_fi' => array( 1389 'type' => 'integer', 1390 'length' => 4, 1391 'notnull' => true, 1392 'default' => 0 1393 ), 1394 'skill_tref_fi' => array( 1395 'type' => 'integer', 1396 'length' => 4, 1397 'notnull' => true, 1398 'default' => 0 1399 ), 1400 'skill_points' => array( 1401 'type' => 'integer', 1402 'length' => 4, 1403 'notnull' => true, 1404 'default' => 0 1405 ) 1406 )); 1407 1408 $ilDB->addPrimaryKey('tst_skl_qst_assigns', array('test_fi', 'question_fi', 'skill_base_fi', 'skill_tref_fi')); 1409} 1410 1411if (!$ilDB->tableExists('tst_skl_thresholds')) { 1412 $ilDB->createTable('tst_skl_thresholds', array( 1413 'test_fi' => array( 1414 'type' => 'integer', 1415 'length' => 4, 1416 'notnull' => true, 1417 'default' => 0 1418 ), 1419 'skill_base_fi' => array( 1420 'type' => 'integer', 1421 'length' => 4, 1422 'notnull' => true, 1423 'default' => 0 1424 ), 1425 'skill_tref_fi' => array( 1426 'type' => 'integer', 1427 'length' => 4, 1428 'notnull' => true, 1429 'default' => 0 1430 ), 1431 'skill_level_fi' => array( 1432 'type' => 'integer', 1433 'length' => 4, 1434 'notnull' => true, 1435 'default' => 0 1436 ), 1437 'threshold' => array( 1438 'type' => 'integer', 1439 'length' => 4, 1440 'notnull' => true, 1441 'default' => 0 1442 ) 1443 )); 1444 1445 $ilDB->addPrimaryKey('tst_skl_thresholds', array('test_fi', 'skill_base_fi', 'skill_tref_fi', 'skill_level_fi')); 1446} 1447 1448if (!$ilDB->tableColumnExists('tst_active', 'last_finished_pass')) { 1449 $ilDB->addTableColumn('tst_active', 'last_finished_pass', array( 1450 'type' => 'integer', 1451 'length' => 4, 1452 'notnull' => false, 1453 'default' => null 1454 )); 1455} 1456?> 1457<#4241> 1458<?php 1459if (!$ilDB->tableColumnExists('tst_tests', 'result_tax_filters')) { 1460 $ilDB->addTableColumn('tst_tests', 'result_tax_filters', array( 1461 'type' => 'text', 1462 'length' => 255, 1463 'notnull' => false, 1464 'default' => null 1465 )); 1466} 1467?> 1468<#4242> 1469<?php 1470$ilCtrlStructureReader->getStructure(); 1471?> 1472 1473<#4243> 1474<?php 1475if (!$ilDB->tableColumnExists('tst_test_rnd_qst', 'src_pool_def_fi')) { 1476 $ilDB->addTableColumn('tst_test_rnd_qst', 'src_pool_def_fi', array( 1477 'type' => 'integer', 1478 'length' => 4, 1479 'notnull' => false, 1480 'default' => null 1481 )); 1482} 1483?> 1484<#4244> 1485<?php 1486$ilCtrlStructureReader->getStructure(); 1487?> 1488 1489<#4245> 1490<?php 1491 1492if (!$ilDB->tableExists('ecs_remote_user')) { 1493 $ilDB->createTable('ecs_remote_user', array( 1494 'eru_id' => array( 1495 'type' => 'integer', 1496 'length' => 4, 1497 'notnull' => true, 1498 'default' => 0 1499 ), 1500 'sid' => array( 1501 'type' => 'integer', 1502 'length' => 4, 1503 'notnull' => true, 1504 'default' => 0 1505 ), 1506 'mid' => array( 1507 'type' => 'integer', 1508 'length' => 4, 1509 'notnull' => true, 1510 'default' => 0 1511 ), 1512 'usr_id' => array( 1513 'type' => 'integer', 1514 'length' => 4, 1515 'notnull' => true, 1516 'default' => 0 1517 ), 1518 'remote_usr_id' => array( 1519 'type' => 'integer', 1520 'length' => 4, 1521 'notnull' => true, 1522 'default' => 0 1523 ) 1524 )); 1525 $ilDB->addPrimaryKey('ecs_remote_user', array('eru_id')); 1526 $ilDB->createSequence('ecs_remote_user'); 1527} 1528?> 1529<#4246> 1530<?php 1531 1532if ($ilDB->tableExists('ecs_remote_user')) { 1533 $ilDB->dropTable('ecs_remote_user'); 1534} 1535 1536?> 1537<#4247> 1538<?php 1539if (!$ilDB->tableExists('ecs_remote_user')) { 1540 $ilDB->createTable('ecs_remote_user', array( 1541 'eru_id' => array( 1542 'type' => 'integer', 1543 'length' => 4, 1544 'notnull' => true, 1545 'default' => 0 1546 ), 1547 'sid' => array( 1548 'type' => 'integer', 1549 'length' => 4, 1550 'notnull' => true, 1551 'default' => 0 1552 ), 1553 'mid' => array( 1554 'type' => 'integer', 1555 'length' => 4, 1556 'notnull' => true, 1557 'default' => 0 1558 ), 1559 'usr_id' => array( 1560 'type' => 'integer', 1561 'length' => 4, 1562 'notnull' => true, 1563 'default' => 0 1564 ), 1565 'remote_usr_id' => array( 1566 'type' => 'text', 1567 'length' => 50, 1568 'notnull' => false, 1569 'fixed' => true 1570 ) 1571 )); 1572 $ilDB->addPrimaryKey('ecs_remote_user', array('eru_id')); 1573 $ilDB->createSequence('ecs_remote_user'); 1574} 1575?> 1576<#4248> 1577<?php 1578 1579include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 1580ilDBUpdateNewObjectType::addAdminNode('excs', 'Exercise Settings'); 1581 1582?> 1583<#4249> 1584<?php 1585 1586if ($ilDB->tableColumnExists('exc_data', 'add_desktop')) { 1587 $ilDB->dropTableColumn('exc_data', 'add_desktop'); 1588} 1589 1590?> 1591<#4250> 1592<?php 1593if (!$ilDB->tableColumnExists('tst_tests', 'show_grading_status')) { 1594 $ilDB->addTableColumn('tst_tests', 'show_grading_status', array( 1595 'type' => 'integer', 1596 'length' => 1, 1597 'notnull' => false, 1598 'default' => 0 1599 )); 1600 1601 $ilDB->queryF("UPDATE tst_tests SET show_grading_status = %s", array('integer'), array(1)); 1602} 1603 1604if (!$ilDB->tableColumnExists('tst_tests', 'show_grading_mark')) { 1605 $ilDB->addTableColumn('tst_tests', 'show_grading_mark', array( 1606 'type' => 'integer', 1607 'length' => 1, 1608 'notnull' => false, 1609 'default' => 0 1610 )); 1611 1612 $ilDB->queryF("UPDATE tst_tests SET show_grading_mark = %s", array('integer'), array(1)); 1613} 1614?> 1615<#4251> 1616<?php 1617 1618include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 1619ilDBUpdateNewObjectType::addAdminNode('taxs', 'Taxonomy Settings'); 1620 1621?> 1622<#4252> 1623<?php 1624// Datacollection: Add formula fieldtype 1625$ilDB->insert('il_dcl_datatype', array( 1626 'id' => array('integer', 11), 1627 'title' => array('text', 'formula'), 1628 'ildb_type' => array('text', 'text'), 1629 'storage_location' => array('integer', 0), 1630 'sort' => array('integer', 90), 1631 )); 1632?> 1633<#4253> 1634<?php 1635 1636if (!$ilDB->tableColumnExists('booking_settings', 'ovlimit')) { 1637 $ilDB->addTableColumn('booking_settings', 'ovlimit', array( 1638 'type' => 'integer', 1639 'length' => 1, 1640 'notnull' => false 1641 )); 1642} 1643 1644?> 1645<#4254> 1646<?php 1647if ($ilDB->tableColumnExists('qpl_qst_essay', 'keyword_relation')) { 1648 $ilDB->queryF( 1649 "UPDATE qpl_qst_essay SET keyword_relation = %s WHERE keyword_relation = %s", 1650 array('text', 'text'), 1651 array('non', 'none') 1652 ); 1653} 1654?> 1655<#4255> 1656 <?php 1657 // Datacollection: Add formula fieldtype 1658 $ilDB->insert('il_dcl_datatype_prop', array( 1659 'id' => array('integer', 12), 1660 'datatype_id' => array('integer', 11), 1661 'title' => array('text', 'expression'), 1662 'inputformat' => array('integer', 2), 1663 )); 1664?> 1665<#4256> 1666<?php 1667if (!$ilDB->tableExists('wiki_stat')) { 1668 $ilDB->createTable('wiki_stat', array( 1669 'wiki_id' => array( 1670 'type' => 'integer', 1671 'length' => 4, 1672 'notnull' => true 1673 ), 1674 'ts' => array( 1675 'type' => 'timestamp', 1676 'notnull' => true 1677 ), 1678 'num_pages' => array( 1679 'type' => 'integer', 1680 'length' => 4, 1681 'notnull' => true 1682 ), 1683 'del_pages' => array( 1684 'type' => 'integer', 1685 'length' => 4, 1686 'notnull' => true 1687 ), 1688 'avg_rating' => array( 1689 'type' => 'integer', 1690 'length' => 4, 1691 'notnull' => true 1692 ) 1693 )); 1694 1695 $ilDB->addPrimaryKey('wiki_stat', array('wiki_id', 'ts')); 1696} 1697?> 1698<#4257> 1699<?php 1700if (!$ilDB->tableExists('wiki_stat_page_user')) { 1701 $ilDB->createTable('wiki_stat_page_user', array( 1702 'wiki_id' => array( 1703 'type' => 'integer', 1704 'length' => 4, 1705 'notnull' => true 1706 ), 1707 'page_id' => array( 1708 'type' => 'integer', 1709 'length' => 4, 1710 'notnull' => true 1711 ), 1712 'user_id' => array( 1713 'type' => 'integer', 1714 'length' => 4, 1715 'notnull' => true 1716 ), 1717 'ts' => array( 1718 'type' => 'timestamp', 1719 'notnull' => true 1720 ), 1721 'changes' => array( 1722 'type' => 'integer', 1723 'length' => 4, 1724 'notnull' => true, 1725 'default' => 0 1726 ), 1727 'read_events' => array( 1728 'type' => 'integer', 1729 'length' => 4, 1730 'notnull' => true, 1731 'default' => 0 1732 ) 1733 )); 1734 1735 $ilDB->addPrimaryKey('wiki_stat_page_user', array('wiki_id', 'page_id', 'ts', 'user_id')); 1736} 1737?> 1738<#4258> 1739<?php 1740if (!$ilDB->tableExists('wiki_stat_user')) { 1741 $ilDB->createTable('wiki_stat_user', array( 1742 'wiki_id' => array( 1743 'type' => 'integer', 1744 'length' => 4, 1745 'notnull' => true 1746 ), 1747 'user_id' => array( 1748 'type' => 'integer', 1749 'length' => 4, 1750 'notnull' => true 1751 ), 1752 'ts' => array( 1753 'type' => 'timestamp', 1754 'notnull' => true 1755 ), 1756 'new_pages' => array( 1757 'type' => 'integer', 1758 'length' => 4, 1759 'notnull' => true 1760 ) 1761 )); 1762 1763 $ilDB->addPrimaryKey('wiki_stat_user', array('wiki_id', 'user_id', 'ts')); 1764} 1765?> 1766<#4259> 1767<?php 1768if (!$ilDB->tableExists('wiki_stat_page')) { 1769 $ilDB->createTable('wiki_stat_page', array( 1770 'wiki_id' => array( 1771 'type' => 'integer', 1772 'length' => 4, 1773 'notnull' => true 1774 ), 1775 'page_id' => array( 1776 'type' => 'integer', 1777 'length' => 4, 1778 'notnull' => true 1779 ), 1780 'ts' => array( 1781 'type' => 'timestamp', 1782 'notnull' => true 1783 ), 1784 'int_links' => array( 1785 'type' => 'integer', 1786 'length' => 4, 1787 'notnull' => true 1788 ), 1789 'ext_links' => array( 1790 'type' => 'integer', 1791 'length' => 4, 1792 'notnull' => true 1793 ), 1794 'footnotes' => array( 1795 'type' => 'integer', 1796 'length' => 4, 1797 'notnull' => true 1798 ), 1799 'num_ratings' => array( 1800 'type' => 'integer', 1801 'length' => 4, 1802 'notnull' => true 1803 ), 1804 'num_words' => array( 1805 'type' => 'integer', 1806 'length' => 4, 1807 'notnull' => true 1808 ), 1809 'num_chars' => array( 1810 'type' => 'integer', 1811 'length' => 8, 1812 'notnull' => true 1813 ), 1814 1815 )); 1816 1817 $ilDB->addPrimaryKey('wiki_stat_page', array('wiki_id', 'page_id', 'ts')); 1818} 1819?> 1820<#4260> 1821<?php 1822if (!$ilDB->tableColumnExists('wiki_stat_page', 'avg_rating')) { 1823 $ilDB->addTableColumn( 1824 'wiki_stat_page', 1825 'avg_rating', 1826 array( 1827 'type' => 'integer', 1828 'length' => 4, 1829 'notnull' => true 1830 ) 1831 ); 1832} 1833?> 1834<#4261> 1835<?php 1836 1837if (!$ilDB->tableColumnExists('wiki_stat', 'ts_day')) { 1838 $ilDB->addTableColumn( 1839 'wiki_stat', 1840 'ts_day', 1841 array( 1842 'type' => 'text', 1843 'length' => 10, 1844 'fixed' => true, 1845 'notnull' => false 1846 ) 1847 ); 1848 $ilDB->addTableColumn( 1849 'wiki_stat', 1850 'ts_hour', 1851 array( 1852 'type' => 'integer', 1853 'length' => 1, 1854 'notnull' => false 1855 ) 1856 ); 1857} 1858 1859if (!$ilDB->tableColumnExists('wiki_stat_page', 'ts_day')) { 1860 $ilDB->addTableColumn( 1861 'wiki_stat_page', 1862 'ts_day', 1863 array( 1864 'type' => 'text', 1865 'length' => 10, 1866 'fixed' => true, 1867 'notnull' => false 1868 ) 1869 ); 1870 $ilDB->addTableColumn( 1871 'wiki_stat_page', 1872 'ts_hour', 1873 array( 1874 'type' => 'integer', 1875 'length' => 1, 1876 'notnull' => false 1877 ) 1878 ); 1879} 1880 1881if (!$ilDB->tableColumnExists('wiki_stat_user', 'ts_day')) { 1882 $ilDB->addTableColumn( 1883 'wiki_stat_user', 1884 'ts_day', 1885 array( 1886 'type' => 'text', 1887 'length' => 10, 1888 'fixed' => true, 1889 'notnull' => false 1890 ) 1891 ); 1892 $ilDB->addTableColumn( 1893 'wiki_stat_user', 1894 'ts_hour', 1895 array( 1896 'type' => 'integer', 1897 'length' => 1, 1898 'notnull' => false 1899 ) 1900 ); 1901} 1902 1903if (!$ilDB->tableColumnExists('wiki_stat_page_user', 'ts_day')) { 1904 $ilDB->addTableColumn( 1905 'wiki_stat_page_user', 1906 'ts_day', 1907 array( 1908 'type' => 'text', 1909 'length' => 10, 1910 'fixed' => true, 1911 'notnull' => false 1912 ) 1913 ); 1914 $ilDB->addTableColumn( 1915 'wiki_stat_page_user', 1916 'ts_hour', 1917 array( 1918 'type' => 'integer', 1919 'length' => 1, 1920 'notnull' => false 1921 ) 1922 ); 1923} 1924 1925?> 1926<#4262> 1927<?php 1928 if (!$ilDB->tableExists('wiki_page_template')) { 1929 $ilDB->createTable('wiki_page_template', array( 1930 'wiki_id' => array( 1931 'type' => 'integer', 1932 'length' => 4, 1933 'notnull' => true 1934 ), 1935 'wpage_id' => array( 1936 'type' => 'integer', 1937 'length' => 4, 1938 'notnull' => true 1939 ) 1940 )); 1941 1942 $ilDB->addPrimaryKey('wiki_page_template', array('wiki_id', 'wpage_id')); 1943 } 1944?> 1945<#4263> 1946<?php 1947if (!$ilDB->tableColumnExists('wiki_page_template', 'new_pages')) { 1948 $ilDB->addTableColumn( 1949 'wiki_page_template', 1950 'new_pages', 1951 array( 1952 'type' => 'integer', 1953 'length' => 1, 1954 'notnull' => true, 1955 'default' => 0 1956 ) 1957 ); 1958 $ilDB->addTableColumn( 1959 'wiki_page_template', 1960 'add_to_page', 1961 array( 1962 'type' => 'integer', 1963 'length' => 1, 1964 'notnull' => true, 1965 'default' => 0 1966 ) 1967 ); 1968} 1969?> 1970<#4264> 1971<?php 1972if (!$ilDB->tableColumnExists('il_wiki_data', 'empty_page_templ')) { 1973 $ilDB->addTableColumn( 1974 'il_wiki_data', 1975 'empty_page_templ', 1976 array( 1977 'type' => 'integer', 1978 'length' => 1, 1979 'notnull' => true, 1980 'default' => 1 1981 ) 1982 ); 1983} 1984?> 1985<#4265> 1986<?php 1987 1988if (!$ilDB->tableColumnExists('wiki_stat_page', 'deleted')) { 1989 $ilDB->addTableColumn( 1990 'wiki_stat_page', 1991 'deleted', 1992 array( 1993 'type' => 'integer', 1994 'length' => 1, 1995 'notnull' => true, 1996 'default' => 0 1997 ) 1998 ); 1999} 2000 2001?> 2002<#4266> 2003<?php 2004 2005include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 2006 2007$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 2008if ($wiki_type_id) { 2009 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('statistics_read', 'Read Statistics', 'object', 2200); 2010 if ($new_ops_id) { 2011 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 2012 2013 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 2014 if ($src_ops_id) { 2015 ilDBUpdateNewObjectType::cloneOperation('wiki', $src_ops_id, $new_ops_id); 2016 } 2017 } 2018} 2019 2020?> 2021<#4267> 2022<?php 2023 $ilCtrlStructureReader->getStructure(); 2024?> 2025<#4268> 2026<?php 2027 $ilDB->insert('il_dcl_datatype_prop', array( 2028 'id' => array('integer', 13), 2029 'datatype_id' => array('integer', 8), 2030 'title' => array('text', 'display_action_menu'), 2031 'inputformat' => array('integer', 4), 2032 )); 2033?> 2034<#4269> 2035<?php 2036 $ilDB->modifyTableColumn( 2037 'help_map', 2038 'screen_id', 2039 array( 2040 "type" => "text", 2041 "length" => 100, 2042 "notnull" => true, 2043 'fixed' => false 2044 ) 2045); 2046?> 2047<#4270> 2048 <?php 2049 $ilDB->modifyTableColumn( 2050 'help_map', 2051 'screen_sub_id', 2052 array( 2053 "type" => "text", 2054 "length" => 100, 2055 "notnull" => true, 2056 'fixed' => false 2057 ) 2058); 2059?> 2060<#4271> 2061<?php 2062 2063$client_id = basename(CLIENT_DATA_DIR); 2064$web_path = ilUtil::getWebspaceDir() . $client_id; 2065$sec_path = $web_path . "/sec"; 2066 2067if (!file_exists($sec_path)) { 2068 ilUtil::makeDir($sec_path); 2069} 2070 2071$mods = array("ilBlog", "ilPoll", "ilPortfolio"); 2072foreach ($mods as $mod) { 2073 $mod_path = $web_path . "/" . $mod; 2074 if (file_exists($mod_path)) { 2075 $mod_sec_path = $sec_path . "/" . $mod; 2076 rename($mod_path, $mod_sec_path); 2077 } 2078} 2079 2080?> 2081<#4272> 2082<?php 2083$ilCtrlStructureReader->getStructure(); 2084?> 2085<#4273> 2086<?php 2087//$ilDB->insert('il_dcl_datatype_prop', array( 2088// 'id' => array('integer', 14), 2089// 'datatype_id' => array('integer', 2), 2090// 'title' => array('text', 'link_detail_page'), 2091// 'inputformat' => array('integer', 4), 2092//)); 2093//$ilDB->insert('il_dcl_datatype_prop', array( 2094// 'id' => array('integer', 15), 2095// 'datatype_id' => array('integer', 9), 2096// 'title' => array('text', 'link_detail_page'), 2097// 'inputformat' => array('integer', 4), 2098//)); 2099?> 2100<#4274> 2101<?php 2102 2103$ilDB->dropTable("ut_access"); // #13663 2104 2105?> 2106<#4275> 2107<?php 2108 2109if (!$ilDB->tableExists('obj_user_data_hist')) { 2110 $ilDB->createTable('obj_user_data_hist', array( 2111 'obj_id' => array( 2112 'type' => 'integer', 2113 'length' => 4, 2114 'notnull' => true 2115 ), 2116 'usr_id' => array( 2117 'type' => 'integer', 2118 'length' => 4, 2119 'notnull' => true 2120 ), 2121 'update_user' => array( 2122 'type' => 'integer', 2123 'length' => 4, 2124 'notnull' => true 2125 ), 2126 'editing_time' => array( 2127 'type' => 'timestamp', 2128 'notnull' => false 2129 ) 2130 )); 2131 $ilDB->addPrimaryKey('obj_user_data_hist', array('obj_id','usr_id')); 2132} 2133 2134?> 2135<#4276> 2136<?php 2137if (!$ilDB->tableColumnExists('frm_threads', 'avg_rating')) { 2138 $ilDB->addTableColumn( 2139 'frm_threads', 2140 'avg_rating', 2141 array( 2142 'type' => 'float', 2143 'notnull' => true, 2144 'default' => 0 2145 ) 2146 ); 2147} 2148?> 2149<#4277> 2150<?php 2151$ilCtrlStructureReader->getStructure(); 2152?> 2153<#4278> 2154<?php 2155if (!$ilDB->tableColumnExists('frm_settings', 'thread_rating')) { 2156 $ilDB->addTableColumn( 2157 'frm_settings', 2158 'thread_rating', 2159 array( 2160 'type' => 'integer', 2161 'length' => 1, 2162 'notnull' => true, 2163 'default' => 0 2164 ) 2165 ); 2166} 2167?> 2168<#4279> 2169<?php 2170if (!$ilDB->tableColumnExists('exc_assignment', 'peer_file')) { 2171 $ilDB->addTableColumn( 2172 'exc_assignment', 2173 'peer_file', 2174 array( 2175 'type' => 'integer', 2176 'length' => 1, 2177 'notnull' => false, 2178 'default' => 0 2179 ) 2180 ); 2181} 2182?> 2183<#4280> 2184<?php 2185if (!$ilDB->tableColumnExists('exc_assignment_peer', 'upload')) { 2186 $ilDB->addTableColumn( 2187 'exc_assignment_peer', 2188 'upload', 2189 array( 2190 'type' => 'text', 2191 'length' => 1000, 2192 'notnull' => false, 2193 'fixed' => false 2194 ) 2195 ); 2196} 2197?> 2198<#4281> 2199<?php 2200if (!$ilDB->tableColumnExists('exc_assignment', 'peer_prsl')) { 2201 $ilDB->addTableColumn( 2202 'exc_assignment', 2203 'peer_prsl', 2204 array( 2205 'type' => 'integer', 2206 'length' => 1, 2207 'notnull' => false, 2208 'default' => 0 2209 ) 2210 ); 2211} 2212?> 2213<#4282> 2214<?php 2215if (!$ilDB->tableColumnExists('exc_assignment', 'fb_date')) { 2216 $ilDB->addTableColumn( 2217 'exc_assignment', 2218 'fb_date', 2219 array( 2220 'type' => 'integer', 2221 'length' => 1, 2222 'notnull' => true, 2223 'default' => 1 2224 ) 2225 ); 2226} 2227?> 2228<#4283> 2229<?php 2230if (!$ilDB->tableColumnExists('container_sorting_set', 'sort_direction')) { 2231 $ilDB->addTableColumn( 2232 'container_sorting_set', 2233 'sort_direction', 2234 array( 2235 'type' => 'integer', 2236 'length' => 1, 2237 'notnull' => true, 2238 'default' => 0 2239 ) 2240 ); 2241} 2242?> 2243<#4284> 2244<?php 2245if (!$ilDB->tableExists('tst_seq_qst_checked')) { 2246 $ilDB->createTable('tst_seq_qst_checked', array( 2247 'active_fi' => array( 2248 'type' => 'integer', 2249 'length' => 4, 2250 'notnull' => true, 2251 'default' => 0 2252 ), 2253 'pass' => array( 2254 'type' => 'integer', 2255 'length' => 4, 2256 'notnull' => true, 2257 'default' => 0 2258 ), 2259 'question_fi' => array( 2260 'type' => 'integer', 2261 'length' => 4, 2262 'notnull' => true, 2263 'default' => 0 2264 ) 2265 )); 2266 2267 $ilDB->addPrimaryKey('tst_seq_qst_checked', array('active_fi','pass', 'question_fi')); 2268} 2269 2270if (!$ilDB->tableColumnExists('tst_tests', 'inst_fb_answer_fixation')) { 2271 $ilDB->addTableColumn('tst_tests', 'inst_fb_answer_fixation', array( 2272 'type' => 'integer', 2273 'length' => 1, 2274 'notnull' => false, 2275 'default' => null 2276 )); 2277} 2278?> 2279<#4285> 2280<?php 2281if (!$ilDB->tableExists('container_sorting_bl')) { 2282 $ilDB->createTable('container_sorting_bl', array( 2283 'obj_id' => array( 2284 'type' => 'integer', 2285 'length' => 4, 2286 'notnull' => true, 2287 'default' => 0 2288 ), 2289 'block_ids' => array( 2290 'type' => 'text', 2291 'length' => 4000, 2292 'notnull' => false, 2293 ) 2294 )); 2295 2296 $ilDB->addPrimaryKey('container_sorting_bl', array('obj_id')); 2297} 2298?> 2299<#4286> 2300<?php 2301$ilCtrlStructureReader->getStructure(); 2302?> 2303<#4287> 2304<?php 2305 2306include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 2307 2308$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("read_learning_progress"); 2309if (!$tgt_ops_id) { 2310 $tgt_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('read_learning_progress', 'Read Learning Progress', 'object', 2300); 2311} 2312 2313$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 2314if ($src_ops_id && 2315 $tgt_ops_id) { 2316 // see ilObjectLP 2317 $lp_types = array("crs", "grp", "fold", "lm", "htlm", "sahs", "tst", "exc", "sess"); 2318 2319 foreach ($lp_types as $lp_type) { 2320 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId($lp_type); 2321 if ($lp_type_id) { 2322 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $tgt_ops_id); 2323 ilDBUpdateNewObjectType::cloneOperation($lp_type, $src_ops_id, $tgt_ops_id); 2324 } 2325 } 2326} 2327 2328?> 2329<#4288> 2330<?php 2331$ilCtrlStructureReader->getStructure(); 2332?> 2333<#4289> 2334<?php 2335$def = array( 2336 'type' => 'integer', 2337 'length' => 1, 2338 'notnull' => true, 2339 'default' => 0 2340 ); 2341$ilDB->addTableColumn("content_object", "progr_icons", $def); 2342?> 2343<#4290> 2344<?php 2345$def = array( 2346 'type' => 'integer', 2347 'length' => 1, 2348 'notnull' => true, 2349 'default' => 0 2350 ); 2351$ilDB->addTableColumn("content_object", "store_tries", $def); 2352?> 2353<#4291> 2354<?php 2355 $query = 'DELETE FROM rbac_fa WHERE parent = ' . $ilDB->quote(0, 'integer'); 2356 $ilDB->manipulate($query); 2357 2358 2359 /*$query = 'UPDATE rbac_fa f '. 2360 'SET parent = '. 2361 '(SELECT t.parent FROM tree t where t.child = f.parent) '. 2362 'WHERE f.parent != '.$ilDB->quote(8,'integer').' '. 2363 'AND EXISTS (SELECT t.parent FROM tree t where t.child = f.parent) '; 2364 $ilDB->manipulate($query);*/ 2365 2366 global $ilLog; 2367 2368 if (!$ilDB->tableColumnExists('rbac_fa', 'old_parent')) { 2369 $ilDB->addTableColumn( 2370 'rbac_fa', 2371 'old_parent', 2372 array( 2373 "type" => "integer", 2374 "notnull" => true, 2375 "length" => 8, 2376 "default" => 0 2377 ) 2378 ); 2379 $ilLog->write("Created new temporary column: rbac_fa->old_parent"); 2380 } 2381 2382 if (!$ilDB->tableExists('rbac_fa_temp')) { 2383 $fields = array( 2384 'role_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 2385 'parent_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0) 2386 ); 2387 $ilDB->createTable('rbac_fa_temp', $fields); 2388 $ilDB->addPrimaryKey('rbac_fa_temp', array('role_id', 'parent_id')); 2389 $ilLog->write("Created new temporary table: rbac_fa_temp"); 2390 } 2391 2392 2393 $stmt = $ilDB->prepareManip("UPDATE rbac_fa SET parent = ?, old_parent = ? WHERE rol_id = ? AND parent = ?", array("integer", "integer", "integer", "integer")); 2394 $stmt2 = $ilDB->prepareManip("INSERT INTO rbac_fa_temp (role_id, parent_id) VALUES(?, ?)", array("integer", "integer")); 2395 $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")); 2396 2397 $query = " 2398 SELECT f.*, t.parent grandparent 2399 FROM rbac_fa f 2400 INNER JOIN tree t ON t.child = f.parent 2401 LEFT JOIN rbac_fa_temp 2402 ON rbac_fa_temp.role_id = f.rol_id 2403 AND rbac_fa_temp.parent_id = old_parent 2404 WHERE f.parent != 8 AND rbac_fa_temp.role_id IS NULL 2405 ORDER BY f.rol_id, f.parent 2406 "; 2407 $res = $ilDB->query($query); 2408 2409 $handled_roles_by_parent = array(); 2410 2411 while ($row = $ilDB->fetchAssoc($res)) { 2412 $role_id = $row["rol_id"]; 2413 $parent_id = $row["parent"]; 2414 2415 if ($handled_roles_by_parent[$role_id][$parent_id]) { 2416 continue; 2417 } 2418 2419 $new_parent_id = $row['grandparent']; 2420 2421 $parent_res = $ilDB->execute($stmt3, array($parent_id)); 2422 $parent_row = $ilDB->fetchAssoc($parent_res); 2423 if ($parent_row['type'] != 'rolf') { 2424 $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'])); 2425 continue; 2426 } 2427 2428 if ($new_parent_id <= 0) { 2429 $ilLog->write(sprintf("Could not migrate record with role_id %s and parent id %s because the grandparent is 0", $role_id, $parent_id)); 2430 continue; 2431 } 2432 2433 $ilDB->execute($stmt, array($new_parent_id, $parent_id , $role_id, $parent_id)); 2434 $ilDB->execute($stmt2, array($role_id, $parent_id)); 2435 $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)); 2436 2437 $handled_roles_by_parent[$role_id][$parent_id] = true; 2438 } 2439 2440 if ($ilDB->tableColumnExists('rbac_fa', 'old_parent')) { 2441 $ilDB->dropTableColumn('rbac_fa', 'old_parent'); 2442 $ilLog->write("Dropped new temporary column: rbac_fa->old_parent"); 2443 } 2444 2445 if ($ilDB->tableExists('rbac_fa_temp')) { 2446 $ilDB->dropTable('rbac_fa_temp'); 2447 $ilLog->write("Dropped new temporary table: rbac_fa_temp"); 2448 } 2449?> 2450 2451<#4292> 2452<?php 2453 $query = 'DELETE FROM rbac_templates WHERE parent = ' . $ilDB->quote(0, 'integer'); 2454 $ilDB->manipulate($query); 2455 2456 /*$query = 'UPDATE rbac_templates rt '. 2457 'SET parent = '. 2458 '(SELECT t.parent FROM tree t WHERE t.child = rt.parent) '. 2459 'WHERE rt.parent != '.$ilDB->quote(8,'integer').' '. 2460 'AND EXISTS (SELECT t.parent FROM tree t WHERE t.child = rt.parent) '; 2461 $ilDB->manipulate($query);*/ 2462 2463 global $ilLog; 2464 2465 if (!$ilDB->tableColumnExists('rbac_templates', 'old_parent')) { 2466 $ilDB->addTableColumn( 2467 'rbac_templates', 2468 'old_parent', 2469 array( 2470 "type" => "integer", 2471 "notnull" => true, 2472 "length" => 8, 2473 "default" => 0 2474 ) 2475 ); 2476 $ilLog->write("Created new temporary column: rbac_templates->old_parent"); 2477 } 2478 2479 if (!$ilDB->tableExists('rbac_templates_temp')) { 2480 $fields = array( 2481 'role_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 2482 'parent_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0) 2483 ); 2484 $ilDB->createTable('rbac_templates_temp', $fields); 2485 $ilDB->addPrimaryKey('rbac_templates_temp', array('role_id', 'parent_id')); 2486 $ilLog->write("Created new temporary table: rbac_templates_temp"); 2487 } 2488 2489 2490 $stmt = $ilDB->prepareManip("UPDATE rbac_templates SET parent = ?, old_parent = ? WHERE rol_id = ? AND parent = ?", array("integer", "integer", "integer", "integer")); 2491 $stmt2 = $ilDB->prepareManip("INSERT INTO rbac_templates_temp (role_id, parent_id) VALUES(?, ?)", array("integer", "integer")); 2492 $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")); 2493 2494 $query = " 2495 SELECT f.*, t.parent grandparent 2496 FROM rbac_templates f 2497 INNER JOIN tree t ON t.child = f.parent 2498 LEFT JOIN rbac_templates_temp 2499 ON rbac_templates_temp.role_id = f.rol_id 2500 AND rbac_templates_temp.parent_id = old_parent 2501 WHERE f.parent != 8 AND rbac_templates_temp.role_id IS NULL 2502 ORDER BY f.rol_id, f.parent 2503 "; 2504 $res = $ilDB->query($query); 2505 2506 $handled_roles_by_parent = array(); 2507 2508 while ($row = $ilDB->fetchAssoc($res)) { 2509 $role_id = $row["rol_id"]; 2510 $parent_id = $row["parent"]; 2511 2512 if ($handled_roles_by_parent[$role_id][$parent_id]) { 2513 continue; 2514 } 2515 2516 $new_parent_id = $row['grandparent']; 2517 2518 $parent_res = $ilDB->execute($stmt3, array($parent_id)); 2519 $parent_row = $ilDB->fetchAssoc($parent_res); 2520 if ($parent_row['type'] != 'rolf') { 2521 $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'])); 2522 continue; 2523 } 2524 2525 if ($new_parent_id <= 0) { 2526 $ilLog->write(sprintf("Could not migrate record with role_id %s and parent id %s because the grandparent is 0", $role_id, $parent_id)); 2527 continue; 2528 } 2529 2530 $ilDB->execute($stmt, array($new_parent_id, $parent_id , $role_id, $parent_id)); 2531 $ilDB->execute($stmt2, array($role_id, $parent_id)); 2532 $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)); 2533 2534 $handled_roles_by_parent[$role_id][$parent_id] = true; 2535 } 2536 2537 if ($ilDB->tableColumnExists('rbac_templates', 'old_parent')) { 2538 $ilDB->dropTableColumn('rbac_templates', 'old_parent'); 2539 $ilLog->write("Dropped new temporary column: rbac_templates->old_parent"); 2540 } 2541 2542 if ($ilDB->tableExists('rbac_templates_temp')) { 2543 $ilDB->dropTable('rbac_templates_temp'); 2544 $ilLog->write("Dropped new temporary table: rbac_templates_temp"); 2545 } 2546?> 2547<#4293> 2548<?php 2549$def = array( 2550 'type' => 'integer', 2551 'length' => 1, 2552 'notnull' => true, 2553 'default' => 0 2554 ); 2555$ilDB->addTableColumn("content_object", "restrict_forw_nav", $def); 2556?> 2557<#4294> 2558<?php 2559 2560// category taxonomy custom blocks are obsolete 2561$ilDB->manipulate("DELETE FROM il_custom_block" . 2562 " WHERE context_obj_type = " . $ilDB->quote("cat", "text") . 2563 " AND context_sub_obj_type = " . $ilDB->quote("tax", "text")); 2564 2565?> 2566<#4295> 2567<?php 2568$ilCtrlStructureReader->getStructure(); 2569?> 2570<#4296> 2571<?php 2572if (!$ilDB->tableColumnExists('container_sorting_set', 'new_items_position')) { 2573 $def = array( 2574 'type' => 'integer', 2575 'length' => 1, 2576 'notnull' => true, 2577 'default' => 1 2578 ); 2579 $ilDB->addTableColumn('container_sorting_set', 'new_items_position', $def); 2580} 2581 2582if (!$ilDB->tableColumnExists('container_sorting_set', 'new_items_order')) { 2583 $def = array( 2584 'type' => 'integer', 2585 'length' => 1, 2586 'notnull' => true, 2587 'default' => 0 2588 ); 2589 $ilDB->addTableColumn('container_sorting_set', 'new_items_order', $def); 2590} 2591?> 2592<#4297> 2593<?php 2594 $ilCtrlStructureReader->getStructure(); 2595?> 2596<#4298> 2597<?php 2598if (!$ilDB->tableExists('usr_cron_mail_reminder')) { 2599 $fields = array( 2600 'usr_id' => array( 2601 'type' => 'integer', 2602 'length' => 4, 2603 'default' => 0, 2604 'notnull' => true 2605 ), 2606 'ts' => array( 2607 'type' => 'integer', 2608 'length' => 4, 2609 'default' => 0, 2610 'notnull' => true 2611 ) 2612 ); 2613 $ilDB->createTable('usr_cron_mail_reminder', $fields); 2614 $ilDB->addPrimaryKey('usr_cron_mail_reminder', array('usr_id')); 2615} 2616?> 2617<#4299> 2618 <?php 2619 if (!$ilDB->tableExists('orgu_types')) { 2620 $fields = array( 2621 'id' => array('type' => 'integer', 'length' => 4,'notnull' => true, 'default' => 0), 2622 'default_lang' => array('type' => 'text', 'notnull' => true, 'length' => 4, 'fixed' => false), 2623 'icon' => array('type' => 'text', 'length' => 256, 'notnull' => false), 2624 'owner' => array('type' => 'integer', 'notnull' => true, 'length' => 4), 2625 'create_date' => array('type' => 'timestamp'), 2626 'last_update' => array('type' => 'timestamp'), 2627 ); 2628 $ilDB->createTable('orgu_types', $fields); 2629 $ilDB->addPrimaryKey('orgu_types', array('id')); 2630 $ilDB->createSequence('orgu_types'); 2631 } 2632 ?> 2633<#4300> 2634 <?php 2635 if (!$ilDB->tableExists('orgu_data')) { 2636 $fields = array( 2637 'orgu_id' => array('type' => 'integer', 'length' => 4,'notnull' => true, 'default' => 0), 2638 'orgu_type_id' => array('type' => 'integer', 'notnull' => false, 'length' => 4), 2639 ); 2640 $ilDB->createTable('orgu_data', $fields); 2641 $ilDB->addPrimaryKey('orgu_data', array('orgu_id')); 2642 } 2643 ?> 2644<#4301> 2645 <?php 2646 if (!$ilDB->tableExists('orgu_types_trans')) { 2647 $fields = array( 2648 'orgu_type_id' => array('type' => 'integer', 'length' => 4,'notnull' => true), 2649 'lang' => array('type' => 'text', 'notnull' => true, 'length' => 4), 2650 'member' => array('type' => 'text', 'length' => 32, 'notnull' => true), 2651 'value' => array('type' => 'text', 'length' => 4000, 'notnull' => false), 2652 ); 2653 $ilDB->createTable('orgu_types_trans', $fields); 2654 $ilDB->addPrimaryKey('orgu_types_trans', array('orgu_type_id', 'lang', 'member')); 2655 } 2656 ?> 2657<#4302> 2658 <?php 2659 $ilCtrlStructureReader->getStructure(); 2660 ?> 2661<#4303> 2662 <?php 2663 if (!$ilDB->tableExists('orgu_types_adv_md_rec')) { 2664 $fields = array( 2665 'type_id' => array('type' => 'integer', 'length' => 4,'notnull' => true), 2666 'rec_id' => array('type' => 'integer', 'notnull' => true, 'length' => 4), 2667 ); 2668 $ilDB->createTable('orgu_types_adv_md_rec', $fields); 2669 $ilDB->addPrimaryKey('orgu_types_adv_md_rec', array('type_id', 'rec_id')); 2670 } 2671 ?> 2672<#4304> 2673<?php 2674 $ilDB->modifyTableColumn( 2675 'ecs_server', 2676 'auth_pass', 2677 array( 2678 "type" => "text", 2679 "length" => 128, 2680 "notnull" => false, 2681 'fixed' => false 2682 ) 2683 ); 2684?> 2685<#4305> 2686<?php 2687 2688// #13822 2689include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 2690ilDBUpdateNewObjectType::varchar2text('exc_assignment_peer', 'pcomment'); 2691 2692?> 2693<#4306> 2694<?php 2695/** 2696 * @var $ilDB ilDB 2697 */ 2698global $ilDB; 2699 2700$ilDB->modifyTableColumn('usr_data', 'passwd', array( 2701 'type' => 'text', 2702 'length' => 80, 2703 'notnull' => false, 2704 'default' => null 2705)); 2706?> 2707<#4307> 2708<?php 2709$ilDB->manipulateF( 2710 'DELETE FROM settings WHERE keyword = %s', 2711 array('text'), 2712 array('usr_settings_export_password') 2713); 2714?> 2715<#4308> 2716<?php 2717if (!$ilDB->tableColumnExists('usr_data', 'passwd_enc_type')) { 2718 $ilDB->addTableColumn('usr_data', 'passwd_enc_type', array( 2719 'type' => 'text', 2720 'length' => 10, 2721 'notnull' => false, 2722 'default' => null 2723 )); 2724} 2725?> 2726<#4309> 2727<?php 2728// We have to handle alle users with a password. We cannot rely on the auth_mode information. 2729$ilDB->manipulateF( 2730 ' 2731 UPDATE usr_data 2732 SET passwd_enc_type = %s 2733 WHERE (SUBSTR(passwd, 1, 4) = %s OR SUBSTR(passwd, 1, 4) = %s) AND passwd IS NOT NULL 2734 ', 2735 array('text', 'text', 'text'), 2736 array('bcrypt', '$2a$', '$2y$') 2737); 2738$ilDB->manipulateF( 2739 ' 2740 UPDATE usr_data 2741 SET passwd_enc_type = %s 2742 WHERE SUBSTR(passwd, 1, 4) != %s AND SUBSTR(passwd, 1, 4) != %s AND LENGTH(passwd) = 32 AND passwd IS NOT NULL 2743 ', 2744 array('text', 'text', 'text'), 2745 array('md5', '$2a$', '$2y$') 2746); 2747?> 2748<#4310> 2749<?php 2750if (!$ilDB->tableColumnExists('usr_data', 'passwd_salt')) { 2751 $ilDB->addTableColumn('usr_data', 'passwd_salt', array( 2752 'type' => 'text', 2753 'length' => 32, 2754 'notnull' => false, 2755 'default' => null 2756 )); 2757} 2758?> 2759<#4311> 2760<?php 2761if ($ilDB->tableColumnExists('usr_data', 'i2passwd')) { 2762 $ilDB->dropTableColumn('usr_data', 'i2passwd'); 2763} 2764?> 2765<#4312> 2766<?php 2767 2768 $a_obj_id = array(); 2769 $a_scope_id = array(); 2770 $a_scope_id_one = array(); 2771 //select targetobjectiveid = cmi_gobjective.objective_id 2772 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid 2773 FROM cp_package, cp_mapinfo, cp_node 2774 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 2775 GROUP BY cp_mapinfo.targetobjectiveid'); 2776 while ($data = $ilDB->fetchAssoc($res)) { 2777 $a_obj_id[] = $data['targetobjectiveid']; 2778 } 2779 //make arrays 2780 for ($i = 0;$i < count($a_obj_id);$i++) { 2781 $a_scope_id[$a_obj_id[$i]] = array(); 2782 $a_scope_id_one[$a_obj_id[$i]] = array(); 2783 } 2784 //only global_to_system=0 -> should be updated 2785 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid, cp_package.obj_id 2786 FROM cp_package, cp_mapinfo, cp_node 2787 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'); 2788 while ($data = $ilDB->fetchAssoc($res)) { 2789 $a_scope_id[$data['targetobjectiveid']][] = $data['obj_id']; 2790 } 2791 //only global_to_system=1 -> should maintain 2792 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid, cp_package.obj_id 2793 FROM cp_package, cp_mapinfo, cp_node 2794 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'); 2795 while ($data = $ilDB->fetchAssoc($res)) { 2796 $a_scope_id_one[$data['targetobjectiveid']][] = $data['obj_id']; 2797 } 2798 2799 //for all targetobjectiveid 2800 for ($i = 0;$i < count($a_obj_id);$i++) { 2801 $a_toupdate = array(); 2802 //get old data without correct scope_id 2803 $res = $ilDB->queryF( 2804 "SELECT * FROM cmi_gobjective WHERE scope_id = %s AND objective_id = %s", 2805 array('integer', 'text'), 2806 array(0, $a_obj_id[$i]) 2807 ); 2808 while ($data = $ilDB->fetchAssoc($res)) { 2809 $a_toupdate[] = $data; 2810 } 2811 //check specific possible scope_ids with global_to_system=0 -> a_o 2812 $a_o = $a_scope_id[$a_obj_id[$i]]; 2813 for ($z = 0; $z < count($a_o); $z++) { 2814 //for all existing entries 2815 for ($y = 0; $y < count($a_toupdate); $y++) { 2816 $a_t = $a_toupdate[$y]; 2817 //only users attempted 2818 $res = $ilDB->queryF( 2819 'SELECT user_id FROM sahs_user WHERE obj_id=%s AND user_id=%s', 2820 array('integer', 'integer'), 2821 array($a_o[$z], $a_t['user_id']) 2822 ); 2823 if ($ilDB->numRows($res)) { 2824 //check existing entry 2825 $res = $ilDB->queryF( 2826 'SELECT user_id FROM cmi_gobjective WHERE scope_id=%s AND user_id=%s AND objective_id=%s', 2827 array('integer', 'integer','text'), 2828 array($a_o[$z], $a_t['user_id'],$a_t['objective_id']) 2829 ); 2830 if (!$ilDB->numRows($res)) { 2831 $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" 2832 . " (" . $ilDB->quote($a_t['user_id'], "integer") 2833 . ", " . $ilDB->quote($a_t['satisfied'], "text") 2834 . ", " . $ilDB->quote($a_t['measure'], "text") 2835 . ", " . $ilDB->quote($a_o[$z], "integer") 2836 . ", " . $ilDB->quote($a_t['status'], "text") 2837 . ", " . $ilDB->quote($a_t['objective_id'], "text") 2838 . ", " . $ilDB->quote($a_t['score_raw'], "text") 2839 . ", " . $ilDB->quote($a_t['score_min'], "text") 2840 . ", " . $ilDB->quote($a_t['score_max'], "text") 2841 . ", " . $ilDB->quote($a_t['progress_measure'], "text") 2842 . ", " . $ilDB->quote($a_t['completion_status'], "text") 2843 . ")"); 2844 } 2845 } 2846 } 2847 } 2848 //delete entries if global_to_system=1 is not used by any learning module 2849 if (count($a_scope_id_one[$a_obj_id[$i]]) == 0) { 2850 $ilDB->queryF( 2851 'DELETE FROM cmi_gobjective WHERE scope_id = %s AND objective_id = %s', 2852 array('integer', 'text'), 2853 array(0, $a_obj_id[$i]) 2854 ); 2855 } 2856 } 2857 2858 2859?> 2860<#4313> 2861<?php 2862if ($ilDB->tableColumnExists('exc_assignment_peer', 'upload')) { 2863 $ilDB->dropTableColumn('exc_assignment_peer', 'upload'); 2864} 2865?> 2866 2867<#4314> 2868<?php 2869 2870$res = $ilDB->queryF( 2871 "SELECT COUNT(*) cnt FROM qpl_qst_type WHERE type_tag = %s", 2872 array('text'), 2873 array('assKprimChoice') 2874); 2875 2876$row = $ilDB->fetchAssoc($res); 2877 2878if (!$row['cnt']) { 2879 $res = $ilDB->query("SELECT MAX(question_type_id) maxid FROM qpl_qst_type"); 2880 $data = $ilDB->fetchAssoc($res); 2881 $nextId = $data['maxid'] + 1; 2882 2883 $ilDB->insert('qpl_qst_type', array( 2884 'question_type_id' => array('integer', $nextId), 2885 'type_tag' => array('text', 'assKprimChoice'), 2886 'plugin' => array('integer', 0) 2887 )); 2888} 2889 2890?> 2891 2892<#4315> 2893<?php 2894 2895if (!$ilDB->tableExists('qpl_qst_kprim')) { 2896 $ilDB->createTable('qpl_qst_kprim', array( 2897 'question_fi' => array( 2898 'type' => 'integer', 2899 'length' => 4, 2900 'notnull' => true, 2901 'default' => 0 2902 ), 2903 'shuffle_answers' => array( 2904 'type' => 'integer', 2905 'length' => 1, 2906 'notnull' => true, 2907 'default' => 0 2908 ), 2909 'answer_type' => array( 2910 'type' => 'text', 2911 'length' => 16, 2912 'notnull' => true, 2913 'default' => 'singleLine' 2914 ), 2915 'thumb_size' => array( 2916 'type' => 'integer', 2917 'length' => 4, 2918 'notnull' => false, 2919 'default' => null 2920 ), 2921 'opt_label' => array( 2922 'type' => 'text', 2923 'length' => 32, 2924 'notnull' => true, 2925 'default' => 'right/wrong' 2926 ), 2927 'custom_true' => array( 2928 'type' => 'text', 2929 'length' => 255, 2930 'notnull' => false, 2931 'default' => null 2932 ), 2933 'custom_false' => array( 2934 'type' => 'text', 2935 'length' => 255, 2936 'notnull' => false, 2937 'default' => null 2938 ), 2939 'score_partsol' => array( 2940 'type' => 'integer', 2941 'length' => 1, 2942 'notnull' => true, 2943 'default' => 0 2944 ), 2945 'feedback_setting' => array( 2946 'type' => 'integer', 2947 'length' => 4, 2948 'notnull' => true, 2949 'default' => 1 2950 ) 2951 )); 2952 2953 $ilDB->addPrimaryKey('qpl_qst_kprim', array('question_fi')); 2954} 2955 2956?> 2957 2958<#4316> 2959<?php 2960 2961if (!$ilDB->tableExists('qpl_a_kprim')) { 2962 $ilDB->createTable('qpl_a_kprim', array( 2963 'question_fi' => array( 2964 'type' => 'integer', 2965 'length' => 4, 2966 'notnull' => true, 2967 'default' => 0 2968 ), 2969 'position' => array( 2970 'type' => 'integer', 2971 'length' => 4, 2972 'notnull' => true, 2973 'default' => 0 2974 ), 2975 'answertext' => array( 2976 'type' => 'text', 2977 'length' => 1000, 2978 'notnull' => false, 2979 'default' => null 2980 ), 2981 'imagefile' => array( 2982 'type' => 'text', 2983 'length' => 255, 2984 'notnull' => false, 2985 'default' => null 2986 ), 2987 'correctness' => array( 2988 'type' => 'integer', 2989 'length' => 1, 2990 'notnull' => true, 2991 'default' => 0 2992 ) 2993 )); 2994 2995 $ilDB->addPrimaryKey('qpl_a_kprim', array('question_fi', 'position')); 2996 $ilDB->addIndex('qpl_a_kprim', array('question_fi'), 'i1'); 2997} 2998?> 2999 3000<#4317> 3001<?php 3002 $ilCtrlStructureReader->getStructure(); 3003?> 3004<#4318> 3005<?php 3006 3007// #13858 3008include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 3009ilDBUpdateNewObjectType::varchar2text('rbac_log', 'data'); 3010 3011?> 3012<#4319> 3013<?php 3014 3015$ilDB->addTableColumn('page_qst_answer', 'unlocked', array( 3016 "type" => "integer", 3017 "notnull" => true, 3018 "length" => 1, 3019 "default" => 0 3020)); 3021 3022?> 3023<#4320> 3024<?php 3025/** @var ilDB $ilDB */ 3026if (!$ilDB->tableColumnExists('tst_solutions', 'step')) { 3027 $ilDB->addTableColumn('tst_solutions', 'step', array( 3028 'type' => 'integer', 3029 'length' => 4, 3030 'notnull' => false, 3031 'default' => null 3032 )); 3033} 3034?> 3035<#4321> 3036<?php 3037/** @var ilDB $ilDB */ 3038if (!$ilDB->tableColumnExists('tst_test_result', 'step')) { 3039 $ilDB->addTableColumn('tst_test_result', 'step', array( 3040 'type' => 'integer', 3041 'length' => 4, 3042 'notnull' => false, 3043 'default' => null 3044 )); 3045} 3046?> 3047 3048<#4322> 3049<?php 3050 3051 $ilDB->addTableColumn('event', 'reg_type', array( 3052 'type' => 'integer', 3053 'length' => 2, 3054 'notnull' => false, 3055 'default' => 0 3056 )); 3057 3058?> 3059 3060<#4323> 3061<?php 3062 3063 $query = 'UPDATE event set reg_type = registration'; 3064 $ilDB->manipulate($query); 3065?> 3066 3067<#4324> 3068<?php 3069 $ilDB->addTableColumn('event', 'reg_limit_users', array( 3070 'type' => 'integer', 3071 'length' => 4, 3072 'notnull' => false, 3073 'default' => 0 3074 )); 3075 3076?> 3077<#4325> 3078<?php 3079 $ilDB->addTableColumn('event', 'reg_waiting_list', array( 3080 'type' => 'integer', 3081 'length' => 1, 3082 'notnull' => false, 3083 'default' => 0 3084 )); 3085 3086?> 3087<#4326> 3088<?php 3089 $ilDB->addTableColumn('event', 'reg_limited', array( 3090 'type' => 'integer', 3091 'length' => 1, 3092 'notnull' => false, 3093 'default' => 0 3094 )); 3095 3096?> 3097<#4327> 3098<?php 3099 3100include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 3101ilDBUpdateNewObjectType::addAdminNode('bibs', 'BibliographicAdmin'); 3102 3103$ilCtrlStructureReader->getStructure(); 3104?> 3105<#4328> 3106<?php 3107 3108if (!$ilDB->tableExists('il_bibl_settings')) { 3109 $ilDB->createTable('il_bibl_settings', array( 3110 'id' => array( 3111 'type' => "integer", 3112 'length' => 4, 3113 'notnull' => true, 3114 'default' => 0 3115 ), 3116 'name' => array( 3117 'type' => 'text', 3118 'length' => 50, 3119 'notnull' => true, 3120 'default' => "-" 3121 ), 3122 'url' => array( 3123 'type' => 'text', 3124 'length' => 128, 3125 'notnull' => true, 3126 'default' => "-" 3127 ), 3128 'img' => array( 3129 'type' => 'text', 3130 'length' => 128, 3131 'notnull' => false 3132 ) 3133 )); 3134 $ilDB->addPrimaryKey('il_bibl_settings', array('id')); 3135} 3136?> 3137<#4329> 3138<?php 3139 if (!$ilDB->tableColumnExists('frm_threads', 'thr_author_id')) { 3140 $ilDB->addTableColumn( 3141 'frm_threads', 3142 'thr_author_id', 3143 array( 3144 'type' => 'integer', 3145 'length' => 4, 3146 'notnull' => true, 3147 'default' => 0 3148 ) 3149 ); 3150 } 3151?> 3152<#4330> 3153<?php 3154 if ($ilDB->tableColumnExists('frm_threads', 'thr_author_id')) { 3155 $ilDB->manipulate('UPDATE frm_threads SET thr_author_id = thr_usr_id'); 3156 } 3157?> 3158<#4331> 3159<?php 3160 if (!$ilDB->tableColumnExists('frm_posts', 'pos_author_id')) { 3161 $ilDB->addTableColumn( 3162 'frm_posts', 3163 'pos_author_id', 3164 array( 3165 'type' => 'integer', 3166 'length' => 4, 3167 'notnull' => true, 3168 'default' => 0 3169 ) 3170 ); 3171 } 3172?> 3173<#4332> 3174<?php 3175 if ($ilDB->tableColumnExists('frm_posts', 'pos_author_id')) { 3176 $ilDB->manipulate('UPDATE frm_posts SET pos_author_id = pos_usr_id'); 3177 } 3178?> 3179<#4333> 3180<?php 3181 if (!$ilDB->tableColumnExists('frm_threads', 'thr_display_user_id')) { 3182 $ilDB->addTableColumn( 3183 'frm_threads', 3184 'thr_display_user_id', 3185 array( 3186 'type' => 'integer', 3187 'length' => 4, 3188 'notnull' => true, 3189 'default' => 0 3190 ) 3191 ); 3192 } 3193?> 3194<#4334> 3195<?php 3196 if ($ilDB->tableColumnExists('frm_threads', 'thr_display_user_id')) { 3197 $ilDB->manipulate('UPDATE frm_threads SET thr_display_user_id = thr_usr_id'); 3198 } 3199?> 3200<#4335> 3201<?php 3202 if ($ilDB->tableColumnExists('frm_threads', 'thr_usr_id')) { 3203 $ilDB->dropTableColumn('frm_threads', 'thr_usr_id'); 3204 } 3205 3206?> 3207<#4336> 3208<?php 3209 if (!$ilDB->tableColumnExists('frm_posts', 'pos_display_user_id')) { 3210 $ilDB->addTableColumn( 3211 'frm_posts', 3212 'pos_display_user_id', 3213 array( 3214 'type' => 'integer', 3215 'length' => 4, 3216 'notnull' => true, 3217 'default' => 0 3218 ) 3219 ); 3220 } 3221?> 3222<#4337> 3223<?php 3224 if ($ilDB->tableColumnExists('frm_posts', 'pos_display_user_id')) { 3225 $ilDB->manipulate('UPDATE frm_posts SET pos_display_user_id = pos_usr_id'); 3226 } 3227?> 3228<#4338> 3229<?php 3230 if ($ilDB->tableColumnExists('frm_posts', 'pos_usr_id')) { 3231 $ilDB->dropTableColumn('frm_posts', 'pos_usr_id'); 3232 } 3233?> 3234<#4339> 3235<?php 3236 3237$ilDB->createTable('sty_media_query', array( 3238 'id' => array( 3239 'type' => "integer", 3240 'length' => 4, 3241 'notnull' => true, 3242 'default' => 0 3243 ), 3244 'style_id' => array( 3245 'type' => "integer", 3246 'length' => 4, 3247 'notnull' => true, 3248 'default' => 0 3249 ), 3250 'order_nr' => array( 3251 'type' => "integer", 3252 'length' => 4, 3253 'notnull' => true, 3254 'default' => 0 3255 ), 3256 'mquery' => array( 3257 'type' => 'text', 3258 'length' => 2000, 3259 'notnull' => false, 3260 ))); 3261?> 3262<#4340> 3263<?php 3264 $ilDB->addPrimaryKey('sty_media_query', array('id')); 3265 $ilDB->createSequence('sty_media_query'); 3266?> 3267<#4341> 3268<?php 3269 $ilDB->addTableColumn('style_parameter', 'mq_id', array( 3270 "type" => "integer", 3271 "notnull" => true, 3272 "length" => 4, 3273 "default" => 0 3274 )); 3275?> 3276<#4342> 3277<?php 3278 $ilDB->addTableColumn('style_parameter', 'custom', array( 3279 "type" => "integer", 3280 "notnull" => true, 3281 "length" => 1, 3282 "default" => 0 3283 )); 3284?> 3285 3286<#4343> 3287<?php 3288$ini = new ilIniFile(ILIAS_ABSOLUTE_PATH . "/ilias.ini.php"); 3289 3290if ($ini->read()) { 3291 $ilSetting = new ilSetting(); 3292 3293 $https_header_enable = (bool) $ilSetting->get('ps_auto_https_enabled', false); 3294 $https_header_name = (string) $ilSetting->get('ps_auto_https_headername', "ILIAS_HTTPS_ENABLED"); 3295 $https_header_value = (string) $ilSetting->get('ps_auto_https_headervalue', "1"); 3296 3297 if (!$ini->groupExists('https')) { 3298 $ini->addGroup('https'); 3299 } 3300 3301 $ini->setVariable("https", "auto_https_detect_enabled", (!$https_header_enable) ? 0 : 1); 3302 $ini->setVariable("https", "auto_https_detect_header_name", $https_header_name); 3303 $ini->setVariable("https", "auto_https_detect_header_value", $https_header_value); 3304 3305 $ini->write(); 3306} 3307?> 3308<#4344> 3309<?php 3310 $ilSetting = new ilSetting(); 3311 3312 $ilSetting->delete('ps_auto_https_enabled'); 3313 $ilSetting->delete('ps_auto_https_headername'); 3314 $ilSetting->delete('ps_auto_https_headervalue'); 3315?> 3316<#4345> 3317<?php 3318 $ilCtrlStructureReader->getStructure(); 3319?> 3320<#4346> 3321<?php 3322if (!$ilDB->tableColumnExists('tst_active', 'objective_container')) { 3323 $ilDB->addTableColumn('tst_active', 'objective_container', array( 3324 'type' => 'integer', 3325 'length' => 4, 3326 'notnull' => false, 3327 'default' => null 3328 )); 3329} 3330?> 3331<#4347> 3332<?php 3333if (!$ilDB->tableExists('qpl_a_cloze_combi_res')) { 3334 $ilDB->createTable('qpl_a_cloze_combi_res', array( 3335 'combination_id' => array( 3336 'type' => "integer", 3337 'length' => 4, 3338 'notnull' => true 3339 ), 3340 'question_fi' => array( 3341 'type' => "integer", 3342 'length' => 4, 3343 'notnull' => true 3344 ), 3345 'gap_fi' => array( 3346 'type' => "integer", 3347 'length' => 4, 3348 'notnull' => true 3349 ), 3350 'answer' => array( 3351 'type' => 'text', 3352 'length' => 1000, 3353 'notnull' => false 3354 ), 3355 'points' => array( 3356 'type' => 'float' 3357 ), 3358 'best_solution' => array( 3359 'type' => 'integer', 3360 'length' => 1, 3361 'notnull' => false 3362 ), 3363 )); 3364} 3365?> 3366<#4348> 3367<?php 3368if (!$ilDB->tableColumnExists('conditions', 'hidden_status')) { 3369 $ilDB->addTableColumn('conditions', 'hidden_status', array( 3370 'type' => 'integer', 3371 'length' => 1, 3372 'notnull' => false, 3373 'default' => 0 3374 )); 3375} 3376?> 3377<#4349> 3378<?php 3379 if ($ilDB->tableColumnExists('frm_posts', 'pos_usr_id')) { 3380 $ilDB->dropTableColumn('frm_posts', 'pos_usr_id'); 3381 } 3382?> 3383<#4350> 3384<?php 3385 if ($ilDB->tableColumnExists('frm_threads', 'thr_usr_id')) { 3386 $ilDB->dropTableColumn('frm_threads', 'thr_usr_id'); 3387 } 3388?> 3389 3390 3391<#4351> 3392<?php 3393 $res = $ilDB->query("SELECT value FROM settings WHERE module = 'google_maps' AND keyword = 'enable'"); 3394 if ($rec = $ilDB->fetchAssoc($res)) { 3395 $ilDB->manipulate("INSERT INTO settings (module, keyword, value) VALUES ('maps', 'type', 'googlemaps')"); 3396 } 3397 3398 // adjust naming in settings 3399 $ilDB->manipulate("UPDATE settings SET module = 'maps' WHERE module = 'google_maps'"); 3400 3401 // adjust naming in language data 3402 $ilDB->manipulate("UPDATE lng_data SET module = 'maps' WHERE module = 'gmaps'"); 3403 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_enable_maps_info' WHERE identifier = 'gmaps_enable_gmaps_info'"); 3404 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_enable_maps' WHERE identifier = 'gmaps_enable_gmaps'"); 3405 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_extt_maps' WHERE identifier = 'gmaps_extt_gmaps'"); 3406 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_latitude' WHERE identifier = 'gmaps_latitude'"); 3407 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_longitude' WHERE identifier = 'gmaps_longitude'"); 3408 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_lookup_address' WHERE identifier = 'gmaps_lookup_address'"); 3409 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_public_profile_info' WHERE identifier = 'gmaps_public_profile_info'"); 3410 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_settings' WHERE identifier = 'gmaps_settings'"); 3411 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_std_location_desc' WHERE identifier = 'gmaps_std_location_desc'"); 3412 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_std_location' WHERE identifier = 'gmaps_std_location'"); 3413 $ilDB->manipulate("UPDATE lng_data SET identifier = 'maps_zoom_level' WHERE identifier = 'gmaps_zoom_level'"); 3414 3415?> 3416<#4352> 3417<?php 3418 3419if (!$ilDB->tableColumnExists('il_blog', 'abs_shorten')) { 3420 $ilDB->addTableColumn( 3421 'il_blog', 3422 'abs_shorten', 3423 array( 3424 'type' => 'integer', 3425 'length' => 1, 3426 'notnull' => false, 3427 'default' => 0 3428 ) 3429 ); 3430} 3431 3432if (!$ilDB->tableColumnExists('il_blog', 'abs_shorten_len')) { 3433 $ilDB->addTableColumn( 3434 'il_blog', 3435 'abs_shorten_len', 3436 array( 3437 'type' => 'integer', 3438 'length' => 2, 3439 'notnull' => false, 3440 'default' => 0 3441 ) 3442 ); 3443} 3444 3445if (!$ilDB->tableColumnExists('il_blog', 'abs_image')) { 3446 $ilDB->addTableColumn( 3447 'il_blog', 3448 'abs_image', 3449 array( 3450 'type' => 'integer', 3451 'length' => 1, 3452 'notnull' => false, 3453 'default' => 0 3454 ) 3455 ); 3456} 3457 3458if (!$ilDB->tableColumnExists('il_blog', 'abs_img_width')) { 3459 $ilDB->addTableColumn( 3460 'il_blog', 3461 'abs_img_width', 3462 array( 3463 'type' => 'integer', 3464 'length' => 2, 3465 'notnull' => false, 3466 'default' => 0 3467 ) 3468 ); 3469} 3470 3471if (!$ilDB->tableColumnExists('il_blog', 'abs_img_height')) { 3472 $ilDB->addTableColumn( 3473 'il_blog', 3474 'abs_img_height', 3475 array( 3476 'type' => 'integer', 3477 'length' => 2, 3478 'notnull' => false, 3479 'default' => 0 3480 ) 3481 ); 3482} 3483 3484?> 3485 3486<#4353> 3487<?php 3488 3489if (!$ilDB->tableExists('usr_data_multi')) { 3490 $ilDB->createTable('usr_data_multi', array( 3491 'usr_id' => array( 3492 'type' => 'integer', 3493 'length' => 4, 3494 'notnull' => true, 3495 'default' => 0 3496 ), 3497 'field_id' => array( 3498 'type' => 'text', 3499 'length' => 255, 3500 'notnull' => true 3501 ), 3502 'value' => array( 3503 'type' => 'text', 3504 'length' => 1000, 3505 'notnull' => false, 3506 ) 3507 )); 3508} 3509 3510?> 3511 3512<#4354> 3513<?php 3514if (!$ilDB->tableColumnExists('crs_start', 'pos')) { 3515 $ilDB->addTableColumn('crs_start', 'pos', array( 3516 'type' => 'integer', 3517 'length' => 4, 3518 'notnull' => false, 3519 'default' => null 3520 )); 3521} 3522?> 3523 3524<#4355> 3525<?php 3526if (!$ilDB->tableExists('loc_settings')) { 3527 $ilDB->createTable( 3528 'loc_settings', 3529 array( 3530 'obj_id' => array( 3531 'type' => 'integer', 3532 'length' => 4, 3533 'notnull' => true, 3534 'default' => 0 3535 ), 3536 'type' => array( 3537 'type' => 'integer', 3538 'length' => 1, 3539 'notnull' => true, 3540 'default' => 0 3541 ) 3542 ) 3543 ); 3544 3545 $ilDB->addPrimaryKey('loc_settings', array('obj_id')); 3546} 3547?> 3548<#4356> 3549<?php 3550if (!$ilDB->tableColumnExists('loc_settings', 'itest')) { 3551 $ilDB->addTableColumn('loc_settings', 'itest', array( 3552 'type' => 'integer', 3553 'length' => 4, 3554 'notnull' => false, 3555 'default' => null 3556 )); 3557} 3558 3559if (!$ilDB->tableColumnExists('loc_settings', 'qtest')) { 3560 $ilDB->addTableColumn('loc_settings', 'qtest', array( 3561 'type' => 'integer', 3562 'length' => 4, 3563 'notnull' => false, 3564 'default' => null 3565 )); 3566} 3567?> 3568 3569<#4357> 3570<?php 3571if (!$ilDB->tableColumnExists('adm_settings_template', 'auto_generated')) { 3572 $ilDB->addTableColumn('adm_settings_template', 'auto_generated', array( 3573 'type' => 'integer', 3574 'length' => 1, 3575 'notnull' => false, 3576 'default' => 0 3577 )); 3578} 3579?> 3580 3581<#4358> 3582<?php 3583if (!$ilDB->tableColumnExists('crs_objective_lm', 'position')) { 3584 $ilDB->addTableColumn('crs_objective_lm', 'position', array( 3585 'type' => 'integer', 3586 'length' => 4, 3587 'notnull' => false, 3588 'default' => 0 3589 )); 3590} 3591?> 3592<#4359> 3593<?php 3594 3595if (!$ilDB->tableExists('loc_rnd_qpl')) { 3596 $ilDB->createTable('loc_rnd_qpl', array( 3597 'container_id' => array( 3598 'type' => 'integer', 3599 'length' => 4, 3600 'notnull' => true, 3601 'default' => 0 3602 ), 3603 'objective_id' => array( 3604 'type' => 'integer', 3605 'length' => 4, 3606 'notnull' => true, 3607 'default' => 0 3608 ), 3609 'tst_type' => array( 3610 'type' => 'integer', 3611 'length' => 1, 3612 'notnull' => true, 3613 'default' => 0 3614 ), 3615 'tst_id' => array( 3616 'type' => 'integer', 3617 'length' => 4, 3618 'notnull' => true, 3619 'default' => 0 3620 ), 3621 'qp_seq' => array( 3622 'type' => 'integer', 3623 'length' => 4, 3624 'notnull' => true, 3625 'default' => 0 3626 ), 3627 'percentage' => array( 3628 'type' => 'integer', 3629 'length' => 4, 3630 'notnull' => true, 3631 'default' => 0 3632 ), 3633 )); 3634 $ilDB->addPrimaryKey('loc_rnd_qpl', array('container_id', 'objective_id', 'tst_type')); 3635} 3636?> 3637<#4360> 3638<?php 3639 3640$query = 'INSERT INTO adm_settings_template ' . 3641 '(id, type, title, description, auto_generated) ' . 3642 'VALUES( ' . 3643 $ilDB->quote($ilDB->nextId('adm_settings_template'), 'integer') . ', ' . 3644 $ilDB->quote('tst', 'text') . ', ' . 3645 $ilDB->quote('il_astpl_loc_initial', 'text') . ', ' . 3646 $ilDB->quote('il_astpl_loc_initial_desc', 'text') . ', ' . 3647 $ilDB->quote(1, 'integer') . ' ' . 3648 ')'; 3649$ilDB->manipulate($query); 3650?> 3651<#4361> 3652<?php 3653 3654$query = 'INSERT INTO adm_settings_template ' . 3655 '(id, type, title, description, auto_generated) ' . 3656 'VALUES( ' . 3657 $ilDB->quote($ilDB->nextId('adm_settings_template'), 'integer') . ', ' . 3658 $ilDB->quote('tst', 'text') . ', ' . 3659 $ilDB->quote('il_astpl_loc_qualified', 'text') . ', ' . 3660 $ilDB->quote('il_astpl_loc_qualified_desc', 'text') . ', ' . 3661 $ilDB->quote(1, 'integer') . ' ' . 3662 ')'; 3663$ilDB->manipulate($query); 3664?> 3665 3666<#4362> 3667<?php 3668 3669if (!$ilDB->tableExists('loc_user_results')) { 3670 $ilDB->createTable('loc_user_results', array( 3671 'user_id' => array( 3672 'type' => 'integer', 3673 'length' => 4, 3674 'notnull' => true, 3675 'default' => 0 3676 ), 3677 'course_id' => array( 3678 'type' => 'integer', 3679 'length' => 4, 3680 'notnull' => true, 3681 'default' => 0 3682 ), 3683 'objective_id' => array( 3684 'type' => 'integer', 3685 'length' => 4, 3686 'notnull' => true, 3687 'default' => 0 3688 ), 3689 'type' => array( 3690 'type' => 'integer', 3691 'length' => 1, 3692 'notnull' => true, 3693 'default' => 0 3694 ), 3695 'status' => array( 3696 'type' => 'integer', 3697 'length' => 1, 3698 'notnull' => false, 3699 'default' => 0 3700 ), 3701 'result_perc' => array( 3702 'type' => 'integer', 3703 'length' => 1, 3704 'notnull' => false, 3705 'default' => 0 3706 ), 3707 'limit_perc' => array( 3708 'type' => 'integer', 3709 'length' => 1, 3710 'notnull' => false, 3711 'default' => 0 3712 ), 3713 'tries' => array( 3714 'type' => 'integer', 3715 'length' => 1, 3716 'notnull' => false, 3717 'default' => 0 3718 ), 3719 'is_final' => array( 3720 'type' => 'integer', 3721 'length' => 1, 3722 'notnull' => false, 3723 'default' => 0 3724 ), 3725 'tstamp' => array( 3726 'type' => 'integer', 3727 'length' => 4, 3728 'notnull' => false, 3729 'default' => 0 3730 ) 3731 )); 3732 3733 $ilDB->addPrimaryKey('loc_user_results', array('user_id', 'course_id', 'objective_id', 'type')); 3734} 3735?> 3736<#4363> 3737<?php 3738if (!$ilDB->tableColumnExists('loc_settings', 'qt_vis_all')) { 3739 $ilDB->addTableColumn('loc_settings', 'qt_vis_all', array( 3740 'type' => 'integer', 3741 'length' => 1, 3742 'notnull' => false, 3743 'default' => 1 3744 )); 3745} 3746?> 3747 3748<#4364> 3749<?php 3750if (!$ilDB->tableColumnExists('loc_settings', 'qt_vis_obj')) { 3751 $ilDB->addTableColumn('loc_settings', 'qt_vis_obj', array( 3752 'type' => 'integer', 3753 'length' => 1, 3754 'notnull' => false, 3755 'default' => 0 3756 )); 3757} 3758?> 3759 3760<#4365> 3761<?php 3762if (!$ilDB->tableColumnExists('crs_objectives', 'active')) { 3763 $ilDB->addTableColumn('crs_objectives', 'active', array( 3764 'type' => 'integer', 3765 'length' => 1, 3766 'notnull' => false, 3767 'default' => 1 3768 )); 3769} 3770?> 3771 3772<#4366> 3773<?php 3774if (!$ilDB->tableColumnExists('crs_objectives', 'passes')) { 3775 $ilDB->addTableColumn('crs_objectives', 'passes', array( 3776 'type' => 'integer', 3777 'length' => 2, 3778 'notnull' => false, 3779 'default' => 0 3780 )); 3781} 3782?> 3783 3784<#4367> 3785<?php 3786if (!$ilDB->tableExists('loc_tst_run')) { 3787 $ilDB->createTable('loc_tst_run', array( 3788 'container_id' => array( 3789 'type' => 'integer', 3790 'length' => 4, 3791 'notnull' => true, 3792 'default' => 0 3793 ), 3794 'user_id' => array( 3795 'type' => 'integer', 3796 'length' => 4, 3797 'notnull' => true, 3798 'default' => 0 3799 ), 3800 'test_id' => array( 3801 'type' => 'integer', 3802 'length' => 4, 3803 'notnull' => true, 3804 'default' => 0 3805 ), 3806 'objective_id' => array( 3807 'type' => 'integer', 3808 'length' => 4, 3809 'notnull' => true, 3810 'default' => 0 3811 ), 3812 'max_points' => array( 3813 'type' => 'integer', 3814 'length' => 4, 3815 'notnull' => false, 3816 'default' => 0 3817 ), 3818 'questions' => array( 3819 'type' => 'text', 3820 'length' => 1000, 3821 'notnull' => false, 3822 'default' => 0 3823 ) 3824 )); 3825 $ilDB->addPrimaryKey('loc_tst_run', array('container_id', 'user_id', 'test_id', 'objective_id')); 3826} 3827?> 3828<#4368> 3829<?php 3830if (!$ilDB->tableColumnExists('loc_settings', 'reset_results')) { 3831 $ilDB->addTableColumn( 3832 'loc_settings', 3833 'reset_results', 3834 array( 3835 'type' => 'integer', 3836 'length' => 1, 3837 'notnull' => false, 3838 'default' => 0 3839 ) 3840 ); 3841} 3842?> 3843<#4369> 3844<?php 3845$ilCtrlStructureReader->getStructure(); 3846?> 3847<#4370> 3848<?php 3849if (!$ilDB->tableColumnExists('il_bibl_settings', 'show_in_list')) { 3850 $ilDB->addTableColumn('il_bibl_settings', 'show_in_list', array( 3851 'type' => 'integer', 3852 'length' => 1, 3853 'notnull' => false, 3854 'default' => 0 3855 )); 3856} 3857?> 3858<#4371> 3859<?php 3860 3861 $a_obj_id = array(); 3862 $a_scope_id = array(); 3863 $a_scope_id_one = array(); 3864 //select targetobjectiveid = cmi_gobjective.objective_id 3865 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid 3866 FROM cp_package, cp_mapinfo, cp_node 3867 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 3868 GROUP BY cp_mapinfo.targetobjectiveid'); 3869 while ($data = $ilDB->fetchAssoc($res)) { 3870 $a_obj_id[] = $data['targetobjectiveid']; 3871 } 3872 //make arrays 3873 for ($i = 0;$i < count($a_obj_id);$i++) { 3874 $a_scope_id[$a_obj_id[$i]] = array(); 3875 $a_scope_id_one[$a_obj_id[$i]] = array(); 3876 } 3877 //only global_to_system=0 -> should be updated 3878 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid, cp_package.obj_id 3879 FROM cp_package, cp_mapinfo, cp_node 3880 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'); 3881 while ($data = $ilDB->fetchAssoc($res)) { 3882 $a_scope_id[$data['targetobjectiveid']][] = $data['obj_id']; 3883 } 3884 //only global_to_system=1 -> should maintain 3885 $res = $ilDB->query('SELECT cp_mapinfo.targetobjectiveid, cp_package.obj_id 3886 FROM cp_package, cp_mapinfo, cp_node 3887 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'); 3888 while ($data = $ilDB->fetchAssoc($res)) { 3889 $a_scope_id_one[$data['targetobjectiveid']][] = $data['obj_id']; 3890 } 3891 3892 //for all targetobjectiveid 3893 for ($i = 0;$i < count($a_obj_id);$i++) { 3894 $a_toupdate = array(); 3895 //get old data without correct scope_id 3896 $res = $ilDB->queryF( 3897 "SELECT * FROM cmi_gobjective WHERE scope_id = %s AND objective_id = %s", 3898 array('integer', 'text'), 3899 array(0, $a_obj_id[$i]) 3900 ); 3901 while ($data = $ilDB->fetchAssoc($res)) { 3902 $a_toupdate[] = $data; 3903 } 3904 //check specific possible scope_ids with global_to_system=0 -> a_o 3905 $a_o = $a_scope_id[$a_obj_id[$i]]; 3906 for ($z = 0; $z < count($a_o); $z++) { 3907 //for all existing entries 3908 for ($y = 0; $y < count($a_toupdate); $y++) { 3909 $a_t = $a_toupdate[$y]; 3910 //only users attempted 3911 $res = $ilDB->queryF( 3912 'SELECT user_id FROM sahs_user WHERE obj_id=%s AND user_id=%s', 3913 array('integer', 'integer'), 3914 array($a_o[$z], $a_t['user_id']) 3915 ); 3916 if ($ilDB->numRows($res)) { 3917 //check existing entry 3918 $res = $ilDB->queryF( 3919 'SELECT user_id FROM cmi_gobjective WHERE scope_id=%s AND user_id=%s AND objective_id=%s', 3920 array('integer', 'integer','text'), 3921 array($a_o[$z], $a_t['user_id'],$a_t['objective_id']) 3922 ); 3923 if (!$ilDB->numRows($res)) { 3924 $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" 3925 . " (" . $ilDB->quote($a_t['user_id'], "integer") 3926 . ", " . $ilDB->quote($a_t['satisfied'], "text") 3927 . ", " . $ilDB->quote($a_t['measure'], "text") 3928 . ", " . $ilDB->quote($a_o[$z], "integer") 3929 . ", " . $ilDB->quote($a_t['status'], "text") 3930 . ", " . $ilDB->quote($a_t['objective_id'], "text") 3931 . ", " . $ilDB->quote($a_t['score_raw'], "text") 3932 . ", " . $ilDB->quote($a_t['score_min'], "text") 3933 . ", " . $ilDB->quote($a_t['score_max'], "text") 3934 . ", " . $ilDB->quote($a_t['progress_measure'], "text") 3935 . ", " . $ilDB->quote($a_t['completion_status'], "text") 3936 . ")"); 3937 } 3938 } 3939 } 3940 } 3941 //delete entries if global_to_system=1 is not used by any learning module 3942 if (count($a_scope_id_one[$a_obj_id[$i]]) == 0) { 3943 $ilDB->queryF( 3944 'DELETE FROM cmi_gobjective WHERE scope_id = %s AND objective_id = %s', 3945 array('integer', 'text'), 3946 array(0, $a_obj_id[$i]) 3947 ); 3948 } 3949 } 3950 3951 3952?> 3953<#4372> 3954<?php 3955 if ($ilDB->getDBType() == 'innodb') { 3956 $query = "show index from cmi_gobjective where Key_name = 'PRIMARY'"; 3957 $res = $ilDB->query($query); 3958 if (!$ilDB->numRows($res)) { 3959 $ilDB->addPrimaryKey('cmi_gobjective', array('user_id', 'scope_id', 'objective_id')); 3960 } 3961 } 3962?> 3963<#4373> 3964<?php 3965 if ($ilDB->getDBType() == 'innodb') { 3966 $query = "show index from cp_suspend where Key_name = 'PRIMARY'"; 3967 $res = $ilDB->query($query); 3968 if (!$ilDB->numRows($res)) { 3969 $ilDB->addPrimaryKey('cp_suspend', array('user_id', 'obj_id')); 3970 } 3971 } 3972?> 3973<#4374> 3974<?php 3975 if (!$ilDB->tableColumnExists('frm_posts', 'is_author_moderator')) { 3976 $ilDB->addTableColumn( 3977 'frm_posts', 3978 'is_author_moderator', 3979 array( 3980 'type' => 'integer', 3981 'length' => 1, 3982 'notnull' => false, 3983 'default' => null) 3984 ); 3985 } 3986?> 3987<#4375> 3988<?php 3989if (!$ilDB->tableColumnExists('ecs_part_settings', 'token')) { 3990 $ilDB->addTableColumn( 3991 'ecs_part_settings', 3992 'token', 3993 array( 3994 'type' => 'integer', 3995 'length' => 1, 3996 'notnull' => false, 3997 'default' => 1 3998 ) 3999 ); 4000} 4001?> 4002<#4376> 4003<?php 4004$ilCtrlStructureReader->getStructure(); 4005?> 4006<#4377> 4007<?php 4008if (!$ilDB->tableColumnExists('ecs_part_settings', 'export_types')) { 4009 $ilDB->addTableColumn( 4010 'ecs_part_settings', 4011 'export_types', 4012 array( 4013 'type' => 'text', 4014 'length' => 4000, 4015 'notnull' => false, 4016 ) 4017 ); 4018} 4019?> 4020<#4378> 4021<?php 4022if (!$ilDB->tableColumnExists('ecs_part_settings', 'import_types')) { 4023 $ilDB->addTableColumn( 4024 'ecs_part_settings', 4025 'import_types', 4026 array( 4027 'type' => 'text', 4028 'length' => 4000, 4029 'notnull' => false, 4030 ) 4031 ); 4032} 4033?> 4034<#4379> 4035<?php 4036 4037 $query = 'UPDATE ecs_part_settings SET export_types = ' . $ilDB->quote(serialize(array('cat','crs','file','glo','grp','wiki','lm')), 'text'); 4038 $ilDB->manipulate($query); 4039 4040?> 4041 4042<#4380> 4043<?php 4044 4045 $query = 'UPDATE ecs_part_settings SET import_types = ' . $ilDB->quote(serialize(array('cat','crs','file','glo','grp','wiki','lm')), 'text'); 4046 $ilDB->manipulate($query); 4047 4048?> 4049<#4381> 4050<?php 4051if (!$ilDB->tableColumnExists('reg_registration_codes', 'reg_enabled')) { 4052 $ilDB->addTableColumn( 4053 'reg_registration_codes', 4054 'reg_enabled', 4055 array( 4056 'type' => 'integer', 4057 'length' => 1, 4058 'notnull' => true, 4059 'default' => 1 4060 ) 4061 ); 4062} 4063?> 4064 4065<#4382> 4066<?php 4067if (!$ilDB->tableColumnExists('reg_registration_codes', 'ext_enabled')) { 4068 $ilDB->addTableColumn( 4069 'reg_registration_codes', 4070 'ext_enabled', 4071 array( 4072 'type' => 'integer', 4073 'length' => 1, 4074 'notnull' => true, 4075 'default' => 0 4076 ) 4077 ); 4078} 4079?> 4080<#4383> 4081<?php 4082 4083if ($ilDB->tableColumnExists('reg_registration_codes', 'generated')) { 4084 $ilDB->renameTableColumn('reg_registration_codes', "generated", 'generated_on'); 4085} 4086 4087 4088$query = 'SELECT * FROM usr_account_codes '; 4089$res = $ilDB->query($query); 4090while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 4091 $until = $row->valid_until; 4092 if ($until === '0') { 4093 $alimit = 'unlimited'; 4094 $a_limitdt = null; 4095 } elseif (is_numeric($until)) { 4096 $alimit = 'relative'; 4097 $a_limitdt = array( 4098 'd' => (string) $until, 4099 'm' => '', 4100 'y' => '' 4101 ); 4102 $a_limitdt = serialize($a_limitdt); 4103 } else { 4104 $alimit = 'absolute'; 4105 $a_limitdt = $until; 4106 } 4107 4108 $next_id = $ilDB->nextId('reg_registration_codes'); 4109 $query = 'INSERT INTO reg_registration_codes ' . 4110 '(code_id, code, role, generated_on, used, role_local, alimit, alimitdt, reg_enabled, ext_enabled ) ' . 4111 'VALUES ( ' . 4112 $ilDB->quote($next_id, 'integer') . ', ' . 4113 $ilDB->quote($row->code, 'text') . ', ' . 4114 $ilDB->quote(0, 'integer') . ', ' . 4115 $ilDB->quote($row->generated_on, 'integer') . ', ' . 4116 $ilDB->quote($row->used, 'integer') . ', ' . 4117 $ilDB->quote('', 'text') . ', ' . 4118 $ilDB->quote($alimit, 'text') . ', ' . 4119 $ilDB->quote($a_limitdt, 'text') . ', ' . 4120 $ilDB->quote(0, 'integer') . ', ' . 4121 $ilDB->quote(1, 'integer') . ' ' . 4122 ')'; 4123 $ilDB->manipulate($query); 4124} 4125?> 4126<#4384> 4127<?php 4128$ilCtrlStructureReader->getStructure(); 4129?> 4130<#4385> 4131<?php 4132$ilCtrlStructureReader->getStructure(); 4133?> 4134<#4386> 4135<?php 4136 $ilSetting = new ilSetting("assessment"); 4137 $ilSetting->set("use_javascript", "1"); 4138?> 4139<#4387> 4140<?php 4141 $ilDB->update( 4142 'tst_tests', 4143 array('forcejs' => array('integer', 1)), 4144 array('forcejs' => array('integer', 0)) 4145); 4146?> 4147<#4388> 4148<?php 4149$ilCtrlStructureReader->getStructure(); 4150?> 4151<#4389> 4152<?php 4153$ilDB->addTableColumn( 4154 "tst_test_defaults", 4155 "marks_tmp", 4156 array( 4157 "type" => "clob", 4158 "notnull" => false, 4159 "default" => null) 4160); 4161 4162$ilDB->manipulate('UPDATE tst_test_defaults SET marks_tmp = marks'); 4163$ilDB->dropTableColumn('tst_test_defaults', 'marks'); 4164$ilDB->renameTableColumn("tst_test_defaults", "marks_tmp", "marks"); 4165?> 4166<#4390> 4167<?php 4168$ilDB->addTableColumn( 4169 "tst_test_defaults", 4170 "defaults_tmp", 4171 array( 4172 "type" => "clob", 4173 "notnull" => false, 4174 "default" => null) 4175); 4176 4177$ilDB->manipulate('UPDATE tst_test_defaults SET defaults_tmp = defaults'); 4178$ilDB->dropTableColumn('tst_test_defaults', 'defaults'); 4179$ilDB->renameTableColumn("tst_test_defaults", "defaults_tmp", "defaults"); 4180?> 4181 4182<#4391> 4183<?php 4184 4185if (!$ilDB->tableExists('tst_seq_qst_tracking')) { 4186 $ilDB->createTable('tst_seq_qst_tracking', array( 4187 'active_fi' => array( 4188 'type' => 'integer', 4189 'length' => 4, 4190 'notnull' => true, 4191 'default' => 0 4192 ), 4193 'pass' => array( 4194 'type' => 'integer', 4195 'length' => 4, 4196 'notnull' => true, 4197 'default' => 0 4198 ), 4199 'question_fi' => array( 4200 'type' => 'integer', 4201 'length' => 4, 4202 'notnull' => true, 4203 'default' => 0 4204 ), 4205 'status' => array( 4206 'type' => 'text', 4207 'length' => 16, 4208 'notnull' => false 4209 ), 4210 'orderindex' => array( 4211 'type' => 'integer', 4212 'length' => 4, 4213 'notnull' => true, 4214 'default' => 0 4215 ) 4216 )); 4217 4218 $ilDB->addPrimaryKey('tst_seq_qst_tracking', array('active_fi', 'pass', 'question_fi')); 4219 $ilDB->addIndex('tst_seq_qst_tracking', array('active_fi', 'pass'), 'i1'); 4220 $ilDB->addIndex('tst_seq_qst_tracking', array('active_fi', 'question_fi'), 'i2'); 4221} 4222 4223?> 4224 4225<#4392> 4226<?php 4227 4228$query = " 4229 SELECT active_fi, pass, sequence 4230 FROM tst_tests 4231 INNER JOIN tst_active 4232 ON test_fi = test_id 4233 INNER JOIN tst_sequence 4234 ON active_fi = active_id 4235 AND sequence IS NOT NULL 4236 WHERE question_set_type = %s 4237"; 4238 4239$res = $ilDB->queryF($query, array('text'), array('DYNAMIC_QUEST_SET')); 4240 4241while ($row = $ilDB->fetchAssoc($res)) { 4242 $tracking = unserialize($row['sequence']); 4243 4244 if (is_array($tracking)) { 4245 foreach ($tracking as $index => $question) { 4246 $ilDB->replace( 4247 'tst_seq_qst_tracking', 4248 array( 4249 'active_fi' => array('integer', $row['active_fi']), 4250 'pass' => array('integer', $row['pass']), 4251 'question_fi' => array('integer', $question['qid']) 4252 ), 4253 array( 4254 'status' => array('text', $question['status']), 4255 'orderindex' => array('integer', $index + 1) 4256 ) 4257 ); 4258 } 4259 4260 $ilDB->update( 4261 'tst_sequence', 4262 array( 4263 'sequence' => array('text', null) 4264 ), 4265 array( 4266 'active_fi' => array('integer', $row['active_fi']), 4267 'pass' => array('integer', $row['pass']) 4268 ) 4269 ); 4270 } 4271} 4272 4273?> 4274 4275<#4393> 4276<?php 4277 4278if (!$ilDB->tableExists('tst_seq_qst_postponed')) { 4279 $ilDB->createTable('tst_seq_qst_postponed', array( 4280 'active_fi' => array( 4281 'type' => 'integer', 4282 'length' => 4, 4283 'notnull' => true, 4284 'default' => 0 4285 ), 4286 'pass' => array( 4287 'type' => 'integer', 4288 'length' => 4, 4289 'notnull' => true, 4290 'default' => 0 4291 ), 4292 'question_fi' => array( 4293 'type' => 'integer', 4294 'length' => 4, 4295 'notnull' => true, 4296 'default' => 0 4297 ), 4298 'cnt' => array( 4299 'type' => 'integer', 4300 'length' => 4, 4301 'notnull' => true, 4302 'default' => 0 4303 ) 4304 )); 4305 4306 $ilDB->addPrimaryKey('tst_seq_qst_postponed', array('active_fi', 'pass', 'question_fi')); 4307 $ilDB->addIndex('tst_seq_qst_postponed', array('active_fi', 'pass'), 'i1'); 4308 $ilDB->addIndex('tst_seq_qst_postponed', array('active_fi', 'question_fi'), 'i2'); 4309} 4310 4311?> 4312 4313<#4394> 4314<?php 4315 4316$query = " 4317 SELECT active_fi, pass, postponed 4318 FROM tst_tests 4319 INNER JOIN tst_active 4320 ON test_fi = test_id 4321 INNER JOIN tst_sequence 4322 ON active_fi = active_id 4323 AND postponed IS NOT NULL 4324 WHERE question_set_type = %s 4325"; 4326 4327$res = $ilDB->queryF($query, array('text'), array('DYNAMIC_QUEST_SET')); 4328 4329while ($row = $ilDB->fetchAssoc($res)) { 4330 $postponed = unserialize($row['postponed']); 4331 4332 if (is_array($postponed)) { 4333 foreach ($postponed as $questionId => $postponeCount) { 4334 $ilDB->replace( 4335 'tst_seq_qst_postponed', 4336 array( 4337 'active_fi' => array('integer', $row['active_fi']), 4338 'pass' => array('integer', $row['pass']), 4339 'question_fi' => array('integer', $questionId) 4340 ), 4341 array( 4342 'cnt' => array('integer', $postponeCount) 4343 ) 4344 ); 4345 } 4346 4347 $ilDB->update( 4348 'tst_sequence', 4349 array( 4350 'postponed' => array('text', null) 4351 ), 4352 array( 4353 'active_fi' => array('integer', $row['active_fi']), 4354 'pass' => array('integer', $row['pass']) 4355 ) 4356 ); 4357 } 4358} 4359 4360?> 4361 4362<#4395> 4363<?php 4364 4365if (!$ilDB->tableExists('tst_seq_qst_answstatus')) { 4366 $ilDB->createTable('tst_seq_qst_answstatus', array( 4367 'active_fi' => array( 4368 'type' => 'integer', 4369 'length' => 4, 4370 'notnull' => true, 4371 'default' => 0 4372 ), 4373 'pass' => array( 4374 'type' => 'integer', 4375 'length' => 4, 4376 'notnull' => true, 4377 'default' => 0 4378 ), 4379 'question_fi' => array( 4380 'type' => 'integer', 4381 'length' => 4, 4382 'notnull' => true, 4383 'default' => 0 4384 ), 4385 'correctness' => array( 4386 'type' => 'integer', 4387 'length' => 1, 4388 'notnull' => true, 4389 'default' => 0 4390 ) 4391 )); 4392 4393 $ilDB->addPrimaryKey('tst_seq_qst_answstatus', array('active_fi', 'pass', 'question_fi')); 4394 $ilDB->addIndex('tst_seq_qst_answstatus', array('active_fi', 'pass'), 'i1'); 4395 $ilDB->addIndex('tst_seq_qst_answstatus', array('active_fi', 'question_fi'), 'i2'); 4396} 4397 4398?> 4399 4400<#4396> 4401<?php 4402 4403$query = " 4404 SELECT active_fi, pass, hidden 4405 FROM tst_tests 4406 INNER JOIN tst_active 4407 ON test_fi = test_id 4408 INNER JOIN tst_sequence 4409 ON active_fi = active_id 4410 AND hidden IS NOT NULL 4411 WHERE question_set_type = %s 4412"; 4413 4414$res = $ilDB->queryF($query, array('text'), array('DYNAMIC_QUEST_SET')); 4415 4416while ($row = $ilDB->fetchAssoc($res)) { 4417 $answerStatus = unserialize($row['hidden']); 4418 4419 if (is_array($answerStatus)) { 4420 foreach ($answerStatus['correct'] as $questionId) { 4421 $ilDB->replace( 4422 'tst_seq_qst_answstatus', 4423 array( 4424 'active_fi' => array('integer', $row['active_fi']), 4425 'pass' => array('integer', $row['pass']), 4426 'question_fi' => array('integer', $questionId) 4427 ), 4428 array( 4429 'correctness' => array('integer', 1) 4430 ) 4431 ); 4432 } 4433 4434 foreach ($answerStatus['wrong'] as $questionId) { 4435 $ilDB->replace( 4436 'tst_seq_qst_answstatus', 4437 array( 4438 'active_fi' => array('integer', $row['active_fi']), 4439 'pass' => array('integer', $row['pass']), 4440 'question_fi' => array('integer', $questionId) 4441 ), 4442 array( 4443 'correctness' => array('integer', 0) 4444 ) 4445 ); 4446 } 4447 4448 $ilDB->update( 4449 'tst_sequence', 4450 array( 4451 'hidden' => array('text', null) 4452 ), 4453 array( 4454 'active_fi' => array('integer', $row['active_fi']), 4455 'pass' => array('integer', $row['pass']) 4456 ) 4457 ); 4458 } 4459} 4460 4461?> 4462 4463<#4397> 4464<?php 4465 4466//$ilDB->addPrimaryKey('tst_dyn_quest_set_cfg', array('test_fi')); 4467 4468?> 4469 4470<#4398> 4471<?php 4472 4473$indexName = $ilDB->constraintName('tst_dyn_quest_set_cfg', $ilDB->getPrimaryKeyIdentifier()); 4474 4475if (($ilDB->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) && $ilDB->db->options['field_case'] == CASE_LOWER) { 4476 $indexName = strtolower($indexName); 4477} else { 4478 $indexName = strtoupper($indexName); 4479} 4480 4481$indexDefinition = $ilDB->loadModule('Reverse')->getTableConstraintDefinition('tst_dyn_quest_set_cfg', $indexName); 4482 4483if ($indexDefinition instanceof MDB2_Error) { 4484 $res = $ilDB->query(" 4485 SELECT test_fi, source_qpl_fi, source_qpl_title, answer_filter_enabled, tax_filter_enabled, order_tax 4486 FROM tst_dyn_quest_set_cfg 4487 GROUP BY test_fi, source_qpl_fi, source_qpl_title, answer_filter_enabled, tax_filter_enabled, order_tax 4488 HAVING COUNT(*) > 1 4489 "); 4490 4491 $insertStmt = $ilDB->prepareManip( 4492 " 4493 INSERT INTO tst_dyn_quest_set_cfg ( 4494 test_fi, source_qpl_fi, source_qpl_title, answer_filter_enabled, tax_filter_enabled, order_tax 4495 ) VALUES (?, ?, ?, ?, ?, ?) 4496 ", 4497 array('integer', 'integer', 'text', 'integer', 'integer', 'integer') 4498 ); 4499 4500 while ($row = $ilDB->fetchAssoc($res)) { 4501 $expressions = array(); 4502 4503 foreach ($row as $field => $value) { 4504 if ($value === null) { 4505 $expressions[] = "$field IS NULL"; 4506 } else { 4507 if ($field == 'source_qpl_title') { 4508 $value = $ilDB->quote($value, 'text'); 4509 } else { 4510 $value = $ilDB->quote($value, 'integer'); 4511 } 4512 4513 $expressions[] = "$field = $value"; 4514 } 4515 } 4516 4517 $expressions = implode(' AND ', $expressions); 4518 4519 $ilDB->manipulate("DELETE FROM tst_dyn_quest_set_cfg WHERE $expressions"); 4520 4521 $ilDB->execute($insertStmt, array_values($row)); 4522 } 4523 4524 $ilDB->addPrimaryKey('tst_dyn_quest_set_cfg', array('test_fi')); 4525} 4526 4527?> 4528 4529<#4399> 4530<?php 4531if (!$ilDB->tableColumnExists('tst_dyn_quest_set_cfg', 'prev_quest_list_enabled')) { 4532 $ilDB->addTableColumn( 4533 'tst_dyn_quest_set_cfg', 4534 'prev_quest_list_enabled', 4535 array( 4536 'type' => 'integer', 4537 'length' => 1, 4538 'notnull' => true, 4539 'default' => 0 4540 ) 4541 ); 4542} 4543?> 4544<#4400> 4545<?php 4546$set = $ilDB->query('SELECT * FROM il_dcl_datatype_prop WHERE id = 14'); 4547if (!$ilDB->numRows($set)) { 4548 $ilDB->insert('il_dcl_datatype_prop', array( 4549 'id' => array('integer', 14), 4550 'datatype_id' => array('integer', 2), 4551 'title' => array('text', 'link_detail_page'), 4552 'inputformat' => array('integer', 4), 4553 )); 4554} 4555$set = $ilDB->query('SELECT * FROM il_dcl_datatype_prop WHERE id = 15'); 4556if (!$ilDB->numRows($set)) { 4557 $ilDB->insert('il_dcl_datatype_prop', array( 4558 'id' => array('integer', 15), 4559 'datatype_id' => array('integer', 9), 4560 'title' => array('text', 'link_detail_page'), 4561 'inputformat' => array('integer', 4), 4562 )); 4563} 4564?> 4565<#4401> 4566<?php 4567$ilDB->dropIndex("page_object", $a_name = "i2"); 4568?> 4569<#4402> 4570<?php 4571 4572$ilDB->manipulate("DELETE FROM settings" . 4573 " WHERE module = " . $ilDB->quote("common", "text") . 4574 " AND keyword = " . $ilDB->quote("obj_dis_creation_rcrs", "text")); 4575 4576?> 4577<#4403> 4578<?php 4579 4580$settings = new ilSetting(); 4581if (!$settings->get('ommit_legacy_ou_dbtable_deletion', 0)) { 4582 $ilDB->dropSequence('org_unit_data'); 4583 $ilDB->dropTable('org_unit_data'); 4584 $ilDB->dropTable('org_unit_tree'); 4585 $ilDB->dropTable('org_unit_assignments'); 4586} 4587 4588?> 4589<#4404> 4590<?php 4591 $ilDB->manipulate("UPDATE frm_posts SET pos_update = pos_date WHERE pos_update IS NULL"); 4592?> 4593<#4405> 4594<?php 4595$ilCtrlStructureReader->getStructure(); 4596?> 4597<#4406> 4598<?php 4599$ilDB->insert('il_dcl_datatype_prop', array( 4600 'id' => array('integer', 16), 4601 'datatype_id' => array('integer', 9), 4602 'title' => array('text', 'allowed_file_types'), 4603 'inputformat' => array('integer', 12), 4604)); 4605?> 4606<#4407> 4607<?php 4608$setting = new ilSetting(); 4609$fixState = $setting->get('dbupdate_randtest_pooldef_migration_fix', '0'); 4610 4611if ($fixState === '0') { 4612 $query = " 4613 SELECT tst_tests.test_id, COUNT(tst_rnd_quest_set_qpls.def_id) 4614 4615 FROM tst_tests 4616 4617 LEFT JOIN tst_rnd_quest_set_qpls 4618 ON tst_tests.test_id = tst_rnd_quest_set_qpls.test_fi 4619 4620 WHERE question_set_type = %s 4621 4622 GROUP BY tst_tests.test_id 4623 4624 HAVING COUNT(tst_rnd_quest_set_qpls.def_id) < 1 4625 "; 4626 4627 $res = $ilDB->queryF($query, array('text'), array('RANDOM_QUEST_SET')); 4628 4629 $testsWithoutDefinitionsDetected = false; 4630 4631 while ($row = $ilDB->fetchAssoc($res)) { 4632 $testsWithoutDefinitionsDetected = true; 4633 break; 4634 } 4635 4636 if ($testsWithoutDefinitionsDetected) { 4637 echo "<pre> 4638 4639 Dear Administrator, 4640 4641 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 4642 4643 The update process has been stopped, because your attention is required. 4644 4645 If you did not migrate ILIAS from version 4.3 to 4.4, but installed a 4.4 version from scratch, 4646 please ignore this message and simply refresh the page. 4647 4648 Otherwise please have a look to: http://www.ilias.de/mantis/view.php?id=12700 4649 4650 A bug in the db migration for ILIAS 4.4.x has lead to missing source pool definitions within several random tests. 4651 Your installation could be affected, because random tests without any source pool definition were detected. 4652 Perhaps, these tests were just created, but the update process has to assume that these tests are broken. 4653 4654 If you have a backup of your old ILIAS 4.3.x database the update process can repair these tests. 4655 Therefor please restore the table > tst_test_random < from your ILIAS 4.3.x backup database to your productive ILIAS 4.4.x database. 4656 4657 If you try to rerun the update process by refreshing the page, this message will be skipped. 4658 4659 Possibly broken random tests will be repaired, if the old database table mentioned above is available. 4660 After repairing the tests, the old database table will be dropped again. 4661 4662 Best regards, 4663 The Test Maintainers 4664 4665 </pre>"; 4666 4667 $setting->set('dbupdate_randtest_pooldef_migration_fix', '1'); 4668 4669 exit; // db update step MUST NOT finish in a normal way, so step will be processed again 4670 } else { 4671 $setting->set('dbupdate_randtest_pooldef_migration_fix', '2'); 4672 } 4673} elseif ($fixState === '1') { 4674 if ($ilDB->tableExists('tst_test_random')) { 4675 $query = " 4676 SELECT tst_test_random.test_fi, 4677 tst_test_random.questionpool_fi, 4678 tst_test_random.num_of_q, 4679 tst_test_random.tstamp, 4680 tst_test_random.sequence, 4681 object_data.title pool_title 4682 4683 FROM tst_tests 4684 4685 INNER JOIN tst_test_random 4686 ON tst_tests.test_id = tst_test_random.test_fi 4687 4688 LEFT JOIN tst_rnd_quest_set_qpls 4689 ON tst_tests.test_id = tst_rnd_quest_set_qpls.test_fi 4690 4691 LEFT JOIN object_data 4692 ON object_data.obj_id = tst_test_random.questionpool_fi 4693 4694 WHERE question_set_type = %s 4695 AND tst_rnd_quest_set_qpls.def_id IS NULL 4696 "; 4697 4698 $res = $ilDB->queryF($query, array('text'), array('RANDOM_QUEST_SET')); 4699 4700 $syncTimes = array(); 4701 4702 while ($row = $ilDB->fetchAssoc($res)) { 4703 if (!(int) $row['num_of_q']) { 4704 $row['num_of_q'] = null; 4705 } 4706 4707 if (!strlen($row['pool_title'])) { 4708 $row['pool_title'] = '*** unknown/deleted ***'; 4709 } 4710 4711 $nextId = $ilDB->nextId('tst_rnd_quest_set_qpls'); 4712 4713 $ilDB->insert('tst_rnd_quest_set_qpls', array( 4714 'def_id' => array('integer', $nextId), 4715 'test_fi' => array('integer', $row['test_fi']), 4716 'pool_fi' => array('integer', $row['questionpool_fi']), 4717 'pool_title' => array('text', $row['pool_title']), 4718 'origin_tax_fi' => array('integer', null), 4719 'origin_node_fi' => array('integer', null), 4720 'mapped_tax_fi' => array('integer', null), 4721 'mapped_node_fi' => array('integer', null), 4722 'quest_amount' => array('integer', $row['num_of_q']), 4723 'sequence_pos' => array('integer', $row['sequence']) 4724 )); 4725 4726 if (!is_array($syncTimes[$row['test_fi']])) { 4727 $syncTimes[$row['test_fi']] = array(); 4728 } 4729 4730 $syncTimes[$row['test_fi']][] = $row['tstamp']; 4731 } 4732 4733 foreach ($syncTimes as $testId => $times) { 4734 $assumedSyncTS = max($times); 4735 4736 $ilDB->update( 4737 'tst_rnd_quest_set_cfg', 4738 array( 4739 'quest_sync_timestamp' => array('integer', $assumedSyncTS) 4740 ), 4741 array( 4742 'test_fi' => array('integer', $testId) 4743 ) 4744 ); 4745 } 4746 } 4747 4748 $setting->set('dbupdate_randtest_pooldef_migration_fix', '2'); 4749} 4750?> 4751<#4408> 4752<?php 4753if ($ilDB->tableExists('tst_test_random')) { 4754 $ilDB->dropTable('tst_test_random'); 4755} 4756?> 4757 4758<#4409> 4759<?php 4760 $ilCtrlStructureReader->getStructure(); 4761?> 4762<#4410> 4763<?php 4764 $ilCtrlStructureReader->getStructure(); 4765?> 4766<#4411> 4767<?php 4768if (!$ilDB->sequenceExists('il_bibl_settings')) { 4769 $ilDB->createSequence('il_bibl_settings'); 4770 $set = $ilDB->query('SELECT MAX(id) new_seq FROM il_bibl_settings'); 4771 $rec = $ilDB->fetchObject($set); 4772 $ilDB->insert('il_bibl_settings_seq', array('sequence' => array('integer', $rec->new_seq))); 4773} 4774?> 4775<#4412> 4776<?php 4777if (!$ilDB->tableColumnExists('ecs_part_settings', 'dtoken')) { 4778 $ilDB->addTableColumn( 4779 'ecs_part_settings', 4780 'dtoken', 4781 array( 4782 'type' => 'integer', 4783 'length' => 1, 4784 'notnull' => true, 4785 'default' => 1 4786 ) 4787 ); 4788} 4789?> 4790<#4413> 4791<?php 4792if ($ilDB->tableColumnExists('crs_objectives', 'description')) { 4793 $ilDB->modifyTableColumn( 4794 'crs_objectives', 4795 'description', 4796 array( 4797 "type" => "text", 4798 "length" => 500, 4799 "notnull" => false, 4800 "default" => "" 4801 ) 4802 ); 4803} 4804?> 4805<#4414> 4806<?php 4807 4808$ilDB->insert("payment_settings", array( 4809 "keyword" => array("text", 'enable_topics'), 4810 "value" => array("clob", 1), 4811 "scope" => array("text", 'gui'))); 4812 4813?> 4814<#4415> 4815<?php 4816 4817if (!$ilDB->uniqueConstraintExists('tst_active', array('user_fi', 'test_fi', 'anonymous_id'))) { 4818 $ilDB->createTable('tmp_active_fix', array( 4819 'test_fi' => array( 4820 'type' => 'integer', 4821 'length' => 4, 4822 'notnull' => true, 4823 'default' => 0 4824 ), 4825 'user_fi' => array( 4826 'type' => 'integer', 4827 'length' => 4, 4828 'notnull' => true, 4829 'default' => 0 4830 ), 4831 'anonymous_id' => array( 4832 'type' => 'text', 4833 'length' => 255, 4834 'notnull' => true, 4835 'default' => '-' 4836 ), 4837 'active_id' => array( 4838 'type' => 'integer', 4839 'length' => 4, 4840 'notnull' => false, 4841 'default' => null 4842 ) 4843 )); 4844 4845 $ilDB->addPrimaryKey('tmp_active_fix', array('test_fi', 'user_fi', 'anonymous_id')); 4846 4847 $res = $ilDB->query(" 4848 SELECT COUNT(*), test_fi, user_fi, anonymous_id 4849 FROM tst_active 4850 GROUP BY user_fi, test_fi, anonymous_id 4851 HAVING COUNT(*) > 1 4852 "); 4853 4854 while ($row = $ilDB->fetchAssoc($res)) { 4855 if (is_null($row['anonymous_id']) || !strlen($row['anonymous_id'])) { 4856 $row['anonymous_id'] = '-'; 4857 } 4858 4859 $ilDB->replace( 4860 'tmp_active_fix', 4861 array( 4862 'test_fi' => array('integer', $row['test_fi']), 4863 'user_fi' => array('integer', (int) $row['user_fi']), 4864 'anonymous_id' => array('text', $row['anonymous_id']) 4865 ), 4866 array() 4867 ); 4868 } 4869} 4870 4871?> 4872<#4416> 4873<?php 4874 4875if ($ilDB->tableExists('tmp_active_fix')) { 4876 $selectUser = $ilDB->prepare( 4877 " 4878 SELECT active_id, max_points, reached_points, passed FROM tst_active 4879 LEFT JOIN tst_result_cache ON active_fi = active_id 4880 WHERE test_fi = ? AND user_fi = ? AND anonymous_id IS NULL 4881 ", 4882 array('integer', 'integer') 4883 ); 4884 4885 $selectAnonym = $ilDB->prepare( 4886 " 4887 SELECT active_id, max_points, reached_points, passed FROM tst_active 4888 LEFT JOIN tst_result_cache ON active_fi = active_id 4889 WHERE test_fi = ? AND user_fi IS NULL AND anonymous_id = ? 4890 ", 4891 array('integer', 'text') 4892 ); 4893 4894 $select = $ilDB->prepare( 4895 " 4896 SELECT active_id, max_points, reached_points, passed FROM tst_active 4897 LEFT JOIN tst_result_cache ON active_fi = active_id 4898 WHERE test_fi = ? AND user_fi = ? AND anonymous_id = ? 4899 ", 4900 array('integer', 'integer', 'text') 4901 ); 4902 4903 $update = $ilDB->prepareManip( 4904 " 4905 UPDATE tmp_active_fix SET active_id = ? 4906 WHERE test_fi = ? AND user_fi = ? AND anonymous_id = ? 4907 ", 4908 array('integer', 'integer', 'integer', 'text') 4909 ); 4910 4911 $res1 = $ilDB->query("SELECT * FROM tmp_active_fix WHERE active_id IS NULL"); 4912 4913 while ($row1 = $ilDB->fetchAssoc($res1)) { 4914 if (!$row1['user_fi']) { 4915 $res2 = $ilDB->execute($selectAnonym, array( 4916 $row1['test_fi'], $row1['anonymous_id'] 4917 )); 4918 } elseif ($row1['anonymous_id'] == '-') { 4919 $res2 = $ilDB->execute($selectUser, array( 4920 $row1['test_fi'], $row1['user_fi'] 4921 )); 4922 } else { 4923 $res2 = $ilDB->execute($select, array( 4924 $row1['test_fi'], $row1['user_fi'], $row1['anonymous_id'] 4925 )); 4926 } 4927 4928 $activeId = null; 4929 $passed = null; 4930 $points = null; 4931 4932 while ($row2 = $ilDB->fetchAssoc($res2)) { 4933 if ($activeId === null) { 4934 $activeId = $row2['active_id']; 4935 $passed = $row2['passed']; 4936 $points = $row2['reached_points']; 4937 continue; 4938 } 4939 4940 if (!$row2['max_points']) { 4941 continue; 4942 } 4943 4944 if (!$passed && $row2['passed']) { 4945 $activeId = $row2['active_id']; 4946 $passed = $row2['passed']; 4947 $points = $row2['reached_points']; 4948 continue; 4949 } 4950 4951 if ($passed && !$row2['passed']) { 4952 continue; 4953 } 4954 4955 if ($row2['reached_points'] > $points) { 4956 $activeId = $row2['active_id']; 4957 $passed = $row2['passed']; 4958 $points = $row2['reached_points']; 4959 continue; 4960 } 4961 } 4962 4963 $ilDB->execute($update, array( 4964 $activeId, $row1['test_fi'], $row1['user_fi'], $row1['anonymous_id'] 4965 )); 4966 } 4967} 4968 4969?> 4970<#4417> 4971<?php 4972 4973if ($ilDB->tableExists('tmp_active_fix')) { 4974 $deleteUserActives = $ilDB->prepareManip( 4975 "DELETE FROM tst_active WHERE active_id != ? AND test_fi = ? AND user_fi = ? AND anonymous_id IS NULL", 4976 array('integer', 'integer', 'integer') 4977 ); 4978 4979 $deleteAnonymActives = $ilDB->prepareManip( 4980 "DELETE FROM tst_active WHERE active_id != ? AND test_fi = ? AND user_fi IS NULL AND anonymous_id = ?", 4981 array('integer', 'integer', 'text') 4982 ); 4983 4984 $deleteActives = $ilDB->prepareManip( 4985 "DELETE FROM tst_active WHERE active_id != ? AND test_fi = ? AND user_fi = ? AND anonymous_id = ?", 4986 array('integer', 'integer', 'integer', 'text') 4987 ); 4988 4989 $deleteLp = $ilDB->prepareManip( 4990 "DELETE FROM ut_lp_marks WHERE obj_id = ? AND usr_id = ?", 4991 array('integer', 'integer') 4992 ); 4993 4994 $deleteTmpRec = $ilDB->prepareManip( 4995 "DELETE FROM tmp_active_fix WHERE test_fi = ? AND user_fi = ? AND anonymous_id = ?", 4996 array('integer', 'integer', 'text') 4997 ); 4998 4999 $res = $ilDB->query(" 5000 SELECT tmp_active_fix.*, obj_fi FROM tmp_active_fix INNER JOIN tst_tests ON test_id = test_fi 5001 "); 5002 5003 while ($row = $ilDB->fetchAssoc($res)) { 5004 if (!$row['user_fi']) { 5005 $ilDB->execute($deleteAnonymActives, array( 5006 $row['active_id'], $row['test_fi'], $row['anonymous_id'] 5007 )); 5008 } elseif ($row['anonymous_id'] == '-') { 5009 $ilDB->execute($deleteUserActives, array( 5010 $row['active_id'], $row['test_fi'], $row['user_fi'] 5011 )); 5012 } else { 5013 $ilDB->execute($deleteActives, array( 5014 $row['active_id'], $row['test_fi'], $row['user_fi'], $row['anonymous_id'] 5015 )); 5016 } 5017 5018 $ilDB->execute($deleteLp, array( 5019 $row['obj_fi'], $row['user_fi'] 5020 )); 5021 5022 $ilDB->execute($deleteTmpRec, array( 5023 $row['test_fi'], $row['user_fi'], $row['anonymous_id'] 5024 )); 5025 } 5026 5027 $ilDB->dropTable('tmp_active_fix'); 5028} 5029 5030?> 5031<#4418> 5032<?php 5033 5034if (!$ilDB->uniqueConstraintExists('tst_active', array('user_fi', 'test_fi', 'anonymous_id'))) { 5035 $ilDB->addUniqueConstraint('tst_active', array('user_fi', 'test_fi', 'anonymous_id'), 'uc1'); 5036} 5037 5038?> 5039<#4419> 5040<?php 5041 5042$ilDB->manipulate('delete from ecs_course_assignments'); 5043 5044?> 5045<#4420> 5046<?php 5047 $ilCtrlStructureReader->getStructure(); 5048?> 5049<#4421> 5050<?php 5051 $ilCtrlStructureReader->getStructure(); 5052?> 5053<#4422> 5054<?php 5055 5056$settings = new ilSetting('assessment'); 5057 5058if (!(int) $settings->get('quest_process_lock_mode_autoinit', 0)) { 5059 if ($settings->get('quest_process_lock_mode', 'none') == 'none') { 5060 $settings->set('quest_process_lock_mode', 'db'); 5061 } 5062 5063 $settings->set('quest_process_lock_mode_autoinit_done', 1); 5064} 5065 5066?> 5067<#4423> 5068<?php 5069 5070if ($ilDB->tableColumnExists("usr_portfolio", "comments")) { 5071 // #14661 - centralized public comments setting 5072 include_once "Services/Notes/classes/class.ilNote.php"; 5073 5074 $data = array(); 5075 5076 $set = $ilDB->query("SELECT prtf.id,prtf.comments,od.type" . 5077 " FROM usr_portfolio prtf" . 5078 " JOIN object_data od ON (prtf.id = od.obj_id)"); 5079 while ($row = $ilDB->fetchAssoc($set)) { 5080 $row["comments"] = (bool) $row["comments"]; 5081 $data[] = $row; 5082 } 5083 5084 $set = $ilDB->query("SELECT id,notes comments" . 5085 " FROM il_blog"); 5086 while ($row = $ilDB->fetchAssoc($set)) { 5087 $row["type"] = "blog"; 5088 $row["comments"] = (bool) $row["comments"]; 5089 $data[] = $row; 5090 } 5091 5092 $set = $ilDB->query("SELECT cobj.id,cobj.pub_notes comments,od.type" . 5093 " FROM content_object cobj" . 5094 " JOIN object_data od ON (cobj.id = od.obj_id)"); 5095 while ($row = $ilDB->fetchAssoc($set)) { 5096 $row["comments"] = ($row["comments"] == "y" ? true : false); 5097 $data[] = $row; 5098 } 5099 5100 $set = $ilDB->query("SELECT id,show_comments comments" . 5101 " FROM il_poll"); 5102 while ($row = $ilDB->fetchAssoc($set)) { 5103 $row["type"] = "poll"; 5104 $row["comments"] = (bool) $row["comments"]; 5105 $data[] = $row; 5106 } 5107 5108 if (sizeof($data)) { 5109 foreach ($data as $item) { 5110 if ($item["id"] && $item["type"]) { 5111 $ilDB->manipulate("DELETE FROM note_settings" . 5112 " WHERE rep_obj_id = " . $ilDB->quote($item["id"], "integer") . 5113 " AND obj_id = " . $ilDB->quote(0, "integer") . 5114 " AND obj_type = " . $ilDB->quote($item["type"], "text")); 5115 5116 if ($item["comments"]) { 5117 $ilDB->manipulate("INSERT INTO note_settings" . 5118 " (rep_obj_id, obj_id, obj_type, activated)" . 5119 " VALUES (" . $ilDB->quote($item["id"], "integer") . 5120 ", " . $ilDB->quote(0, "integer") . 5121 ", " . $ilDB->quote($item["type"], "text") . 5122 ", " . $ilDB->quote(1, "integer") . ")"); 5123 } 5124 } 5125 } 5126 } 5127} 5128 5129?> 5130<#4424> 5131<?php 5132 5133if ($ilDB->tableColumnExists("usr_portfolio", "comments")) { 5134 $ilDB->dropTableColumn("usr_portfolio", "comments"); 5135 $ilDB->dropTableColumn("il_blog", "notes"); 5136 $ilDB->dropTableColumn("content_object", "pub_notes"); 5137 $ilDB->dropTableColumn("il_poll", "show_comments"); 5138} 5139 5140?> 5141 5142<#4425> 5143<?php 5144 5145if ($ilDB->tableColumnExists('ecs_cms_data', 'cms_id')) { 5146 $ilDB->renameTableColumn('ecs_cms_data', 'cms_id', 'cms_bak'); 5147 $ilDB->addTableColumn( 5148 'ecs_cms_data', 5149 'cms_id', 5150 array( 5151 "type" => "text", 5152 "notnull" => false, 5153 "length" => 512 5154 ) 5155 ); 5156 5157 $query = 'UPDATE ecs_cms_data SET cms_id = cms_bak '; 5158 $ilDB->manipulate($query); 5159 5160 $ilDB->dropTableColumn('ecs_cms_data', 'cms_bak'); 5161} 5162?> 5163<#4426> 5164<?php 5165 $ilCtrlStructureReader->getStructure(); 5166?> 5167<#4427> 5168<?php 5169 5170if ($ilDB->tableColumnExists('ecs_import', 'econtent_id')) { 5171 $ilDB->renameTableColumn('ecs_import', 'econtent_id', 'econtent_id_bak'); 5172 $ilDB->addTableColumn( 5173 'ecs_import', 5174 'econtent_id', 5175 array( 5176 "type" => "text", 5177 "notnull" => false, 5178 "length" => 512 5179 ) 5180 ); 5181 5182 $query = 'UPDATE ecs_import SET econtent_id = econtent_id_bak '; 5183 $ilDB->manipulate($query); 5184 5185 $ilDB->dropTableColumn('ecs_import', 'econtent_id_bak'); 5186} 5187?> 5188<#4428> 5189<?php 5190 5191include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 5192$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 5193if ($tgt_ops_id) { 5194 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId('sess'); 5195 if ($lp_type_id) { 5196 // add "edit_learning_progress" to session 5197 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $tgt_ops_id); 5198 5199 // clone settings from "write" to "edit_learning_progress" 5200 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 5201 ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 5202 5203 // clone settings from "write" to "read_learning_progress" (4287 did not work for sessions) 5204 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('read_learning_progress'); 5205 if ($tgt_ops_id) { 5206 ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 5207 } 5208 } 5209} 5210 5211?> 5212 5213<#4429> 5214<?php 5215 5216$query = 'DELETE from cal_recurrence_rules WHERE cal_id IN ( select cal_id from cal_entries where is_milestone = ' . $ilDB->quote(1, 'integer') . ')'; 5217$ilDB->manipulate($query); 5218 5219?> 5220 5221<#4430> 5222<?php 5223if (!$ilDB->tableColumnExists('qpl_a_cloze_combi_res', 'row_id')) { 5224 $query = 'DELETE from qpl_a_cloze_combi_res'; 5225 $ilDB->manipulate($query); 5226 $ilDB->addTableColumn( 5227 'qpl_a_cloze_combi_res', 5228 'row_id', 5229 array( 5230 'type' => 'integer', 5231 'length' => 4, 5232 'default' => 0 5233 ) 5234 ); 5235} 5236?> 5237<#4431> 5238<?php 5239$ilCtrlStructureReader->getStructure(); 5240?> 5241<#4432> 5242<?php 5243$ilCtrlStructureReader->getStructure(); 5244?> 5245<#4433> 5246<?php 5247$ilCtrlStructureReader->getStructure(); 5248?> 5249<#4434> 5250<?php 5251if ($ilDB->tableColumnExists('tst_tests', 'examid_in_kiosk')) { 5252 $ilDB->renameTableColumn('tst_tests', 'examid_in_kiosk', 'examid_in_test_pass'); 5253} 5254?> 5255<#4435> 5256<?php 5257if ($ilDB->tableColumnExists('tst_tests', 'show_exam_id')) { 5258 $ilDB->renameTableColumn('tst_tests', 'show_exam_id', 'examid_in_test_res'); 5259} 5260?> 5261<#4436> 5262<?php 5263if (!$ilDB->tableColumnExists('il_wiki_page', 'hide_adv_md')) { 5264 $ilDB->addTableColumn( 5265 'il_wiki_page', 5266 'hide_adv_md', 5267 array( 5268 'type' => 'integer', 5269 'length' => 1, 5270 'default' => 0 5271 ) 5272 ); 5273} 5274?> 5275<#4437> 5276<?php 5277if (!$ilDB->tableColumnExists('tst_active', 'start_lock')) { 5278 $ilDB->addTableColumn( 5279 'tst_active', 5280 'start_lock', 5281 array( 5282 'type' => 'text', 5283 'length' => 128, 5284 'notnull' => false, 5285 'default' => null 5286 ) 5287 ); 5288} 5289?> 5290<#4438> 5291<?php 5292 5293$row = $ilDB->fetchAssoc($ilDB->queryF( 5294 "SELECT count(*) cnt FROM settings WHERE module = %s AND keyword = %s", 5295 array('text', 'text'), 5296 array('assessment', 'ass_process_lock_mode') 5297)); 5298 5299if ($row['cnt']) { 5300 $ilDB->manipulateF( 5301 "DELETE FROM settings WHERE module = %s AND keyword = %s", 5302 array('text', 'text'), 5303 array('assessment', 'quest_process_lock_mode') 5304 ); 5305} else { 5306 $ilDB->update( 5307 'settings', 5308 array( 5309 'keyword' => array('text', 'ass_process_lock_mode') 5310 ), 5311 array( 5312 'module' => array('text', 'assessment'), 5313 'keyword' => array('text', 'quest_process_lock_mode') 5314 ) 5315 ); 5316} 5317 5318?> 5319<#4439> 5320<?php 5321if (!$ilDB->tableColumnExists('file_based_lm', 'show_lic')) { 5322 $ilDB->addTableColumn( 5323 'file_based_lm', 5324 'show_lic', 5325 array( 5326 'type' => 'integer', 5327 'length' => 1, 5328 'notnull' => false, 5329 'default' => null 5330 ) 5331 ); 5332} 5333if (!$ilDB->tableColumnExists('file_based_lm', 'show_bib')) { 5334 $ilDB->addTableColumn( 5335 'file_based_lm', 5336 'show_bib', 5337 array( 5338 'type' => 'integer', 5339 'length' => 1, 5340 'notnull' => false, 5341 'default' => null 5342 ) 5343 ); 5344} 5345?> 5346<#4440> 5347<?php 5348 5349$ilDB->manipulate("UPDATE settings " . 5350 "SET value = " . $ilDB->quote(1370, "text") . 5351 " WHERE module = " . $ilDB->quote("blga", "text") . 5352 " AND keyword = " . $ilDB->quote("banner_width", "text") . 5353 " AND value = " . $ilDB->quote(880, "text")); 5354 5355$ilDB->manipulate("UPDATE settings " . 5356 "SET value = " . $ilDB->quote(1370, "text") . 5357 " WHERE module = " . $ilDB->quote("prfa", "text") . 5358 " AND keyword = " . $ilDB->quote("banner_width", "text") . 5359 " AND value = " . $ilDB->quote(880, "text")); 5360 5361?> 5362<#4441> 5363<?php 5364 5365include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 5366$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('copy'); 5367if ($tgt_ops_id) { 5368 $feed_type_id = ilDBUpdateNewObjectType::getObjectTypeId('feed'); 5369 if ($feed_type_id) { 5370 // add "copy" to (external) feed 5371 ilDBUpdateNewObjectType::addRBACOperation($feed_type_id, $tgt_ops_id); 5372 5373 // clone settings from "write" to "copy" 5374 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 5375 ilDBUpdateNewObjectType::cloneOperation('feed', $src_ops_id, $tgt_ops_id); 5376 } 5377} 5378 5379?> 5380<#4442> 5381<?php 5382 $ilCtrlStructureReader->getStructure(); 5383?> 5384<#4443> 5385<?php 5386 $ilCtrlStructureReader->getStructure(); 5387?> 5388<#4444> 5389<?php 5390 $ilCtrlStructureReader->getStructure(); 5391?> 5392<#4445> 5393<?php 5394 $ilCtrlStructureReader->getStructure(); 5395?> 5396<#4446> 5397<?php 5398 $ilCtrlStructureReader->getStructure(); 5399?> 5400<#4447> 5401<?php 5402 if (!$ilDB->tableColumnExists('skl_user_has_level', 'self_eval')) { 5403 $ilDB->addTableColumn("skl_user_has_level", "self_eval", array( 5404 "type" => "integer", 5405 "length" => 1, 5406 "notnull" => true, 5407 "default" => 0 5408 )); 5409 } 5410?> 5411<#4448> 5412<?php 5413 if (!$ilDB->tableColumnExists('skl_user_skill_level', 'self_eval')) { 5414 $ilDB->addTableColumn("skl_user_skill_level", "self_eval", array( 5415 "type" => "integer", 5416 "length" => 1, 5417 "notnull" => true, 5418 "default" => 0 5419 )); 5420 } 5421?> 5422<#4449> 5423<?php 5424 $ilDB->dropPrimaryKey("skl_user_has_level"); 5425 $ilDB->addPrimaryKey( 5426 "skl_user_has_level", 5427 array("level_id", "user_id", "trigger_obj_id", "tref_id", "self_eval") 5428 ); 5429?> 5430<#4450> 5431<?php 5432 $ilDB->modifyTableColumn( 5433 "skl_user_has_level", 5434 "trigger_obj_type", 5435 array( 5436 "type" => "text", 5437 "length" => 4, 5438 "notnull" => false 5439 ) 5440); 5441 5442 $ilDB->modifyTableColumn( 5443 "skl_user_skill_level", 5444 "trigger_obj_type", 5445 array( 5446 "type" => "text", 5447 "length" => 4, 5448 "notnull" => false 5449 ) 5450 ); 5451?> 5452<#4451> 5453<?php 5454 $ilSetting = new ilSetting(); 5455 if ((int) $ilSetting->get("optes_360_db") <= 0) { 5456 /*$ilDB->manipulate("DELETE FROM skl_user_has_level WHERE ". 5457 " self_eval = ".$ilDB->quote(1, "integer") 5458 ); 5459 $ilDB->manipulate("DELETE FROM skl_user_skill_level WHERE ". 5460 " self_eval = ".$ilDB->quote(1, "integer") 5461 );*/ 5462 5463 $set = $ilDB->query("SELECT * FROM skl_self_eval_level ORDER BY last_update ASC"); 5464 $writtenkeys = array(); 5465 while ($rec = $ilDB->fetchAssoc($set)) { 5466 if (!in_array($rec["level_id"] . ":" . $rec["user_id"] . ":" . $rec["tref_id"], $writtenkeys)) { 5467 $writtenkeys[] = $rec["level_id"] . ":" . $rec["user_id"] . ":" . $rec["tref_id"]; 5468 $q = "INSERT INTO skl_user_has_level " . 5469 "(level_id, user_id, status_date, skill_id, trigger_ref_id, trigger_obj_id, trigger_title, tref_id, trigger_obj_type, self_eval) VALUES (" . 5470 $ilDB->quote($rec["level_id"], "integer") . "," . 5471 $ilDB->quote($rec["user_id"], "integer") . "," . 5472 $ilDB->quote($rec["last_update"], "timestamp") . "," . 5473 $ilDB->quote($rec["skill_id"], "integer") . "," . 5474 $ilDB->quote(0, "integer") . "," . 5475 $ilDB->quote(0, "integer") . "," . 5476 $ilDB->quote("", "text") . "," . 5477 $ilDB->quote($rec["tref_id"], "integer") . "," . 5478 $ilDB->quote("", "text") . "," . 5479 $ilDB->quote(1, "integer") . 5480 ")"; 5481 $ilDB->manipulate($q); 5482 } else { 5483 $ilDB->manipulate( 5484 "UPDATE skl_user_has_level SET " . 5485 " status_date = " . $ilDB->quote($rec["last_update"], "timestamp") . "," . 5486 " skill_id = " . $ilDB->quote($rec["skill_id"], "integer") . 5487 " WHERE level_id = " . $ilDB->quote($rec["level_id"], "integer") . 5488 " AND user_id = " . $ilDB->quote($rec["user_id"], "integer") . 5489 " AND trigger_obj_id = " . $ilDB->quote(0, "integer") . 5490 " AND tref_id = " . $ilDB->quote($rec["tref_id"], "integer") . 5491 " AND self_eval = " . $ilDB->quote(1, "integer") 5492 ); 5493 } 5494 $q = "INSERT INTO skl_user_skill_level " . 5495 "(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 (" . 5496 $ilDB->quote($rec["level_id"], "integer") . "," . 5497 $ilDB->quote($rec["user_id"], "integer") . "," . 5498 $ilDB->quote($rec["last_update"], "timestamp") . "," . 5499 $ilDB->quote($rec["skill_id"], "integer") . "," . 5500 $ilDB->quote(0, "integer") . "," . 5501 $ilDB->quote(0, "integer") . "," . 5502 $ilDB->quote("", "text") . "," . 5503 $ilDB->quote($rec["tref_id"], "integer") . "," . 5504 $ilDB->quote("", "text") . "," . 5505 $ilDB->quote(1, "integer") . "," . 5506 $ilDB->quote(1, "integer") . "," . 5507 $ilDB->quote(1, "integer") . 5508 ")"; 5509 $ilDB->manipulate($q); 5510 } 5511 } 5512?> 5513<#4452> 5514<?php 5515 $ilCtrlStructureReader->getStructure(); 5516?> 5517<#4453> 5518<?php 5519 $ilCtrlStructureReader->getStructure(); 5520?> 5521<#4454> 5522<?php 5523 $ilCtrlStructureReader->getStructure(); 5524?> 5525<#4455> 5526<?php 5527 if (!$ilDB->sequenceExists('booking_reservation_group')) { 5528 $ilDB->createSequence('booking_reservation_group'); 5529 } 5530?> 5531<#4456> 5532<?php 5533 5534 if (!$ilDB->tableColumnExists('crs_objective_tst', 'tst_limit_p')) { 5535 $ilDB->addTableColumn('crs_objective_tst', 'tst_limit_p', array( 5536 'type' => 'integer', 5537 'length' => 2, 5538 'notnull' => true, 5539 'default' => 0 5540 )); 5541 } 5542?> 5543<#4457> 5544<?php 5545 5546// update question assignment limits 5547$query = 'SELECT objective_id, ref_id, question_id FROM crs_objective_qst '; 5548$res = $ilDB->query($query); 5549 5550$questions = array(); 5551while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 5552 $questions[$row->objective_id . '_' . $row->ref_id][] = $row->question_id; 5553} 5554 5555$GLOBALS['ilLog']->write(__METHOD__ . ': ' . print_r($questions, true)); 5556 5557foreach ($questions as $objective_ref_id => $qst_ids) { 5558 $parts = explode('_', $objective_ref_id); 5559 $objective_id = $parts[0]; 5560 $tst_ref_id = $parts[1]; 5561 5562 $sum = 0; 5563 foreach ((array) $qst_ids as $qst_id) { 5564 $query = 'SELECT points FROM qpl_questions WHERE question_id = ' . $ilDB->quote($qst_id, 'integer'); 5565 $res_qst = $ilDB->query($query); 5566 while ($row = $res_qst->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 5567 $sum += $row->points; 5568 } 5569 if ($sum > 0) { 5570 // read limit 5571 $query = 'SELECT tst_limit FROM crs_objective_tst ' . 5572 'WHERE objective_id = ' . $ilDB->quote($objective_id, 'integer'); 5573 $res_limit = $ilDB->query($query); 5574 5575 $limit_points = 0; 5576 while ($row = $res_limit->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 5577 $limit_points = $row->tst_limit; 5578 } 5579 // calculate percentage 5580 $limit_p = $limit_points / $sum * 100; 5581 $limit_p = intval($limit_p); 5582 $limit_p = ($limit_p >= 100 ? 100 : $limit_p); 5583 5584 // update 5585 $query = 'UPDATE crs_objective_tst ' . 5586 'SET tst_limit_p = ' . $ilDB->quote($limit_p, 'integer') . ' ' . 5587 'WHERE objective_id = ' . $ilDB->quote($objective_id, 'integer') . ' ' . 5588 'AND ref_id = ' . $ilDB->quote($tst_ref_id, 'integer'); 5589 $ilDB->manipulate($query); 5590 } 5591 } 5592} 5593?> 5594<#4458> 5595<?php 5596if (!$ilDB->tableColumnExists('tst_tests', 'intro_enabled')) { 5597 $ilDB->addTableColumn('tst_tests', 'intro_enabled', array( 5598 'type' => 'integer', 5599 'length' => 1, 5600 'notnull' => false, 5601 'default' => null 5602 )); 5603} 5604?> 5605<#4459> 5606<?php 5607if (!$ilDB->tableColumnExists('tst_tests', 'starting_time_enabled')) { 5608 $ilDB->addTableColumn('tst_tests', 'starting_time_enabled', array( 5609 'type' => 'integer', 5610 'length' => 1, 5611 'notnull' => false, 5612 'default' => null 5613 )); 5614} 5615?> 5616<#4460> 5617<?php 5618if (!$ilDB->tableColumnExists('tst_tests', 'ending_time_enabled')) { 5619 $ilDB->addTableColumn('tst_tests', 'ending_time_enabled', array( 5620 'type' => 'integer', 5621 'length' => 1, 5622 'notnull' => false, 5623 'default' => null 5624 )); 5625} 5626?> 5627<#4461> 5628<?php 5629if ($ilDB->tableColumnExists('tst_tests', 'intro_enabled')) { 5630 $ilDB->dropTableColumn('tst_tests', 'intro_enabled'); 5631} 5632?> 5633<#4462> 5634<?php 5635if ($ilDB->tableColumnExists('tst_tests', 'starting_time_enabled')) { 5636 $ilDB->dropTableColumn('tst_tests', 'starting_time_enabled'); 5637} 5638?> 5639<#4463> 5640<?php 5641if ($ilDB->tableColumnExists('tst_tests', 'ending_time_enabled')) { 5642 $ilDB->dropTableColumn('tst_tests', 'ending_time_enabled'); 5643} 5644?> 5645<#4464> 5646<?php 5647if (!$ilDB->tableColumnExists('tst_tests', 'intro_enabled')) { 5648 $ilDB->addTableColumn('tst_tests', 'intro_enabled', array( 5649 'type' => 'integer', 5650 'length' => 1, 5651 'notnull' => false, 5652 'default' => null 5653 )); 5654 5655 $ilDB->queryF( 5656 "UPDATE tst_tests SET intro_enabled = %s WHERE LENGTH(introduction) > %s", 5657 array('integer', 'integer'), 5658 array(1, 0) 5659 ); 5660 5661 $ilDB->queryF( 5662 "UPDATE tst_tests SET intro_enabled = %s WHERE LENGTH(introduction) = %s OR LENGTH(introduction) IS NULL", 5663 array('integer', 'integer'), 5664 array(0, 0) 5665 ); 5666} 5667?> 5668<#4465> 5669<?php 5670if (!$ilDB->tableColumnExists('tst_tests', 'starting_time_enabled')) { 5671 $ilDB->addTableColumn('tst_tests', 'starting_time_enabled', array( 5672 'type' => 'integer', 5673 'length' => 1, 5674 'notnull' => false, 5675 'default' => null 5676 )); 5677 5678 $ilDB->queryF( 5679 "UPDATE tst_tests SET starting_time_enabled = %s WHERE LENGTH(starting_time) > %s", 5680 array('integer', 'integer'), 5681 array(1, 0) 5682 ); 5683 5684 $ilDB->queryF( 5685 "UPDATE tst_tests SET starting_time_enabled = %s WHERE LENGTH(starting_time) = %s OR LENGTH(starting_time) IS NULL", 5686 array('integer', 'integer'), 5687 array(0, 0) 5688 ); 5689} 5690?> 5691<#4466> 5692<?php 5693if (!$ilDB->tableColumnExists('tst_tests', 'ending_time_enabled')) { 5694 $ilDB->addTableColumn('tst_tests', 'ending_time_enabled', array( 5695 'type' => 'integer', 5696 'length' => 1, 5697 'notnull' => false, 5698 'default' => null 5699 )); 5700 5701 $ilDB->queryF( 5702 "UPDATE tst_tests SET ending_time_enabled = %s WHERE LENGTH(ending_time) > %s", 5703 array('integer', 'integer'), 5704 array(1, 0) 5705 ); 5706 5707 $ilDB->queryF( 5708 "UPDATE tst_tests SET ending_time_enabled = %s WHERE LENGTH(ending_time) = %s OR LENGTH(ending_time) IS NULL", 5709 array('integer', 'integer'), 5710 array(0, 0) 5711 ); 5712} 5713?> 5714<#4467> 5715<?php 5716if (!$ilDB->tableColumnExists('tst_tests', 'password_enabled')) { 5717 $ilDB->addTableColumn('tst_tests', 'password_enabled', array( 5718 'type' => 'integer', 5719 'length' => 1, 5720 'notnull' => false, 5721 'default' => null 5722 )); 5723 5724 $ilDB->queryF( 5725 "UPDATE tst_tests SET password_enabled = %s WHERE LENGTH(password) > %s", 5726 array('integer', 'integer'), 5727 array(1, 0) 5728 ); 5729 5730 $ilDB->queryF( 5731 "UPDATE tst_tests SET password_enabled = %s WHERE LENGTH(password) = %s OR LENGTH(password) IS NULL", 5732 array('integer', 'integer'), 5733 array(0, 0) 5734 ); 5735} 5736?> 5737<#4468> 5738<?php 5739if (!$ilDB->tableColumnExists('tst_tests', 'limit_users_enabled')) { 5740 $ilDB->addTableColumn('tst_tests', 'limit_users_enabled', array( 5741 'type' => 'integer', 5742 'length' => 1, 5743 'notnull' => false, 5744 'default' => null 5745 )); 5746 5747 $ilDB->queryF( 5748 "UPDATE tst_tests SET limit_users_enabled = %s WHERE allowedusers IS NOT NULL AND allowedusers > %s", 5749 array('integer', 'integer'), 5750 array(1, 0) 5751 ); 5752 5753 $ilDB->queryF( 5754 "UPDATE tst_tests SET limit_users_enabled = %s WHERE allowedusers IS NULL OR allowedusers <= %s", 5755 array('integer', 'integer'), 5756 array(0, 0) 5757 ); 5758} 5759?> 5760<#4469> 5761<?php 5762// @ukonhle: Please do not commit empty database steps ;-) 5763?> 5764<#4470> 5765<?php 5766$ilDB->queryF( 5767 'DELETE FROM settings WHERE keyword = %s', 5768 array('text'), 5769 array('ps_export_scorm') 5770); 5771$ilDB->queryF( 5772 'INSERT INTO settings (module, keyword, value) VALUES (%s,%s,%s)', 5773 array('text','text','text'), 5774 array('common','ps_export_scorm','1') 5775); 5776?> 5777<#4471> 5778<?php 5779$ilDB->manipulate('DELETE FROM addressbook WHERE login NOT IN(SELECT login FROM usr_data) AND email IS NULL'); 5780$ilDB->manipulate( 5781 'DELETE FROM addressbook_mlist_ass WHERE addr_id NOT IN( 5782 SELECT addr_id FROM addressbook 5783 )' 5784); 5785?> 5786<#4472> 5787<?php 5788 if (!$ilDB->indexExistsByFields('page_question', array('page_parent_type','page_id', 'page_lang'))) { 5789 $ilDB->addIndex('page_question', array('page_parent_type','page_id', 'page_lang'), 'i1'); 5790 } 5791?> 5792<#4473> 5793<?php 5794 $ilCtrlStructureReader->getStructure(); 5795?> 5796<#4474> 5797<?php 5798 5799include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 5800$lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId('svy'); 5801if ($lp_type_id) { 5802 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 5803 5804 // clone settings from "write" to "edit_learning_progress" 5805 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_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 // clone settings from "write" to "read_learning_progress" 5812 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('read_learning_progress'); 5813 if ($tgt_ops_id) { 5814 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $tgt_ops_id); 5815 ilDBUpdateNewObjectType::cloneOperation('svy', $src_ops_id, $tgt_ops_id); 5816 } 5817} 5818 5819?> 5820<#4475> 5821<?php 5822 5823if ($ilDB->tableColumnExists('obj_stat', 'tstamp')) { 5824 $ilDB->dropTableColumn('obj_stat', 'tstamp'); 5825} 5826 5827?> 5828<#4476> 5829<?php 5830if (!$ilDB->uniqueConstraintExists('usr_data', array('login'))) { 5831 $res = $ilDB->query(" 5832 SELECT COUNT(*) cnt 5833 FROM ( 5834 SELECT login 5835 FROM usr_data 5836 GROUP BY login 5837 HAVING COUNT(*) > 1 5838 ) duplicatelogins 5839 "); 5840 $data = $ilDB->fetchAssoc($res); 5841 if ($data['cnt'] > 0) { 5842 echo "<pre> 5843 Dear Administrator, 5844 5845 PLEASE READ THE FOLLOWING INSTRUCTIONS 5846 5847 The update process has been stopped due to data inconsistency reasons. 5848 We found multiple ILIAS user accounts with the same login. You have to fix this issue manually. 5849 5850 Database table: usr_data 5851 Field: login 5852 5853 You can determine these accounts by executing the following SQL statement: 5854 5855 SELECT ud.* FROM usr_data ud 5856 INNER JOIN ( 5857 SELECT login FROM usr_data GROUP BY login HAVING COUNT(*) > 1 5858 ) tmp ON tmp.login = ud.login 5859 5860 Please manipulate the affected records by choosing different login names or use the following statement 5861 to change the duplicate login name to unique name like [usr_id]_[login]_duplicate. The further changes on 5862 user data (e.g. deletion of duplicates) could then be easily done in ILIAS administration. 5863 5864 UPDATE usr_data ud 5865 INNER JOIN ( 5866 SELECT udinner.login, udinner.usr_id 5867 FROM usr_data udinner 5868 GROUP BY udinner.login 5869 HAVING COUNT(udinner.login) > 1 5870 ) dup ON ud.login = dup.login 5871 SET ud.login = CONCAT(CONCAT(CONCAT(ud.usr_id, '_'), CONCAT(ud.login, '_')), 'duplicate') 5872 5873 If you try to rerun the update process, this warning will apear again if the issue is still not solved. 5874 5875 Best regards, 5876 The ILIAS developers 5877 </pre>"; 5878 exit(); 5879 } 5880 5881 $ilDB->addUniqueConstraint('usr_data', array('login'), 'uc1'); 5882} 5883?> 5884<#4477> 5885<?php 5886 5887$query = " 5888 UPDATE tst_rnd_quest_set_qpls SET pool_title = ( 5889 COALESCE( 5890 (SELECT title FROM object_data WHERE obj_id = pool_fi), %s 5891 ) 5892 ) WHERE pool_title IS NULL OR pool_title = %s 5893"; 5894 5895$ilDB->manipulateF($query, array('text', 'text'), array('*** unknown/deleted ***', '')); 5896 5897?> 5898<#4478> 5899<?php 5900 5901if (!$ilDB->tableColumnExists('tst_tests', 'broken')) { 5902 $ilDB->addTableColumn( 5903 'tst_tests', 5904 'broken', 5905 array( 5906 'type' => 'integer', 5907 'length' => 1, 5908 'notnull' => false, 5909 'default' => null 5910 ) 5911 ); 5912 5913 $ilDB->queryF("UPDATE tst_tests SET broken = %s", array('integer'), array(0)); 5914} 5915 5916?> 5917<#4479> 5918<?php 5919$ilDB->manipulate( 5920 "UPDATE style_data SET " . 5921 " uptodate = " . $ilDB->quote(0, "integer") 5922); 5923?> 5924<#4480> 5925<?php 5926 $ilCtrlStructureReader->getStructure(); 5927?> 5928<#4481> 5929<?php 5930$ilDB->manipulate("UPDATE tst_active SET last_finished_pass = (tries - 1) WHERE last_finished_pass IS NULL"); 5931?> 5932<#4482> 5933<?php 5934$ilDB->manipulate("DELETE FROM il_dcl_datatype_prop WHERE title = " . $ilDB->quote('allowed_file_types', 'text')); 5935?> 5936<#4483> 5937<?php 5938 $ilCtrlStructureReader->getStructure(); 5939?> 5940<#4484> 5941<?php 5942if (!$ilDB->tableColumnExists('qpl_questionpool', 'skill_service')) { 5943 $ilDB->addTableColumn('qpl_questionpool', 'skill_service', array( 5944 'type' => 'integer', 5945 'length' => 1, 5946 'notnull' => false, 5947 'default' => null 5948 )); 5949 5950 $ilDB->manipulateF( 5951 'UPDATE qpl_questionpool SET skill_service = %s', 5952 array('integer'), 5953 array(0) 5954 ); 5955} 5956?> 5957<#4485> 5958<?php 5959if (!$ilDB->tableExists('qpl_qst_skl_assigns')) { 5960 $ilDB->createTable('qpl_qst_skl_assigns', array( 5961 'obj_fi' => array( 5962 'type' => 'integer', 5963 'length' => 4, 5964 'notnull' => true, 5965 'default' => 0 5966 ), 5967 'question_fi' => array( 5968 'type' => 'integer', 5969 'length' => 4, 5970 'notnull' => true, 5971 'default' => 0 5972 ), 5973 'skill_base_fi' => array( 5974 'type' => 'integer', 5975 'length' => 4, 5976 'notnull' => true, 5977 'default' => 0 5978 ), 5979 'skill_tref_fi' => array( 5980 'type' => 'integer', 5981 'length' => 4, 5982 'notnull' => true, 5983 'default' => 0 5984 ), 5985 'skill_points' => array( 5986 'type' => 'integer', 5987 'length' => 4, 5988 'notnull' => true, 5989 'default' => 0 5990 ) 5991 )); 5992 5993 $ilDB->addPrimaryKey('qpl_qst_skl_assigns', array('obj_fi', 'question_fi', 'skill_base_fi', 'skill_tref_fi')); 5994 5995 if ($ilDB->tableExists('tst_skl_qst_assigns')) { 5996 $res = $ilDB->query(" 5997 SELECT tst_skl_qst_assigns.*, tst_tests.obj_fi 5998 FROM tst_skl_qst_assigns 5999 INNER JOIN tst_tests ON test_id = test_fi 6000 "); 6001 6002 while ($row = $ilDB->fetchAssoc($res)) { 6003 $ilDB->replace( 6004 'qpl_qst_skl_assigns', 6005 array( 6006 'obj_fi' => array('integer', $row['obj_fi']), 6007 'question_fi' => array('integer', $row['question_fi']), 6008 'skill_base_fi' => array('integer', $row['skill_base_fi']), 6009 'skill_tref_fi' => array('integer', $row['skill_tref_fi']) 6010 ), 6011 array( 6012 'skill_points' => array('integer', $row['skill_points']) 6013 ) 6014 ); 6015 } 6016 6017 $ilDB->dropTable('tst_skl_qst_assigns'); 6018 } 6019} 6020?> 6021<#4486> 6022<?php 6023$setting = new ilSetting(); 6024 6025if (!$setting->get('dbup_tst_skl_thres_mig_done', 0)) { 6026 if (!$ilDB->tableExists('tst_threshold_tmp')) { 6027 $ilDB->createTable('tst_threshold_tmp', array( 6028 'test_id' => array( 6029 'type' => 'integer', 6030 'length' => 4, 6031 'notnull' => true, 6032 'default' => 0 6033 ), 6034 'obj_id' => array( 6035 'type' => 'integer', 6036 'length' => 4, 6037 'notnull' => true, 6038 'default' => 0 6039 ) 6040 )); 6041 6042 $ilDB->addPrimaryKey('tst_threshold_tmp', array('test_id')); 6043 } 6044 6045 $res = $ilDB->query(" 6046 SELECT DISTINCT tst_tests.test_id, obj_fi FROM tst_tests 6047 INNER JOIN tst_skl_thresholds ON test_fi = tst_tests.test_id 6048 LEFT JOIN tst_threshold_tmp ON tst_tests.test_id = tst_threshold_tmp.test_id 6049 WHERE tst_threshold_tmp.test_id IS NULL 6050 "); 6051 6052 while ($row = $ilDB->fetchAssoc($res)) { 6053 $ilDB->replace( 6054 'tst_threshold_tmp', 6055 array('test_id' => array('integer', $row['test_id'])), 6056 array('obj_id' => array('integer', $row['obj_fi'])) 6057 ); 6058 } 6059 6060 if (!$ilDB->tableColumnExists('tst_skl_thresholds', 'tmp')) { 6061 $ilDB->addTableColumn('tst_skl_thresholds', 'tmp', array( 6062 'type' => 'integer', 6063 'length' => 4, 6064 'notnull' => false, 6065 'default' => null 6066 )); 6067 } 6068 6069 $setting->set('dbup_tst_skl_thres_mig_done', 1); 6070} 6071?> 6072<#4487> 6073<?php 6074if ($ilDB->tableExists('tst_threshold_tmp')) { 6075 $stmtSelectSklPointSum = $ilDB->prepare( 6076 "SELECT skill_base_fi, skill_tref_fi, SUM(skill_points) points_sum FROM qpl_qst_skl_assigns 6077 WHERE obj_fi = ? GROUP BY skill_base_fi, skill_tref_fi", 6078 array('integer') 6079 ); 6080 6081 $stmtUpdatePercentThresholds = $ilDB->prepareManip( 6082 "UPDATE tst_skl_thresholds SET tmp = ROUND( ((threshold * 100) / ?), 0 ) 6083 WHERE test_fi = ? AND skill_base_fi = ? AND skill_tref_fi = ?", 6084 array('integer', 'integer', 'integer', 'integer') 6085 ); 6086 6087 $res1 = $ilDB->query(" 6088 SELECT DISTINCT test_id, obj_id FROM tst_threshold_tmp 6089 INNER JOIN tst_skl_thresholds ON test_fi = test_id 6090 WHERE tmp IS NULL 6091 "); 6092 6093 while ($row1 = $ilDB->fetchAssoc($res1)) { 6094 $res2 = $ilDB->execute($stmtSelectSklPointSum, array($row1['obj_id'])); 6095 6096 while ($row2 = $ilDB->fetchAssoc($res2)) { 6097 $ilDB->execute($stmtUpdatePercentThresholds, array( 6098 $row2['points_sum'], $row1['test_id'], $row2['skill_base_fi'], $row2['skill_tref_fi'] 6099 )); 6100 } 6101 } 6102} 6103?> 6104<#4488> 6105<?php 6106if ($ilDB->tableExists('tst_threshold_tmp')) { 6107 $ilDB->dropTable('tst_threshold_tmp'); 6108} 6109?> 6110<#4489> 6111<?php 6112if ($ilDB->tableColumnExists('tst_skl_thresholds', 'tmp')) { 6113 $ilDB->manipulate("UPDATE tst_skl_thresholds SET threshold = tmp"); 6114 $ilDB->dropTableColumn('tst_skl_thresholds', 'tmp'); 6115} 6116?> 6117<#4490> 6118<?php 6119if (!$ilDB->tableColumnExists('qpl_qst_skl_assigns', 'eval_mode')) { 6120 $ilDB->addTableColumn('qpl_qst_skl_assigns', 'eval_mode', array( 6121 'type' => 'text', 6122 'length' => 16, 6123 'notnull' => false, 6124 'default' => null 6125 )); 6126 6127 $ilDB->manipulateF( 6128 "UPDATE qpl_qst_skl_assigns SET eval_mode = %s", 6129 array('text'), 6130 array('result') 6131 ); 6132} 6133?> 6134<#4491> 6135<?php 6136if (!$ilDB->tableExists('qpl_qst_skl_sol_expr')) { 6137 $ilDB->createTable('qpl_qst_skl_sol_expr', array( 6138 'question_fi' => array( 6139 'type' => 'integer', 6140 'length' => 4, 6141 'notnull' => true, 6142 'default' => 0 6143 ), 6144 'skill_base_fi' => array( 6145 'type' => 'integer', 6146 'length' => 4, 6147 'notnull' => true, 6148 'default' => 0 6149 ), 6150 'skill_tref_fi' => array( 6151 'type' => 'integer', 6152 'length' => 4, 6153 'notnull' => true, 6154 'default' => 0 6155 ), 6156 'order_index' => array( 6157 'type' => 'integer', 6158 'length' => 4, 6159 'notnull' => true, 6160 'default' => 0 6161 ), 6162 'expression' => array( 6163 'type' => 'text', 6164 'length' => 255, 6165 'notnull' => true, 6166 'default' => '' 6167 ), 6168 'points' => array( 6169 'type' => 'integer', 6170 'length' => 4, 6171 'notnull' => true, 6172 'default' => 0 6173 ) 6174 )); 6175 6176 $ilDB->addPrimaryKey('qpl_qst_skl_sol_expr', array( 6177 'question_fi', 'skill_base_fi', 'skill_tref_fi', 'order_index' 6178 )); 6179} 6180?> 6181<#4492> 6182<?php 6183$res = $ilDB->query(" 6184 SELECT DISTINCT(question_fi) FROM qpl_qst_skl_assigns 6185 LEFT JOIN qpl_questions ON question_fi = question_id 6186 WHERE question_id IS NULL 6187"); 6188 6189$deletedQuestionIds = array(); 6190 6191while ($row = $ilDB->fetchAssoc($res)) { 6192 $deletedQuestionIds[] = $row['question_fi']; 6193} 6194 6195$inDeletedQuestionIds = $ilDB->in('question_fi', $deletedQuestionIds, false, 'integer'); 6196 6197$ilDB->query(" 6198 DELETE FROM qpl_qst_skl_assigns WHERE $inDeletedQuestionIds 6199"); 6200?> 6201<#4493> 6202<?php 6203$row = $ilDB->fetchAssoc($ilDB->queryF( 6204 'SELECT COUNT(*) cnt 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 6209if ($row['cnt']) { 6210 $res = $ilDB->queryF( 6211 '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', 6212 array('text'), 6213 array('sktr') 6214 ); 6215 6216 while ($row = $ilDB->fetchAssoc($res)) { 6217 $ilDB->update( 6218 'qpl_qst_skl_assigns', 6219 array( 6220 'skill_base_fi' => array('integer', $row['skill_tref_fi']), 6221 'skill_tref_fi' => array('integer', $row['skill_base_fi']) 6222 ), 6223 array( 6224 'obj_fi' => array('integer', $row['obj_fi']), 6225 'question_fi' => array('integer', $row['question_fi']), 6226 'skill_base_fi' => array('integer', $row['skill_base_fi']), 6227 'skill_tref_fi' => array('integer', $row['skill_tref_fi']) 6228 ) 6229 ); 6230 } 6231} 6232?> 6233<#4494> 6234<?php 6235$ilDB->manipulateF( 6236 "UPDATE qpl_qst_skl_assigns SET eval_mode = %s WHERE eval_mode IS NULL", 6237 array('text'), 6238 array('result') 6239); 6240?> 6241<#4495> 6242<?php 6243 $ilCtrlStructureReader->getStructure(); 6244?> 6245<#4496> 6246<?php 6247if (!$ilDB->tableExists('mail_cron_orphaned')) { 6248 $ilDB->createTable('mail_cron_orphaned', array( 6249 'mail_id' => array( 6250 'type' => 'integer', 6251 'length' => 4, 6252 'notnull' => true 6253 ), 6254 'folder_id' => array( 6255 'type' => 'integer', 6256 'length' => 4, 6257 'notnull' => true 6258 ), 6259 'ts_do_delete' => array( 6260 'type' => 'integer', 6261 'length' => 4, 6262 'notnull' => true 6263 ) 6264 )); 6265 6266 $ilDB->addPrimaryKey('mail_cron_orphaned', array('mail_id', 'folder_id')); 6267} 6268?> 6269<#4497> 6270<?php 6271if ($ilDB->tableExists('chat_blocked')) { 6272 $ilDB->dropTable('chat_blocked'); 6273} 6274?> 6275<#4498> 6276<?php 6277// Don't remove this comment 6278?> 6279<#4499> 6280<?php 6281if ($ilDB->tableExists('chat_invitations')) { 6282 $ilDB->dropTable('chat_invitations'); 6283} 6284?> 6285<#4500> 6286<?php 6287if ($ilDB->tableExists('chat_records')) { 6288 $ilDB->dropTable('chat_records'); 6289} 6290?> 6291<#4501> 6292<?php 6293if ($ilDB->sequenceExists('chat_records')) { 6294 $ilDB->dropSequence('chat_records'); 6295} 6296?> 6297<#4502> 6298<?php 6299if ($ilDB->sequenceExists('chat_rooms')) { 6300 $ilDB->dropSequence('chat_rooms'); 6301} 6302?> 6303<#4503> 6304<?php 6305if ($ilDB->tableExists('chat_rooms')) { 6306 $ilDB->dropTable('chat_rooms'); 6307} 6308?> 6309<#4504> 6310<?php 6311if ($ilDB->tableExists('chat_room_messages')) { 6312 $ilDB->dropTable('chat_room_messages'); 6313} 6314?> 6315<#4505> 6316<?php 6317if ($ilDB->sequenceExists('chat_room_messages')) { 6318 $ilDB->dropSequence('chat_room_messages'); 6319} 6320?> 6321<#4506> 6322<?php 6323if ($ilDB->sequenceExists('chat_smilies')) { 6324 $ilDB->dropSequence('chat_smilies'); 6325} 6326?> 6327<#4507> 6328<?php 6329if ($ilDB->tableExists('chat_smilies')) { 6330 $ilDB->dropTable('chat_smilies'); 6331} 6332?> 6333<#4508> 6334<?php 6335if ($ilDB->tableExists('chat_user')) { 6336 $ilDB->dropTable('chat_user'); 6337} 6338?> 6339<#4509> 6340<?php 6341if ($ilDB->tableExists('chat_record_data')) { 6342 $ilDB->dropTable('chat_record_data'); 6343} 6344?> 6345<#4510> 6346<?php 6347if ($ilDB->sequenceExists('chat_record_data')) { 6348 $ilDB->dropSequence('chat_record_data'); 6349} 6350?> 6351<#4511> 6352<?php 6353if ($ilDB->tableExists('ilinc_data')) { 6354 $ilDB->dropTable('ilinc_data'); 6355} 6356?> 6357<#4512> 6358<?php 6359if ($ilDB->tableExists('ilinc_registration')) { 6360 $ilDB->dropTable('ilinc_registration'); 6361} 6362?> 6363<#4513> 6364<?php 6365if ($ilDB->tableColumnExists('usr_data', 'ilinc_id')) { 6366 $ilDB->dropTableColumn('usr_data', 'ilinc_id'); 6367} 6368 6369if ($ilDB->tableColumnExists('usr_data', 'ilinc_login')) { 6370 $ilDB->dropTableColumn('usr_data', 'ilinc_login'); 6371} 6372 6373if ($ilDB->tableColumnExists('usr_data', 'ilinc_passwd')) { 6374 $ilDB->dropTableColumn('usr_data', 'ilinc_passwd'); 6375} 6376?> 6377<#4514> 6378<?php 6379if ($ilDB->uniqueConstraintExists('tst_sequence', array('active_fi', 'pass'))) { 6380 $ilDB->dropUniqueConstraintByFields('tst_sequence', array('active_fi', 'pass')); 6381 $ilDB->addPrimaryKey('tst_sequence', array('active_fi', 'pass')); 6382} 6383?> 6384<#4515> 6385<?php 6386if ($ilDB->uniqueConstraintExists('tst_pass_result', array('active_fi', 'pass'))) { 6387 $ilDB->dropUniqueConstraintByFields('tst_pass_result', array('active_fi', 'pass')); 6388 $ilDB->addPrimaryKey('tst_pass_result', array('active_fi', 'pass')); 6389} 6390?> 6391<#4516> 6392<?php 6393$crpra_dup_query_num = " 6394SELECT COUNT(*) cnt 6395FROM ( 6396 SELECT proom_id, user_id 6397 FROM chatroom_proomaccess 6398 GROUP BY proom_id, user_id 6399 HAVING COUNT(*) > 1 6400) duplicateChatProoms 6401"; 6402$res = $ilDB->query($crpra_dup_query_num); 6403$data = $ilDB->fetchAssoc($res); 6404if ($data['cnt']) { 6405 $mopt_dup_query = " 6406 SELECT proom_id, user_id 6407 FROM chatroom_proomaccess 6408 GROUP BY proom_id, user_id 6409 HAVING COUNT(*) > 1 6410 "; 6411 $res = $ilDB->query($mopt_dup_query); 6412 6413 $stmt_del = $ilDB->prepareManip("DELETE FROM chatroom_proomaccess WHERE proom_id = ? AND user_id = ?", array('integer', 'integer')); 6414 $stmt_in = $ilDB->prepareManip("INSERT INTO chatroom_proomaccess (proom_id, user_id) VALUES(?, ?)", array('integer', 'integer')); 6415 6416 while ($row = $ilDB->fetchAssoc($res)) { 6417 $ilDB->execute($stmt_del, array($row['proom_id'], $row['user_id'])); 6418 $ilDB->execute($stmt_in, array($row['proom_id'], $row['user_id'])); 6419 } 6420} 6421 6422$res = $ilDB->query($crpra_dup_query_num); 6423$data = $ilDB->fetchAssoc($res); 6424if ($data['cnt'] > 0) { 6425 die("There are still duplicate entries in table 'chatroom_proomaccess'. Please execute this database update step again."); 6426} 6427 6428$ilDB->addPrimaryKey('chatroom_proomaccess', array('proom_id', 'user_id')); 6429?> 6430<#4517> 6431<?php 6432$mopt_dup_query_num = " 6433SELECT COUNT(*) cnt 6434FROM ( 6435 SELECT user_id 6436 FROM mail_options 6437 GROUP BY user_id 6438 HAVING COUNT(*) > 1 6439) duplicateMailOptions 6440"; 6441$res = $ilDB->query($mopt_dup_query_num); 6442$data = $ilDB->fetchAssoc($res); 6443if ($data['cnt']) { 6444 $mopt_dup_query = " 6445 SELECT user_id 6446 FROM mail_options 6447 GROUP BY user_id 6448 HAVING COUNT(*) > 1 6449 "; 6450 $res = $ilDB->query($mopt_dup_query); 6451 6452 $stmt_sel = $ilDB->prepare("SELECT * FROM mail_options WHERE user_id = ?", array('integer')); 6453 $stmt_del = $ilDB->prepareManip("DELETE FROM mail_options WHERE user_id = ?", array('integer')); 6454 $stmt_in = $ilDB->prepareManip("INSERT INTO mail_options (user_id, linebreak, signature, incoming_type, cronjob_notification) VALUES(?, ?, ?, ?, ?)", array('integer', 'integer', 'text', 'integer', 'integer')); 6455 6456 while ($row = $ilDB->fetchAssoc($res)) { 6457 $opt_res = $ilDB->execute($stmt_sel, array($row['user_id'])); 6458 $opt_row = $ilDB->fetchAssoc($opt_res); 6459 if ($opt_row) { 6460 $ilDB->execute($stmt_del, array($opt_row['user_id'])); 6461 $ilDB->execute($stmt_in, array($opt_row['user_id'], $opt_row['linebreak'], $opt_row['signature'], $opt_row['incoming_type'], $opt_row['cronjob_notification'])); 6462 } 6463 } 6464} 6465 6466$res = $ilDB->query($mopt_dup_query_num); 6467$data = $ilDB->fetchAssoc($res); 6468if ($data['cnt'] > 0) { 6469 die("There are still duplicate entries in table 'mail_options'. Please execute this database update step again."); 6470} 6471 6472$ilDB->addPrimaryKey('mail_options', array('user_id')); 6473?> 6474<#4518> 6475<?php 6476$psc_dup_query_num = " 6477SELECT COUNT(*) cnt 6478FROM ( 6479 SELECT psc_ps_fk, psc_pc_fk, psc_pcc_fk 6480 FROM payment_statistic_coup 6481 GROUP BY psc_ps_fk, psc_pc_fk, psc_pcc_fk 6482 HAVING COUNT(*) > 1 6483) duplicatePaymentStatistics 6484"; 6485$res = $ilDB->query($psc_dup_query_num); 6486$data = $ilDB->fetchAssoc($res); 6487if ($data['cnt']) { 6488 $psc_dup_query = " 6489 SELECT psc_ps_fk, psc_pc_fk, psc_pcc_fk 6490 FROM payment_statistic_coup 6491 GROUP BY psc_ps_fk, psc_pc_fk, psc_pcc_fk 6492 HAVING COUNT(*) > 1 6493 "; 6494 $res = $ilDB->query($psc_dup_query); 6495 6496 $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')); 6497 $stmt_in = $ilDB->prepareManip("INSERT INTO payment_statistic_coup (psc_ps_fk, psc_pc_fk, psc_pcc_fk) VALUES(?, ?, ?)", array('integer', 'integer', 'integer')); 6498 6499 while ($row = $ilDB->fetchAssoc($res)) { 6500 $ilDB->execute($stmt_del, array($row['psc_ps_fk'], $row['psc_pc_fk'], $row['psc_pcc_fk'])); 6501 $ilDB->execute($stmt_in, array($row['psc_ps_fk'], $row['psc_pc_fk'], $row['psc_pcc_fk'])); 6502 } 6503} 6504 6505$res = $ilDB->query($psc_dup_query_num); 6506$data = $ilDB->fetchAssoc($res); 6507if ($data['cnt'] > 0) { 6508 die("There are still duplicate entries in table 'payment_statistic_coup'. Please execute this database update step again."); 6509} 6510 6511$ilDB->addPrimaryKey('payment_statistic_coup', array('psc_ps_fk', 'psc_pc_fk', 'psc_pcc_fk')); 6512?> 6513<#4519> 6514<?php 6515$msave_dup_query_num = " 6516SELECT COUNT(*) cnt 6517FROM ( 6518 SELECT user_id 6519 FROM mail_saved 6520 GROUP BY user_id 6521 HAVING COUNT(*) > 1 6522) duplicateMailSaved 6523"; 6524$res = $ilDB->query($msave_dup_query_num); 6525$data = $ilDB->fetchAssoc($res); 6526if ($data['cnt']) { 6527 $msave_dup_query = " 6528 SELECT user_id 6529 FROM mail_saved 6530 GROUP BY user_id 6531 HAVING COUNT(*) > 1 6532 "; 6533 $res = $ilDB->query($msave_dup_query); 6534 6535 $stmt_sel = $ilDB->prepare("SELECT * FROM mail_saved WHERE user_id = ?", array('integer')); 6536 $stmt_del = $ilDB->prepareManip("DELETE FROM mail_saved WHERE user_id = ?", array('integer')); 6537 6538 while ($row = $ilDB->fetchAssoc($res)) { 6539 $opt_res = $ilDB->execute($stmt_sel, array($row['user_id'])); 6540 $opt_row = $ilDB->fetchAssoc($opt_res); 6541 if ($opt_row) { 6542 $ilDB->execute($stmt_del, array($opt_row['user_id'])); 6543 $ilDB->insert( 6544 'mail_saved', 6545 array( 6546 'user_id' => array('integer', $opt_row['user_id']), 6547 'm_type' => array('text', $opt_row['m_type']), 6548 'm_email' => array('integer', $opt_row['m_email']), 6549 'm_subject' => array('text', $opt_row['m_subject']), 6550 'use_placeholders' => array('integer', $opt_row['use_placeholders']), 6551 'm_message' => array('clob', $opt_row['m_message']), 6552 'rcp_to' => array('clob', $opt_row['rcp_to']), 6553 'rcp_cc' => array('clob', $opt_row['rcp_cc']), 6554 'rcp_bcc' => array('clob', $opt_row['rcp_bcc']), 6555 'attachments' => array('clob', $opt_row['attachments']) 6556 ) 6557 ); 6558 } 6559 } 6560} 6561 6562$res = $ilDB->query($msave_dup_query_num); 6563$data = $ilDB->fetchAssoc($res); 6564if ($data['cnt']) { 6565 die("There are still duplicate entries in table 'mail_saved'. Please execute this database update step again."); 6566} 6567 6568$ilDB->addPrimaryKey('mail_saved', array('user_id')); 6569?> 6570<#4520> 6571<?php 6572$chrban_dup_query_num = " 6573SELECT COUNT(*) cnt 6574FROM ( 6575 SELECT room_id, user_id 6576 FROM chatroom_bans 6577 GROUP BY room_id, user_id 6578 HAVING COUNT(*) > 1 6579) duplicateChatroomBans 6580"; 6581$res = $ilDB->query($chrban_dup_query_num); 6582$data = $ilDB->fetchAssoc($res); 6583if ($data['cnt']) { 6584 $chrban_dup_query = " 6585 SELECT DISTINCT finalDuplicateChatroomBans.room_id, finalDuplicateChatroomBans.user_id, finalDuplicateChatroomBans.timestamp, finalDuplicateChatroomBans.remark 6586 FROM ( 6587 SELECT chatroom_bans.* 6588 FROM chatroom_bans 6589 INNER JOIN ( 6590 SELECT room_id, user_id, MAX(timestamp) ts 6591 FROM chatroom_bans 6592 GROUP BY room_id, user_id 6593 HAVING COUNT(*) > 1 6594 ) duplicateChatroomBans 6595 ON duplicateChatroomBans.room_id = chatroom_bans.room_id 6596 AND duplicateChatroomBans.user_id = chatroom_bans.user_id 6597 AND duplicateChatroomBans.ts = chatroom_bans.timestamp 6598 ) finalDuplicateChatroomBans 6599 "; 6600 $res = $ilDB->query($chrban_dup_query); 6601 6602 $stmt_del = $ilDB->prepareManip("DELETE FROM chatroom_bans WHERE room_id = ? AND user_id = ?", array('integer', 'integer')); 6603 $stmt_in = $ilDB->prepareManip("INSERT INTO chatroom_bans (room_id, user_id, timestamp, remark) VALUES(?, ?, ?, ?)", array('integer', 'integer', 'integer', 'text')); 6604 6605 while ($row = $ilDB->fetchAssoc($res)) { 6606 $ilDB->execute($stmt_del, array($row['room_id'], $row['user_id'])); 6607 $ilDB->execute($stmt_in, array($row['room_id'], $row['user_id'], $row['timestamp'], $row['remark'])); 6608 } 6609} 6610 6611$res = $ilDB->query($chrban_dup_query_num); 6612$data = $ilDB->fetchAssoc($res); 6613if ($data['cnt']) { 6614 die("There are still duplicate entries in table 'chatroom_bans'. Please execute this database update step again."); 6615} 6616 6617$ilDB->addPrimaryKey('chatroom_bans', array('room_id', 'user_id')); 6618?> 6619<#4521> 6620<?php 6621if (!$ilDB->sequenceExists('chatroom_psessionstmp')) { 6622 $ilDB->createSequence('chatroom_psessionstmp'); 6623} 6624?> 6625<#4522> 6626<?php 6627if (!$ilDB->tableExists('chatroom_psessionstmp')) { 6628 $fields = array( 6629 'psess_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 6630 'proom_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6631 'user_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6632 'connected' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6633 'disconnected' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0) 6634 ); 6635 $ilDB->createTable('chatroom_psessionstmp', $fields); 6636 $ilDB->addPrimaryKey('chatroom_psessionstmp', array('psess_id')); 6637} 6638?> 6639<#4523> 6640<?php 6641$query = ' 6642SELECT chatroom_psessions.proom_id, chatroom_psessions.user_id, chatroom_psessions.connected, chatroom_psessions.disconnected 6643FROM chatroom_psessions 6644LEFT JOIN chatroom_psessionstmp 6645 ON chatroom_psessionstmp.proom_id = chatroom_psessions.proom_id 6646 AND chatroom_psessionstmp.user_id = chatroom_psessions.user_id 6647 AND chatroom_psessionstmp.connected = chatroom_psessions.connected 6648 AND chatroom_psessionstmp.disconnected = chatroom_psessions.disconnected 6649WHERE chatroom_psessionstmp.psess_id IS NULL 6650GROUP BY chatroom_psessions.proom_id, chatroom_psessions.user_id, chatroom_psessions.connected, chatroom_psessions.disconnected 6651'; 6652$res = $ilDB->query($query); 6653 6654$stmt_in = $ilDB->prepareManip('INSERT INTO chatroom_psessionstmp (psess_id, proom_id, user_id, connected, disconnected) VALUES(?, ?, ?, ?, ?)', array('integer', 'integer', 'integer', 'integer','integer')); 6655 6656while ($row = $ilDB->fetchAssoc($res)) { 6657 $psess_id = $ilDB->nextId('chatroom_psessionstmp'); 6658 $ilDB->execute($stmt_in, array($psess_id, (int) $row['proom_id'], (int) $row['user_id'], (int) $row['connected'], (int) $row['disconnected'])); 6659} 6660?> 6661<#4524> 6662<?php 6663$ilDB->dropTable('chatroom_psessions'); 6664?> 6665<#4525> 6666<?php 6667$ilDB->renameTable('chatroom_psessionstmp', 'chatroom_psessions'); 6668?> 6669<#4526> 6670<?php 6671if (!$ilDB->sequenceExists('chatroom_psessions')) { 6672 $query = "SELECT MAX(psess_id) mpsess_id FROM chatroom_psessions"; 6673 $row = $ilDB->fetchAssoc($ilDB->query($query)); 6674 $ilDB->createSequence('chatroom_psessions', (int) $row['mpsess_id'] + 1); 6675} 6676?> 6677<#4527> 6678<?php 6679if ($ilDB->sequenceExists('chatroom_psessionstmp')) { 6680 $ilDB->dropSequence('chatroom_psessionstmp'); 6681} 6682?> 6683<#4528> 6684<?php 6685$ilDB->addIndex('chatroom_psessions', array('proom_id', 'user_id'), 'i1'); 6686?> 6687<#4529> 6688<?php 6689$ilDB->addIndex('chatroom_psessions', array('disconnected'), 'i2'); 6690?> 6691<#4530> 6692<?php 6693if (!$ilDB->sequenceExists('chatroom_sessionstmp')) { 6694 $ilDB->createSequence('chatroom_sessionstmp'); 6695} 6696?> 6697<#4531> 6698<?php 6699if (!$ilDB->tableExists('chatroom_sessionstmp')) { 6700 $fields = array( 6701 'sess_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 6702 'room_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6703 'user_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6704 'userdata' => array('type' => 'text', 'length' => 4000, 'notnull' => false, 'default' => null), 6705 'connected' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 6706 'disconnected' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0) 6707 ); 6708 $ilDB->createTable('chatroom_sessionstmp', $fields); 6709 $ilDB->addPrimaryKey('chatroom_sessionstmp', array('sess_id')); 6710} 6711?> 6712<#4532> 6713<?php 6714if ($ilDB->getDBType() == 'innodb' || $ilDB->getDBType() == 'mysql') { 6715 $query = ' 6716 SELECT chatroom_sessions.room_id, chatroom_sessions.user_id, chatroom_sessions.connected, chatroom_sessions.disconnected, chatroom_sessions.userdata 6717 FROM chatroom_sessions 6718 LEFT JOIN chatroom_sessionstmp 6719 ON chatroom_sessionstmp.room_id = chatroom_sessions.room_id 6720 AND chatroom_sessionstmp.user_id = chatroom_sessions.user_id 6721 AND chatroom_sessionstmp.connected = chatroom_sessions.connected 6722 AND chatroom_sessionstmp.disconnected = chatroom_sessions.disconnected 6723 AND chatroom_sessionstmp.userdata = chatroom_sessions.userdata COLLATE utf8_general_ci 6724 WHERE chatroom_sessionstmp.sess_id IS NULL 6725 GROUP BY chatroom_sessions.room_id, chatroom_sessions.user_id, chatroom_sessions.connected, chatroom_sessions.disconnected, chatroom_sessions.userdata 6726 '; 6727} else { 6728 $query = ' 6729 SELECT chatroom_sessions.room_id, chatroom_sessions.user_id, chatroom_sessions.connected, chatroom_sessions.disconnected, chatroom_sessions.userdata 6730 FROM chatroom_sessions 6731 LEFT JOIN chatroom_sessionstmp 6732 ON chatroom_sessionstmp.room_id = chatroom_sessions.room_id 6733 AND chatroom_sessionstmp.user_id = chatroom_sessions.user_id 6734 AND chatroom_sessionstmp.connected = chatroom_sessions.connected 6735 AND chatroom_sessionstmp.disconnected = chatroom_sessions.disconnected 6736 AND chatroom_sessionstmp.userdata = chatroom_sessions.userdata 6737 WHERE chatroom_sessionstmp.sess_id IS NULL 6738 GROUP BY chatroom_sessions.room_id, chatroom_sessions.user_id, chatroom_sessions.connected, chatroom_sessions.disconnected, chatroom_sessions.userdata 6739 '; 6740} 6741 6742$res = $ilDB->query($query); 6743 6744$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')); 6745 6746while ($row = $ilDB->fetchAssoc($res)) { 6747 $sess_id = $ilDB->nextId('chatroom_sessionstmp'); 6748 $ilDB->execute($stmt_in, array($sess_id, (int) $row['room_id'], (int) $row['user_id'], (int) $row['connected'], (int) $row['disconnected'], (string) $row['userdata'])); 6749} 6750?> 6751<#4533> 6752<?php 6753$ilDB->dropTable('chatroom_sessions'); 6754?> 6755<#4534> 6756<?php 6757$ilDB->renameTable('chatroom_sessionstmp', 'chatroom_sessions'); 6758?> 6759<#4535> 6760<?php 6761if (!$ilDB->sequenceExists('chatroom_sessions')) { 6762 $query = "SELECT MAX(sess_id) msess_id FROM chatroom_sessions"; 6763 $row = $ilDB->fetchAssoc($ilDB->query($query)); 6764 $ilDB->createSequence('chatroom_sessions', (int) $row['msess_id'] + 1); 6765} 6766?> 6767<#4536> 6768<?php 6769if ($ilDB->sequenceExists('chatroom_sessionstmp')) { 6770 $ilDB->dropSequence('chatroom_sessionstmp'); 6771} 6772?> 6773<#4537> 6774<?php 6775$ilDB->addIndex('chatroom_sessions', array('room_id', 'user_id'), 'i1'); 6776?> 6777<#4538> 6778<?php 6779$ilDB->addIndex('chatroom_sessions', array('disconnected'), 'i2'); 6780?> 6781<#4539> 6782<?php 6783$ilDB->addIndex('chatroom_sessions', array('user_id'), 'i3'); 6784?> 6785<#4540> 6786<?php 6787// qpl_a_cloze_combi_res - primary key step 1/8 6788 6789$dupsCountRes = $ilDB->query(" 6790 SELECT COUNT(*) dups_cnt FROM ( 6791 SELECT combination_id, question_fi, gap_fi, row_id 6792 FROM qpl_a_cloze_combi_res 6793 GROUP BY combination_id, question_fi, gap_fi, row_id 6794 HAVING COUNT(*) > 1 6795 ) dups"); 6796 6797$dupsCountRow = $ilDB->fetchAssoc($dupsCountRes); 6798 6799if ($dupsCountRow['dups_cnt'] > 0) { 6800 if (!$ilDB->tableExists('dups_clozecombis_qst')) { 6801 $ilDB->createTable('dups_clozecombis_qst', array( 6802 'qst' => array( 6803 'type' => 'integer', 6804 'length' => 4, 6805 'notnull' => true 6806 ), 6807 'num' => array( 6808 'type' => 'integer', 6809 'length' => 4, 6810 'notnull' => false 6811 ) 6812 )); 6813 6814 $ilDB->addPrimaryKey('dups_clozecombis_qst', array('qst')); 6815 } 6816 6817 if (!$ilDB->tableExists('dups_clozecombis_rows')) { 6818 $ilDB->createTable('dups_clozecombis_rows', array( 6819 'combination_id' => array( 6820 'type' => 'integer', 6821 'length' => 4, 6822 'notnull' => true 6823 ), 6824 'question_fi' => array( 6825 'type' => 'integer', 6826 'length' => 4, 6827 'notnull' => true 6828 ), 6829 'gap_fi' => array( 6830 'type' => 'integer', 6831 'length' => 4, 6832 'notnull' => true 6833 ), 6834 'answer' => array( 6835 'type' => 'text', 6836 'length' => 1000, 6837 'notnull' => false 6838 ), 6839 'points' => array( 6840 'type' => 'float', 6841 'notnull' => false 6842 ), 6843 'best_solution' => array( 6844 'type' => 'integer', 6845 'length' => 1, 6846 'notnull' => false 6847 ), 6848 'row_id' => array( 6849 'type' => 'integer', 6850 'length' => 4, 6851 'notnull' => false, 6852 'default' => 0 6853 ) 6854 )); 6855 6856 $ilDB->addPrimaryKey('dups_clozecombis_rows', array( 6857 'combination_id', 'question_fi', 'gap_fi', 'row_id' 6858 )); 6859 } 6860} 6861?> 6862<#4541> 6863<?php 6864// qpl_a_cloze_combi_res - primary key step 2/8 6865 6866// break safe update step 6867 6868if ($ilDB->tableExists('dups_clozecombis_qst')) { 6869 $res = $ilDB->query(" 6870 SELECT combination_id, question_fi, gap_fi, row_id, COUNT(*) 6871 FROM qpl_a_cloze_combi_res 6872 LEFT JOIN dups_clozecombis_qst ON qst = question_fi 6873 WHERE qst IS NULL 6874 GROUP BY combination_id, question_fi, gap_fi, row_id 6875 HAVING COUNT(*) > 1 6876 "); 6877 6878 while ($row = $ilDB->fetchAssoc($res)) { 6879 $ilDB->replace( 6880 'dups_clozecombis_qst', 6881 array( 6882 'qst' => array('integer', $row['question_fi']) 6883 ), 6884 array( 6885 'num' => array('integer', null) 6886 ) 6887 ); 6888 } 6889} 6890?> 6891<#4542> 6892<?php 6893// qpl_a_cloze_combi_res - primary key step 3/8 6894 6895// break safe update step 6896 6897if ($ilDB->tableExists('dups_clozecombis_qst')) { 6898 $selectNumQuery = " 6899 SELECT COUNT(*) num FROM ( 6900 SELECT question_fi FROM qpl_a_cloze_combi_res WHERE question_fi = ? 6901 GROUP BY combination_id, question_fi, gap_fi, row_id 6902 ) numrows 6903 "; 6904 $selectNumStmt = $ilDB->prepare($selectNumQuery, array('integer')); 6905 6906 $updateNumQuery = " 6907 UPDATE dups_clozecombis_qst SET num = ? WHERE qst = ? 6908 "; 6909 $updateNumStmt = $ilDB->prepareManip($updateNumQuery, array('integer', 'integer')); 6910 6911 $qstRes = $ilDB->query("SELECT qst FROM dups_clozecombis_qst WHERE num IS NULL"); 6912 6913 while ($qstRow = $ilDB->fetchAssoc($qstRes)) { 6914 $selectNumRes = $ilDB->execute($selectNumStmt, array($qstRow['qst'])); 6915 $selectNumRow = $ilDB->fetchAssoc($selectNumRes); 6916 6917 $ilDB->execute($updateNumStmt, array($selectNumRow['num'], $qstRow['qst'])); 6918 } 6919} 6920?> 6921<#4543> 6922<?php 6923// qpl_a_cloze_combi_res - primary key step 4/8 6924 6925// break safe update step 6926 6927if ($ilDB->tableExists('dups_clozecombis_qst')) { 6928 $deleteRowsStmt = $ilDB->prepareManip( 6929 "DELETE FROM dups_clozecombis_rows WHERE question_fi = ?", 6930 array('integer') 6931 ); 6932 6933 $selectRowsStmt = $ilDB->prepare( 6934 "SELECT * FROM qpl_a_cloze_combi_res WHERE question_fi = ? ORDER BY combination_id, row_id, gap_fi", 6935 array('integer') 6936 ); 6937 6938 $insertRowStmt = $ilDB->prepareManip( 6939 "INSERT INTO dups_clozecombis_rows (combination_id, question_fi, gap_fi, answer, points, best_solution, row_id) 6940 VALUES (?, ?, ?, ?, ?, ?, ?)", 6941 array('integer', 'integer', 'integer', 'text', 'float', 'integer', 'integer') 6942 ); 6943 6944 $qstRes = $ilDB->query(" 6945 SELECT qst, num 6946 FROM dups_clozecombis_qst 6947 LEFT JOIN dups_clozecombis_rows 6948 ON question_fi = qst 6949 GROUP BY qst, num, question_fi 6950 HAVING COUNT(question_fi) < num 6951 "); 6952 6953 while ($qstRow = $ilDB->fetchAssoc($qstRes)) { 6954 $ilDB->execute($deleteRowsStmt, array($qstRow['qst'])); 6955 6956 $selectRowsRes = $ilDB->execute($selectRowsStmt, array($qstRow['qst'])); 6957 6958 $existingRows = array(); 6959 while ($selectRowsRow = $ilDB->fetchAssoc($selectRowsRes)) { 6960 $combinationId = $selectRowsRow['combination_id']; 6961 $rowId = $selectRowsRow['row_id']; 6962 $gapFi = $selectRowsRow['gap_fi']; 6963 6964 if (!isset($existingRows[$combinationId])) { 6965 $existingRows[$combinationId] = array(); 6966 } 6967 6968 if (!isset($existingRows[$combinationId][$rowId])) { 6969 $existingRows[$combinationId][$rowId] = array(); 6970 } 6971 6972 if (!isset($existingRows[$combinationId][$rowId][$gapFi])) { 6973 $existingRows[$combinationId][$rowId][$gapFi] = array(); 6974 } 6975 6976 $existingRows[$combinationId][$rowId][$gapFi][] = array( 6977 'answer' => $selectRowsRow['answer'], 6978 'points' => $selectRowsRow['points'] 6979 ); 6980 } 6981 6982 $newRows = array(); 6983 foreach ($existingRows as $combinationId => $combination) { 6984 if (!isset($newRows[$combinationId])) { 6985 $newRows[$combinationId] = array(); 6986 } 6987 6988 $maxPointsForCombination = null; 6989 $maxPointsRowIdForCombination = null; 6990 foreach ($combination as $rowId => $row) { 6991 if (!isset($newRows[$combinationId][$rowId])) { 6992 $newRows[$combinationId][$rowId] = array(); 6993 } 6994 6995 $maxPointsForRow = null; 6996 foreach ($row as $gapFi => $gap) { 6997 foreach ($gap as $dups) { 6998 if (!isset($newRows[$combinationId][$rowId][$gapFi])) { 6999 $newRows[$combinationId][$rowId][$gapFi] = array( 7000 'answer' => $dups['answer'] 7001 ); 7002 7003 if ($maxPointsForRow === null || $maxPointsForRow < $dups['points']) { 7004 $maxPointsForRow = $dups['points']; 7005 } 7006 } 7007 } 7008 } 7009 7010 foreach ($newRows[$combinationId][$rowId] as $gapFi => $gap) { 7011 $newRows[$combinationId][$rowId][$gapFi]['points'] = $maxPointsForRow; 7012 } 7013 7014 if ($maxPointsForCombination === null || $maxPointsForCombination < $maxPointsForRow) { 7015 $maxPointsForCombination = $maxPointsForRow; 7016 $maxPointsRowIdForCombination = $rowId; 7017 } 7018 } 7019 7020 foreach ($combination as $rowId => $row) { 7021 foreach ($newRows[$combinationId][$rowId] as $gapFi => $gap) { 7022 $newRows[$combinationId][$rowId][$gapFi]['best_solution'] = ($rowId == $maxPointsRowIdForCombination ? 1 : 0); 7023 } 7024 } 7025 } 7026 7027 foreach ($newRows as $combinationId => $combination) { 7028 foreach ($combination as $rowId => $row) { 7029 foreach ($row as $gapFi => $gap) { 7030 $ilDB->execute($insertRowStmt, array( 7031 $combinationId, $qstRow['qst'], $gapFi, $gap['answer'], 7032 $gap['points'], $gap['best_solution'], $rowId 7033 )); 7034 } 7035 } 7036 } 7037 } 7038} 7039?> 7040<#4544> 7041<?php 7042// qpl_a_cloze_combi_res - primary key step 5/8 7043 7044if ($ilDB->tableExists('dups_clozecombis_rows')) { 7045 $ilDB->manipulate(" 7046 DELETE FROM qpl_a_cloze_combi_res WHERE question_fi IN( 7047 SELECT DISTINCT question_fi FROM dups_clozecombis_rows 7048 ) 7049 "); 7050} 7051?> 7052<#4545> 7053<?php 7054// qpl_a_cloze_combi_res - primary key step 6/8 7055 7056if ($ilDB->tableExists('dups_clozecombis_rows')) { 7057 $ilDB->manipulate(" 7058 INSERT INTO qpl_a_cloze_combi_res ( 7059 combination_id, question_fi, gap_fi, answer, points, best_solution, row_id 7060 ) SELECT combination_id, question_fi, gap_fi, answer, points, best_solution, row_id 7061 FROM dups_clozecombis_rows 7062 "); 7063} 7064?> 7065<#4546> 7066<?php 7067// qpl_a_cloze_combi_res - primary key step 7/8 7068 7069if ($ilDB->tableExists('dups_clozecombis_qst')) { 7070 $ilDB->dropTable('dups_clozecombis_qst'); 7071} 7072 7073if ($ilDB->tableExists('dups_clozecombis_rows')) { 7074 $ilDB->dropTable('dups_clozecombis_rows'); 7075} 7076?> 7077<#4547> 7078<?php 7079// qpl_a_cloze_combi_res - primary key step 8/8 7080 7081$ilDB->addPrimaryKey('qpl_a_cloze_combi_res', array( 7082 'combination_id', 'question_fi', 'gap_fi', 'row_id' 7083)); 7084?> 7085<#4548> 7086<?php 7087if (!$ilDB->sequenceExists('chatroom_historytmp')) { 7088 $ilDB->createSequence('chatroom_historytmp'); 7089} 7090?> 7091<#4549> 7092<?php 7093if (!$ilDB->tableExists('chatroom_historytmp')) { 7094 $fields = array( 7095 'hist_id' => array('type' => 'integer', 'length' => 8, 'notnull' => true, 'default' => 0), 7096 'room_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 7097 'message' => array('type' => 'text', 'length' => 4000, 'notnull' => false, 'default' => null), 7098 'timestamp' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0), 7099 'sub_room' => array('type' => 'integer', 'length' => 4, 'notnull' => true, 'default' => 0) 7100 ); 7101 $ilDB->createTable('chatroom_historytmp', $fields); 7102 $ilDB->addPrimaryKey('chatroom_historytmp', array('hist_id')); 7103} 7104?> 7105<#4550> 7106<?php 7107require_once 'Services/Migration/DBUpdate_4550/classes/class.ilDBUpdate4550.php'; 7108ilDBUpdate4550::cleanupOrphanedChatRoomData(); 7109if ($ilDB->getDBType() == 'innodb' || $ilDB->getDBType() == 'mysql' || $ilDB->getDBType() == '') { 7110 $query = ' 7111 SELECT chatroom_history.room_id, chatroom_history.timestamp, chatroom_history.sub_room, chatroom_history.message 7112 FROM chatroom_history 7113 LEFT JOIN chatroom_historytmp 7114 ON chatroom_historytmp.room_id = chatroom_history.room_id 7115 AND chatroom_historytmp.timestamp = chatroom_history.timestamp 7116 AND chatroom_historytmp.sub_room = chatroom_history.sub_room 7117 AND chatroom_historytmp.message = chatroom_history.message COLLATE utf8_general_ci 7118 WHERE chatroom_historytmp.hist_id IS NULL 7119 GROUP BY chatroom_history.room_id, chatroom_history.timestamp, chatroom_history.sub_room, chatroom_history.message 7120 '; 7121} else { 7122 $query = ' 7123 SELECT chatroom_history.room_id, chatroom_history.timestamp, chatroom_history.sub_room, chatroom_history.message 7124 FROM chatroom_history 7125 LEFT JOIN chatroom_historytmp 7126 ON chatroom_historytmp.room_id = chatroom_history.room_id 7127 AND chatroom_historytmp.timestamp = chatroom_history.timestamp 7128 AND chatroom_historytmp.sub_room = chatroom_history.sub_room 7129 AND chatroom_historytmp.message = chatroom_history.message 7130 WHERE chatroom_historytmp.hist_id IS NULL 7131 GROUP BY chatroom_history.room_id, chatroom_history.timestamp, chatroom_history.sub_room, chatroom_history.message 7132 '; 7133} 7134$res = $ilDB->query($query); 7135 7136$stmt_in = $ilDB->prepareManip('INSERT INTO chatroom_historytmp (hist_id, room_id, timestamp, sub_room, message) VALUES(?, ?, ?, ?, ?)', array('integer', 'integer', 'integer', 'integer', 'text')); 7137 7138while ($row = $ilDB->fetchAssoc($res)) { 7139 $hist_id = $ilDB->nextId('chatroom_historytmp'); 7140 $ilDB->execute($stmt_in, array($hist_id, (int) $row['room_id'], (int) $row['timestamp'], (int) $row['sub_room'], (string) $row['message'])); 7141} 7142?> 7143<#4551> 7144<?php 7145$ilDB->dropTable('chatroom_history'); 7146?> 7147<#4552> 7148<?php 7149$ilDB->renameTable('chatroom_historytmp', 'chatroom_history'); 7150?> 7151<#4553> 7152<?php 7153if (!$ilDB->sequenceExists('chatroom_history')) { 7154 $query = "SELECT MAX(hist_id) mhist_id FROM chatroom_history"; 7155 $row = $ilDB->fetchAssoc($ilDB->query($query)); 7156 $ilDB->createSequence('chatroom_history', (int) $row['mhist_id'] + 1); 7157} 7158?> 7159<#4554> 7160<?php 7161if ($ilDB->sequenceExists('chatroom_historytmp')) { 7162 $ilDB->dropSequence('chatroom_historytmp'); 7163} 7164?> 7165<#4555> 7166<?php 7167$ilDB->addIndex('chatroom_history', array('room_id', 'sub_room'), 'i1'); 7168?> 7169<#4556> 7170<?php 7171require_once 'Services/Migration/DBUpdate_4550/classes/class.ilDBUpdate4550.php'; 7172ilDBUpdate4550::cleanupOrphanedChatRoomData(); 7173?> 7174<#4557> 7175<?php 7176if ($ilDB->getDBType() == 'postgres') { 7177 $ilDB->manipulate("ALTER TABLE chatroom_prooms ALTER COLUMN parent_id SET DEFAULT 0"); 7178 $ilDB->manipulate("ALTER TABLE chatroom_prooms ALTER parent_id TYPE INTEGER USING (parent_id::INTEGER)"); 7179} else { 7180 $ilDB->modifyTableColumn('chatroom_prooms', 'parent_id', array( 7181 'type' => 'integer', 7182 'length' => 4, 7183 'notnull' => true, 7184 'default' => 0 7185 )); 7186} 7187$ilDB->addIndex('chatroom_prooms', array('parent_id'), 'i1'); 7188?> 7189<#4558> 7190<?php 7191$ilDB->addIndex('chatroom_prooms', array('owner'), 'i2'); 7192?> 7193<#4559> 7194<?php 7195/* 7196Moved to 4557 7197if($ilDB->getDBType() == 'postgres') 7198{ 7199 $ilDB->manipulate("ALTER TABLE chatroom_prooms ALTER COLUMN parent_id SET DEFAULT 0"); 7200 $ilDB->manipulate("ALTER TABLE chatroom_prooms ALTER parent_id TYPE INTEGER USING (parent_id::INTEGER)"); 7201} 7202else 7203{ 7204 $ilDB->modifyTableColumn('chatroom_prooms', 'parent_id', array( 7205 'type' => 'integer', 7206 'length' => 4, 7207 'notnull' => true, 7208 'default' => 0 7209 )); 7210} 7211*/ 7212?> 7213<#4560> 7214<?php 7215if ($ilDB->sequenceExists('chatroom_smilies')) { 7216 $ilDB->dropSequence('chatroom_smilies'); 7217} 7218?> 7219<#4561> 7220<?php 7221$query = "SELECT MAX(smiley_id) msmiley_id FROM chatroom_smilies"; 7222$row = $ilDB->fetchAssoc($ilDB->query($query)); 7223$ilDB->createSequence('chatroom_smilies', (int) $row['msmiley_id'] + 1); 7224?> 7225<#4562> 7226<?php 7227if (!$ilDB->tableColumnExists('frm_settings', 'file_upload_allowed')) { 7228 $ilDB->addTableColumn( 7229 'frm_settings', 7230 'file_upload_allowed', 7231 array( 7232 "type" => "integer", 7233 "notnull" => true, 7234 "length" => 1, 7235 "default" => 0 7236 ) 7237 ); 7238} 7239?> 7240<#4563> 7241<?php 7242 7243if ($ilDB->tableExists('sysc_groups')) { 7244 $ilDB->dropTable('sysc_groups'); 7245} 7246if ($ilDB->tableExists('sysc_groups_seq')) { 7247 $ilDB->dropTable('sysc_groups_seq'); 7248} 7249 7250if (!$ilDB->tableExists('sysc_groups')) { 7251 $fields = array( 7252 'id' => array( 7253 'type' => 'integer', 7254 'length' => 4, 7255 'notnull' => true), 7256 'component' => array( 7257 "type" => "text", 7258 "notnull" => false, 7259 "length" => 16, 7260 "fixed" => true), 7261 7262 'last_update' => array( 7263 "type" => "timestamp", 7264 "notnull" => false), 7265 7266 'status' => array( 7267 "type" => "integer", 7268 "notnull" => true, 7269 'length' => 1, 7270 'default' => 0) 7271 ); 7272 $ilDB->createTable('sysc_groups', $fields); 7273 $ilDB->addPrimaryKey('sysc_groups', array('id')); 7274 $ilDB->createSequence("sysc_groups"); 7275} 7276?> 7277<#4564> 7278<?php 7279 7280if (!$ilDB->tableExists('sysc_tasks')) { 7281 $fields = array( 7282 'id' => array( 7283 'type' => 'integer', 7284 'length' => 4, 7285 'notnull' => true), 7286 'grp_id' => array( 7287 "type" => "integer", 7288 "notnull" => true, 7289 "length" => 4), 7290 7291 'last_update' => array( 7292 "type" => "timestamp", 7293 "notnull" => false), 7294 7295 'status' => array( 7296 "type" => "integer", 7297 "notnull" => true, 7298 'length' => 1, 7299 'default' => 0), 7300 'identifier' => array( 7301 "type" => "text", 7302 "notnull" => false, 7303 'length' => 64) 7304 ); 7305 $ilDB->createTable('sysc_tasks', $fields); 7306 $ilDB->addPrimaryKey('sysc_tasks', array('id')); 7307 $ilDB->createSequence("sysc_tasks"); 7308} 7309 7310?> 7311<#4565> 7312<?php 7313// primary key for tst_addtime - step 1/8 7314 7315$cntRes = $ilDB->query(" 7316 SELECT COUNT(active_fi) cnt FROM ( 7317 SELECT active_fi FROM tst_addtime 7318 GROUP BY active_fi HAVING COUNT(active_fi) > 1 7319 ) actives 7320"); 7321 7322$cntRow = $ilDB->fetchAssoc($cntRes); 7323 7324if ($cntRow['cnt'] > 0) { 7325 $ilDB->createTable('tst_addtime_tmp', array( 7326 'active_fi' => array( 7327 'type' => 'integer', 7328 'length' => 8, 7329 'notnull' => true, 7330 'default' => 0 7331 ), 7332 'additionaltime' => array( 7333 'type' => 'integer', 7334 'length' => 8, 7335 'notnull' => false, 7336 'default' => null, 7337 ), 7338 'tstamp' => array( 7339 'type' => 'integer', 7340 'length' => 8, 7341 'notnull' => false, 7342 'default' => null 7343 ) 7344 )); 7345 7346 $ilDB->addPrimaryKey('tst_addtime_tmp', array('active_fi')); 7347} 7348?> 7349<#4566> 7350<?php 7351// primary key for tst_addtime - step 2/8 7352 7353// break safe 7354 7355if ($ilDB->tableExists('tst_addtime_tmp')) { 7356 $res = $ilDB->query(" 7357 SELECT orig.active_fi FROM tst_addtime orig 7358 LEFT JOIN tst_addtime_tmp tmp ON tmp.active_fi = orig.active_fi 7359 WHERE tmp.active_fi IS NULL 7360 GROUP BY orig.active_fi HAVING COUNT(orig.active_fi) > 1 7361 "); 7362 7363 while ($row = $ilDB->fetchAssoc($res)) { 7364 $ilDB->replace( 7365 'tst_addtime_tmp', 7366 array( 7367 'additionaltime' => array('integer', null), 7368 'tstamp' => array('integer', null) 7369 ), 7370 array( 7371 'active_fi' => array('integer', $row['active_fi']) 7372 ) 7373 ); 7374 } 7375} 7376?> 7377<#4567> 7378<?php 7379// primary key for tst_addtime - step 3/8 7380 7381// break safe 7382 7383if ($ilDB->tableExists('tst_addtime_tmp')) { 7384 $res = $ilDB->query(" 7385 SELECT orig.* 7386 FROM tst_addtime_tmp tmp 7387 INNER JOIN tst_addtime orig ON orig.active_fi = tmp.active_fi 7388 WHERE tmp.additionaltime IS NULL 7389 AND tmp.tstamp IS NULL 7390 ORDER BY tmp.active_fi ASC, orig.tstamp ASC 7391 "); 7392 7393 $active_fi = null; 7394 $addtime = null; 7395 $tstamp = null; 7396 7397 while ($row = $ilDB->fetchAssoc($res)) { 7398 if ($active_fi === null) { 7399 // first loop 7400 $active_fi = $row['active_fi']; 7401 } elseif ($row['active_fi'] != $active_fi) { 7402 // update last active 7403 $ilDB->update( 7404 'tst_addtime_tmp', 7405 array( 7406 'additionaltime' => array('integer', $addtime), 7407 'tstamp' => array('integer', $tstamp) 7408 ), 7409 array( 7410 'active_fi' => array('integer', $active_fi) 7411 ) 7412 ); 7413 7414 // process next active 7415 $active_fi = $row['active_fi']; 7416 $addtime = null; 7417 $tstamp = null; 7418 } 7419 7420 if ($addtime === null || $row['additionaltime'] >= $addtime) { 7421 $addtime = $row['additionaltime']; 7422 $tstamp = $row['tstamp']; 7423 } 7424 } 7425 7426 $ilDB->update( 7427 'tst_addtime_tmp', 7428 array( 7429 'additionaltime' => array('integer', $addtime), 7430 'tstamp' => array('integer', $tstamp) 7431 ), 7432 array( 7433 'active_fi' => array('integer', $active_fi) 7434 ) 7435 ); 7436} 7437?> 7438<#4568> 7439<?php 7440// primary key for tst_addtime - step 4/8 7441 7442if ($ilDB->tableExists('tst_addtime_tmp')) { 7443 $ilDB->manipulate(" 7444 DELETE FROM tst_addtime WHERE active_fi IN( 7445 SELECT DISTINCT active_fi FROM tst_addtime_tmp 7446 ) 7447 "); 7448} 7449?> 7450<#4569> 7451<?php 7452// primary key for tst_addtime - step 5/8 7453 7454if ($ilDB->tableExists('tst_addtime_tmp')) { 7455 $ilDB->manipulate(" 7456 INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) 7457 SELECT active_fi, additionaltime, tstamp 7458 FROM tst_addtime_tmp 7459 "); 7460} 7461?> 7462<#4570> 7463<?php 7464// primary key for tst_addtime - step 6/8 7465 7466if ($ilDB->tableExists('tst_addtime_tmp')) { 7467 $ilDB->dropTable('tst_addtime_tmp'); 7468} 7469?> 7470<#4571> 7471<?php 7472// primary key for tst_addtime - step 7/8 7473 7474if ($ilDB->indexExistsByFields('tst_addtime', array('active_fi'))) { 7475 $ilDB->dropIndexByFields('tst_addtime', array('active_fi')); 7476} 7477?> 7478<#4572> 7479<?php 7480// primary key for tst_addtime - step 8/8 7481 7482$ilDB->addPrimaryKey('tst_addtime', array('active_fi')); 7483?> 7484<#4573> 7485<?php 7486 7487// delete all entries 7488// structure reload is done at end of db update. 7489$query = 'DELETE from ctrl_calls'; 7490$ilDB->manipulate($query); 7491 7492if ($ilDB->indexExistsByFields('ctrl_calls', array('parent'))) { 7493 $ilDB->dropIndexByFields('ctrl_calls', array('parent')); 7494} 7495$ilDB->addPrimaryKey('ctrl_calls', array('parent','child')); 7496?> 7497<#4574> 7498<?php 7499global $ilDB; 7500if (!$ilDB->tableColumnExists('il_dcl_table', 'delete_by_owner')) { 7501 $ilDB->addTableColumn( 7502 'il_dcl_table', 7503 'delete_by_owner', 7504 array( 7505 "type" => "integer", 7506 "notnull" => true, 7507 "length" => 1, 7508 "default" => 0 7509 ) 7510 ); 7511 // Migrate tables: Set new setting to true if "edit by owner" is true 7512 // Set edit permission to true if edit 7513 $ilDB->manipulate("UPDATE il_dcl_table SET delete_by_owner = 1, edit_perm = 1, delete_perm = 1 WHERE edit_by_owner = 1"); 7514} 7515?> 7516<#4575> 7517<?php 7518// primary key for tst_result_cache - step 1/7 7519 7520$res = $ilDB->query(" 7521 SELECT COUNT(active_fi) cnt FROM ( 7522 SELECT active_fi FROM tst_result_cache 7523 GROUP BY active_fi HAVING COUNT(active_fi) > 1 7524 ) actives 7525"); 7526 7527$row = $ilDB->fetchAssoc($res); 7528 7529if ($row['cnt'] > 0) { 7530 $ilDB->createTable('tst_result_cache_tmp', array( 7531 'active_fi' => array( 7532 'type' => 'integer', 7533 'length' => 8, 7534 'notnull' => true, 7535 'default' => 0 7536 ) 7537 )); 7538 7539 $ilDB->addPrimaryKey('tst_result_cache_tmp', array('active_fi')); 7540} 7541?> 7542<#4576> 7543<?php 7544// primary key for tst_result_cache - step 2/7 7545 7546// break safe 7547 7548if ($ilDB->tableExists('tst_result_cache_tmp')) { 7549 $res = $ilDB->query(" 7550 SELECT active_fi FROM tst_result_cache 7551 GROUP BY active_fi HAVING COUNT(active_fi) > 1 7552 "); 7553 7554 while ($row = $ilDB->fetchAssoc($res)) { 7555 $ilDB->replace('tst_result_cache_tmp', array(), array( 7556 'active_fi' => array('integer', $row['active_fi']) 7557 )); 7558 } 7559} 7560?> 7561<#4577> 7562<?php 7563// primary key for tst_result_cache - step 3/7 7564 7565if ($ilDB->tableExists('tst_result_cache_tmp')) { 7566 $ilDB->manipulate(" 7567 DELETE FROM tst_result_cache WHERE active_fi IN( 7568 SELECT DISTINCT active_fi FROM tst_result_cache_tmp 7569 ) 7570 "); 7571} 7572?> 7573<#4578> 7574<?php 7575// primary key for tst_result_cache - step 4/7 7576 7577if ($ilDB->indexExistsByFields('tst_result_cache', array('active_fi'))) { 7578 $ilDB->dropIndexByFields('tst_result_cache', array('active_fi')); 7579} 7580?> 7581<#4579> 7582<?php 7583// primary key for tst_result_cache - step 5/7 7584 7585$ilDB->addPrimaryKey('tst_result_cache', array('active_fi')); 7586?> 7587<#4580> 7588<?php 7589// primary key for tst_result_cache - step 6/7 7590 7591// break safe 7592 7593if ($ilDB->tableExists('tst_result_cache_tmp')) { 7594 include_once 'Services/Migration/DBUpdate_4209/classes/class.DBUpdateTestResultCalculator.php'; 7595 7596 $res = $ilDB->query(" 7597 SELECT tmp.active_fi, pass_scoring FROM tst_result_cache_tmp tmp 7598 INNER JOIN tst_active ON active_id = tmp.active_fi 7599 INNER JOIN tst_tests ON test_id = test_fi 7600 LEFT JOIN tst_result_cache orig ON orig.active_fi = tmp.active_fi 7601 WHERE orig.active_fi IS NULL 7602 "); 7603 7604 while ($row = $ilDB->fetchAssoc($res)) { 7605 DBUpdateTestResultCalculator::_updateTestResultCache( 7606 $row['active_fi'], 7607 $row['pass_scoring'] 7608 ); 7609 } 7610} 7611?> 7612<#4581> 7613<?php 7614// primary key for tst_result_cache - step 7/7 7615 7616if ($ilDB->tableExists('tst_result_cache_tmp')) { 7617 $ilDB->dropTable('tst_result_cache_tmp'); 7618} 7619?> 7620<#4582> 7621<?php 7622$ilDB->addIndex('mail_obj_data', array('obj_id', 'user_id'), 'i2'); 7623?> 7624<#4583> 7625<?php 7626$ilDB->dropPrimaryKey('mail_obj_data'); 7627?> 7628<#4584> 7629<?php 7630$mod_dup_query_num = " 7631SELECT COUNT(*) cnt 7632FROM ( 7633 SELECT obj_id 7634 FROM mail_obj_data 7635 GROUP BY obj_id 7636 HAVING COUNT(*) > 1 7637) duplicateMailFolders 7638"; 7639 7640$res = $ilDB->query($mod_dup_query_num); 7641$data = $ilDB->fetchAssoc($res); 7642 7643$ilSetting = new ilSetting(); 7644$setting = $ilSetting->get('mail_mod_dupl_warn_51x_shown', 0); 7645if ($data['cnt'] > 0 && !(int) $setting) { 7646 echo "<pre> 7647 7648 Dear Administrator, 7649 7650 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 7651 7652 The update process has been stopped due to a data consistency issue in table 'mail_obj_data'. 7653 The values in field 'obj_id' should be unique, but there are different values in field 'user_id', associated to the same 'obj_id'. 7654 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: 7655 7656 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 7657 7658 If you try to rerun the update process, this warning will be skipped. 7659 The remaining duplicates will be removed automatically by the criteria documented below. 7660 7661 Foreach each duplicate record, ... 7662 7663 1. ILIAS temporarily stores the value of the duplicate 'obj_id' in a variable: \$old_folder_id . 7664 2. ILIAS deletes every duplicate row in table 'mail_obj_data' determined by \$old_folder_id (field: 'obj_id') and the respective 'user_id'. 7665 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 . 7666 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'). 7667 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'). 7668 7669 Please ensure to backup your current database before reloading this page or executing the database update in general. 7670 Furthermore disable your client while executing the following 2 update steps. 7671 7672 Best regards, 7673 The mail system maintainer 7674 7675 </pre>"; 7676 7677 $ilSetting->set('mail_mod_dupl_warn_51x_shown', 1); 7678 exit(); 7679} 7680 7681 7682if ($data['cnt'] > 0) { 7683 $db_step = $nr; 7684 7685 $ps_delete_mf_by_obj_and_usr = $ilDB->prepareManip( 7686 "DELETE FROM mail_obj_data WHERE obj_id = ? AND user_id = ?", 7687 array('integer', 'integer') 7688 ); 7689 7690 $ps_create_mf_by_obj_and_usr = $ilDB->prepareManip( 7691 "INSERT INTO mail_obj_data (obj_id, user_id, title, m_type) VALUES(?, ?, ?, ?)", 7692 array('integer','integer', 'text', 'text') 7693 ); 7694 7695 $ps_update_mail_by_usr_and_folder = $ilDB->prepareManip( 7696 "UPDATE mail SET folder_id = ? WHERE folder_id = ? AND user_id = ?", 7697 array('integer', 'integer', 'integer') 7698 ); 7699 7700 $ps_update_tree_entry_by_child_and_usr = $ilDB->prepareManip( 7701 "UPDATE mail_tree SET child = ? WHERE child = ? AND tree = ?", 7702 array('integer', 'integer', 'integer') 7703 ); 7704 7705 $ps_update_tree_par_entry_by_child_and_usr = $ilDB->prepareManip( 7706 "UPDATE mail_tree SET parent = ? WHERE parent = ? AND tree = ?", 7707 array('integer', 'integer', 'integer') 7708 ); 7709 7710 $mod_dup_query = " 7711 SELECT mail_obj_data.* 7712 FROM mail_obj_data 7713 INNER JOIN ( 7714 SELECT obj_id 7715 FROM mail_obj_data 7716 GROUP BY obj_id 7717 HAVING COUNT(*) > 1 7718 ) duplicateMailFolders ON duplicateMailFolders.obj_id = mail_obj_data.obj_id 7719 ORDER BY mail_obj_data.obj_id 7720 "; 7721 $res = $ilDB->query($mod_dup_query); 7722 while ($row = $ilDB->fetchAssoc($res)) { 7723 $old_folder_id = $row['obj_id']; 7724 $user_id = $row['user_id']; 7725 $title = $row['title']; 7726 $type = $row['m_type']; 7727 7728 // Delete old folder entry 7729 $ilDB->execute($ps_delete_mf_by_obj_and_usr, array($old_folder_id, $user_id)); 7730 $GLOBALS['ilLog']->write(sprintf( 7731 "DB Step %s: Deleted folder %s of user %s .", 7732 $db_step, 7733 $old_folder_id, 7734 $user_id 7735 )); 7736 7737 $new_folder_id = $ilDB->nextId('mail_obj_data'); 7738 // create new folder entry 7739 $ilDB->execute($ps_create_mf_by_obj_and_usr, array($new_folder_id, $user_id, $title, $type)); 7740 $GLOBALS['ilLog']->write(sprintf( 7741 "DB Step %s: Created new folder %s for user %s .", 7742 $db_step, 7743 $new_folder_id, 7744 $user_id 7745 )); 7746 7747 // Move mails to new folder 7748 $ilDB->execute($ps_update_mail_by_usr_and_folder, array($new_folder_id, $old_folder_id, $user_id)); 7749 $GLOBALS['ilLog']->write(sprintf( 7750 "DB Step %s: Moved mails from %s to %s for user %s .", 7751 $db_step, 7752 $old_folder_id, 7753 $new_folder_id, 7754 $user_id 7755 )); 7756 7757 // Change existing tree entry 7758 $ilDB->execute($ps_update_tree_entry_by_child_and_usr, array($new_folder_id, $old_folder_id, $user_id)); 7759 $GLOBALS['ilLog']->write(sprintf( 7760 "DB Step %s: Changed child 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 // Change existing tree parent entry 7767 $ilDB->execute($ps_update_tree_par_entry_by_child_and_usr, array($new_folder_id, $old_folder_id, $user_id)); 7768 $GLOBALS['ilLog']->write(sprintf( 7769 "DB Step %s: Changed parent in table 'mail_tree' from %s to %s for tree %s .", 7770 $db_step, 7771 $old_folder_id, 7772 $new_folder_id, 7773 $user_id 7774 )); 7775 } 7776} 7777 7778$res = $ilDB->query($mod_dup_query_num); 7779$data = $ilDB->fetchAssoc($res); 7780if ($data['cnt'] > 0) { 7781 die("There are still duplicate entries in table 'mail_obj_data'. Please execute this database update step again."); 7782} 7783$ilSetting->delete('mail_mod_dupl_warn_51x_shown'); 7784?> 7785<#4585> 7786<?php 7787$mod_dup_query_num = " 7788SELECT COUNT(*) cnt 7789FROM ( 7790 SELECT obj_id 7791 FROM mail_obj_data 7792 GROUP BY obj_id 7793 HAVING COUNT(*) > 1 7794) duplicateMailFolders 7795"; 7796$res = $ilDB->query($mod_dup_query_num); 7797$data = $ilDB->fetchAssoc($res); 7798if ($data['cnt'] > 0) { 7799 die("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'; "); 7800} 7801$ilDB->addPrimaryKey('mail_obj_data', array('obj_id')); 7802?> 7803<#4586> 7804<?php 7805$fields = array( 7806 'id' => array( 7807 'type' => 'integer', 7808 'length' => '8', 7809 ), 7810 'status' => array( 7811 'type' => 'integer', 7812 'length' => '1', 7813 ), 7814 'host' => array( 7815 'type' => 'text', 7816 'length' => '256', 7817 ), 7818 'port' => array( 7819 'type' => 'integer', 7820 'length' => '8', 7821 ), 7822 'weight' => array( 7823 'type' => 'integer', 7824 'length' => '2', 7825 ), 7826 'flush_needed' => array( 7827 'type' => 'integer', 7828 'length' => '1', 7829 ), 7830 ); 7831if (!$ilDB->tableExists('il_gc_memcache_server')) { 7832 $ilDB->createTable('il_gc_memcache_server', $fields); 7833 $ilDB->addPrimaryKey('il_gc_memcache_server', array( 'id' )); 7834 $ilDB->createSequence('il_gc_memcache_server'); 7835} 7836?> 7837<#4587> 7838<?php 7839include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 7840ilDBUpdate3136::addStyleClass( 7841 "Sup", 7842 "sup", 7843 "sup", 7844 array() 7845); 7846ilDBUpdate3136::addStyleClass( 7847 "Sub", 7848 "sub", 7849 "sub", 7850 array() 7851); 7852?> 7853<#4588> 7854<?php 7855if (!$ilDB->tableColumnExists("il_wiki_data", "link_md_values")) { 7856 $ilDB->addTableColumn("il_wiki_data", "link_md_values", array( 7857 "type" => "integer", 7858 "length" => 1, 7859 "notnull" => false, 7860 "default" => 0, 7861 )); 7862} 7863?> 7864<#4589> 7865<?php 7866$mt_dup_query_num = " 7867SELECT COUNT(*) cnt 7868FROM ( 7869 SELECT child 7870 FROM mail_tree 7871 GROUP BY child 7872 HAVING COUNT(*) > 1 7873) duplicateMailFolderNodes 7874"; 7875$res = $ilDB->query($mt_dup_query_num); 7876$data = $ilDB->fetchAssoc($res); 7877 7878$ilSetting = new ilSetting(); 7879$setting = $ilSetting->get('mail_mt_dupl_warn_51x_shown', 0); 7880if ($data['cnt'] > 0 && !(int) $setting) { 7881 echo "<pre> 7882 7883 Dear Administrator, 7884 7885 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 7886 7887 The update process has been stopped due to a data consistency issue in table 'mail_tree'. 7888 The values in field 'child' should be unique, but there are different values in field 'tree', associated to the same 'child'. 7889 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: 7890 7891 SELECT * FROM mail_tree INNER JOIN (SELECT child FROM mail_tree GROUP BY child HAVING COUNT(*) > 1) duplicateMailFolderNodes ON duplicateMailFolderNodes.child = mail_tree.child 7892 7893 If you try to rerun the update process, this warning will be skipped. 7894 The remaining duplicates will be removed automatically by the criteria documented below. 7895 7896 1. ILIAS determines the relevant unique users for the duplicate entries (field: tree) 7897 2. ILIAS ensures that the default folders (root, inbox, trash, drafts, sent, local) exist in table 'mail_obj_data' 7898 3. For every affected user ILIAS deletes all records in table 'mail_tree' 7899 4. For every affected user ILIAS creates a new root node in table 'mail_tree' 7900 5. For every affected user ILIAS creates new nodes (inbox, trash, drafts, sent, local) below the root node 7901 6. For every affected user ILIAS creates new nodes for the custom folters below the 'local' folder 7902 7903 Please ensure to backup your current database before reloading this page or executing the database update in general. 7904 Furthermore disable your client while executing the following 3 update steps. 7905 7906 Best regards, 7907 The mail system maintainer 7908 7909 </pre>"; 7910 7911 $ilSetting->set('mail_mt_dupl_warn_51x_shown', 1); 7912 exit(); 7913} 7914 7915if ($data['cnt'] > 0) { 7916 if (!$ilDB->tableExists('mail_tree_migr')) { 7917 $ilDB->createTable('mail_tree_migr', array( 7918 'usr_id' => array( 7919 'type' => 'integer', 7920 'length' => 4, 7921 'notnull' => true, 7922 'default' => 0 7923 ) 7924 )); 7925 $ilDB->addPrimaryKey('mail_tree_migr', array('usr_id')); 7926 } 7927} 7928?> 7929<#4590> 7930<?php 7931if ($ilDB->tableExists('mail_tree_migr')) { 7932 $db_step = $nr; 7933 7934 $ps_create_mtmig_rec = $ilDB->prepareManip( 7935 "INSERT INTO mail_tree_migr (usr_id) VALUES(?)", 7936 array('integer') 7937 ); 7938 7939 $mt_dup_query = " 7940 SELECT DISTINCT mail_tree.tree 7941 FROM mail_tree 7942 INNER JOIN ( 7943 SELECT child 7944 FROM mail_tree 7945 GROUP BY child 7946 HAVING COUNT(*) > 1 7947 ) duplicateMailFolderNodes ON duplicateMailFolderNodes.child = mail_tree.child 7948 LEFT JOIN mail_tree_migr ON mail_tree_migr.usr_id = mail_tree.tree 7949 WHERE mail_tree_migr.usr_id IS NULL 7950 "; 7951 $res = $ilDB->query($mt_dup_query); 7952 while ($row = $ilDB->fetchAssoc($res)) { 7953 $ilDB->execute($ps_create_mtmig_rec, array($row['tree'])); 7954 7955 $GLOBALS['ilLog']->write(sprintf( 7956 "DB Step %s: Detected duplicate entries (field: child) in table 'mail_tree' for user (field: tree) %s .", 7957 $db_step, 7958 $row['tree'] 7959 )); 7960 } 7961} 7962?> 7963<#4591> 7964<?php 7965if ($ilDB->tableExists('mail_tree_migr')) { 7966 $db_step = $nr; 7967 7968 $ps_del_tree_entries = $ilDB->prepareManip( 7969 "DELETE FROM mail_tree WHERE tree = ?", 7970 array('integer') 7971 ); 7972 7973 $ps_sel_fold_entries = $ilDB->prepare( 7974 "SELECT obj_id, title, m_type FROM mail_obj_data WHERE user_id = ?", 7975 array('integer') 7976 ); 7977 7978 $default_folders_title_to_type_map = array( 7979 'a_root' => 'root', 7980 'b_inbox' => 'inbox', 7981 'c_trash' => 'trash', 7982 'd_drafts' => 'drafts', 7983 'e_sent' => 'sent', 7984 'z_local' => 'local' 7985 ); 7986 $default_folder_type_to_title_map = array_flip($default_folders_title_to_type_map); 7987 7988 $ps_in_fold_entry = $ilDB->prepareManip( 7989 "INSERT INTO mail_obj_data (obj_id, user_id, title, m_type) VALUES(?, ?, ?, ?)", 7990 array('integer','integer', 'text', 'text') 7991 ); 7992 7993 $ps_in_tree_entry = $ilDB->prepareManip( 7994 "INSERT INTO mail_tree (tree, child, parent, lft, rgt, depth) VALUES(?, ?, ?, ?, ?, ?)", 7995 array('integer', 'integer', 'integer', 'integer', 'integer', 'integer') 7996 ); 7997 7998 $ps_sel_tree_entry = $ilDB->prepare( 7999 "SELECT rgt, lft, parent FROM mail_tree WHERE child = ? AND tree = ?", 8000 array('integer', 'integer') 8001 ); 8002 8003 $ps_up_tree_entry = $ilDB->prepareManip( 8004 "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 = ?", 8005 array('integer', 'integer', 'integer') 8006 ); 8007 8008 $ps_del_mtmig_rec = $ilDB->prepareManip( 8009 "DELETE FROM mail_tree_migr WHERE usr_id = ?", 8010 array('integer') 8011 ); 8012 8013 $res = $ilDB->query("SELECT usr_id FROM mail_tree_migr"); 8014 $num = $ilDB->numRows($res); 8015 8016 $GLOBALS['ilLog']->write(sprintf( 8017 "DB Step %s: Found %s duplicates in table 'mail_tree'.", 8018 $db_step, 8019 $num 8020 )); 8021 8022 $i = 0; 8023 while ($row = $ilDB->fetchAssoc($res)) { 8024 ++$i; 8025 8026 $usr_id = $row['usr_id']; 8027 8028 $ilDB->execute($ps_del_tree_entries, array($usr_id)); 8029 $GLOBALS['ilLog']->write(sprintf( 8030 "DB Step %s: Started 'mail_tree' migration for user %s. Deleted all records referring this user (field: tree)", 8031 $db_step, 8032 $usr_id 8033 )); 8034 8035 $fold_res = $ilDB->execute($ps_sel_fold_entries, array($usr_id)); 8036 $user_folders = array(); 8037 $user_default_folders = array(); 8038 while ($fold_row = $ilDB->fetchAssoc($fold_res)) { 8039 $user_folders[$fold_row['obj_id']] = $fold_row; 8040 if (isset($default_folder_type_to_title_map[strtolower($fold_row['m_type'])])) { 8041 $user_default_folders[$fold_row['m_type']] = $fold_row['title']; 8042 } 8043 } 8044 8045 // Create missing default folders 8046 $folders_to_create = array_diff_key($default_folder_type_to_title_map, $user_default_folders); 8047 foreach ($folders_to_create as $type => $title) { 8048 $folder_id = $ilDB->nextId('mail_obj_data'); 8049 $ilDB->execute($ps_in_fold_entry, array($folder_id, $usr_id, $title, $type)); 8050 8051 $user_folders[$folder_id] = array( 8052 'obj_id' => $folder_id, 8053 'user_id' => $usr_id, 8054 'title' => $title, 8055 'm_type' => $type 8056 ); 8057 $GLOBALS['ilLog']->write(sprintf( 8058 "DB Step %s, iteration %s: Created 'mail_obj_data' record (missing folder type): %s, %s, %s, %s .", 8059 $db_step, 8060 $i, 8061 $folder_id, 8062 $usr_id, 8063 $title, 8064 $type 8065 )); 8066 } 8067 8068 // Create a new root folder node 8069 $root_id = null; 8070 foreach ($user_folders as $folder_id => $data) { 8071 if ('root' != $data['m_type']) { 8072 continue; 8073 } 8074 8075 $root_id = $folder_id; 8076 $ilDB->execute($ps_in_tree_entry, array($usr_id, $root_id, 0, 1, 2, 1)); 8077 8078 $GLOBALS['ilLog']->write(sprintf( 8079 "DB Step %s, iteration %s: Created root node with id %s for user %s in 'mail_tree'.", 8080 $db_step, 8081 $i, 8082 $root_id, 8083 $usr_id 8084 )); 8085 break; 8086 } 8087 8088 if (!$root_id) { 8089 // Did not find root folder, skip user and move to the next one 8090 $GLOBALS['ilLog']->write(sprintf( 8091 "DB Step %s, iteration %s: No root folder found for user %s . Skipped user.", 8092 $db_step, 8093 $i, 8094 $usr_id 8095 )); 8096 continue; 8097 } 8098 8099 $custom_folder_root_id = null; 8100 // Create all default folders below 'root' 8101 foreach ($user_folders as $folder_id => $data) { 8102 if ('root' == $data['m_type'] || !isset($default_folder_type_to_title_map[strtolower($data['m_type'])])) { 8103 continue; 8104 } 8105 8106 if (null === $custom_folder_root_id && 'local' == $data['m_type']) { 8107 $custom_folder_root_id = $folder_id; 8108 } 8109 8110 $res_parent = $ilDB->execute($ps_sel_tree_entry, array($root_id, $usr_id)); 8111 $parent_row = $ilDB->fetchAssoc($res_parent); 8112 8113 $right = $parent_row['rgt']; 8114 $lft = $right; 8115 $rgt = $right + 1; 8116 8117 $ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id)); 8118 $ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $root_id, $lft, $rgt, 2)); 8119 $GLOBALS['ilLog']->write(sprintf( 8120 "DB Step %s, iteration %s: Created node with id %s (lft: %s | rgt: %s) for user %s in 'mail_tree'.", 8121 $db_step, 8122 $i, 8123 $folder_id, 8124 $lft, 8125 $rgt, 8126 $usr_id 8127 )); 8128 } 8129 8130 if (!$custom_folder_root_id) { 8131 // Did not find custom folder root, skip user and move to the next one 8132 $GLOBALS['ilLog']->write(sprintf( 8133 "DB Step %s, iteration %s: No custom folder root found for user %s . Skipped user.", 8134 $db_step, 8135 $i, 8136 $usr_id 8137 )); 8138 continue; 8139 } 8140 8141 // Create all custom folders below 'local' 8142 foreach ($user_folders as $folder_id => $data) { 8143 if (isset($default_folder_type_to_title_map[strtolower($data['m_type'])])) { 8144 continue; 8145 } 8146 8147 $res_parent = $ilDB->execute($ps_sel_tree_entry, array($custom_folder_root_id, $usr_id)); 8148 $parent_row = $ilDB->fetchAssoc($res_parent); 8149 8150 $right = $parent_row['rgt']; 8151 $lft = $right; 8152 $rgt = $right + 1; 8153 8154 $ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id)); 8155 $ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $custom_folder_root_id, $lft, $rgt, 3)); 8156 $GLOBALS['ilLog']->write(sprintf( 8157 "DB Step %s, iteration %s: Created custom folder node with id %s (lft: %s | rgt: %s) for user % in 'mail_tree'.", 8158 $db_step, 8159 $i, 8160 $folder_id, 8161 $lft, 8162 $rgt, 8163 $usr_id 8164 )); 8165 } 8166 8167 // Tree completely created, remove migration record 8168 $ilDB->execute($ps_del_mtmig_rec, array($usr_id)); 8169 8170 $GLOBALS['ilLog']->write(sprintf( 8171 "DB Step %s, iteration %s: Finished 'mail_tree' migration for user %s .", 8172 $db_step, 8173 $i, 8174 $usr_id 8175 )); 8176 } 8177 8178 $res = $ilDB->query("SELECT usr_id FROM mail_tree_migr"); 8179 $num = $ilDB->numRows($res); 8180 if ($num > 0) { 8181 die("There are still duplicate entries in table 'mail_tree'. Please execute this database update step again."); 8182 } 8183} 8184?> 8185<#4592> 8186<?php 8187if ($ilDB->tableExists('mail_tree_migr')) { 8188 $ilDB->dropTable('mail_tree_migr'); 8189} 8190 8191$ilSetting = new ilSetting(); 8192$ilSetting->delete('mail_mt_dupl_warn_51x_shown'); 8193 8194$mt_dup_query_num = " 8195SELECT COUNT(*) cnt 8196FROM ( 8197 SELECT child 8198 FROM mail_tree 8199 GROUP BY child 8200 HAVING COUNT(*) > 1 8201) duplicateMailFolderNodes 8202"; 8203$res = $ilDB->query($mt_dup_query_num); 8204$data = $ilDB->fetchAssoc($res); 8205if ($data['cnt'] > 0) { 8206 die("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'; "); 8207} 8208 8209$ilDB->addPrimaryKey('mail_tree', array('child')); 8210?> 8211<#4593> 8212<?php 8213$ilDB->dropIndex('mail_tree', 'i1'); 8214?> 8215<#4594> 8216<?php 8217 if (!$ilDB->tableColumnExists("booking_schedule", "av_from")) { 8218 $ilDB->addTableColumn("booking_schedule", "av_from", array( 8219 "type" => "integer", 8220 "notnull" => false, 8221 "length" => 4 8222 )); 8223 } 8224 if (!$ilDB->tableColumnExists("booking_schedule", "av_to")) { 8225 $ilDB->addTableColumn("booking_schedule", "av_to", array( 8226 "type" => "integer", 8227 "notnull" => false, 8228 "length" => 4 8229 )); 8230 } 8231?> 8232<#4595> 8233<?php 8234include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 8235ilDBUpdate3136::addStyleClass( 8236 "CarouselCntr", 8237 "ca_cntr", 8238 "div", 8239 array() 8240); 8241?> 8242<#4596> 8243<?php 8244include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 8245ilDBUpdate3136::addStyleClass( 8246 "CarouselICntr", 8247 "ca_icntr", 8248 "div", 8249 array() 8250); 8251?> 8252<#4597> 8253<?php 8254include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 8255ilDBUpdate3136::addStyleClass( 8256 "CarouselIHead", 8257 "ca_ihead", 8258 "div", 8259 array() 8260); 8261?> 8262<#4598> 8263<?php 8264include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 8265ilDBUpdate3136::addStyleClass( 8266 "CarouselICont", 8267 "ca_icont", 8268 "div", 8269 array() 8270); 8271?> 8272<#4599> 8273<?php 8274 8275if (!$ilDB->tableExists('member_noti')) { 8276 $ilDB->createTable('member_noti', array( 8277 'ref_id' => array( 8278 'type' => 'integer', 8279 'length' => 4, 8280 'notnull' => true, 8281 'default' => 0 8282 ), 8283 'nmode' => array( 8284 'type' => 'integer', 8285 'length' => 1, 8286 'notnull' => true, 8287 'default' => 0 8288 ) 8289 )); 8290 8291 $ilDB->addPrimaryKey('member_noti', array('ref_id')); 8292} 8293 8294?> 8295<#4600> 8296<?php 8297 8298if (!$ilDB->tableExists('member_noti_user')) { 8299 $ilDB->createTable('member_noti_user', array( 8300 'ref_id' => array( 8301 'type' => 'integer', 8302 'length' => 4, 8303 'notnull' => true, 8304 'default' => 0 8305 ), 8306 'user_id' => array( 8307 'type' => 'integer', 8308 'length' => 4, 8309 'notnull' => true, 8310 'default' => 0 8311 ), 8312 'status' => array( 8313 'type' => 'integer', 8314 'length' => 1, 8315 'notnull' => true, 8316 'default' => 0 8317 ) 8318 )); 8319 8320 $ilDB->addPrimaryKey('member_noti_user', array('ref_id', 'user_id')); 8321} 8322 8323?> 8324<#4601> 8325<?php 8326if (!$ilDB->tableColumnExists('frm_posts', 'pos_cens_date')) { 8327 $ilDB->addTableColumn( 8328 'frm_posts', 8329 'pos_cens_date', 8330 array( 8331 'type' => 'timestamp', 8332 'notnull' => false) 8333 ); 8334} 8335?> 8336<#4602> 8337<?php 8338if (!$ilDB->tableExists('frm_posts_deleted')) { 8339 $ilDB->createTable( 8340 'frm_posts_deleted', 8341 array( 8342 'deleted_id' => array( 8343 'type' => 'integer', 8344 'length' => 4, 8345 'notnull' => true 8346 ), 8347 'deleted_date' => array( 8348 'type' => 'timestamp', 8349 'notnull' => true 8350 ), 8351 'deleted_by' => array( 8352 'type' => 'text', 8353 'length' => 255, 8354 'notnull' => true 8355 ), 8356 'forum_title' => array( 8357 'type' => 'text', 8358 'length' => 255, 8359 'notnull' => true 8360 ), 8361 'thread_title' => array( 8362 'type' => 'text', 8363 'length' => 255, 8364 'notnull' => true 8365 ), 8366 'post_title' => array( 8367 'type' => 'text', 8368 'length' => 255, 8369 'notnull' => true 8370 ), 8371 'post_message' => array( 8372 'type' => 'clob', 8373 'notnull' => true 8374 ), 8375 'post_date' => array( 8376 'type' => 'timestamp', 8377 'notnull' => true 8378 ), 8379 'obj_id' => array( 8380 'type' => 'integer', 8381 'length' => 4, 8382 'notnull' => true 8383 ), 8384 'ref_id' => array( 8385 'type' => 'integer', 8386 'length' => 4, 8387 'notnull' => true 8388 ), 8389 'thread_id' => array( 8390 'type' => 'integer', 8391 'length' => 4, 8392 'notnull' => true 8393 ), 8394 'forum_id' => array( 8395 'type' => 'integer', 8396 'length' => 4, 8397 'notnull' => true 8398 ), 8399 'pos_display_user_id' => array( 8400 'type' => 'integer', 8401 'length' => 4, 8402 'notnull' => true, 8403 'default' => 0 8404 ), 8405 'pos_usr_alias' => array( 8406 'type' => 'text', 8407 'length' => 255, 8408 'notnull' => false 8409 ) 8410 ) 8411 ); 8412 8413 $ilDB->addPrimaryKey('frm_posts_deleted', array('deleted_id')); 8414 $ilDB->createSequence('frm_posts_deleted'); 8415} 8416?> 8417<#4603> 8418<?php 8419 $ilCtrlStructureReader->getStructure(); 8420?> 8421<#4604> 8422<?php 8423if (!$ilDB->tableColumnExists('frm_posts_deleted', 'is_thread_deleted')) { 8424 $ilDB->addTableColumn( 8425 'frm_posts_deleted', 8426 'is_thread_deleted', 8427 array( 8428 'type' => 'integer', 8429 'length' => 1, 8430 'notnull' => true, 8431 'default' => 0) 8432 ); 8433} 8434?> 8435<#4605> 8436<?php 8437 8438$res = $ilDB->query("SELECT a.id, a.tpl_id, od.obj_id , od.title FROM " . 8439 "(didactic_tpl_a a JOIN " . 8440 "(didactic_tpl_alr alr JOIN " . 8441 "object_data od " . 8442 "ON (alr.role_template_id = od.obj_id)) " . 8443 "ON ( a.id = alr.action_id)) " . 8444 "WHERE a.type_id = " . $ilDB->quote(2, 'integer')); 8445 8446$names = array(); 8447$templates = array(); 8448 8449while ($row = $ilDB->fetchAssoc($res)) { 8450 $names[$row["tpl_id"]][$row["id"]] = array( 8451 "action_id" => $row["id"], 8452 "role_template_id" => $row["obj_id"], 8453 "role_title" => $row["title"]); 8454 8455 $templates[$row["tpl_id"]] = $row["tpl_id"]; 8456} 8457 8458$res = $ilDB->query("SELECT * FROM didactic_tpl_objs"); 8459 8460while ($row = $ilDB->fetchAssoc($res)) { 8461 if (in_array($row["tpl_id"], $templates)) { 8462 $roles = array(); 8463 $rol_res = $ilDB->query("SELECT rol_id FROM rbac_fa " . 8464 "WHERE parent = " . $ilDB->quote($row["ref_id"], 'integer') . " AND assign = " . $ilDB->quote('y', 'text')); 8465 8466 while ($rol_row = $ilDB->fetchObject($rol_res)) { 8467 $roles[] = $rol_row->rol_id; 8468 } 8469 8470 foreach ($names[$row["tpl_id"]] as $name) { 8471 $concat = $ilDB->concat(array( 8472 array("title", "text"), 8473 array($ilDB->quote("_" . $row["ref_id"], "text"), "text") 8474 ), false); 8475 8476 $ilDB->manipulate("UPDATE object_data" . 8477 " SET title = " . $concat . 8478 " WHERE " . $ilDB->in("obj_id", $roles, "", "integer") . 8479 " AND title = " . $ilDB->quote($name['role_title'])); 8480 } 8481 } 8482} 8483?> 8484<#4606> 8485<?php 8486if (!$ilDB->tableColumnExists('exc_assignment', 'peer_char')) { 8487 $ilDB->addTableColumn('exc_assignment', 'peer_char', array( 8488 'type' => 'integer', 8489 'length' => 2, 8490 'notnull' => false 8491 )); 8492} 8493?> 8494<#4607> 8495<?php 8496if (!$ilDB->tableColumnExists('exc_assignment', 'peer_unlock')) { 8497 $ilDB->addTableColumn('exc_assignment', 'peer_unlock', array( 8498 'type' => 'integer', 8499 'length' => 1, 8500 'notnull' => true, 8501 'default' => 0 8502 )); 8503} 8504?> 8505<#4608> 8506<?php 8507if (!$ilDB->tableColumnExists('exc_assignment', 'peer_valid')) { 8508 $ilDB->addTableColumn('exc_assignment', 'peer_valid', array( 8509 'type' => 'integer', 8510 'length' => 1, 8511 'notnull' => true, 8512 'default' => 1 8513 )); 8514} 8515?> 8516<#4609> 8517<?php 8518if (!$ilDB->tableColumnExists('exc_assignment', 'team_tutor')) { 8519 $ilDB->addTableColumn('exc_assignment', 'team_tutor', array( 8520 'type' => 'integer', 8521 'length' => 1, 8522 'notnull' => true, 8523 'default' => 0 8524 )); 8525} 8526?> 8527<#4610> 8528<?php 8529if (!$ilDB->tableColumnExists('exc_assignment', 'max_file')) { 8530 $ilDB->addTableColumn('exc_assignment', 'max_file', array( 8531 'type' => 'integer', 8532 'length' => 1, 8533 'notnull' => false 8534 )); 8535} 8536?> 8537<#4611> 8538<?php 8539if (!$ilDB->tableColumnExists('exc_assignment', 'deadline2')) { 8540 $ilDB->addTableColumn('exc_assignment', 'deadline2', array( 8541 'type' => 'integer', 8542 'length' => 4, 8543 'notnull' => false 8544 )); 8545} 8546?> 8547<#4612> 8548<?php 8549 $ilCtrlStructureReader->getStructure(); 8550?> 8551<#4613> 8552<?php 8553if (!$ilDB->tableColumnExists('exc_returned', 'late')) { 8554 $ilDB->addTableColumn('exc_returned', 'late', array( 8555 'type' => 'integer', 8556 'length' => 1, 8557 'notnull' => true, 8558 'default' => 0 8559 )); 8560} 8561?> 8562<#4614> 8563<?php 8564 8565if (!$ilDB->tableExists('exc_crit_cat')) { 8566 $ilDB->createTable('exc_crit_cat', array( 8567 'id' => array( 8568 'type' => 'integer', 8569 'length' => 4, 8570 'notnull' => true, 8571 'default' => 0 8572 ), 8573 'parent' => array( 8574 'type' => 'integer', 8575 'length' => 4, 8576 'notnull' => true, 8577 'default' => 0 8578 ), 8579 'title' => array( 8580 'type' => 'text', 8581 'length' => 255, 8582 'notnull' => false 8583 ), 8584 'pos' => array( 8585 'type' => 'integer', 8586 'length' => 4, 8587 'notnull' => true, 8588 'default' => 0 8589 ) 8590 )); 8591 $ilDB->addPrimaryKey('exc_crit_cat', array('id')); 8592 $ilDB->createSequence('exc_crit_cat'); 8593} 8594 8595?> 8596<#4615> 8597<?php 8598 8599if (!$ilDB->tableExists('exc_crit')) { 8600 $ilDB->createTable('exc_crit', array( 8601 'id' => array( 8602 'type' => 'integer', 8603 'length' => 4, 8604 'notnull' => true, 8605 'default' => 0 8606 ), 8607 'parent' => array( 8608 'type' => 'integer', 8609 'length' => 4, 8610 'notnull' => true, 8611 'default' => 0 8612 ), 8613 'type' => array( 8614 'type' => 'text', 8615 'length' => 255, 8616 'notnull' => false 8617 ), 8618 'title' => array( 8619 'type' => 'text', 8620 'length' => 255, 8621 'notnull' => false 8622 ), 8623 'descr' => array( 8624 'type' => 'text', 8625 'length' => 1000, 8626 'notnull' => false 8627 ), 8628 'pos' => array( 8629 'type' => 'integer', 8630 'length' => 4, 8631 'notnull' => true, 8632 'default' => 0 8633 ) 8634 )); 8635 $ilDB->addPrimaryKey('exc_crit', array('id')); 8636 $ilDB->createSequence('exc_crit'); 8637} 8638 8639?> 8640<#4616> 8641<?php 8642 8643if (!$ilDB->tableColumnExists('exc_crit', 'required')) { 8644 $ilDB->addTableColumn('exc_crit', 'required', array( 8645 'type' => 'integer', 8646 'length' => 1, 8647 'notnull' => true, 8648 'default' => 0 8649 )); 8650} 8651 8652?> 8653<#4617> 8654<?php 8655 8656if (!$ilDB->tableColumnExists('exc_crit', 'def')) { 8657 $ilDB->addTableColumn('exc_crit', 'def', array( 8658 'type' => 'text', 8659 'length' => 4000, 8660 'notnull' => false 8661 )); 8662} 8663 8664?> 8665<#4618> 8666<?php 8667 $ilCtrlStructureReader->getStructure(); 8668?> 8669<#4619> 8670<?php 8671 8672if (!$ilDB->tableColumnExists('exc_assignment', 'peer_text')) { 8673 $ilDB->addTableColumn('exc_assignment', 'peer_text', array( 8674 'type' => 'integer', 8675 'length' => 1, 8676 'notnull' => true, 8677 'default' => 1 8678 )); 8679} 8680 8681?> 8682<#4620> 8683<?php 8684 8685if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rating')) { 8686 $ilDB->addTableColumn('exc_assignment', 'peer_rating', array( 8687 'type' => 'integer', 8688 'length' => 1, 8689 'notnull' => true, 8690 'default' => 1 8691 )); 8692} 8693 8694?> 8695<#4621> 8696<?php 8697 8698if (!$ilDB->tableColumnExists('exc_assignment', 'peer_crit_cat')) { 8699 $ilDB->addTableColumn('exc_assignment', 'peer_crit_cat', array( 8700 'type' => 'integer', 8701 'length' => 4, 8702 'notnull' => false 8703 )); 8704} 8705 8706?> 8707<#4622> 8708<?php 8709 8710include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 8711$blog_type_id = ilDBUpdateNewObjectType::getObjectTypeId('blog'); 8712if ($blog_type_id) { 8713 // not sure if we want to clone "write" or "contribute"? 8714 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('redact', 'Redact', 'object', 6100); 8715 if ($new_ops_id) { 8716 ilDBUpdateNewObjectType::addRBACOperation($blog_type_id, $new_ops_id); 8717 } 8718} 8719 8720?> 8721<#4623> 8722<?php 8723 8724include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 8725$redact_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('redact'); 8726if ($redact_ops_id) { 8727 ilDBUpdateNewObjectType::addRBACTemplate( 8728 'blog', 8729 'il_blog_editor', 8730 'Editor template for blogs', 8731 array( 8732 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 8733 ilDBUpdateNewObjectType::RBAC_OP_READ, 8734 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 8735 $redact_ops_id) 8736 ); 8737} 8738 8739?> 8740<#4624> 8741<?php 8742 8743if (!$ilDB->tableColumnExists('adv_md_record_objs', 'optional')) { 8744 $ilDB->addTableColumn('adv_md_record_objs', 'optional', array( 8745 "type" => "integer", 8746 "notnull" => true, 8747 "length" => 1, 8748 "default" => 0 8749 )); 8750} 8751 8752?> 8753<#4625> 8754<?php 8755 8756if (!$ilDB->tableColumnExists('adv_md_record', 'parent_obj')) { 8757 $ilDB->addTableColumn('adv_md_record', 'parent_obj', array( 8758 "type" => "integer", 8759 "notnull" => false, 8760 "length" => 4 8761 )); 8762} 8763 8764?> 8765<#4626> 8766<?php 8767 $ilCtrlStructureReader->getStructure(); 8768?> 8769<#4627> 8770<?php 8771 if (!$ilDB->tableExists("copg_section_timings")) { 8772 $fields = array( 8773 'pm_id' => array('type' => 'integer', 'length' => 4,'notnull' => true, 'default' => 0), 8774 'pm_title' => array('type' => 'text', 'notnull' => true, 'length' => 60, 'fixed' => false), 8775 'pm_enabled' => array('type' => 'integer', 'length' => 1,"notnull" => true,"default" => 0), 8776 'save_usr_adr' => array('type' => 'integer', 'length' => 1,"notnull" => true,"default" => 0) 8777 ); 8778 8779 8780 $fields = array( 8781 "page_id" => array( 8782 "type" => "integer", 8783 "length" => 4, 8784 "notnull" => true 8785 ), 8786 "parent_type" => array( 8787 "type" => "text", 8788 "length" => 10, 8789 "notnull" => true 8790 ), 8791 "utc_ts" => array( 8792 "type" => "timestamp", 8793 "notnull" => true 8794 ) 8795 ); 8796 8797 $ilDB->createTable("copg_section_timings", $fields); 8798 } 8799?> 8800<#4628> 8801<?php 8802 $ilDB->dropTableColumn("copg_section_timings", "utc_ts"); 8803 $ilDB->addTableColumn( 8804 'copg_section_timings', 8805 'unix_ts', 8806 array( 8807 "type" => "integer", 8808 "notnull" => true, 8809 "length" => 4, 8810 "default" => 0 8811 ) 8812 ); 8813?> 8814<#4629> 8815<?php 8816if (!$ilDB->tableColumnExists('skl_user_skill_level', 'unique_identifier')) { 8817 $ilDB->addTableColumn('skl_user_skill_level', 'unique_identifier', array( 8818 'type' => 'text', 8819 'length' => 80, 8820 'notnull' => false 8821 )); 8822} 8823?> 8824<#4630> 8825<?php 8826 $ilCtrlStructureReader->getStructure(); 8827?> 8828<#4631> 8829<?php 8830 if (!$ilDB->tableColumnExists('crs_settings', 'crs_start')) { 8831 $ilDB->addTableColumn('crs_settings', 'crs_start', array( 8832 "type" => "integer", 8833 "notnull" => false, 8834 "length" => 4 8835 )); 8836 } 8837 if (!$ilDB->tableColumnExists('crs_settings', 'crs_end')) { 8838 $ilDB->addTableColumn('crs_settings', 'crs_end', array( 8839 "type" => "integer", 8840 "notnull" => false, 8841 "length" => 4 8842 )); 8843 } 8844?> 8845<#4632> 8846<?php 8847 if (!$ilDB->tableColumnExists('crs_settings', 'leave_end')) { 8848 $ilDB->addTableColumn('crs_settings', 'leave_end', array( 8849 "type" => "integer", 8850 "notnull" => false, 8851 "length" => 4 8852 )); 8853 } 8854?> 8855<#4633> 8856<?php 8857 if (!$ilDB->tableColumnExists('crs_settings', 'auto_wait')) { 8858 $ilDB->addTableColumn('crs_settings', 'auto_wait', array( 8859 "type" => "integer", 8860 "notnull" => true, 8861 "length" => 1, 8862 "default" => 0 8863 )); 8864 } 8865?> 8866<#4634> 8867<?php 8868 if (!$ilDB->tableColumnExists('crs_settings', 'min_members')) { 8869 $ilDB->addTableColumn('crs_settings', 'min_members', array( 8870 "type" => "integer", 8871 "notnull" => false, 8872 "length" => 2 8873 )); 8874 } 8875?> 8876<#4635> 8877<?php 8878 if (!$ilDB->tableColumnExists('grp_settings', 'registration_min_members')) { 8879 $ilDB->addTableColumn('grp_settings', 'registration_min_members', array( 8880 "type" => "integer", 8881 "notnull" => false, 8882 "length" => 2 8883 )); 8884 } 8885?> 8886<#4636> 8887<?php 8888 if (!$ilDB->tableColumnExists('grp_settings', 'leave_end')) { 8889 $ilDB->addTableColumn('grp_settings', 'leave_end', array( 8890 "type" => "integer", 8891 "notnull" => false, 8892 "length" => 4 8893 )); 8894 } 8895?> 8896<#4637> 8897<?php 8898 if (!$ilDB->tableColumnExists('grp_settings', 'auto_wait')) { 8899 $ilDB->addTableColumn('grp_settings', 'auto_wait', array( 8900 "type" => "integer", 8901 "notnull" => true, 8902 "length" => 1, 8903 "default" => 0 8904 )); 8905 } 8906?> 8907<#4638> 8908<?php 8909 if (!$ilDB->tableColumnExists('event', 'reg_min_users')) { 8910 $ilDB->addTableColumn('event', 'reg_min_users', array( 8911 "type" => "integer", 8912 "notnull" => false, 8913 "length" => 2 8914 )); 8915 } 8916?> 8917<#4639> 8918<?php 8919 if (!$ilDB->tableColumnExists('event', 'reg_auto_wait')) { 8920 $ilDB->addTableColumn('event', 'reg_auto_wait', array( 8921 "type" => "integer", 8922 "notnull" => true, 8923 "length" => 1, 8924 "default" => 0 8925 )); 8926 } 8927?> 8928<#4640> 8929<?php 8930if (!$ilDB->tableExists('mail_man_tpl')) { 8931 $ilDB->createTable('mail_man_tpl', array( 8932 'tpl_id' => array( 8933 'type' => 'integer', 8934 'length' => 4, 8935 'notnull' => true, 8936 'default' => 0 8937 ), 8938 'title' => array( 8939 'type' => 'text', 8940 'length' => 255, 8941 'notnull' => true 8942 ), 8943 'context' => array( 8944 'type' => 'text', 8945 'length' => 100, 8946 'notnull' => true 8947 ), 8948 'lang' => array( 8949 'type' => 'text', 8950 'length' => 2, 8951 'notnull' => true 8952 ), 8953 'm_subject' => array( 8954 'type' => 'text', 8955 'length' => 255, 8956 'notnull' => false, 8957 'default' => null 8958 ), 8959 'm_message' => array( 8960 'type' => 'clob', 8961 'notnull' => false, 8962 'default' => null 8963 ) 8964 )); 8965 8966 $ilDB->addPrimaryKey('mail_man_tpl', array('tpl_id')); 8967 $ilDB->createSequence('mail_man_tpl'); 8968} 8969?> 8970<#4641> 8971<?php 8972if (!$ilDB->tableExists('mail_tpl_ctx')) { 8973 $ilDB->createTable('mail_tpl_ctx', array( 8974 'id' => array( 8975 'type' => 'text', 8976 'length' => 100, 8977 'notnull' => true 8978 ), 8979 'component' => array( 8980 'type' => 'text', 8981 'length' => 100, 8982 'notnull' => true 8983 ), 8984 'class' => array( 8985 'type' => 'text', 8986 'length' => 100, 8987 'notnull' => true 8988 ), 8989 'path' => array( 8990 'type' => 'text', 8991 'length' => 4000, 8992 'notnull' => false, 8993 'default' => null 8994 ) 8995 )); 8996 $ilDB->addPrimaryKey('mail_tpl_ctx', array('id')); 8997} 8998?> 8999<#4642> 9000<?php 9001$ilDB->addIndex('mail_man_tpl', array('context'), 'i1'); 9002?> 9003<#4643> 9004<?php 9005if (!$ilDB->tableColumnExists('mail_saved', 'tpl_ctx_id')) { 9006 $ilDB->addTableColumn( 9007 'mail_saved', 9008 'tpl_ctx_id', 9009 array( 9010 'type' => 'text', 9011 'length' => '100', 9012 'notnull' => false, 9013 'default' => null 9014 ) 9015 ); 9016} 9017 9018if (!$ilDB->tableColumnExists('mail_saved', 'tpl_ctx_params')) { 9019 $ilDB->addTableColumn( 9020 'mail_saved', 9021 'tpl_ctx_params', 9022 array( 9023 'type' => 'blob', 9024 'notnull' => false, 9025 'default' => null 9026 ) 9027 ); 9028} 9029?> 9030<#4644> 9031<?php 9032if (!$ilDB->tableColumnExists('mail', 'tpl_ctx_id')) { 9033 $ilDB->addTableColumn( 9034 'mail', 9035 'tpl_ctx_id', 9036 array( 9037 'type' => 'text', 9038 'length' => '100', 9039 'notnull' => false, 9040 'default' => null 9041 ) 9042 ); 9043} 9044 9045if (!$ilDB->tableColumnExists('mail', 'tpl_ctx_params')) { 9046 $ilDB->addTableColumn( 9047 'mail', 9048 'tpl_ctx_params', 9049 array( 9050 'type' => 'blob', 9051 'notnull' => false, 9052 'default' => null 9053 ) 9054 ); 9055} 9056?> 9057<#4645> 9058<?php 9059$ilCtrlStructureReader->getStructure(); 9060?> 9061<#4646> 9062<?php 9063if (!$ilDB->tableExists('itgr_data')) { 9064 $ilDB->createTable('itgr_data', array( 9065 'id' => array( 9066 'type' => 'integer', 9067 'length' => 4, 9068 'notnull' => true 9069 ), 9070 'hide_title' => array( 9071 'type' => 'integer', 9072 'length' => 1, 9073 'notnull' => true, 9074 'default' => 0 9075 ) 9076 )); 9077 9078 $ilDB->addPrimaryKey('itgr_data', array('id')); 9079} 9080?> 9081<#4647> 9082<?php 9083$set = $ilDB->query( 9084 "SELECT * FROM object_data " . 9085 " WHERE type = " . $ilDB->quote("itgr", "text") 9086); 9087while ($rec = $ilDB->fetchAssoc($set)) { 9088 $ilDB->manipulate("INSERT INTO itgr_data " . 9089 "(id, hide_title) VALUES (" . 9090 $ilDB->quote($rec["obj_id"], "integer") . "," . 9091 $ilDB->quote(0, "integer") . 9092 ")"); 9093} 9094?> 9095<#4648> 9096<?php 9097//$ilDB->query('ALTER TABLE il_dcl_record_field ADD INDEX (record_id)'); 9098//$ilDB->query('ALTER TABLE il_dcl_record_field ADD INDEX (field_id)'); 9099//$ilDB->query('ALTER TABLE il_dcl_record ADD INDEX (table_id)'); 9100//$ilDB->query('ALTER TABLE il_dcl_stloc1_value ADD INDEX (record_field_id)'); 9101//$ilDB->query('ALTER TABLE il_dcl_stloc2_value ADD INDEX (record_field_id)'); 9102//$ilDB->query('ALTER TABLE il_dcl_stloc3_value ADD INDEX (record_field_id)'); 9103//$ilDB->query('ALTER TABLE il_dcl_field ADD INDEX (table_id)'); 9104//$ilDB->query('ALTER TABLE il_dcl_field_prop ADD INDEX (field_id)'); 9105//$ilDB->query('ALTER TABLE il_dcl_field_prop ADD INDEX (datatype_prop_id)'); 9106//$ilDB->query('ALTER TABLE il_dcl_viewdefinition ADD INDEX (view_id)'); 9107//$ilDB->query('ALTER TABLE il_dcl_view ADD INDEX (table_id)'); 9108//$ilDB->query('ALTER TABLE il_dcl_view ADD INDEX (type)'); 9109//$ilDB->query('ALTER TABLE il_dcl_data ADD INDEX (main_table_id)'); 9110//$ilDB->query('ALTER TABLE il_dcl_table ADD INDEX (obj_id)'); 9111?> 9112<#4649> 9113<?php 9114if (!$ilDB->tableColumnExists("content_object", "for_translation")) { 9115 $ilDB->addTableColumn("content_object", "for_translation", array( 9116 "type" => "integer", 9117 "notnull" => true, 9118 "length" => 1, 9119 "default" => 0)); 9120} 9121?> 9122<#4650> 9123<?php 9124$set = $ilDB->query( 9125 "SELECT * FROM mep_item JOIN mep_tree ON (mep_item.obj_id = mep_tree.child) " . 9126 " WHERE mep_item.type = " . $ilDB->quote("pg", "text") 9127); 9128while ($rec = $ilDB->fetchAssoc($set)) { 9129 $q = "UPDATE page_object SET " . 9130 " parent_id = " . $ilDB->quote($rec["mep_id"], "integer") . 9131 " WHERE parent_type = " . $ilDB->quote("mep", "text") . 9132 " AND page_id = " . $ilDB->quote($rec["obj_id"], "integer"); 9133 //echo "<br>".$q; 9134 $ilDB->manipulate($q); 9135} 9136?> 9137<#4651> 9138<?php 9139if (!$ilDB->tableColumnExists("mep_data", "for_translation")) { 9140 $ilDB->addTableColumn("mep_data", "for_translation", array( 9141 "type" => "integer", 9142 "notnull" => true, 9143 "length" => 1, 9144 "default" => 0)); 9145} 9146?> 9147<#4652> 9148<?php 9149if (!$ilDB->tableColumnExists("mep_item", "import_id")) { 9150 $ilDB->addTableColumn("mep_item", "import_id", array( 9151 "type" => "text", 9152 "notnull" => false, 9153 "length" => 50)); 9154} 9155?> 9156<#4653> 9157<?php 9158 $ilCtrlStructureReader->getStructure(); 9159?> 9160<#4654> 9161<?php 9162 9163include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 9164 9165$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 9166if ($wiki_type_id) { 9167 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('edit_wiki_navigation', 'Edit Wiki Navigation', 'object', 3220); 9168 if ($new_ops_id) { 9169 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 9170 } 9171} 9172?> 9173<#4655> 9174<?php 9175 9176include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 9177 9178$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 9179if ($wiki_type_id) { 9180 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('delete_wiki_pages', 'Delete Wiki Pages', 'object', 3300); 9181 if ($new_ops_id) { 9182 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 9183 } 9184} 9185 9186?> 9187<#4656> 9188<?php 9189 9190include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 9191 9192$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 9193if ($wiki_type_id) { 9194 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('activate_wiki_protection', 'Set Read-Only', 'object', 3240); 9195 if ($new_ops_id) { 9196 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 9197 } 9198} 9199 9200?> 9201<#4657> 9202<?php 9203 $ilCtrlStructureReader->getStructure(); 9204?> 9205<#4658> 9206<?php 9207 if (!$ilDB->tableExists('wiki_user_html_export')) { 9208 $ilDB->createTable('wiki_user_html_export', array( 9209 'wiki_id' => array( 9210 'type' => 'integer', 9211 'length' => 4, 9212 'notnull' => true 9213 ), 9214 'usr_id' => array( 9215 'type' => 'integer', 9216 'length' => 4, 9217 'notnull' => true 9218 ), 9219 'progress' => array( 9220 'type' => 'integer', 9221 'length' => 4, 9222 'notnull' => true 9223 ), 9224 'start_ts' => array( 9225 'type' => 'timestamp', 9226 'notnull' => false 9227 ), 9228 'status' => array( 9229 'type' => 'integer', 9230 'length' => 1, 9231 'notnull' => true, 9232 'default' => 0 9233 ) 9234 )); 9235 $ilDB->addPrimaryKey('wiki_user_html_export', array('wiki_id')); 9236 } 9237?> 9238<#4659> 9239<?php 9240 9241include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 9242 9243$wiki_type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 9244if ($wiki_type_id) { 9245 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('wiki_html_export', 'Wiki HTML Export', 'object', 3242); 9246 if ($new_ops_id) { 9247 ilDBUpdateNewObjectType::addRBACOperation($wiki_type_id, $new_ops_id); 9248 } 9249} 9250 9251?> 9252 9253<#4660> 9254<?php 9255 9256if (!$ilDB->tableColumnExists('loc_settings', 'it_type')) { 9257 $ilDB->addTableColumn( 9258 'loc_settings', 9259 'it_type', 9260 array( 9261 'type' => 'integer', 9262 'length' => 1, 9263 'notnull' => false, 9264 'default' => 5 9265 ) 9266 ); 9267} 9268?> 9269<#4661> 9270<?php 9271 9272if (!$ilDB->tableColumnExists('loc_settings', 'qt_type')) { 9273 $ilDB->addTableColumn( 9274 'loc_settings', 9275 'qt_type', 9276 array( 9277 'type' => 'integer', 9278 'length' => 1, 9279 'notnull' => false, 9280 'default' => 1 9281 ) 9282 ); 9283} 9284 9285?> 9286 9287<#4662> 9288<?php 9289 9290if (!$ilDB->tableColumnExists('loc_settings', 'it_start')) { 9291 $ilDB->addTableColumn( 9292 'loc_settings', 9293 'it_start', 9294 array( 9295 'type' => 'integer', 9296 'length' => 1, 9297 'notnull' => false, 9298 'default' => 1 9299 ) 9300 ); 9301} 9302 9303?> 9304 9305<#4663> 9306<?php 9307 9308if (!$ilDB->tableColumnExists('loc_settings', 'qt_start')) { 9309 $ilDB->addTableColumn( 9310 'loc_settings', 9311 'qt_start', 9312 array( 9313 'type' => 'integer', 9314 'length' => 1, 9315 'notnull' => false, 9316 'default' => 1 9317 ) 9318 ); 9319} 9320?> 9321 9322<#4664> 9323<?php 9324 9325 9326$query = 'UPDATE loc_settings SET it_type = ' . $ilDB->quote(1, 'integer') . ' WHERE type = ' . $ilDB->quote(1, 'integer'); 9327$res = $ilDB->manipulate($query); 9328 9329?> 9330 9331<#4665> 9332<?php 9333 9334 9335$query = 'UPDATE loc_settings SET qt_start = ' . $ilDB->quote(0, 'integer') . ' WHERE type = ' . $ilDB->quote(4, 'integer'); 9336$res = $ilDB->manipulate($query); 9337 9338?> 9339 9340<#4666> 9341<?php 9342 9343if (!$ilDB->tableExists('loc_tst_assignments')) { 9344 $ilDB->createTable('loc_tst_assignments', array( 9345 'assignment_id' => array( 9346 'type' => 'integer', 9347 'length' => 4, 9348 'notnull' => true, 9349 'default' => 0 9350 ), 9351 'container_id' => array( 9352 'type' => 'integer', 9353 'length' => 4, 9354 'notnull' => true, 9355 'default' => 0 9356 ), 9357 'assignment_type' => array( 9358 'type' => 'integer', 9359 'length' => 1, 9360 'notnull' => true, 9361 'default' => 0 9362 ), 9363 'objective_id' => array( 9364 'type' => 'integer', 9365 'length' => 4, 9366 'notnull' => true, 9367 'default' => 0 9368 ), 9369 'tst_ref_id' => array( 9370 'type' => 'integer', 9371 'length' => 4, 9372 'notnull' => true, 9373 'default' => 0 9374 ) 9375 )); 9376 9377 $ilDB->addPrimaryKey('loc_tst_assignments', array('assignment_id')); 9378 $ilDB->createSequence('loc_tst_assignments'); 9379} 9380?> 9381 9382 9383<#4667> 9384<?php 9385 9386if (!$ilDB->tableColumnExists('loc_settings', 'passed_obj_mode')) { 9387 $ilDB->addTableColumn( 9388 'loc_settings', 9389 'passed_obj_mode', 9390 array( 9391 'type' => 'integer', 9392 'length' => 1, 9393 'notnull' => false, 9394 'default' => 1 9395 ) 9396 ); 9397} 9398?> 9399 9400<#4668> 9401<?php 9402if (!$ilDB->tableExists('tst_seq_qst_optional')) { 9403 $ilDB->createTable('tst_seq_qst_optional', array( 9404 'active_fi' => array( 9405 'type' => 'integer', 9406 'length' => 4, 9407 'notnull' => true, 9408 'default' => 0 9409 ), 9410 'pass' => array( 9411 'type' => 'integer', 9412 'length' => 4, 9413 'notnull' => true, 9414 'default' => 0 9415 ), 9416 'question_fi' => array( 9417 'type' => 'integer', 9418 'length' => 4, 9419 'notnull' => true, 9420 'default' => 0 9421 ) 9422 )); 9423 9424 $ilDB->addPrimaryKey('tst_seq_qst_optional', array( 9425 'active_fi', 'pass', 'question_fi' 9426 )); 9427} 9428?> 9429 9430<#4669> 9431<?php 9432if (!$ilDB->tableColumnExists('tst_sequence', 'ans_opt_confirmed')) { 9433 $ilDB->addTableColumn('tst_sequence', 'ans_opt_confirmed', array( 9434 'type' => 'integer', 9435 'length' => 1, 9436 'notnull' => true, 9437 'default' => 0 9438 )); 9439} 9440?> 9441 9442<#4670> 9443<?php 9444if (!$ilDB->tableExists('il_wac_secure_path')) { 9445 $fields = array( 9446 'path' => array( 9447 'type' => 'text', 9448 'length' => '64', 9449 9450 ), 9451 'component_directory' => array( 9452 'type' => 'text', 9453 'length' => '256', 9454 9455 ), 9456 'checking_class' => array( 9457 'type' => 'text', 9458 'length' => '256', 9459 9460 ), 9461 'in_sec_folder' => array( 9462 'type' => 'integer', 9463 'length' => '1', 9464 ), 9465 9466 ); 9467 9468 $ilDB->createTable('il_wac_secure_path', $fields); 9469 $ilDB->addPrimaryKey('il_wac_secure_path', array( 'path' )); 9470} 9471?> 9472<#4671> 9473 <?php 9474 //step 1/5 search for dublicates and store it in desktop_item_tmp 9475 9476 if ($ilDB->tableExists('desktop_item')) { 9477 $res = $ilDB->query(" 9478 SELECT first.item_id, first.user_id 9479 FROM desktop_item first 9480 WHERE EXISTS ( 9481 SELECT second.item_id, second.user_id 9482 FROM desktop_item second 9483 WHERE first.item_id = second.item_id AND first.user_id = second.user_id 9484 GROUP BY second.item_id, second.user_id 9485 HAVING COUNT(second.item_id) > 1 9486 ) 9487 GROUP BY first.item_id, first.user_id 9488 "); 9489 9490 if ($ilDB->numRows($res)) { 9491 if (!$ilDB->tableExists('desktop_item_tmp')) { 9492 $ilDB->createTable('desktop_item_tmp', array( 9493 'item_id' => array( 9494 'type' => 'integer', 9495 'length' => 8, 9496 'notnull' => true, 9497 'default' => 0 9498 ), 9499 'user_id' => array( 9500 'type' => 'integer', 9501 'length' => 8, 9502 'notnull' => true, 9503 'default' => 0 9504 ) 9505 )); 9506 $ilDB->addPrimaryKey('desktop_item_tmp', array('item_id','user_id')); 9507 } 9508 9509 while ($row = $ilDB->fetchAssoc($res)) { 9510 $ilDB->replace('desktop_item_tmp', array(), array( 9511 'item_id' => array('integer', $row['item_id']), 9512 'user_id' => array('integer', $row['user_id']) 9513 )); 9514 } 9515 } 9516 } 9517 ?> 9518<#4672> 9519 <?php 9520 //step 2/5 deletes dublicates stored in desktop_item_tmp 9521 9522 if ($ilDB->tableExists('desktop_item_tmp')) { 9523 $res = $ilDB->query(" 9524 SELECT item_id, user_id 9525 FROM desktop_item_tmp 9526 "); 9527 9528 while ($row = $ilDB->fetchAssoc($res)) { 9529 $res_data = $ilDB->query( 9530 " 9531 SELECT * 9532 FROM desktop_item 9533 WHERE 9534 item_id = " . $ilDB->quote($row['item_id'], 'integer') . " AND 9535 user_id = " . $ilDB->quote($row['user_id'], 'integer') 9536 ); 9537 $data = $ilDB->fetchAssoc($res_data); 9538 9539 $ilDB->manipulate( 9540 "DELETE FROM desktop_item WHERE" . 9541 " item_id = " . $ilDB->quote($row['item_id'], 'integer') . 9542 " AND user_id = " . $ilDB->quote($row['user_id'], 'integer') 9543 ); 9544 9545 $ilDB->manipulate("INSERT INTO desktop_item (item_id,user_id,type,parameters) " . 9546 "VALUES ( " . 9547 $ilDB->quote($data['item_id'], 'integer') . ', ' . 9548 $ilDB->quote($data['user_id'], 'integer') . ', ' . 9549 $ilDB->quote($data['type'], 'text') . ', ' . 9550 $ilDB->quote($data['parameters'], 'text') . 9551 ")"); 9552 } 9553 } 9554 ?> 9555<#4673> 9556 <?php 9557 //step 3/5 drop desktop_item_tmp 9558 9559 if ($ilDB->tableExists('desktop_item_tmp')) { 9560 $ilDB->dropTable('desktop_item_tmp'); 9561 } 9562 ?> 9563<#4674> 9564 <?php 9565 //step 4/5 drops not used indexes 9566 9567 if ($ilDB->indexExistsByFields('desktop_item', array('item_id'))) { 9568 $ilDB->dropIndexByFields('desktop_item', array('item_id')); 9569 } 9570 if ($ilDB->indexExistsByFields('desktop_item', array('user_id'))) { 9571 $ilDB->dropIndexByFields('desktop_item', array('user_id')); 9572 } 9573 ?> 9574<#4675> 9575<?php 9576//step 5/5 adding primary keys and useful indexes 9577 9578if ($ilDB->tableExists('desktop_item')) { 9579 $ilDB->addPrimaryKey('desktop_item', array('user_id', 'item_id')); 9580} 9581?> 9582<#4676> 9583<?php 9584if (!$ilDB->tableExists('buddylist')) { 9585 $ilDB->createTable('buddylist', array( 9586 'usr_id' => array( 9587 'type' => 'integer', 9588 'length' => 4, 9589 'notnull' => true, 9590 'default' => 0 9591 ), 9592 'buddy_usr_id' => array( 9593 'type' => 'integer', 9594 'length' => 4, 9595 'notnull' => true, 9596 'default' => 0 9597 ), 9598 'ts' => array( 9599 'type' => 'integer', 9600 'length' => 4, 9601 'notnull' => true, 9602 'default' => 0 9603 ) 9604 )); 9605 $ilDB->addPrimaryKey('buddylist', array('usr_id', 'buddy_usr_id')); 9606} 9607?> 9608<#4677> 9609<?php 9610if (!$ilDB->tableExists('buddylist_requests')) { 9611 $ilDB->createTable('buddylist_requests', array( 9612 'usr_id' => array( 9613 'type' => 'integer', 9614 'length' => 4, 9615 'notnull' => true, 9616 'default' => 0 9617 ), 9618 'buddy_usr_id' => array( 9619 'type' => 'integer', 9620 'length' => 4, 9621 'notnull' => true, 9622 'default' => 0 9623 ), 9624 'ignored' => array( 9625 'type' => 'integer', 9626 'length' => 1, 9627 'notnull' => true, 9628 'default' => 0 9629 ), 9630 'ts' => array( 9631 'type' => 'integer', 9632 'length' => 4, 9633 'notnull' => true, 9634 'default' => 0 9635 ) 9636 )); 9637 $ilDB->addPrimaryKey('buddylist_requests', array('usr_id', 'buddy_usr_id')); 9638 $ilDB->addIndex('buddylist_requests', array('buddy_usr_id', 'ignored'), 'i1'); 9639} 9640?> 9641<#4678> 9642<?php 9643$ilDB->manipulate('DELETE FROM addressbook_mlist_ass'); 9644if ($ilDB->tableColumnExists('addressbook_mlist_ass', 'addr_id')) { 9645 $ilDB->renameTableColumn('addressbook_mlist_ass', 'addr_id', 'usr_id'); 9646} 9647?> 9648<#4679> 9649<?php 9650if ($ilDB->tableExists('addressbook')) { 9651 $query = " 9652 SELECT ud1.usr_id 'u1', ud2.usr_id 'u2' 9653 FROM addressbook a1 9654 INNER JOIN usr_data ud1 ON ud1.usr_id = a1.user_id 9655 INNER JOIN usr_data ud2 ON ud2.login = a1.login 9656 INNER JOIN addressbook a2 ON a2.user_id = ud2.usr_id AND a2.login = ud1.login 9657 WHERE ud1.usr_id != ud2.usr_id 9658 "; 9659 $res = $ilDB->query($query); 9660 while ($row = $ilDB->fetchAssoc($res)) { 9661 $this->db->replace( 9662 'buddylist', 9663 array( 9664 'usr_id' => array('integer', $row['u1']), 9665 'buddy_usr_id' => array('integer', $row['u2']) 9666 ), 9667 array( 9668 'ts' => array('integer', time()) 9669 ) 9670 ); 9671 9672 $this->db->replace( 9673 'buddylist', 9674 array( 9675 'usr_id' => array('integer', $row['u2']), 9676 'buddy_usr_id' => array('integer', $row['u1']) 9677 ), 9678 array( 9679 'ts' => array('integer', time()) 9680 ) 9681 ); 9682 } 9683 9684 $query = " 9685 SELECT ud1.usr_id 'u1', ud2.usr_id 'u2' 9686 FROM addressbook a1 9687 INNER JOIN usr_data ud1 ON ud1.usr_id = a1.user_id 9688 INNER JOIN usr_data ud2 ON ud2.login = a1.login 9689 LEFT JOIN addressbook a2 ON a2.user_id = ud2.usr_id AND a2.login = ud1.login 9690 WHERE a2.addr_id IS NULL AND ud1.usr_id != ud2.usr_id 9691 "; 9692 $res = $ilDB->query($query); 9693 while ($row = $ilDB->fetchAssoc($res)) { 9694 $this->db->replace( 9695 'buddylist_requests', 9696 array( 9697 'usr_id' => array('integer', $row['u1']), 9698 'buddy_usr_id' => array('integer', $row['u2']) 9699 ), 9700 array( 9701 'ts' => array('integer', time()), 9702 'ignored' => array('integer', 0) 9703 ) 9704 ); 9705 } 9706 9707 $ilDB->dropTable('addressbook'); 9708} 9709?> 9710<#4680> 9711<?php 9712if ($ilDB->sequenceExists('addressbook')) { 9713 $ilDB->dropSequence('addressbook'); 9714} 9715?> 9716<#4681> 9717<?php 9718$ilCtrlStructureReader->getStructure(); 9719?> 9720<#4682> 9721<?php 9722$res = $ilDB->queryF( 9723 'SELECT * FROM notification_usercfg WHERE usr_id = %s AND module = %s AND channel = %s', 9724 array('integer', 'text', 'text'), 9725 array(-1, 'buddysystem_request', 'mail') 9726); 9727$num = $ilDB->numRows($res); 9728if (!$ilDB->numRows($res)) { 9729 $ilDB->insert( 9730 'notification_usercfg', 9731 array( 9732 'usr_id' => array('integer', -1), 9733 'module' => array('text', 'buddysystem_request'), 9734 'channel' => array('text', 'mail') 9735 ) 9736 ); 9737} 9738 9739$res = $ilDB->queryF( 9740 'SELECT * FROM notification_usercfg WHERE usr_id = %s AND module = %s AND channel = %s', 9741 array('integer', 'text', 'text'), 9742 array(-1, 'buddysystem_request', 'osd') 9743); 9744if (!$ilDB->numRows($res)) { 9745 $ilDB->insert( 9746 'notification_usercfg', 9747 array( 9748 'usr_id' => array('integer', -1), 9749 'module' => array('text', 'buddysystem_request'), 9750 'channel' => array('text', 'osd') 9751 ) 9752 ); 9753} 9754?> 9755<#4683> 9756<?php 9757if (!$ilDB->tableColumnExists('obj_members', 'contact')) { 9758 $ilDB->addTableColumn( 9759 'obj_members', 9760 'contact', 9761 array( 9762 'type' => 'integer', 9763 'length' => 1, 9764 'notnull' => false, 9765 'default' => 0 9766 ) 9767 ); 9768} 9769?> 9770<#4684> 9771<?php 9772 // register new object type 'awra' for awareness tool administration 9773 $id = $ilDB->nextId("object_data"); 9774 $ilDB->manipulateF( 9775 "INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 9776 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 9777 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 9778 array($id, "typ", "awra", "Awareness Tool Administration", -1, ilUtil::now(), ilUtil::now()) 9779 ); 9780 $typ_id = $id; 9781 9782 // create object data entry 9783 $id = $ilDB->nextId("object_data"); 9784 $ilDB->manipulateF( 9785 "INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 9786 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 9787 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 9788 array($id, "awra", "__AwarenessToolAdministration", "Awareness Tool Administration", -1, ilUtil::now(), ilUtil::now()) 9789 ); 9790 9791 // create object reference entry 9792 $ref_id = $ilDB->nextId('object_reference'); 9793 $res = $ilDB->manipulateF( 9794 "INSERT INTO object_reference (ref_id, obj_id) VALUES (%s, %s)", 9795 array("integer", "integer"), 9796 array($ref_id, $id) 9797 ); 9798 9799 // put in tree 9800 $tree = new ilTree(ROOT_FOLDER_ID); 9801 $tree->insertNode($ref_id, SYSTEM_FOLDER_ID); 9802 9803 // add rbac operations 9804 // 1: edit_permissions, 2: visible, 3: read, 4:write 9805 $ilDB->manipulateF( 9806 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 9807 array("integer", "integer"), 9808 array($typ_id, 1) 9809 ); 9810 $ilDB->manipulateF( 9811 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 9812 array("integer", "integer"), 9813 array($typ_id, 2) 9814 ); 9815 $ilDB->manipulateF( 9816 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 9817 array("integer", "integer"), 9818 array($typ_id, 3) 9819 ); 9820 $ilDB->manipulateF( 9821 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 9822 array("integer", "integer"), 9823 array($typ_id, 4) 9824 ); 9825?> 9826<#4685> 9827<?php 9828 $ilCtrlStructureReader->getStructure(); 9829?> 9830<#4686> 9831<?php 9832 $ilCtrlStructureReader->getStructure(); 9833?> 9834<#4687> 9835<?php 9836 $ilCtrlStructureReader->getStructure(); 9837?> 9838<#4688> 9839<?php 9840 $s = new ilSetting("awrn"); 9841 $s->set("max_nr_entries", 50); 9842?> 9843<#4689> 9844<?php 9845 $ilCtrlStructureReader->getStructure(); 9846?> 9847<#4690> 9848<?php 9849//step 1/4 rbac_log renames old table 9850 9851if ($ilDB->tableExists('rbac_log') && !$ilDB->tableExists('rbac_log_old')) { 9852 $ilDB->renameTable("rbac_log", "rbac_log_old"); 9853} 9854?> 9855<#4691> 9856<?php 9857//step 2/4 rbac_log creates new table with unique id and sequenz 9858 9859if (!$ilDB->tableExists('rbac_log')) { 9860 $ilDB->createTable('rbac_log', array( 9861 'log_id' => array( 9862 'type' => 'integer', 9863 'length' => 4, 9864 'notnull' => true 9865 ), 9866 'user_id' => array( 9867 'type' => 'integer', 9868 'length' => 4, 9869 'notnull' => true 9870 ), 9871 'created' => array( 9872 'type' => 'integer', 9873 'length' => 4, 9874 'notnull' => true 9875 ), 9876 'ref_id' => array( 9877 'type' => 'integer', 9878 'length' => 4, 9879 'notnull' => true 9880 ), 9881 'action' => array( 9882 'type' => 'integer', 9883 'length' => 4, 9884 'notnull' => true 9885 ), 9886 'data' => array( 9887 'type' => 'clob', 9888 'notnull' => false, 9889 'default' => null 9890 ) 9891 )); 9892 $ilDB->addPrimaryKey('rbac_log', array('log_id')); 9893 $ilDB->addIndex('rbac_log', array('ref_id'), 'i1'); 9894 $ilDB->createSequence('rbac_log'); 9895} 9896?> 9897<#4692> 9898<?php 9899//step 3/4 rbac_log moves all data to new table 9900 9901if ($ilDB->tableExists('rbac_log') && $ilDB->tableExists('rbac_log_old')) { 9902 $res = $ilDB->query(" 9903 SELECT * 9904 FROM rbac_log_old 9905 "); 9906 9907 while ($row = $ilDB->fetchAssoc($res)) { 9908 $id = $ilDB->nextId('rbac_log'); 9909 9910 $ilDB->manipulate( 9911 "INSERT INTO rbac_log (log_id, user_id, created, ref_id, action, data)" . 9912 " VALUES (" . 9913 $ilDB->quote($id, "integer") . 9914 "," . $ilDB->quote($row['user_id'], "integer") . 9915 "," . $ilDB->quote($row['created'], "integer") . 9916 "," . $ilDB->quote($row['ref_id'], "integer") . 9917 "," . $ilDB->quote($row['action'], "integer") . 9918 "," . $ilDB->quote($row['data'], "text") . 9919 ")" 9920 ); 9921 9922 $ilDB->manipulateF( 9923 "DELETE FROM rbac_log_old WHERE user_id = %s AND created = %s AND ref_id = %s AND action = %s", 9924 array('integer', 'integer', 'integer', 'integer'), 9925 array($row['user_id'], $row['created'], $row['ref_id'], $row['action']) 9926 ); 9927 } 9928} 9929?> 9930<#4693> 9931<?php 9932//step 4/4 rbac_log removes all table 9933 9934if ($ilDB->tableExists('rbac_log_old')) { 9935 $ilDB->dropTable('rbac_log_old'); 9936} 9937?> 9938<#4694> 9939<?php 9940//step 1/3 rbac_templates removes all dublicates 9941if ($ilDB->tableExists('rbac_templates')) { 9942 $res = $ilDB->query( 9943 'select * from rbac_templates GROUP BY rol_id, type, ops_id, parent ' . 9944 'having count(*) > 1' 9945 ); 9946 9947 9948 /* 9949 $res = $ilDB->query(" 9950 SELECT first.rol_id rol_id, first.type type, first.ops_id ops_id, first.parent parent 9951 FROM rbac_templates first 9952 WHERE EXISTS ( 9953 SELECT second.rol_id, second.type, second.ops_id, second.parent 9954 FROM rbac_templates second 9955 WHERE first.rol_id = second.rol_id 9956 AND first.type = second.type 9957 AND first.ops_id = second.ops_id 9958 AND first.parent = second.parent 9959 GROUP BY second.rol_id, second.type, second.ops_id, second.parent 9960 HAVING COUNT(second.rol_id) > 1 9961 ) 9962 GROUP BY first.rol_id, first.type, first.ops_id, first.parent 9963 "); 9964 */ 9965 9966 while ($row = $ilDB->fetchAssoc($res)) { 9967 $ilDB->manipulateF( 9968 "DELETE FROM rbac_templates WHERE rol_id = %s AND type = %s AND ops_id = %s AND parent = %s", 9969 array('integer', 'text', 'integer', 'integer'), 9970 array($row['rol_id'], $row['type'], $row['ops_id'], $row['parent']) 9971 ); 9972 9973 $ilDB->manipulate( 9974 "INSERT INTO rbac_templates (rol_id, type, ops_id, parent)" . 9975 " VALUES (" . 9976 $ilDB->quote($row['rol_id'], "integer") . 9977 "," . $ilDB->quote($row['type'], "text") . 9978 "," . $ilDB->quote($row['ops_id'], "integer") . 9979 "," . $ilDB->quote($row['parent'], "integer") . 9980 ")" 9981 ); 9982 } 9983} 9984?> 9985<#4695> 9986<?php 9987//step 2/3 rbac_templates remove indexes 9988if ($ilDB->indexExistsByFields('rbac_templates', array('rol_id'))) { 9989 $ilDB->dropIndexByFields('rbac_templates', array('rol_id')); 9990} 9991if ($ilDB->indexExistsByFields('rbac_templates', array('type'))) { 9992 $ilDB->dropIndexByFields('rbac_templates', array('type')); 9993} 9994if ($ilDB->indexExistsByFields('rbac_templates', array('ops_id'))) { 9995 $ilDB->dropIndexByFields('rbac_templates', array('ops_id')); 9996} 9997if ($ilDB->indexExistsByFields('rbac_templates', array('parent'))) { 9998 $ilDB->dropIndexByFields('rbac_templates', array('parent')); 9999} 10000if ($ilDB->indexExistsByFields('rbac_templates', array('rol_id','parent'))) { 10001 $ilDB->dropIndexByFields('rbac_templates', array('rol_id','parent')); 10002} 10003?> 10004<#4696> 10005<?php 10006//step 3/3 rbac_templates add primary 10007if ($ilDB->tableExists('rbac_templates')) { 10008 $ilDB->addPrimaryKey('rbac_templates', array('rol_id','parent', 'type', 'ops_id')); 10009} 10010?> 10011<#4697> 10012<?php 10013//remove unused table search_tree 10014if ($ilDB->tableExists('search_tree')) { 10015 $ilDB->dropTable('search_tree'); 10016} 10017?> 10018<#4698> 10019<?php 10020 if (!$ilDB->tableColumnExists('sahs_lm', 'mastery_score')) { 10021 $ilDB->addTableColumn( 10022 'sahs_lm', 10023 'mastery_score', 10024 array( 10025 'type' => 'integer', 10026 'length' => 1, 10027 'notnull' => false 10028 ) 10029 ); 10030 } 10031?> 10032<#4699> 10033<?php 10034//step 1/2 adm_set_templ_hide_tab removes all dublicates 10035if ($ilDB->tableExists('adm_set_templ_hide_tab')) { 10036 $res = $ilDB->query(" 10037 SELECT first.template_id template_id, first.tab_id tab_id 10038 FROM adm_set_templ_hide_tab first 10039 WHERE EXISTS ( 10040 SELECT second.template_id, second.tab_id 10041 FROM adm_set_templ_hide_tab second 10042 WHERE first.template_id = second.template_id AND first.tab_id = second.tab_id 10043 GROUP BY second.template_id, second.tab_id HAVING COUNT(second.template_id) > 1 10044 ) 10045 GROUP BY first.template_id, first.tab_id; 10046 "); 10047 10048 while ($row = $ilDB->fetchAssoc($res)) { 10049 $ilDB->manipulateF( 10050 "DELETE FROM adm_set_templ_hide_tab WHERE template_id = %s AND tab_id = %s", 10051 array('integer', 'text'), 10052 array($row['template_id'], $row['tab_id']) 10053 ); 10054 10055 $ilDB->manipulate( 10056 "INSERT INTO adm_set_templ_hide_tab (template_id, tab_id)" . 10057 " VALUES (" . 10058 $ilDB->quote($row['template_id'], "integer") . 10059 ", " . $ilDB->quote($row['tab_id'], "text") . 10060 ")" 10061 ); 10062 } 10063} 10064?> 10065<#4700> 10066<?php 10067//step 2/2 adm_set_templ_hide_tab add primary 10068if ($ilDB->tableExists('adm_set_templ_hide_tab')) { 10069 $ilDB->addPrimaryKey('adm_set_templ_hide_tab', array('template_id','tab_id')); 10070} 10071?> 10072<#4701> 10073<?php 10074//step 1/4 adm_set_templ_value search for dublicates and store it in adm_set_tpl_val_tmp 10075 10076if ($ilDB->tableExists('adm_set_templ_value')) { 10077 $res = $ilDB->query(" 10078 SELECT first.template_id template_id, first.setting setting 10079 FROM adm_set_templ_value first 10080 WHERE EXISTS ( 10081 SELECT second.template_id, second.setting 10082 FROM adm_set_templ_value second 10083 WHERE first.template_id = second.template_id AND first.setting = second.setting 10084 GROUP BY second.template_id, second.setting 10085 HAVING COUNT(second.template_id) > 1 10086 ) 10087 GROUP BY first.template_id, first.setting 10088 "); 10089 10090 if ($ilDB->numRows($res)) { 10091 if (!$ilDB->tableExists('adm_set_tpl_val_tmp')) { 10092 $ilDB->createTable('adm_set_tpl_val_tmp', array( 10093 'template_id' => array( 10094 'type' => 'integer', 10095 'length' => 8, 10096 'notnull' => true, 10097 'default' => 0 10098 ), 10099 'setting' => array( 10100 'type' => 'text', 10101 'length' => 40, 10102 'notnull' => true, 10103 'default' => 0 10104 ) 10105 )); 10106 $ilDB->addPrimaryKey('adm_set_tpl_val_tmp', array('template_id','setting')); 10107 } 10108 10109 while ($row = $ilDB->fetchAssoc($res)) { 10110 $ilDB->replace('adm_set_tpl_val_tmp', array(), array( 10111 'template_id' => array('integer', $row['template_id']), 10112 'setting' => array('text', $row['setting']) 10113 )); 10114 } 10115 } 10116} 10117?> 10118<#4702> 10119<?php 10120//step 2/4 adm_set_templ_value deletes dublicates stored in adm_set_tpl_val_tmp 10121 10122if ($ilDB->tableExists('adm_set_tpl_val_tmp')) { 10123 $res = $ilDB->query(" 10124 SELECT template_id, setting 10125 FROM adm_set_tpl_val_tmp 10126 "); 10127 10128 while ($row = $ilDB->fetchAssoc($res)) { 10129 $res_data = $ilDB->query( 10130 " 10131 SELECT * 10132 FROM adm_set_templ_value 10133 WHERE 10134 template_id = " . $ilDB->quote($row['template_id'], 'integer') . " AND 10135 setting = " . $ilDB->quote($row['setting'], 'text') 10136 ); 10137 $data = $ilDB->fetchAssoc($res_data); 10138 10139 $ilDB->manipulate( 10140 "DELETE FROM adm_set_templ_value WHERE" . 10141 " template_id = " . $ilDB->quote($row['template_id'], 'integer') . 10142 " AND setting = " . $ilDB->quote($row['setting'], 'text') 10143 ); 10144 10145 $ilDB->manipulate("INSERT INTO adm_set_templ_value (template_id,setting,value,hide) " . 10146 "VALUES ( " . 10147 $ilDB->quote($data['template_id'], 'integer') . ', ' . 10148 $ilDB->quote($data['setting'], 'text') . ', ' . 10149 $ilDB->quote($data['value'], 'text') . ', ' . 10150 $ilDB->quote($data['hide'], 'integer') . 10151 ")"); 10152 10153 $ilDB->manipulate( 10154 "DELETE FROM adm_set_tpl_val_tmp WHERE" . 10155 " template_id = " . $ilDB->quote($row['template_id'], 'integer') . 10156 " AND setting = " . $ilDB->quote($row['setting'], 'text') 10157 ); 10158 } 10159} 10160?> 10161<#4703> 10162<?php 10163//step 3/4 adm_set_templ_value drop adm_set_tpl_val_tmp 10164 10165if ($ilDB->tableExists('adm_set_tpl_val_tmp')) { 10166 $ilDB->dropTable('adm_set_tpl_val_tmp'); 10167} 10168?> 10169<#4704> 10170<?php 10171//step 4/4 adm_set_templ_value adding primary keys 10172 10173if ($ilDB->tableExists('adm_set_templ_value')) { 10174 $ilDB->addPrimaryKey('adm_set_templ_value', array('template_id', 'setting')); 10175} 10176?> 10177<#4705> 10178<?php 10179//step 1/4 svy_times renames old table 10180 10181if ($ilDB->tableExists('svy_times') && !$ilDB->tableExists('svy_times_old')) { 10182 $ilDB->renameTable("svy_times", "svy_times_old"); 10183} 10184?> 10185<#4706> 10186<?php 10187//step 2/4 svy_times creates new table with unique id, sequenz and index 10188 10189if (!$ilDB->tableExists('svy_times')) { 10190 $ilDB->createTable('svy_times', array( 10191 'id' => array( 10192 'type' => 'integer', 10193 'length' => 4, 10194 'notnull' => true 10195 ), 10196 'finished_fi' => array( 10197 'type' => 'integer', 10198 'length' => 4, 10199 'notnull' => true 10200 ), 10201 'entered_page' => array( 10202 'type' => 'integer', 10203 'length' => 4, 10204 ), 10205 'left_page' => array( 10206 'type' => 'integer', 10207 'length' => 4, 10208 ), 10209 'first_question' => array( 10210 'type' => 'integer', 10211 'length' => 4, 10212 ) 10213 )); 10214 $ilDB->addPrimaryKey('svy_times', array('id')); 10215 $ilDB->addIndex('svy_times', array('finished_fi'), 'i1'); 10216 $ilDB->createSequence('svy_times'); 10217} 10218?> 10219<#4707> 10220<?php 10221//step 3/4 svy_times moves all data to new table 10222 10223if ($ilDB->tableExists('svy_times') && $ilDB->tableExists('svy_times_old')) { 10224 $res = $ilDB->query(" 10225 SELECT * 10226 FROM svy_times_old 10227 "); 10228 10229 while ($row = $ilDB->fetchAssoc($res)) { 10230 $id = $ilDB->nextId('svy_times'); 10231 10232 $ilDB->manipulate( 10233 "INSERT INTO svy_times (id, finished_fi, entered_page, left_page, first_question)" . 10234 " VALUES (" . 10235 $ilDB->quote($id, "integer") . 10236 "," . $ilDB->quote($row['finished_fi'], "integer") . 10237 "," . $ilDB->quote($row['entered_page'], "integer") . 10238 "," . $ilDB->quote($row['left_page'], "integer") . 10239 "," . $ilDB->quote($row['first_question'], "integer") . 10240 ")" 10241 ); 10242 10243 $ilDB->manipulateF( 10244 "DELETE FROM svy_times_old WHERE finished_fi = %s AND entered_page = %s AND left_page = %s AND first_question = %s", 10245 array('integer', 'integer', 'integer', 'integer'), 10246 array($row['finished_fi'], $row['entered_page'], $row['left_page'], $row['first_question']) 10247 ); 10248 } 10249} 10250?> 10251<#4708> 10252<?php 10253//step 4/4 svy_times removes old table 10254 10255if ($ilDB->tableExists('svy_times_old')) { 10256 $ilDB->dropTable('svy_times_old'); 10257} 10258?> 10259 10260<#4709> 10261<?php 10262 10263if (!$ilDB->tableColumnExists("ldap_server_settings", "username_filter")) { 10264 $ilDB->addTableColumn("ldap_server_settings", "username_filter", array( 10265 'type' => 'text', 10266 'length' => 255, 10267 )); 10268} 10269?> 10270<#4710> 10271<?php 10272$query = "SELECT max(server_id) id FROM ldap_server_settings"; 10273$res = $ilDB->query($query); 10274$set = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT); 10275 10276if (!$set->id) { 10277 $set->id = 1; 10278} 10279 10280$query = "UPDATE ldap_role_assignments " . 10281 "SET server_id = " . $set->id . 10282 " WHERE server_id = 0"; 10283$ilDB->manipulate($query); 10284 10285?> 10286<#4711> 10287<?php 10288if (!$ilDB->tableColumnExists('usr_search', 'creation_filter')) { 10289 $ilDB->addTableColumn("usr_search", "creation_filter", array( 10290 "type" => "text", 10291 "notnull" => false, 10292 "length" => 1000, 10293 "fixed" => false)); 10294} 10295?> 10296<#4712> 10297<?php 10298$ilCtrlStructureReader->getStructure(); 10299?> 10300 10301<#4713> 10302<?php 10303 // register new object type 'logs' for Logging administration 10304 $id = $ilDB->nextId("object_data"); 10305 $ilDB->manipulateF( 10306 "INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 10307 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 10308 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 10309 array($id, "typ", "logs", "Logging Administration", -1, ilUtil::now(), ilUtil::now()) 10310 ); 10311 $typ_id = $id; 10312 10313 // create object data entry 10314 $id = $ilDB->nextId("object_data"); 10315 $ilDB->manipulateF( 10316 "INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 10317 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 10318 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 10319 array($id, "logs", "__LoggingSettings", "Logging Administration", -1, ilUtil::now(), ilUtil::now()) 10320 ); 10321 10322 // create object reference entry 10323 $ref_id = $ilDB->nextId('object_reference'); 10324 $res = $ilDB->manipulateF( 10325 "INSERT INTO object_reference (ref_id, obj_id) VALUES (%s, %s)", 10326 array("integer", "integer"), 10327 array($ref_id, $id) 10328 ); 10329 10330 // put in tree 10331 $tree = new ilTree(ROOT_FOLDER_ID); 10332 $tree->insertNode($ref_id, SYSTEM_FOLDER_ID); 10333 10334 // add rbac operations 10335 // 1: edit_permissions, 2: visible, 3: read, 4:write 10336 $ilDB->manipulateF( 10337 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 10338 array("integer", "integer"), 10339 array($typ_id, 1) 10340 ); 10341 $ilDB->manipulateF( 10342 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 10343 array("integer", "integer"), 10344 array($typ_id, 2) 10345 ); 10346 $ilDB->manipulateF( 10347 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 10348 array("integer", "integer"), 10349 array($typ_id, 3) 10350 ); 10351 $ilDB->manipulateF( 10352 "INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", 10353 array("integer", "integer"), 10354 array($typ_id, 4) 10355 ); 10356 10357 10358?> 10359<#4714> 10360<?php 10361 $ilCtrlStructureReader->getStructure(); 10362?> 10363 10364<#4715> 10365<?php 10366 10367 if (!$ilDB->tableExists('log_components')) { 10368 $ilDB->createTable('log_components', array( 10369 'component_id' => array( 10370 'type' => 'text', 10371 'length' => 20, 10372 'notnull' => false 10373 ), 10374 'log_level' => array( 10375 'type' => 'integer', 10376 'length' => 4, 10377 'notnull' => false, 10378 'default' => null 10379 ) 10380 )); 10381 10382 $ilDB->addPrimaryKey('log_components', array('component_id')); 10383 } 10384?> 10385<#4716> 10386<?php 10387 $ilCtrlStructureReader->getStructure(); 10388?> 10389<#4717> 10390<?php 10391 $ilCtrlStructureReader->getStructure(); 10392?> 10393<#4718> 10394<?php 10395$ilCtrlStructureReader->getStructure(); 10396?> 10397<#4719> 10398<?php 10399 10400$res = $ilDB->queryF( 10401 "SELECT COUNT(*) cnt FROM qpl_qst_type WHERE type_tag = %s", 10402 array('text'), 10403 array('assLongMenu') 10404); 10405 10406$row = $ilDB->fetchAssoc($res); 10407 10408if (!$row['cnt']) { 10409 $res = $ilDB->query("SELECT MAX(question_type_id) maxid FROM qpl_qst_type"); 10410 $data = $ilDB->fetchAssoc($res); 10411 $nextId = $data['maxid'] + 1; 10412 10413 $ilDB->insert('qpl_qst_type', array( 10414 'question_type_id' => array('integer', $nextId), 10415 'type_tag' => array('text', 'assLongMenu'), 10416 'plugin' => array('integer', 0) 10417 )); 10418} 10419 10420?> 10421<#4720> 10422<?php 10423if (!$ilDB->tableExists('qpl_qst_lome')) { 10424 $ilDB->createTable('qpl_qst_lome', array( 10425 'question_fi' => array( 10426 'type' => 'integer', 10427 'length' => 4, 10428 'notnull' => true, 10429 'default' => 0 10430 ), 10431 'shuffle_answers' => array( 10432 'type' => 'integer', 10433 'length' => 1, 10434 'notnull' => true, 10435 'default' => 0 10436 ), 10437 'answer_type' => array( 10438 'type' => 'text', 10439 'length' => 16, 10440 'notnull' => true, 10441 'default' => 'singleLine' 10442 ), 10443 'feedback_setting' => array( 10444 'type' => 'integer', 10445 'length' => 4, 10446 'notnull' => true, 10447 'default' => 1 10448 ), 10449 'long_menu_text' => array( 10450 "type" => "clob", 10451 "notnull" => false, 10452 "default" => null 10453 ) 10454 )); 10455 10456 $ilDB->addPrimaryKey('qpl_qst_lome', array('question_fi')); 10457} 10458?> 10459<#4721> 10460<?php 10461if (!$ilDB->tableExists('qpl_a_lome')) { 10462 $ilDB->createTable('qpl_a_lome', array( 10463 'question_fi' => array( 10464 'type' => 'integer', 10465 'length' => 4, 10466 'notnull' => true, 10467 'default' => 0 10468 ), 10469 'gap_number' => array( 10470 'type' => 'integer', 10471 'length' => 4, 10472 'notnull' => true, 10473 'default' => 0 10474 ), 10475 'position' => array( 10476 'type' => 'integer', 10477 'length' => 4, 10478 'notnull' => true, 10479 'default' => 0 10480 ), 10481 'answer_text' => array( 10482 'type' => 'text', 10483 'length' => 1000 10484 ), 10485 'points' => array( 10486 'type' => 'float' 10487 ), 10488 'type' => array( 10489 'type' => 'integer', 10490 'length' => 4 10491 ) 10492 )); 10493 $ilDB->addPrimaryKey('qpl_a_lome', array('question_fi', 'gap_number', 'position')); 10494} 10495?> 10496<#4722> 10497<?php 10498$ilCtrlStructureReader->getStructure(); 10499?> 10500 10501<#4723> 10502<?php 10503 10504 $query = 'SELECT child FROM tree group by child having count(child) > 1'; 10505 $res = $ilDB->query($query); 10506 10507 $found_dup = false; 10508 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 10509 $found_dup = true; 10510 } 10511 10512 if (!$found_dup) { 10513 $ilDB->addPrimaryKey('tree', array('child')); 10514 } else { 10515 $ilSetting = new ilSetting(); 10516 $is_read = $ilSetting->get('tree_dups', 0); 10517 10518 if (!$is_read) { 10519 echo "<pre> 10520 Dear Administrator, 10521 10522 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 10523 10524 The update process has been stopped due to an invalid data structure of the repository tree. 10525 Duplicates have been detected in your installation. 10526 10527 You can continue with the update process. 10528 But you should perform a system check and repair the tree structure in \"Adminstration -> Systemcheck -> Tree\" 10529 10530 Best regards, 10531 The Tree Maintainer 10532 </pre>"; 10533 10534 $ilSetting->set('tree_dups', 1); 10535 exit; 10536 } 10537 } 10538?> 10539<#4724> 10540<?php 10541//step 1/4 usr_data_multi renames old table 10542 10543if ($ilDB->tableExists('usr_data_multi') && !$ilDB->tableExists('usr_data_multi_old')) { 10544 $ilDB->renameTable("usr_data_multi", "usr_data_multi_old"); 10545} 10546?> 10547<#4725> 10548<?php 10549//step 2/4 usr_data_multi creates new table with unique id, sequenz and index 10550 10551if (!$ilDB->tableExists('usr_data_multi')) { 10552 $ilDB->createTable('usr_data_multi', array( 10553 'id' => array( 10554 'type' => 'integer', 10555 'length' => 4, 10556 'notnull' => true 10557 ), 10558 'usr_id' => array( 10559 'type' => 'integer', 10560 'length' => 4, 10561 'notnull' => true 10562 ), 10563 'field_id' => array( 10564 'type' => 'text', 10565 'length' => 255, 10566 'notnull' => true 10567 ), 10568 'value' => array( 10569 'type' => 'text', 10570 'length' => 1000, 10571 'default' => '' 10572 ) 10573 )); 10574 $ilDB->addPrimaryKey('usr_data_multi', array('id')); 10575 $ilDB->addIndex('usr_data_multi', array('usr_id'), 'i1'); 10576 $ilDB->createSequence('usr_data_multi'); 10577} 10578?> 10579<#4726> 10580<?php 10581//step 3/4 usr_data_multi moves all data to new table 10582 10583if ($ilDB->tableExists('usr_data_multi') && $ilDB->tableExists('usr_data_multi_old')) { 10584 $res = $ilDB->query(" 10585 SELECT * 10586 FROM usr_data_multi_old 10587 "); 10588 10589 while ($row = $ilDB->fetchAssoc($res)) { 10590 $id = $ilDB->nextId('usr_data_multi'); 10591 10592 $ilDB->manipulate( 10593 "INSERT INTO usr_data_multi (id, usr_id, field_id, value)" . 10594 " VALUES (" . 10595 $ilDB->quote($id, "integer") . 10596 "," . $ilDB->quote($row['usr_id'], "integer") . 10597 "," . $ilDB->quote($row['field_id'], "text") . 10598 "," . $ilDB->quote($row['value'], "text") . 10599 ")" 10600 ); 10601 10602 $ilDB->manipulateF( 10603 "DELETE FROM usr_data_multi_old WHERE usr_id = %s AND field_id = %s AND value = %s", 10604 array('integer', 'text', 'text'), 10605 array($row['usr_id'], $row['field_id'], $row['value']) 10606 ); 10607 } 10608} 10609?> 10610<#4727> 10611<?php 10612//step 4/4 usr_data_multi removes old table 10613 10614if ($ilDB->tableExists('usr_data_multi_old')) { 10615 $ilDB->dropTable('usr_data_multi_old'); 10616} 10617?> 10618<#4728> 10619<?php 10620//step 1/4 xmlnestedset renames old table 10621 10622if ($ilDB->tableExists('xmlnestedset') && !$ilDB->tableExists('xmlnestedset_old')) { 10623 $ilDB->renameTable("xmlnestedset", "xmlnestedset_old"); 10624} 10625?> 10626<#4729> 10627<?php 10628//step 2/4 xmlnestedset creates new table with unique id and sequenz 10629 10630if (!$ilDB->tableExists('xmlnestedset')) { 10631 $ilDB->createTable( 10632 "xmlnestedset", 10633 array( 10634 "ns_id" => array( 10635 "type" => "integer", 10636 "length" => 4, 10637 "notnull" => true 10638 ), 10639 "ns_book_fk" => array( 10640 "type" => "integer", 10641 "length" => 4, 10642 "notnull" => true 10643 ), 10644 "ns_type" => array( 10645 "type" => "text", 10646 "length" => 50, 10647 "notnull" => true 10648 ), 10649 "ns_tag_fk" => array( 10650 "type" => "integer", 10651 "length" => 4, 10652 "notnull" => true 10653 ), 10654 "ns_l" => array( 10655 "type" => "integer", 10656 "length" => 4, 10657 "notnull" => true 10658 ), 10659 "ns_r" => array( 10660 "type" => "integer", 10661 "length" => 4, 10662 "notnull" => true 10663 ) 10664 ) 10665 ); 10666 $ilDB->addIndex("xmlnestedset", array("ns_tag_fk"), 'i1'); 10667 $ilDB->addIndex("xmlnestedset", array("ns_l"), 'i2'); 10668 $ilDB->addIndex("xmlnestedset", array("ns_r"), 'i3'); 10669 $ilDB->addIndex("xmlnestedset", array("ns_book_fk"), 'i4'); 10670 $ilDB->addPrimaryKey('xmlnestedset', array('ns_id')); 10671 $ilDB->createSequence('xmlnestedset'); 10672} 10673?> 10674<#4730> 10675<?php 10676//step 3/4 xmlnestedset moves all data to new table 10677 10678if ($ilDB->tableExists('xmlnestedset') && $ilDB->tableExists('xmlnestedset_old')) { 10679 $res = $ilDB->query(" 10680 SELECT * 10681 FROM xmlnestedset_old 10682 "); 10683 10684 while ($row = $ilDB->fetchAssoc($res)) { 10685 $id = $ilDB->nextId('xmlnestedset'); 10686 10687 $ilDB->manipulate( 10688 "INSERT INTO xmlnestedset (ns_id, ns_book_fk, ns_type, ns_tag_fk, ns_l, ns_r)" . 10689 " VALUES (" . 10690 $ilDB->quote($id, "integer") . 10691 "," . $ilDB->quote($row['ns_book_fk'], "integer") . 10692 "," . $ilDB->quote($row['ns_type'], "text") . 10693 "," . $ilDB->quote($row['ns_tag_fk'], "integer") . 10694 "," . $ilDB->quote($row['ns_l'], "integer") . 10695 "," . $ilDB->quote($row['ns_r'], "integer") . 10696 ")" 10697 ); 10698 10699 $ilDB->manipulateF( 10700 "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", 10701 array('integer', 'text', 'integer', 'integer', 'integer'), 10702 array($row['ns_book_fk'], $row['ns_type'], $row['ns_tag_fk'], $row['ns_l'], $row['ns_r']) 10703 ); 10704 } 10705} 10706?> 10707<#4731> 10708<?php 10709//step 4/4 xmlnestedset removes old table 10710 10711if ($ilDB->tableExists('xmlnestedset_old')) { 10712 $ilDB->dropTable('xmlnestedset_old'); 10713} 10714?> 10715<#4732> 10716<?php 10717//step 1/4 xmlnestedsettmp renames old table 10718 10719if ($ilDB->tableExists('xmlnestedsettmp') && !$ilDB->tableExists('xmlnestedsettmp_old')) { 10720 $ilDB->renameTable("xmlnestedsettmp", "xmlnestedsettmp_old"); 10721} 10722?> 10723<#4733> 10724<?php 10725//step 2/4 xmlnestedsettmp creates new table with unique id and sequenz 10726 10727if (!$ilDB->tableExists('xmlnestedsettmp')) { 10728 $ilDB->createTable( 10729 "xmlnestedsettmp", 10730 array( 10731 "ns_id" => array( 10732 "type" => "integer", 10733 "length" => 4, 10734 "notnull" => true 10735 ), 10736 "ns_unique_id" => array(// text because maybe we have to store a session_id in future e.g. 10737 "type" => "text", 10738 "length" => 32, 10739 "notnull" => true 10740 ), 10741 "ns_book_fk" => array( 10742 "type" => "integer", 10743 "length" => 4, 10744 "notnull" => true 10745 ), 10746 "ns_type" => array( 10747 "type" => "text", 10748 "length" => 50, 10749 "notnull" => true 10750 ), 10751 "ns_tag_fk" => array( 10752 "type" => "integer", 10753 "length" => 4, 10754 "notnull" => true 10755 ), 10756 "ns_l" => array( 10757 "type" => "integer", 10758 "length" => 4, 10759 "notnull" => true 10760 ), 10761 "ns_r" => array( 10762 "type" => "integer", 10763 "length" => 4, 10764 "notnull" => true 10765 ) 10766 ) 10767 ); 10768 $ilDB->addIndex("xmlnestedsettmp", array("ns_tag_fk"), 'i1'); 10769 $ilDB->addIndex("xmlnestedsettmp", array("ns_l"), 'i2'); 10770 $ilDB->addIndex("xmlnestedsettmp", array("ns_r"), 'i3'); 10771 $ilDB->addIndex("xmlnestedsettmp", array("ns_book_fk"), 'i4'); 10772 $ilDB->addIndex("xmlnestedsettmp", array("ns_unique_id"), 'i5'); 10773 $ilDB->addPrimaryKey('xmlnestedsettmp', array('ns_id')); 10774 $ilDB->createSequence('xmlnestedsettmp'); 10775} 10776?> 10777<#4734> 10778<?php 10779//step 3/4 xmlnestedsettmp moves all data to new table 10780 10781if ($ilDB->tableExists('xmlnestedsettmp') && $ilDB->tableExists('xmlnestedsettmp_old')) { 10782 $res = $ilDB->query(" 10783 SELECT * 10784 FROM xmlnestedsettmp_old 10785 "); 10786 10787 while ($row = $ilDB->fetchAssoc($res)) { 10788 $id = $ilDB->nextId('xmlnestedsettmp'); 10789 10790 $ilDB->manipulate( 10791 "INSERT INTO xmlnestedsettmp (ns_id, ns_unique_id, ns_book_fk, ns_type, ns_tag_fk, ns_l, ns_r)" . 10792 " VALUES (" . 10793 $ilDB->quote($id, "integer") . 10794 "," . $ilDB->quote($row['ns_unique_id'], "text") . 10795 "," . $ilDB->quote($row['ns_book_fk'], "integer") . 10796 "," . $ilDB->quote($row['ns_type'], "text") . 10797 "," . $ilDB->quote($row['ns_tag_fk'], "integer") . 10798 "," . $ilDB->quote($row['ns_l'], "integer") . 10799 "," . $ilDB->quote($row['ns_r'], "integer") . 10800 ")" 10801 ); 10802 10803 $ilDB->manipulateF( 10804 "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", 10805 array('text', 'integer', 'text', 'integer', 'integer', 'integer'), 10806 array($row['ns_unique_id'], $row['ns_book_fk'], $row['ns_type'], $row['ns_tag_fk'], $row['ns_l'], $row['ns_r']) 10807 ); 10808 } 10809} 10810?> 10811<#4735> 10812<?php 10813//step 4/4 xmlnestedset_tmp removes old table 10814 10815if ($ilDB->tableExists('xmlnestedsettmp_old')) { 10816 $ilDB->dropTable('xmlnestedsettmp_old'); 10817} 10818?> 10819<#4736> 10820<?php 10821//step 1/5 xmlparam search for dublicates and store it in xmlparam_tmp 10822 10823if ($ilDB->tableExists('xmlparam')) { 10824 $res = $ilDB->query(" 10825 SELECT first.tag_fk tag_fk, first.param_name param_name 10826 FROM xmlparam first 10827 WHERE EXISTS ( 10828 SELECT second.tag_fk, second.param_name 10829 FROM xmlparam second 10830 WHERE first.tag_fk = second.tag_fk AND first.param_name = second.param_name 10831 GROUP BY second.tag_fk, second.param_name 10832 HAVING COUNT(second.tag_fk) > 1 10833 ) 10834 GROUP BY first.tag_fk, first.param_name 10835 "); 10836 10837 if ($ilDB->numRows($res)) { 10838 if (!$ilDB->tableExists('xmlparam_tmp')) { 10839 $ilDB->createTable('xmlparam_tmp', array( 10840 'tag_fk' => array( 10841 'type' => 'integer', 10842 'length' => 4, 10843 'notnull' => true, 10844 'default' => 0 10845 ), 10846 'param_name' => array( 10847 'type' => 'text', 10848 'length' => 50, 10849 'notnull' => true, 10850 'default' => 0 10851 ) 10852 )); 10853 $ilDB->addPrimaryKey('xmlparam_tmp', array('tag_fk','param_name')); 10854 } 10855 10856 while ($row = $ilDB->fetchAssoc($res)) { 10857 $ilDB->replace('xmlparam_tmp', array(), array( 10858 'tag_fk' => array('integer', $row['tag_fk']), 10859 'param_name' => array('text', $row['param_name']) 10860 )); 10861 } 10862 } 10863} 10864?> 10865<#4737> 10866<?php 10867//step 2/5 xmlparam deletes dublicates stored in xmlparam_tmp 10868 10869if ($ilDB->tableExists('xmlparam_tmp')) { 10870 $res = $ilDB->query(" 10871 SELECT tag_fk, param_name 10872 FROM xmlparam_tmp 10873 "); 10874 10875 while ($row = $ilDB->fetchAssoc($res)) { 10876 $res_data = $ilDB->query( 10877 " 10878 SELECT * 10879 FROM xmlparam 10880 WHERE 10881 tag_fk = " . $ilDB->quote($row['tag_fk'], 'integer') . " AND 10882 param_name = " . $ilDB->quote($row['param_name'], 'text') 10883 ); 10884 $data = $ilDB->fetchAssoc($res_data); 10885 10886 $ilDB->manipulate( 10887 "DELETE FROM xmlparam WHERE" . 10888 " tag_fk = " . $ilDB->quote($row['tag_fk'], 'integer') . 10889 " AND param_name = " . $ilDB->quote($row['param_name'], 'text') 10890 ); 10891 10892 $ilDB->manipulate("INSERT INTO xmlparam (tag_fk,param_name,param_value) " . 10893 "VALUES ( " . 10894 $ilDB->quote($data['tag_fk'], 'integer') . ', ' . 10895 $ilDB->quote($data['param_name'], 'text') . ', ' . 10896 $ilDB->quote($data['param_value'], 'text') . 10897 ")"); 10898 10899 $ilDB->manipulate( 10900 "DELETE FROM xmlparam_tmp WHERE" . 10901 " tag_fk = " . $ilDB->quote($row['tag_fk'], 'integer') . 10902 " AND param_name = " . $ilDB->quote($row['param_name'], 'text') 10903 ); 10904 } 10905} 10906?> 10907<#4738> 10908<?php 10909//step 3/5 xmlparam drop xmlparam_tmp 10910 10911if ($ilDB->tableExists('xmlparam_tmp')) { 10912 $ilDB->dropTable('xmlparam_tmp'); 10913} 10914?> 10915<#4739> 10916<?php 10917//step 4/5 xmlparam drops not used indexes 10918 10919if ($ilDB->indexExistsByFields('xmlparam', array('tag_fk'))) { 10920 $ilDB->dropIndexByFields('xmlparam', array('tag_fk')); 10921} 10922?> 10923<#4740> 10924<?php 10925//step 5/5 xmlparam adding primary keys 10926 10927if ($ilDB->tableExists('xmlparam')) { 10928 $ilDB->addPrimaryKey('xmlparam', array('tag_fk', 'param_name')); 10929} 10930?> 10931<#4741> 10932<?php 10933//step 1/1 tree_workspace adding primary key 10934 10935if ($ilDB->tableExists('tree_workspace')) { 10936 if ($ilDB->indexExistsByFields('tree_workspace', array('child'))) { 10937 $ilDB->dropIndexByFields('tree_workspace', array('child')); 10938 } 10939 10940 $ilDB->addPrimaryKey('tree_workspace', array('child')); 10941} 10942?> 10943<#4742> 10944<?php 10945if (!$ilDB->tableColumnExists('tst_active', 'last_pmode')) { 10946 $ilDB->addTableColumn('tst_active', 'last_pmode', array( 10947 'type' => 'text', 10948 'length' => 16, 10949 'notnull' => false, 10950 'default' => null 10951 )); 10952} 10953?> 10954<#4743> 10955<?php 10956if (!$ilDB->tableColumnExists('tst_solutions', 'authorized')) { 10957 $ilDB->addTableColumn('tst_solutions', 'authorized', array( 10958 'type' => 'integer', 10959 'length' => 1, 10960 'notnull' => false, 10961 'default' => 1 10962 )); 10963 10964 $ilDB->queryF("UPDATE tst_solutions SET authorized = %s", array('integer'), array(1)); 10965} 10966?> 10967<#4744> 10968<?php 10969if ($ilDB->tableColumnExists('tst_dyn_quest_set_cfg', 'prev_quest_list_enabled')) { 10970 $ilDB->dropTableColumn('tst_dyn_quest_set_cfg', 'prev_quest_list_enabled'); 10971} 10972?> 10973<#4745> 10974<?php 10975if (!$ilDB->tableColumnExists('tst_tests', 'force_inst_fb')) { 10976 $ilDB->addTableColumn('tst_tests', 'force_inst_fb', array( 10977 'type' => 'integer', 10978 'length' => 1, 10979 'notnull' => false, 10980 'default' => 0 10981 )); 10982} 10983?> 10984<#4746> 10985<?php 10986require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgramme.php"); 10987require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAssignment.php"); 10988require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeProgress.php"); 10989 10990//ilStudyProgramme::installDB(); 10991 10992$fields = array( 10993 'obj_id' => array( 10994 'type' => 'integer', 10995 'length' => '4', 10996 10997 ), 10998 'last_change' => array( 10999 'notnull' => '1', 11000 'type' => 'timestamp', 11001 11002 ), 11003 'subtype_id' => array( 11004 'notnull' => '1', 11005 'type' => 'integer', 11006 'length' => '4', 11007 11008 ), 11009 'points' => array( 11010 'notnull' => '1', 11011 'type' => 'integer', 11012 'length' => '4', 11013 11014 ), 11015 'lp_mode' => array( 11016 'notnull' => '1', 11017 'type' => 'integer', 11018 'length' => '1', 11019 11020 ), 11021 'status' => array( 11022 'notnull' => '1', 11023 'type' => 'integer', 11024 'length' => '1', 11025 11026 ), 11027 11028); 11029/** 11030 * @var $ilDB ilDB 11031 */ 11032if (!$ilDB->tableExists('prg_settings')) { 11033 $ilDB->createTable('prg_settings', $fields); 11034 $ilDB->addPrimaryKey('prg_settings', array( 'obj_id' )); 11035 if (!$ilDB->sequenceExists('prg_settings')) { 11036 $ilDB->createSequence('prg_settings'); 11037 } 11038} 11039 11040$fields = array( 11041 'id' => array( 11042 'type' => 'integer', 11043 'length' => '4', 11044 11045 ), 11046 'usr_id' => array( 11047 'notnull' => '1', 11048 'type' => 'integer', 11049 'length' => '4', 11050 11051 ), 11052 'root_prg_id' => array( 11053 'notnull' => '1', 11054 'type' => 'integer', 11055 'length' => '4', 11056 11057 ), 11058 'last_change' => array( 11059 'notnull' => '1', 11060 'type' => 'timestamp', 11061 11062 ), 11063 'last_change_by' => array( 11064 'notnull' => '1', 11065 'type' => 'integer', 11066 'length' => '4', 11067 11068 ), 11069 11070); 11071if (!$ilDB->tableExists('prg_usr_assignments')) { 11072 $ilDB->createTable('prg_usr_assignments', $fields); 11073 $ilDB->addPrimaryKey('prg_usr_assignments', array( 'id' )); 11074 11075 if (!$ilDB->sequenceExists('prg_usr_assignments')) { 11076 $ilDB->createSequence('prg_usr_assignments'); 11077 } 11078} 11079 11080 11081$fields = array( 11082 'id' => array( 11083 'type' => 'integer', 11084 'length' => '4', 11085 11086 ), 11087 'assignment_id' => array( 11088 'notnull' => '1', 11089 'type' => 'integer', 11090 'length' => '4', 11091 11092 ), 11093 'prg_id' => array( 11094 'notnull' => '1', 11095 'type' => 'integer', 11096 'length' => '4', 11097 11098 ), 11099 'usr_id' => array( 11100 'notnull' => '1', 11101 'type' => 'integer', 11102 'length' => '4', 11103 11104 ), 11105 'points' => array( 11106 'notnull' => '1', 11107 'type' => 'integer', 11108 'length' => '4', 11109 11110 ), 11111 'points_cur' => array( 11112 'notnull' => '1', 11113 'type' => 'integer', 11114 'length' => '4', 11115 11116 ), 11117 'status' => array( 11118 'notnull' => '1', 11119 'type' => 'integer', 11120 'length' => '1', 11121 11122 ), 11123 'completion_by' => array( 11124 'type' => 'integer', 11125 'length' => '4', 11126 11127 ), 11128 'last_change' => array( 11129 'notnull' => '1', 11130 'type' => 'timestamp', 11131 11132 ), 11133 'last_change_by' => array( 11134 'type' => 'integer', 11135 'length' => '4', 11136 11137 ), 11138 11139); 11140if (!$ilDB->tableExists('prg_usr_progress')) { 11141 $ilDB->createTable('prg_usr_progress', $fields); 11142 $ilDB->addPrimaryKey('prg_usr_progress', array( 'id' )); 11143 11144 if (!$ilDB->sequenceExists('prg_usr_progress')) { 11145 $ilDB->createSequence('prg_usr_progress'); 11146 } 11147} 11148 11149// Active Record does not support tuples as primary keys, so we have to 11150// set those on our own. 11151$ilDB->addUniqueConstraint( 11152 ilStudyProgrammeProgress::returnDbTableName(), 11153 array("assignment_id", "prg_id", "usr_id") 11154); 11155 11156// ActiveRecord seems to not interpret con_is_null correctly, so we have to set 11157// it manually. 11158$ilDB->modifyTableColumn( 11159 ilStudyProgrammeProgress::returnDbTableName(), 11160 "completion_by", 11161 array( "notnull" => false 11162 , "default" => null 11163 ) 11164); 11165$ilDB->modifyTableColumn( 11166 ilStudyProgrammeProgress::returnDbTableName(), 11167 "last_change_by", 11168 array( "notnull" => false 11169 , "default" => null 11170 ) 11171); 11172 11173require_once("./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php"); 11174$obj_type_id = ilDBUpdateNewObjectType::addNewType("prg", "StudyProgramme"); 11175$existing_ops = array("visible", "write", "copy", "delete", "edit_permission"); 11176foreach ($existing_ops as $op) { 11177 $op_id = ilDBUpdateNewObjectType::getCustomRBACOperationId($op); 11178 ilDBUpdateNewObjectType::addRBACOperation($obj_type_id, $op_id); 11179} 11180 11181require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAdvancedMetadataRecord.php"); 11182require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeType.php"); 11183require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeTypeTranslation.php"); 11184 11185$fields = array( 11186 'id' => array( 11187 'type' => 'integer', 11188 'length' => '4', 11189 11190 ), 11191 'type_id' => array( 11192 'type' => 'integer', 11193 'length' => '4', 11194 11195 ), 11196 'rec_id' => array( 11197 'type' => 'integer', 11198 'length' => '4', 11199 11200 ), 11201 11202); 11203if (!$ilDB->tableExists('prg_type_adv_md_rec')) { 11204 $ilDB->createTable('prg_type_adv_md_rec', $fields); 11205 $ilDB->addPrimaryKey('prg_type_adv_md_rec', array( 'id' )); 11206 11207 if (!$ilDB->sequenceExists('prg_type_adv_md_rec')) { 11208 $ilDB->createSequence('prg_type_adv_md_rec'); 11209 } 11210} 11211 11212$fields = array( 11213 'id' => array( 11214 'type' => 'integer', 11215 'length' => '4', 11216 11217 ), 11218 'default_lang' => array( 11219 'type' => 'text', 11220 'length' => '4', 11221 11222 ), 11223 'owner' => array( 11224 'type' => 'integer', 11225 'length' => '4', 11226 11227 ), 11228 'create_date' => array( 11229 'notnull' => '1', 11230 'type' => 'timestamp', 11231 11232 ), 11233 'last_update' => array( 11234 'type' => 'timestamp', 11235 11236 ), 11237 'icon' => array( 11238 'type' => 'text', 11239 'length' => '255', 11240 11241 ), 11242 11243); 11244if (!$ilDB->tableExists('prg_type')) { 11245 $ilDB->createTable('prg_type', $fields); 11246 $ilDB->addPrimaryKey('prg_type', array( 'id' )); 11247 11248 if (!$ilDB->sequenceExists('prg_type')) { 11249 $ilDB->createSequence('prg_type'); 11250 } 11251} 11252 11253$fields = array( 11254 'id' => array( 11255 'type' => 'integer', 11256 'length' => '4', 11257 11258 ), 11259 'prg_type_id' => array( 11260 'type' => 'integer', 11261 'length' => '4', 11262 11263 ), 11264 'lang' => array( 11265 'type' => 'text', 11266 'length' => '4', 11267 11268 ), 11269 'member' => array( 11270 'type' => 'text', 11271 'length' => '32', 11272 11273 ), 11274 'value' => array( 11275 'type' => 'text', 11276 'length' => '3500', 11277 11278 ), 11279 11280); 11281if (!$ilDB->tableExists('prg_translations')) { 11282 $ilDB->createTable('prg_translations', $fields); 11283 $ilDB->addPrimaryKey('prg_translations', array( 'id' )); 11284 11285 if (!$ilDB->sequenceExists('prg_translations')) { 11286 $ilDB->createSequence('prg_translations'); 11287 } 11288} 11289 11290 11291 11292?> 11293<#4747> 11294<?php 11295 11296include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 11297 11298// workaround to avoid error when using addAdminNode. Bug? 11299class EventHandler 11300{ 11301 public function raise($a_component, $a_event, $a_parameter = "") 11302 { 11303 // nothing to do... 11304 } 11305} 11306$GLOBALS['ilAppEventHandler'] = new EventHandler(); 11307 11308ilDBUpdateNewObjectType::addAdminNode('prgs', 'StudyProgrammeAdmin'); 11309 11310?> 11311<#4748> 11312<?php 11313 $ilCtrlStructureReader->getStructure(); 11314?> 11315<#4749> 11316<?php 11317if (!$ilDB->tableColumnExists("obj_members", "admin")) { 11318 $ilDB->addTableColumn( 11319 "obj_members", 11320 "admin", 11321 array( 11322 'type' => 'integer', 11323 'length' => 1, 11324 'notnull' => false, 11325 'default' => 0 11326 ) 11327 ); 11328} 11329if (!$ilDB->tableColumnExists("obj_members", "tutor")) { 11330 $ilDB->addTableColumn( 11331 "obj_members", 11332 "tutor", 11333 array( 11334 'type' => 'integer', 11335 'length' => 1, 11336 'notnull' => false, 11337 'default' => 0 11338 ) 11339 ); 11340} 11341if (!$ilDB->tableColumnExists("obj_members", "member")) { 11342 $ilDB->addTableColumn( 11343 "obj_members", 11344 "member", 11345 array( 11346 'type' => 'integer', 11347 'length' => 2, 11348 'notnull' => false, 11349 'default' => 0 11350 ) 11351 ); 11352} 11353?> 11354<#4750> 11355<?php 11356 $ilCtrlStructureReader->getStructure(); 11357?> 11358<#4751> 11359<?php 11360 $ilCtrlStructureReader->getStructure(); 11361?> 11362<#4752> 11363<?php 11364if (!$ilDB->sequenceExists('prg_settings')) { 11365 $ilDB->createSequence('prg_settings'); 11366} 11367if (!$ilDB->sequenceExists('prg_usr_assignments')) { 11368 $ilDB->createSequence('prg_usr_assignments'); 11369} 11370if (!$ilDB->sequenceExists('prg_usr_progress')) { 11371 $ilDB->createSequence('prg_usr_progress'); 11372} 11373if (!$ilDB->sequenceExists('prg_type_adv_md_rec')) { 11374 $ilDB->createSequence('prg_type_adv_md_rec'); 11375} 11376if (!$ilDB->sequenceExists('prg_type')) { 11377 $ilDB->createSequence('prg_type'); 11378} 11379if (!$ilDB->sequenceExists('prg_translations')) { 11380 $ilDB->createSequence('prg_translations'); 11381} 11382?> 11383<#4753> 11384<?php 11385include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 11386 11387$parent_types = array('root', 'cat', 'prg'); 11388ilDBUpdateNewObjectType::addRBACCreate('create_prg', 'Create Study Programme', $parent_types); 11389?> 11390<#4754> 11391<?php 11392$ilCtrlStructureReader->getStructure(); 11393?> 11394<#4755> 11395<?php 11396$ilDB->modifyTableColumn('il_wac_secure_path', 'path', array( 11397 'length' => 64, 11398)); 11399?> 11400<#4756> 11401<?php 11402$obj_type = 'icla'; 11403$set = $ilDB->queryF( 11404 "SELECT obj_id FROM object_data WHERE type = %s", 11405 array('text'), 11406 array($obj_type) 11407); 11408while ($row = $ilDB->fetchAssoc($set)) { 11409 $obj_id = $row['obj_id']; 11410 11411 $refset = $ilDB->queryF( 11412 "SELECT ref_id FROM object_reference WHERE obj_id = %s", 11413 array('integer'), 11414 array($obj_id) 11415 ); 11416 while ($refrow = $ilDB->fetchAssoc($refset)) { 11417 $ref_id = $refrow['ref_id']; 11418 11419 $ilDB->manipulate("DELETE FROM crs_items WHERE obj_id = " . $ilDB->quote($ref_id, 'integer')); 11420 $ilDB->manipulate("DELETE FROM crs_items WHERE parent_id = " . $ilDB->quote($ref_id, 'integer')); 11421 $ilDB->manipulate("DELETE FROM rbac_log WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11422 $ilDB->manipulate("DELETE FROM rbac_pa WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11423 $ilDB->manipulate("DELETE FROM desktop_item WHERE item_id = " . $ilDB->quote($ref_id, 'integer')); 11424 $ilDB->manipulate("DELETE FROM conditions WHERE target_ref_id = " . $ilDB->quote($ref_id, 'integer') . " OR trigger_ref_id = " . $ilDB->quote($ref_id, 'integer')); 11425 $ilDB->manipulate("DELETE FROM didactic_tpl_objs WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11426 // We know that all of these objects are leafs, so we can delete the records without determining the tree impl. and processing additional checks 11427 $ilDB->manipulate("DELETE FROM tree WHERE child = " . $ilDB->quote($ref_id, 'integer')); 11428 $ilDB->manipulate("DELETE FROM object_reference WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11429 11430 $GLOBALS['ilLog']->write(sprintf( 11431 "DB Step %s: Deleted object reference of type %s with ref_id %s.", 11432 $nr, 11433 $obj_type, 11434 $ref_id 11435 )); 11436 } 11437 11438 $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")); 11439 $ilDB->manipulate("DELETE FROM il_block_setting WHERE block_id = " . $ilDB->quote($obj_id, "integer") . " AND type = " . $ilDB->quote("news", "text")); 11440 $ilDB->manipulate("DELETE FROM ut_lp_settings WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11441 $ilDB->manipulate("DELETE FROM ecs_import WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11442 $ilDB->manipulate("DELETE FROM dav_property WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11443 $ilDB->manipulate("DELETE FROM didactic_tpl_objs WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11444 $ilDB->manipulate("DELETE FROM object_description WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11445 $ilDB->manipulate("DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11446 11447 $GLOBALS['ilLog']->write(sprintf( 11448 "DB Step %s: Deleted object of type %s with obj_id %s.", 11449 $nr, 11450 $obj_type, 11451 $obj_id 11452 )); 11453} 11454?> 11455<#4757> 11456<?php 11457$obj_type = 'icrs'; 11458$set = $ilDB->queryF( 11459 "SELECT obj_id FROM object_data WHERE type = %s", 11460 array('text'), 11461 array($obj_type) 11462); 11463while ($row = $ilDB->fetchAssoc($set)) { 11464 $obj_id = $row['obj_id']; 11465 11466 $refset = $ilDB->queryF( 11467 "SELECT ref_id FROM object_reference WHERE obj_id = %s", 11468 array('integer'), 11469 array($obj_id) 11470 ); 11471 while ($refrow = $ilDB->fetchAssoc($refset)) { 11472 $ref_id = $refrow['ref_id']; 11473 11474 $ilDB->manipulate("DELETE FROM crs_items WHERE obj_id = " . $ilDB->quote($ref_id, 'integer')); 11475 $ilDB->manipulate("DELETE FROM crs_items WHERE parent_id = " . $ilDB->quote($ref_id, 'integer')); 11476 $ilDB->manipulate("DELETE FROM rbac_log WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11477 $ilDB->manipulate("DELETE FROM rbac_pa WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11478 $ilDB->manipulate("DELETE FROM desktop_item WHERE item_id = " . $ilDB->quote($ref_id, 'integer')); 11479 $ilDB->manipulate("DELETE FROM conditions WHERE target_ref_id = " . $ilDB->quote($ref_id, 'integer') . " OR trigger_ref_id = " . $ilDB->quote($ref_id, 'integer')); 11480 $ilDB->manipulate("DELETE FROM didactic_tpl_objs WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11481 // We know that all of these objects are leafs, so we can delete the records without determining the tree impl. and processing additional checks 11482 $ilDB->manipulate("DELETE FROM tree WHERE child = " . $ilDB->quote($ref_id, 'integer')); 11483 $ilDB->manipulate("DELETE FROM object_reference WHERE ref_id = " . $ilDB->quote($ref_id, 'integer')); 11484 11485 $GLOBALS['ilLog']->write(sprintf( 11486 "DB Step %s: Deleted object reference of type %s with ref_id %s.", 11487 $nr, 11488 $obj_type, 11489 $ref_id 11490 )); 11491 } 11492 11493 $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")); 11494 $ilDB->manipulate("DELETE FROM il_block_setting WHERE block_id = " . $ilDB->quote($obj_id, "integer") . " AND type = " . $ilDB->quote("news", "text")); 11495 $ilDB->manipulate("DELETE FROM ut_lp_settings WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11496 $ilDB->manipulate("DELETE FROM ecs_import WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11497 $ilDB->manipulate("DELETE FROM dav_property WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11498 $ilDB->manipulate("DELETE FROM didactic_tpl_objs WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11499 $ilDB->manipulate("DELETE FROM object_description WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11500 $ilDB->manipulate("DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($obj_id, 'integer')); 11501 11502 $GLOBALS['ilLog']->write(sprintf( 11503 "DB Step %s: Deleted object of type %s with obj_id %s.", 11504 $nr, 11505 $obj_type, 11506 $obj_id 11507 )); 11508} 11509?> 11510<#4758> 11511<?php 11512$a_type = 'icla'; 11513$set = $ilDB->queryF( 11514 "SELECT obj_id FROM object_data WHERE type = %s AND title = %s", 11515 array('text', 'text'), 11516 array('typ', $a_type) 11517); 11518$row = $ilDB->fetchAssoc($set); 11519$type_id = $row['obj_id']; 11520if ($type_id) { 11521 // RBAC 11522 11523 // basic operations 11524 $ilDB->manipulate("DELETE FROM rbac_ta WHERE typ_id = " . $ilDB->quote($type_id, "integer")); 11525 11526 // creation operation 11527 $set = $ilDB->query("SELECT ops_id" . 11528 " FROM rbac_operations " . 11529 " WHERE class = " . $ilDB->quote("create", "text") . 11530 " AND operation = " . $ilDB->quote("create_" . $a_type, "text")); 11531 $row = $ilDB->fetchAssoc($set); 11532 $create_ops_id = $row["ops_id"]; 11533 if ($create_ops_id) { 11534 $ilDB->manipulate("DELETE FROM rbac_templates WHERE ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11535 $GLOBALS['ilLog']->write(sprintf( 11536 "DB Step %s: Deleted rbac_templates create operation with ops_id %s for object type %s with obj_id %s.", 11537 $nr, 11538 $create_ops_id, 11539 $a_type, 11540 $type_id 11541 )); 11542 11543 // container create 11544 foreach (array("icrs") as $parent_type) { 11545 $pset = $ilDB->queryF( 11546 "SELECT obj_id FROM object_data WHERE type = %s AND title = %s", 11547 array('text', 'text'), 11548 array('typ', $parent_type) 11549 ); 11550 $prow = $ilDB->fetchAssoc($pset); 11551 $parent_type_id = $prow['obj_id']; 11552 if ($parent_type_id) { 11553 $ilDB->manipulate("DELETE FROM rbac_ta" . 11554 " WHERE typ_id = " . $ilDB->quote($parent_type_id, "integer") . 11555 " AND ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11556 } 11557 } 11558 11559 $ilDB->manipulate("DELETE FROM rbac_operations WHERE ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11560 $GLOBALS['ilLog']->write(sprintf( 11561 "DB Step %s: Deleted create operation with ops_id %s for object type %s with obj_id %s.", 11562 $nr, 11563 $create_ops_id, 11564 $a_type, 11565 $type_id 11566 )); 11567 } 11568 11569 // Type 11570 $ilDB->manipulate("DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($type_id, "integer")); 11571 $GLOBALS['ilLog']->write(sprintf( 11572 "DB Step %s: Deleted object type %s with obj_id %s.", 11573 $nr, 11574 $a_type, 11575 $type_id 11576 )); 11577} 11578 11579$set = new ilSetting(); 11580$set->delete("obj_dis_creation_" . $a_type); 11581$set->delete("obj_add_new_pos_" . $a_type); 11582$set->delete("obj_add_new_pos_grp_" . $a_type); 11583?> 11584<#4759> 11585<?php 11586$a_type = 'icrs'; 11587$set = $ilDB->queryF( 11588 "SELECT obj_id FROM object_data WHERE type = %s AND title = %s", 11589 array('text', 'text'), 11590 array('typ', $a_type) 11591); 11592$row = $ilDB->fetchAssoc($set); 11593$type_id = $row['obj_id']; 11594if ($type_id) { 11595 // RBAC 11596 11597 // basic operations 11598 $ilDB->manipulate("DELETE FROM rbac_ta WHERE typ_id = " . $ilDB->quote($type_id, "integer")); 11599 11600 // creation operation 11601 $set = $ilDB->query("SELECT ops_id" . 11602 " FROM rbac_operations " . 11603 " WHERE class = " . $ilDB->quote("create", "text") . 11604 " AND operation = " . $ilDB->quote("create_" . $a_type, "text")); 11605 $row = $ilDB->fetchAssoc($set); 11606 $create_ops_id = $row["ops_id"]; 11607 if ($create_ops_id) { 11608 $ilDB->manipulate("DELETE FROM rbac_templates WHERE ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11609 $GLOBALS['ilLog']->write(sprintf( 11610 "DB Step %s: Deleted rbac_templates create operation with ops_id %s for object type %s with obj_id %s.", 11611 $nr, 11612 $create_ops_id, 11613 $a_type, 11614 $type_id 11615 )); 11616 11617 // container create 11618 foreach (array("root", "cat", "crs", "grp", "fold") as $parent_type) { 11619 $pset = $ilDB->queryF( 11620 "SELECT obj_id FROM object_data WHERE type = %s AND title = %s", 11621 array('text', 'text'), 11622 array('typ', $parent_type) 11623 ); 11624 $prow = $ilDB->fetchAssoc($pset); 11625 $parent_type_id = $prow['obj_id']; 11626 if ($parent_type_id) { 11627 $ilDB->manipulate("DELETE FROM rbac_ta" . 11628 " WHERE typ_id = " . $ilDB->quote($parent_type_id, "integer") . 11629 " AND ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11630 } 11631 } 11632 11633 $ilDB->manipulate("DELETE FROM rbac_operations WHERE ops_id = " . $ilDB->quote($create_ops_id, "integer")); 11634 $GLOBALS['ilLog']->write(sprintf( 11635 "DB Step %s: Deleted create operation with ops_id %s for object type %s with obj_id %s.", 11636 $nr, 11637 $create_ops_id, 11638 $a_type, 11639 $type_id 11640 )); 11641 } 11642 11643 // Type 11644 $ilDB->manipulate("DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($type_id, "integer")); 11645 $GLOBALS['ilLog']->write(sprintf( 11646 "DB Step %s: Deleted object type %s with obj_id %s.", 11647 $nr, 11648 $a_type, 11649 $type_id 11650 )); 11651} 11652 11653$set = new ilSetting(); 11654$set->delete("obj_dis_creation_" . $a_type); 11655$set->delete("obj_add_new_pos_" . $a_type); 11656$set->delete("obj_add_new_pos_grp_" . $a_type); 11657?> 11658<#4760> 11659<?php 11660$ilCtrlStructureReader->getStructure(); 11661?> 11662<#4761> 11663<?php 11664$mt_mod_incon_query_num = " 11665 SELECT COUNT(*) cnt 11666 FROM mail_obj_data 11667 INNER JOIN mail_tree ON mail_tree.child = mail_obj_data.obj_id 11668 WHERE mail_tree.tree != mail_obj_data.user_id 11669"; 11670$res = $ilDB->query($mt_mod_incon_query_num); 11671$data = $ilDB->fetchAssoc($res); 11672 11673if ($data['cnt'] > 0) { 11674 if (!$ilDB->tableExists('mail_tree_mod_migr')) { 11675 $ilDB->createTable('mail_tree_mod_migr', array( 11676 'usr_id' => array( 11677 'type' => 'integer', 11678 'length' => 4, 11679 'notnull' => true, 11680 'default' => 0 11681 ) 11682 )); 11683 $ilDB->addPrimaryKey('mail_tree_mod_migr', array('usr_id')); 11684 } 11685} 11686?> 11687<#4762> 11688<?php 11689if ($ilDB->tableExists('mail_tree_mod_migr')) { 11690 $db_step = $nr; 11691 11692 $ps_create_mtmig_rec = $ilDB->prepareManip( 11693 "INSERT INTO mail_tree_mod_migr (usr_id) VALUES(?)", 11694 array('integer') 11695 ); 11696 11697 // Important: Use the field "tree" (usr_id in table: tree) AND the "user_id" (table: mail_obj_data) 11698 $mt_mod_incon_query = " 11699 SELECT DISTINCT(mail_tree.tree) 11700 FROM mail_obj_data 11701 INNER JOIN mail_tree ON mail_tree.child = mail_obj_data.obj_id 11702 LEFT JOIN mail_tree_mod_migr ON mail_tree_mod_migr.usr_id = mail_tree.tree 11703 WHERE mail_tree.tree != mail_obj_data.user_id AND mail_tree_mod_migr.usr_id IS NULL 11704 "; 11705 $res = $ilDB->query($mt_mod_incon_query); 11706 while ($row = $ilDB->fetchAssoc($res)) { 11707 $ilDB->execute($ps_create_mtmig_rec, array($row['tree'])); 11708 11709 $GLOBALS['ilLog']->write(sprintf( 11710 "DB Step %s: Detected wrong child in table 'mail_tree' for user (field: tree) %s .", 11711 $db_step, 11712 $row['tree'] 11713 )); 11714 } 11715 11716 $mt_mod_incon_query = " 11717 SELECT DISTINCT(mail_obj_data.user_id) 11718 FROM mail_obj_data 11719 INNER JOIN mail_tree ON mail_tree.child = mail_obj_data.obj_id 11720 LEFT JOIN mail_tree_mod_migr ON mail_tree_mod_migr.usr_id = mail_obj_data.user_id 11721 WHERE mail_tree.tree != mail_obj_data.user_id AND mail_tree_mod_migr.usr_id IS NULL 11722 "; 11723 $res = $ilDB->query($mt_mod_incon_query); 11724 while ($row = $ilDB->fetchAssoc($res)) { 11725 $ilDB->execute($ps_create_mtmig_rec, array($row['user_id'])); 11726 11727 $GLOBALS['ilLog']->write(sprintf( 11728 "DB Step %s: Detected missing child in table 'mail_tree' for user (field: tree) %s .", 11729 $db_step, 11730 $row['user_id'] 11731 )); 11732 } 11733} 11734?> 11735<#4763> 11736<?php 11737if ($ilDB->tableExists('mail_tree_mod_migr')) { 11738 $db_step = $nr; 11739 11740 $ps_del_tree_entries = $ilDB->prepareManip( 11741 "DELETE FROM mail_tree WHERE tree = ?", 11742 array('integer') 11743 ); 11744 11745 $ps_sel_fold_entries = $ilDB->prepare( 11746 "SELECT obj_id, title, m_type FROM mail_obj_data WHERE user_id = ?", 11747 array('integer') 11748 ); 11749 11750 $default_folders_title_to_type_map = array( 11751 'a_root' => 'root', 11752 'b_inbox' => 'inbox', 11753 'c_trash' => 'trash', 11754 'd_drafts' => 'drafts', 11755 'e_sent' => 'sent', 11756 'z_local' => 'local' 11757 ); 11758 $default_folder_type_to_title_map = array_flip($default_folders_title_to_type_map); 11759 11760 $ps_in_fold_entry = $ilDB->prepareManip( 11761 "INSERT INTO mail_obj_data (obj_id, user_id, title, m_type) VALUES(?, ?, ?, ?)", 11762 array('integer','integer', 'text', 'text') 11763 ); 11764 11765 $ps_in_tree_entry = $ilDB->prepareManip( 11766 "INSERT INTO mail_tree (tree, child, parent, lft, rgt, depth) VALUES(?, ?, ?, ?, ?, ?)", 11767 array('integer', 'integer', 'integer', 'integer', 'integer', 'integer') 11768 ); 11769 11770 $ps_sel_tree_entry = $ilDB->prepare( 11771 "SELECT rgt, lft, parent FROM mail_tree WHERE child = ? AND tree = ?", 11772 array('integer', 'integer') 11773 ); 11774 11775 $ps_up_tree_entry = $ilDB->prepareManip( 11776 "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 = ?", 11777 array('integer', 'integer', 'integer') 11778 ); 11779 11780 $ps_del_mtmig_rec = $ilDB->prepareManip( 11781 "DELETE FROM mail_tree_mod_migr WHERE usr_id = ?", 11782 array('integer') 11783 ); 11784 11785 $res = $ilDB->query("SELECT usr_id FROM mail_tree_mod_migr"); 11786 $num = $ilDB->numRows($res); 11787 11788 $GLOBALS['ilLog']->write(sprintf( 11789 "DB Step %s: Found %s duplicates in table 'mail_tree'.", 11790 $db_step, 11791 $num 11792 )); 11793 11794 // We need a first loop to delete all affected mail trees 11795 $i = 0; 11796 while ($row = $ilDB->fetchAssoc($res)) { 11797 ++$i; 11798 11799 $usr_id = $row['usr_id']; 11800 11801 $ilDB->execute($ps_del_tree_entries, array($usr_id)); 11802 $GLOBALS['ilLog']->write(sprintf( 11803 "DB Step %s: Started 'mail_tree' migration for user %s. Deleted all records referring this user (field: tree)", 11804 $db_step, 11805 $usr_id 11806 )); 11807 } 11808 11809 $res = $ilDB->query("SELECT usr_id FROM mail_tree_mod_migr"); 11810 11811 $i = 0; 11812 while ($row = $ilDB->fetchAssoc($res)) { 11813 ++$i; 11814 11815 $usr_id = $row['usr_id']; 11816 11817 $fold_res = $ilDB->execute($ps_sel_fold_entries, array($usr_id)); 11818 $user_folders = array(); 11819 $user_default_folders = array(); 11820 while ($fold_row = $ilDB->fetchAssoc($fold_res)) { 11821 $user_folders[$fold_row['obj_id']] = $fold_row; 11822 if (isset($default_folder_type_to_title_map[strtolower($fold_row['m_type'])])) { 11823 $user_default_folders[$fold_row['m_type']] = $fold_row['title']; 11824 } 11825 } 11826 11827 // Create missing default folders 11828 $folders_to_create = array_diff_key($default_folder_type_to_title_map, $user_default_folders); 11829 foreach ($folders_to_create as $type => $title) { 11830 $folder_id = $ilDB->nextId('mail_obj_data'); 11831 $ilDB->execute($ps_in_fold_entry, array($folder_id, $usr_id, $title, $type)); 11832 11833 $user_folders[$folder_id] = array( 11834 'obj_id' => $folder_id, 11835 'user_id' => $usr_id, 11836 'title' => $title, 11837 'm_type' => $type 11838 ); 11839 $GLOBALS['ilLog']->write(sprintf( 11840 "DB Step %s, iteration %s: Created 'mail_obj_data' record (missing folder type): %s, %s, %s, %s .", 11841 $db_step, 11842 $i, 11843 $folder_id, 11844 $usr_id, 11845 $title, 11846 $type 11847 )); 11848 } 11849 11850 // Create a new root folder node 11851 $root_id = null; 11852 foreach ($user_folders as $folder_id => $data) { 11853 if ('root' != $data['m_type']) { 11854 continue; 11855 } 11856 11857 $root_id = $folder_id; 11858 $ilDB->execute($ps_in_tree_entry, array($usr_id, $root_id, 0, 1, 2, 1)); 11859 11860 $GLOBALS['ilLog']->write(sprintf( 11861 "DB Step %s, iteration %s: Created root node with id %s for user %s in 'mail_tree'.", 11862 $db_step, 11863 $i, 11864 $root_id, 11865 $usr_id 11866 )); 11867 break; 11868 } 11869 11870 if (!$root_id) { 11871 // Did not find root folder, skip user and move to the next one 11872 $GLOBALS['ilLog']->write(sprintf( 11873 "DB Step %s, iteration %s: No root folder found for user %s . Skipped user.", 11874 $db_step, 11875 $i, 11876 $usr_id 11877 )); 11878 continue; 11879 } 11880 11881 $custom_folder_root_id = null; 11882 // Create all default folders below 'root' 11883 foreach ($user_folders as $folder_id => $data) { 11884 if ('root' == $data['m_type'] || !isset($default_folder_type_to_title_map[strtolower($data['m_type'])])) { 11885 continue; 11886 } 11887 11888 if (null === $custom_folder_root_id && 'local' == $data['m_type']) { 11889 $custom_folder_root_id = $folder_id; 11890 } 11891 11892 $res_parent = $ilDB->execute($ps_sel_tree_entry, array($root_id, $usr_id)); 11893 $parent_row = $ilDB->fetchAssoc($res_parent); 11894 11895 $right = $parent_row['rgt']; 11896 $lft = $right; 11897 $rgt = $right + 1; 11898 11899 $ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id)); 11900 $ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $root_id, $lft, $rgt, 2)); 11901 $GLOBALS['ilLog']->write(sprintf( 11902 "DB Step %s, iteration %s: Created node with id %s (lft: %s | rgt: %s) for user %s in 'mail_tree'.", 11903 $db_step, 11904 $i, 11905 $folder_id, 11906 $lft, 11907 $rgt, 11908 $usr_id 11909 )); 11910 } 11911 11912 if (!$custom_folder_root_id) { 11913 // Did not find custom folder root, skip user and move to the next one 11914 $GLOBALS['ilLog']->write(sprintf( 11915 "DB Step %s, iteration %s: No custom folder root found for user %s . Skipped user.", 11916 $db_step, 11917 $i, 11918 $usr_id 11919 )); 11920 continue; 11921 } 11922 11923 // Create all custom folders below 'local' 11924 foreach ($user_folders as $folder_id => $data) { 11925 if (isset($default_folder_type_to_title_map[strtolower($data['m_type'])])) { 11926 continue; 11927 } 11928 11929 $res_parent = $ilDB->execute($ps_sel_tree_entry, array($custom_folder_root_id, $usr_id)); 11930 $parent_row = $ilDB->fetchAssoc($res_parent); 11931 11932 $right = $parent_row['rgt']; 11933 $lft = $right; 11934 $rgt = $right + 1; 11935 11936 $ilDB->execute($ps_up_tree_entry, array($right, $right, $usr_id)); 11937 $ilDB->execute($ps_in_tree_entry, array($usr_id, $folder_id, $custom_folder_root_id, $lft, $rgt, 3)); 11938 $GLOBALS['ilLog']->write(sprintf( 11939 "DB Step %s, iteration %s: Created custom folder node with id %s (lft: %s | rgt: %s) for user % in 'mail_tree'.", 11940 $db_step, 11941 $i, 11942 $folder_id, 11943 $lft, 11944 $rgt, 11945 $usr_id 11946 )); 11947 } 11948 11949 // Tree completely created, remove migration record 11950 $ilDB->execute($ps_del_mtmig_rec, array($usr_id)); 11951 11952 $GLOBALS['ilLog']->write(sprintf( 11953 "DB Step %s, iteration %s: Finished 'mail_tree' migration for user %s .", 11954 $db_step, 11955 $i, 11956 $usr_id 11957 )); 11958 } 11959 11960 $res = $ilDB->query("SELECT usr_id FROM mail_tree_mod_migr"); 11961 $num = $ilDB->numRows($res); 11962 if ($num > 0) { 11963 die("There are still wrong child entries in table 'mail_tree'. Please execute this database update step again."); 11964 } 11965} 11966 11967if ($ilDB->tableExists('mail_tree_mod_migr')) { 11968 $ilDB->dropTable('mail_tree_mod_migr'); 11969} 11970 11971$mt_mod_incon_query_num = " 11972 SELECT COUNT(*) cnt 11973 FROM mail_obj_data 11974 INNER JOIN mail_tree ON mail_tree.child = mail_obj_data.obj_id 11975 WHERE mail_tree.tree != mail_obj_data.user_id 11976"; 11977$res = $ilDB->query($mt_mod_incon_query_num); 11978$data = $ilDB->fetchAssoc($res); 11979if ($data['cnt'] > 0) { 11980 die("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'; "); 11981} 11982?> 11983<#4764> 11984<?php 11985 $ilCtrlStructureReader->getStructure(); 11986?> 11987<#4765> 11988<?php 11989if (!$ilDB->indexExistsByFields('frm_posts_tree', array('thr_fk'))) { 11990 $ilDB->addIndex('frm_posts_tree', array('thr_fk'), 'i1'); 11991} 11992?> 11993<#4766> 11994<?php 11995if (!$ilDB->indexExistsByFields('frm_posts_tree', array('pos_fk'))) { 11996 $ilDB->addIndex('frm_posts_tree', array('pos_fk'), 'i2'); 11997} 11998?> 11999<#4767> 12000<?php 12001 12002 if (!$ilDB->indexExistsByFields('role_data', array('auth_mode'))) { 12003 $ilDB->addIndex('role_data', array('auth_mode'), 'i1'); 12004 } 12005?> 12006<#4768> 12007<?php 12008$ilDB->modifyTableColumn('cmi_gobjective', 'objective_id', array( 12009 'length' => 253, 12010)); 12011?> 12012<#4769> 12013<?php 12014 $ilCtrlStructureReader->getStructure(); 12015?> 12016<#4770> 12017<?php 12018 $query = 'INSERT INTO log_components (component_id) VALUES (' . $ilDB->quote('log_root', 'text') . ')'; 12019 $ilDB->manipulate($query); 12020?> 12021 12022<#4771> 12023<?php 12024 12025// remove role entries in obj_members 12026$query = 'update obj_members set admin = ' . $ilDB->quote(0, 'integer') . ', ' . 12027 'tutor = ' . $ilDB->quote(0, 'integer') . ', member = ' . $ilDB->quote(0, 'integer'); 12028$ilDB->manipulate($query); 12029 12030// iterate through all courses 12031$offset = 0; 12032$limit = 100; 12033do { 12034 $query = 'SELECT obr.ref_id, obr.obj_id FROM object_reference obr ' . 12035 'join object_data obd on obr.obj_id = obd.obj_id where (type = ' . $ilDB->quote('crs', 'text') . ' or type = ' . $ilDB->quote('grp', 'text') . ') ' . 12036 $ilDB->setLimit($limit, $offset); 12037 $res = $ilDB->query($query); 12038 12039 if (!$res->numRows()) { 12040 break; 12041 } 12042 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12043 // find course members roles 12044 $query = 'select rol_id, title from rbac_fa ' . 12045 'join object_data on rol_id = obj_id ' . 12046 'where parent = ' . $ilDB->quote($row->ref_id, 'integer') . ' ' . 12047 'and assign = ' . $ilDB->quote('y', 'text'); 12048 $rol_res = $ilDB->query($query); 12049 while ($rol_row = $rol_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12050 // find users which are not assigned to obj_members and create a default entry 12051 $query = 'select ua.usr_id from rbac_ua ua ' . 12052 'left join obj_members om on ua.usr_id = om.usr_id ' . 12053 'where om.usr_id IS NULL ' . 12054 'and rol_id = ' . $ilDB->quote($rol_row->rol_id, 'integer') . ' ' . 12055 'and om.obj_id = ' . $ilDB->quote($row->obj_id, 'integer'); 12056 $ua_res = $ilDB->query($query); 12057 while ($ua_row = $ua_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12058 $query = 'insert into obj_members (obj_id, usr_id) ' . 12059 'values(' . 12060 $ilDB->quote($row->obj_id, 'integer') . ', ' . 12061 $ilDB->quote($ua_row->usr_id, 'integer') . ' ' . 12062 ')'; 12063 $ilDB->manipulate($query); 12064 } 12065 12066 // find users which are assigned to obj_members and update their role assignment 12067 $query = 'select * from rbac_ua ua ' . 12068 'left join obj_members om on ua.usr_id = om.usr_id ' . 12069 'where om.usr_id IS NOT NULL ' . 12070 'and rol_id = ' . $ilDB->quote($rol_row->rol_id, 'integer') . ' ' . 12071 'and om.obj_id = ' . $ilDB->quote($row->obj_id, 'integer'); 12072 $ua_res = $ilDB->query($query); 12073 while ($ua_row = $ua_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12074 $admin = $tutor = $member = 0; 12075 switch (substr($rol_row->title, 0, 8)) { 12076 case 'il_crs_a': 12077 case 'il_grp_a': 12078 $admin = 1; 12079 break; 12080 12081 case 'il_crs_t': 12082 $tutor = 1; 12083 break; 12084 12085 default: 12086 case 'il_grp_m': 12087 case 'il_crs_m': 12088 $member = 1; 12089 break; 12090 } 12091 12092 $query = 'update obj_members ' . 12093 'set admin = admin + ' . $ilDB->quote($admin, 'integer') . ', ' . 12094 'tutor = tutor + ' . $ilDB->quote($tutor, 'integer') . ', ' . 12095 'member = member + ' . $ilDB->quote($member, 'integer') . ' ' . 12096 'WHERE usr_id = ' . $ilDB->quote($ua_row->usr_id, 'integer') . ' ' . 12097 'AND obj_id = ' . $ilDB->quote($row->obj_id, 'integer'); 12098 $ilDB->manipulate($query); 12099 } 12100 } 12101 } 12102 // increase offset 12103 $offset += $limit; 12104} while (true); 12105 12106?> 12107<#4772> 12108<?php 12109 12110if (!$ilDB->indexExistsByFields('obj_members', array('usr_id'))) { 12111 $ilDB->addIndex('obj_members', array('usr_id'), 'i1'); 12112} 12113 12114?> 12115<#4773> 12116<?php 12117 $ilCtrlStructureReader->getStructure(); 12118?> 12119<#4774> 12120<?php 12121 $ilCtrlStructureReader->getStructure(); 12122?> 12123<#4775> 12124<?php 12125$ilDB->modifyTableColumn( 12126 'il_dcl_field', 12127 'description', 12128 array("type" => "clob") 12129); 12130?> 12131<#4776> 12132<?php 12133 $ilCtrlStructureReader->getStructure(); 12134?> 12135<#4777> 12136<?php 12137 12138 // see #3172 12139 if ($ilDB->getDBType() == 'oracle') { 12140 if (!$ilDB->tableColumnExists('svy_qst_matrixrows', 'title_tmp')) { 12141 $ilDB->addTableColumn( 12142 'svy_qst_matrixrows', 12143 'title_tmp', 12144 array( 12145 "type" => "text", 12146 "length" => 1000, 12147 "notnull" => false, 12148 "default" => null) 12149 ); 12150 $ilDB->manipulate('UPDATE svy_qst_matrixrows SET title_tmp = title'); 12151 $ilDB->dropTableColumn('svy_qst_matrixrows', 'title'); 12152 $ilDB->renameTableColumn('svy_qst_matrixrows', 'title_tmp', 'title'); 12153 } 12154 } else { 12155 $ilDB->modifyTableColumn( 12156 'svy_qst_matrixrows', 12157 'title', 12158 array( 12159 "type" => "text", 12160 "length" => 1000, 12161 "default" => null, 12162 "notnull" => false) 12163 ); 12164 } 12165 12166?> 12167<#4778> 12168<?php 12169 $ilCtrlStructureReader->getStructure(); 12170?> 12171<#4779> 12172<?php 12173 $ilCtrlStructureReader->getStructure(); 12174?> 12175<#4780> 12176<?php 12177 $ilCtrlStructureReader->getStructure(); 12178?> 12179<#4781> 12180<?php 12181 $ilCtrlStructureReader->getStructure(); 12182?> 12183<#4782> 12184<?php 12185 $ilCtrlStructureReader->getStructure(); 12186?> 12187<#4783> 12188<?php 12189 $ilCtrlStructureReader->getStructure(); 12190?> 12191<#4784> 12192<?php 12193 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 12194 $obj_type_id = ilDBUpdateNewObjectType::getObjectTypeId("prg"); 12195 $existing_ops = array("read"); 12196 foreach ($existing_ops as $op) { 12197 $op_id = ilDBUpdateNewObjectType::getCustomRBACOperationId($op); 12198 ilDBUpdateNewObjectType::addRBACOperation($obj_type_id, $op_id); 12199 } 12200?> 12201<#4785> 12202<?php 12203 $ilCtrlStructureReader->getStructure(); 12204?> 12205<#4786> 12206<?php 12207$ilCtrlStructureReader->getStructure(); 12208?> 12209<#4787> 12210<?php 12211include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 12212ilDBUpdateNewObjectType::addAdminNode('cadm', 'Contact'); 12213?> 12214<#4788> 12215<?php 12216$ilSetting = new ilSetting('buddysystem'); 12217$ilSetting->set('enabled', 1); 12218?> 12219<#4789> 12220<?php 12221$stmt = $ilDB->prepareManip('INSERT INTO usr_pref (usr_id, keyword, value) VALUES(?, ?, ?)', array('integer', 'text', 'text')); 12222 12223$notin = $ilDB->in('usr_data.usr_id', array(13), true, 'integer'); 12224$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; 12225$res = $ilDB->queryF($query, array('text'), array('bs_allow_to_contact_me')); 12226while ($row = $ilDB->fetchAssoc($res)) { 12227 $ilDB->execute($stmt, array($row['usr_id'], 'bs_allow_to_contact_me', 'y')); 12228} 12229?> 12230<#4790> 12231<?php 12232 12233 if (!$ilDB->indexExistsByFields('page_question', array('question_id'))) { 12234 $ilDB->addIndex('page_question', array('question_id'), 'i2'); 12235 } 12236?> 12237<#4791> 12238<?php 12239 if (!$ilDB->indexExistsByFields('help_tooltip', array('tt_id', 'module_id'))) { 12240 $ilDB->addIndex('help_tooltip', array('tt_id', 'module_id'), 'i1'); 12241 } 12242?> 12243<#4792> 12244<?php 12245$ilCtrlStructureReader->getStructure(); 12246?> 12247<#4793> 12248<?php 12249$ilCtrlStructureReader->getStructure(); 12250?> 12251<#4794> 12252<?php 12253$ilCtrlStructureReader->getStructure(); 12254?> 12255<#4795> 12256<?php 12257 12258 $query = 'SELECT server_id FROM ldap_server_settings'; 12259 $res = $ilDB->query($query); 12260 12261 $server_id = 0; 12262 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 12263 $server_id = $row->server_id; 12264 } 12265 12266 if ($server_id) { 12267 $query = 'UPDATE usr_data SET auth_mode = ' . $ilDB->quote('ldap_' . (int) $server_id, 'text') . ' ' . 12268 'WHERE auth_mode = ' . $ilDB->quote('ldap', 'text'); 12269 $ilDB->manipulate($query); 12270 } 12271?> 12272<#4796> 12273<?php 12274$delQuery = " 12275 DELETE FROM tax_node_assignment 12276 WHERE node_id = %s 12277 AND component = %s 12278 AND obj_id = %s 12279 AND item_type = %s 12280 AND item_id = %s 12281"; 12282 12283$types = array('integer', 'text', 'integer', 'text', 'integer'); 12284 12285$selQuery = " 12286 SELECT tax_node_assignment.* FROM tax_node_assignment 12287 LEFT JOIN qpl_questions ON question_id = item_id 12288 WHERE component = %s 12289 AND item_type = %s 12290 AND question_id IS NULL 12291"; 12292 12293$res = $ilDB->queryF($selQuery, array('text', 'text'), array('qpl', 'quest')); 12294 12295while ($row = $ilDB->fetchAssoc($res)) { 12296 $ilDB->manipulateF($delQuery, $types, array( 12297 $row['node_id'], $row['component'], $row['obj_id'], $row['item_type'], $row['item_id'] 12298 )); 12299} 12300?> 12301<#4797> 12302<?php 12303$ilCtrlStructureReader->getStructure(); 12304?> 12305<#4798> 12306<?php 12307$ilCtrlStructureReader->getStructure(); 12308?> 12309 12310<#4799> 12311<?php 12312 12313 if (!$ilDB->tableColumnExists('rbac_fa', 'blocked')) { 12314 $ilDB->addTableColumn( 12315 'rbac_fa', 12316 'blocked', 12317 array( 12318 "type" => "integer", 12319 "length" => 1, 12320 "notnull" => true, 12321 "default" => 0) 12322 ); 12323 } 12324?> 12325<#4800> 12326<?php 12327$indices = array( 12328 'il_dcl_record_field' => array( 12329 'record_id', 12330 'field_id' 12331 ), 12332 'il_dcl_record' => array( 'table_id' ), 12333 'il_dcl_stloc1_value' => array( 'record_field_id' ), 12334 'il_dcl_stloc2_value' => array( 'record_field_id' ), 12335 'il_dcl_stloc3_value' => array( 'record_field_id' ), 12336 'il_dcl_field' => array( 12337 'datatype_id', 12338 'table_id' 12339 ), 12340 'il_dcl_field_prop' => array( 12341 'field_id', 12342 'datatype_prop_id' 12343 ), 12344 'il_dcl_viewdefinition' => array( 'view_id' ), 12345 'il_dcl_view' => array( 12346 'table_id', 12347 'type' 12348 ), 12349 'il_dcl_data' => array( 'main_table_id' ), 12350 'il_dcl_table' => array( 'obj_id' ), 12351); 12352 12353$manager = $ilDB->loadModule('Manager'); 12354 12355foreach ($indices as $table_name => $field_names) { 12356 if ($manager) { 12357 foreach ($manager->listTableIndexes($table_name) as $idx_name) { 12358 if ($ilDB->getDbType() == 'oracle' || $ilDB->getDbType() == 'postgres') { 12359 $manager->getDBInstance()->exec('DROP INDEX ' . $idx_name); 12360 $manager->getDBInstance()->exec('DROP INDEX ' . $idx_name . '_idx'); 12361 } else { 12362 $manager->getDBInstance()->exec('DROP INDEX ' . $idx_name . ' ON ' . $table_name); 12363 $manager->getDBInstance()->exec('DROP INDEX ' . $idx_name . '_idx ON ' . $table_name); 12364 } 12365 } 12366 foreach ($field_names as $i => $field_name) { 12367 $ilDB->addIndex($table_name, array( $field_name ), 'i' . ($i + 1)); 12368 } 12369 } 12370} 12371?> 12372<#4801> 12373<?php 12374$ilCtrlStructureReader->getStructure(); 12375?> 12376<#4802> 12377<?php 12378$ilCtrlStructureReader->getStructure(); 12379?> 12380<#4803> 12381<?php 12382if (!$ilDB->tableColumnExists('adl_shared_data', 'cp_node_id')) { 12383 $ilDB->addTableColumn( 12384 'adl_shared_data', 12385 'cp_node_id', 12386 array( 12387 "type" => "integer", 12388 "length" => 4, 12389 "notnull" => true, 12390 "default" => "0" 12391 ) 12392 ); 12393 12394 $dataRes = $ilDB->query( 12395 "select cp_datamap.cp_node_id, cp_datamap.slm_id, cp_datamap.target_id from cp_datamap, adl_shared_data " 12396 . "WHERE cp_datamap.slm_id = adl_shared_data.slm_id AND cp_datamap.target_id = adl_shared_data.target_id" 12397 ); 12398 while ($row = $ilDB->fetchAssoc($dataRes)) { 12399 $ilDB->manipulateF( 12400 "UPDATE adl_shared_data SET cp_node_id = %s WHERE slm_id = %s AND target_id = %s", 12401 array("integer","integer","text"), 12402 array($row["cp_node_id"],$row["slm_id"],$row["target_id"]) 12403 ); 12404 } 12405 $ilDB->manipulate("delete from adl_shared_data WHERE cp_node_id = 0"); 12406 12407 $ilDB->addPrimaryKey("adl_shared_data", array('cp_node_id','user_id')); 12408} 12409?> 12410<#4804> 12411<?php 12412 $query = "show index from sahs_sc13_seq_templ where Key_name = 'PRIMARY'"; 12413 $res = $ilDB->query($query); 12414 if (!$ilDB->numRows($res)) { 12415 $ilDB->addPrimaryKey('sahs_sc13_seq_templ', array('seqnodeid','id')); 12416 } 12417?> 12418<#4805> 12419<?php 12420 $query = "show index from sahs_sc13_seq_tree where Key_name = 'PRIMARY'"; 12421 $res = $ilDB->query($query); 12422 if (!$ilDB->numRows($res)) { 12423 $ilDB->addPrimaryKey('sahs_sc13_seq_tree', array('child','importid','parent')); 12424 } 12425?> 12426<#4806> 12427<?php 12428 $query = "show index from sahs_sc13_tree where Key_name = 'PRIMARY'"; 12429 $res = $ilDB->query($query); 12430 if (!$ilDB->numRows($res)) { 12431 $ilDB->addPrimaryKey('sahs_sc13_tree', array('child','parent','slm_id')); 12432 } 12433?> 12434<#4807> 12435<?php 12436 $query = "show index from scorm_tree where Key_name = 'PRIMARY'"; 12437 $res = $ilDB->query($query); 12438 if (!$ilDB->numRows($res)) { 12439 $ilDB->addPrimaryKey('scorm_tree', array('slm_id','child')); 12440 } 12441?> 12442<#4808> 12443<?php 12444 $ilDB->modifyTableColumn('cp_tree', 'obj_id', array( 12445 "notnull" => true, 12446 "default" => "0" 12447 )); 12448 $ilDB->modifyTableColumn('cp_tree', 'child', array( 12449 "notnull" => true, 12450 "default" => "0" 12451 )); 12452 12453 $query = "show index from cp_tree where Key_name = 'PRIMARY'"; 12454 $res = $ilDB->query($query); 12455 if (!$ilDB->numRows($res)) { 12456 $ilDB->addPrimaryKey('cp_tree', array('obj_id','child')); 12457 } 12458?> 12459<#4809> 12460<?php 12461if (!$ilDB->tableColumnExists('notification_osd', 'visible_for')) { 12462 $ilDB->addTableColumn( 12463 'notification_osd', 12464 'visible_for', 12465 array( 12466 'type' => 'integer', 12467 'length' => 4, 12468 'notnull' => true, 12469 'default' => 0) 12470 ); 12471} 12472?> 12473<#4810> 12474<?php 12475if ($ilDB->tableColumnExists('svy_times', 'first_question')) { 12476 $ilDB->modifyTableColumn( 12477 'svy_times', 12478 'first_question', 12479 array( 12480 'type' => 'integer', 12481 'length' => 4) 12482 ); 12483} 12484?> 12485<#4811> 12486<?php 12487//step 1/4 ecs_part_settings search for dublicates and store it in ecs_part_settings_tmp 12488 12489if ($ilDB->tableExists('ecs_part_settings')) { 12490 $res = $ilDB->query(" 12491 SELECT sid, mid 12492 FROM ecs_part_settings 12493 GROUP BY sid, mid 12494 HAVING COUNT(sid) > 1 12495 "); 12496 12497 if ($ilDB->numRows($res)) { 12498 if (!$ilDB->tableExists('ecs_part_settings_tmp')) { 12499 $ilDB->createTable('ecs_part_settings_tmp', array( 12500 'sid' => array( 12501 'type' => 'integer', 12502 'length' => 8, 12503 'notnull' => true, 12504 'default' => 0 12505 ), 12506 'mid' => array( 12507 'type' => 'integer', 12508 'length' => 8, 12509 'notnull' => true, 12510 'default' => 0 12511 ) 12512 )); 12513 $ilDB->addPrimaryKey('ecs_part_settings_tmp', array('sid','mid')); 12514 } 12515 12516 while ($row = $ilDB->fetchAssoc($res)) { 12517 $ilDB->replace('ecs_part_settings_tmp', array(), array( 12518 'sid' => array('integer', $row['sid']), 12519 'mid' => array('integer', $row['mid']) 12520 )); 12521 } 12522 } 12523} 12524?> 12525<#4812> 12526<?php 12527//step 2/4 ecs_part_settings deletes dublicates stored in ecs_part_settings_tmp 12528 12529if ($ilDB->tableExists('ecs_part_settings_tmp')) { 12530 $res = $ilDB->query(" 12531 SELECT sid, mid 12532 FROM ecs_part_settings_tmp 12533"); 12534 12535 while ($row = $ilDB->fetchAssoc($res)) { 12536 $res_data = $ilDB->query( 12537 " 12538 SELECT * 12539 FROM ecs_part_settings 12540 WHERE 12541 sid = " . $ilDB->quote($row['sid'], 'integer') . " AND 12542 mid = " . $ilDB->quote($row['mid'], 'integer') 12543 ); 12544 $data = $ilDB->fetchAssoc($res_data); 12545 12546 $ilDB->manipulate( 12547 "DELETE FROM ecs_part_settings WHERE" . 12548 " sid = " . $ilDB->quote($row['sid'], 'integer') . 12549 " AND mid = " . $ilDB->quote($row['mid'], 'integer') 12550 ); 12551 12552 $ilDB->manipulate("INSERT INTO ecs_part_settings (sid, mid, export, import, import_type, title, cname, token, export_types, import_types, dtoken) " . 12553 "VALUES ( " . 12554 $ilDB->quote($data['sid'], 'integer') . ', ' . 12555 $ilDB->quote($data['mid'], 'integer') . ', ' . 12556 $ilDB->quote($data['export'], 'integer') . ', ' . 12557 $ilDB->quote($data['import'], 'integer') . ', ' . 12558 $ilDB->quote($data['import_type'], 'integer') . ', ' . 12559 $ilDB->quote($data['title'], 'text') . ', ' . 12560 $ilDB->quote($data['cname'], 'text') . ', ' . 12561 $ilDB->quote($data['token'], 'integer') . ', ' . 12562 $ilDB->quote($data['export_types'], 'text') . ', ' . 12563 $ilDB->quote($data['import_types'], 'text') . ', ' . 12564 $ilDB->quote($data['dtoken'], 'integer') . 12565 ")"); 12566 12567 $ilDB->manipulate( 12568 "DELETE FROM ecs_part_settings_tmp WHERE" . 12569 " sid = " . $ilDB->quote($row['sid'], 'integer') . 12570 " AND mid = " . $ilDB->quote($row['mid'], 'integer') 12571 ); 12572 } 12573} 12574?> 12575<#4813> 12576<?php 12577//step 3/4 ecs_part_settings adding primary key 12578 12579if ($ilDB->tableExists('ecs_part_settings')) { 12580 $ilDB->addPrimaryKey('ecs_part_settings', array('sid', 'mid')); 12581} 12582?> 12583<#4814> 12584<?php 12585//step 4/4 ecs_part_settings removes temp table 12586 12587if ($ilDB->tableExists('ecs_part_settings_tmp')) { 12588 $ilDB->dropTable('ecs_part_settings_tmp'); 12589} 12590?> 12591<#4815> 12592<?php 12593//step 1/1 feedback_results removes table 12594 12595if ($ilDB->tableExists('feedback_results')) { 12596 $ilDB->dropTable('feedback_results'); 12597} 12598if ($ilDB->tableExists('feedback_items')) { 12599 $ilDB->dropTable('feedback_items'); 12600} 12601?> 12602<#4816> 12603<?php 12604//step 1/4 il_exc_team_log renames old table 12605 12606if ($ilDB->tableExists('il_exc_team_log') && !$ilDB->tableExists('exc_team_log_old')) { 12607 $ilDB->renameTable("il_exc_team_log", "exc_team_log_old"); 12608} 12609?> 12610<#4817> 12611<?php 12612//step 2/4 il_exc_team_log creates new table with unique id and sequenz 12613 12614if (!$ilDB->tableExists('il_exc_team_log')) { 12615 $ilDB->createTable('il_exc_team_log', array( 12616 'log_id' => array( 12617 'type' => 'integer', 12618 'length' => 4, 12619 'notnull' => true 12620 ), 12621 'team_id' => array( 12622 'type' => 'integer', 12623 'length' => 4, 12624 'notnull' => true 12625 ), 12626 'user_id' => array( 12627 'type' => 'integer', 12628 'length' => 4, 12629 'notnull' => true 12630 ), 12631 'details' => array( 12632 'type' => 'text', 12633 'length' => 500, 12634 'notnull' => false 12635 ), 12636 'action' => array( 12637 'type' => 'integer', 12638 'length' => 1, 12639 'notnull' => true 12640 ), 12641 'tstamp' => array( 12642 'type' => 'integer', 12643 'length' => 4, 12644 'notnull' => true 12645 ) 12646 )); 12647 $ilDB->addPrimaryKey('il_exc_team_log', array('log_id')); 12648 $ilDB->addIndex('il_exc_team_log', array('team_id'), 'i1'); 12649 $ilDB->createSequence('il_exc_team_log'); 12650} 12651?> 12652<#4818> 12653<?php 12654//step 3/4 il_exc_team_log moves all data to new table 12655 12656if ($ilDB->tableExists('il_exc_team_log') && $ilDB->tableExists('exc_team_log_old')) { 12657 $res = $ilDB->query(" 12658 SELECT * 12659 FROM exc_team_log_old 12660 "); 12661 12662 while ($row = $ilDB->fetchAssoc($res)) { 12663 $id = $ilDB->nextId('il_exc_team_log'); 12664 12665 $ilDB->manipulate( 12666 "INSERT INTO il_exc_team_log (log_id, team_id, user_id, details, action, tstamp)" . 12667 " VALUES (" . 12668 $ilDB->quote($id, "integer") . 12669 "," . $ilDB->quote($row['team_id'], "integer") . 12670 "," . $ilDB->quote($row['user_id'], "integer") . 12671 "," . $ilDB->quote($row['details'], "text") . 12672 "," . $ilDB->quote($row['action'], "integer") . 12673 "," . $ilDB->quote($row['tstamp'], "integer") . 12674 ")" 12675 ); 12676 } 12677} 12678?> 12679<#4819> 12680<?php 12681//step 4/4 il_exc_team_log removes old table 12682 12683if ($ilDB->tableExists('exc_team_log_old')) { 12684 $ilDB->dropTable('exc_team_log_old'); 12685} 12686?> 12687<#4820> 12688<?php 12689//step 1/1 il_log removes old table 12690 12691if ($ilDB->tableExists('il_log')) { 12692 $ilDB->dropTable('il_log'); 12693} 12694?> 12695<#4821> 12696<?php 12697//step 1/5 il_verification removes dublicates 12698 12699if ($ilDB->tableExists('il_verification')) { 12700 $res = $ilDB->query(" 12701 SELECT id, type 12702 FROM il_verification 12703 GROUP BY id, type 12704 HAVING COUNT(id) > 1 12705 "); 12706 12707 if ($ilDB->numRows($res)) { 12708 if (!$ilDB->tableExists('il_verification_tmp')) { 12709 $ilDB->createTable('il_verification_tmp', array( 12710 'id' => array( 12711 'type' => 'integer', 12712 'length' => 8, 12713 'notnull' => true, 12714 'default' => 0 12715 ) 12716 )); 12717 $ilDB->addPrimaryKey('il_verification_tmp', array('id', 'type')); 12718 } 12719 12720 while ($row = $ilDB->fetchAssoc($res)) { 12721 $ilDB->replace('il_verification_tmp', array(), array( 12722 'id' => array('integer', $row['id']), 12723 'type' => array('text', $row['type']) 12724 )); 12725 } 12726 } 12727} 12728?> 12729<#4822> 12730<?php 12731//step 2/5 il_verification deletes dublicates stored in il_verification_tmp 12732 12733if ($ilDB->tableExists('il_verification_tmp')) { 12734 $res = $ilDB->query(" 12735 SELECT id, type 12736 FROM il_verification_tmp 12737 "); 12738 12739 while ($row = $ilDB->fetchAssoc($res)) { 12740 $res_data = $ilDB->query( 12741 " 12742 SELECT * 12743 FROM il_verification 12744 WHERE 12745 id = " . $ilDB->quote($row['id'], 'integer') . " AND 12746 type = " . $ilDB->quote($row['type'], 'text') 12747 ); 12748 $data = $ilDB->fetchAssoc($res_data); 12749 12750 $ilDB->manipulate( 12751 "DELETE FROM il_verification WHERE" . 12752 " id = " . $ilDB->quote($row['id'], 'integer') . 12753 " AND type = " . $ilDB->quote($row['type'], 'text') 12754 ); 12755 12756 $ilDB->manipulate("INSERT INTO il_verification (id, type, parameters, raw_data) " . 12757 "VALUES ( " . 12758 $ilDB->quote($data['id'], 'integer') . ', ' . 12759 $ilDB->quote($data['type'], 'text') . ', ' . 12760 $ilDB->quote($data['parameters'], 'text') . ', ' . 12761 $ilDB->quote($data['raw_data'], 'text') . 12762 ")"); 12763 12764 $ilDB->manipulate( 12765 "DELETE FROM il_verification_tmp WHERE" . 12766 " id = " . $ilDB->quote($row['id'], 'integer') . 12767 " AND type = " . $ilDB->quote($row['type'], 'text') 12768 ); 12769 } 12770} 12771?> 12772<#4823> 12773<?php 12774//step 3/5 il_verification drops not used indexes 12775 12776if ($ilDB->indexExistsByFields('il_verification', array('id'))) { 12777 $ilDB->dropIndexByFields('il_verification', array('id')); 12778} 12779?> 12780<#4824> 12781<?php 12782//step 4/5 il_verification adding primary key 12783 12784if ($ilDB->tableExists('il_verification')) { 12785 $ilDB->addPrimaryKey('il_verification', array('id', 'type')); 12786} 12787?> 12788<#4825> 12789<?php 12790//step 5/5 il_verification removes temp table 12791 12792if ($ilDB->tableExists('il_verification_tmp')) { 12793 $ilDB->dropTable('il_verification_tmp'); 12794} 12795?> 12796<#4826> 12797<?php 12798//step 1/4 il_wiki_imp_pages removes dublicates 12799 12800if ($ilDB->tableExists('il_wiki_imp_pages')) { 12801 $res = $ilDB->query(" 12802 SELECT wiki_id, page_id 12803 FROM il_wiki_imp_pages 12804 GROUP BY wiki_id, page_id 12805 HAVING COUNT(wiki_id) > 1 12806 "); 12807 12808 if ($ilDB->numRows($res)) { 12809 if (!$ilDB->tableExists('wiki_imp_pages_tmp')) { 12810 $ilDB->createTable('wiki_imp_pages_tmp', array( 12811 'wiki_id' => array( 12812 'type' => 'integer', 12813 'length' => 8, 12814 'notnull' => true, 12815 'default' => 0 12816 ), 12817 'page_id' => array( 12818 'type' => 'integer', 12819 'length' => 8, 12820 'notnull' => true, 12821 'default' => 0 12822 ) 12823 )); 12824 $ilDB->addPrimaryKey('wiki_imp_pages_tmp', array('wiki_id','page_id')); 12825 } 12826 12827 while ($row = $ilDB->fetchAssoc($res)) { 12828 $ilDB->replace('wiki_imp_pages_tmp', array(), array( 12829 'wiki_id' => array('integer', $row['wiki_id']), 12830 'page_id' => array('integer', $row['page_id']) 12831 )); 12832 } 12833 } 12834} 12835?> 12836<#4827> 12837<?php 12838//step 2/4 il_wiki_imp_pages deletes dublicates stored in wiki_imp_pages_tmp 12839 12840if ($ilDB->tableExists('wiki_imp_pages_tmp')) { 12841 $res = $ilDB->query(" 12842 SELECT wiki_id, page_id 12843 FROM wiki_imp_pages_tmp 12844 "); 12845 12846 while ($row = $ilDB->fetchAssoc($res)) { 12847 $res_data = $ilDB->query( 12848 " 12849 SELECT * 12850 FROM il_wiki_imp_pages 12851 WHERE 12852 wiki_id = " . $ilDB->quote($row['wiki_id'], 'integer') . " AND 12853 page_id = " . $ilDB->quote($row['page_id'], 'integer') 12854 ); 12855 $data = $ilDB->fetchAssoc($res_data); 12856 12857 $ilDB->manipulate( 12858 "DELETE FROM il_wiki_imp_pages WHERE" . 12859 " wiki_id = " . $ilDB->quote($row['wiki_id'], 'integer') . 12860 " AND page_id = " . $ilDB->quote($row['page_id'], 'integer') 12861 ); 12862 12863 $ilDB->manipulate("INSERT INTO il_wiki_imp_pages (wiki_id, ord, indent, page_id) " . 12864 "VALUES ( " . 12865 $ilDB->quote($data['wiki_id'], 'integer') . ', ' . 12866 $ilDB->quote($data['ord'], 'integer') . ', ' . 12867 $ilDB->quote($data['indent'], 'integer') . ', ' . 12868 $ilDB->quote($data['page_id'], 'integer') . 12869 ")"); 12870 12871 $ilDB->manipulate( 12872 "DELETE FROM wiki_imp_pages_tmp WHERE" . 12873 " wiki_id = " . $ilDB->quote($row['wiki_id'], 'integer') . 12874 " AND page_id = " . $ilDB->quote($row['page_id'], 'integer') 12875 ); 12876 } 12877} 12878?> 12879<#4828> 12880<?php 12881//step 3/4 il_wiki_imp_pages adding primary key 12882 12883if ($ilDB->tableExists('il_wiki_imp_pages')) { 12884 $ilDB->addPrimaryKey('il_wiki_imp_pages', array('wiki_id', 'page_id')); 12885} 12886?> 12887<#4829> 12888<?php 12889//step 4/4 il_wiki_imp_pages removes temp table 12890 12891if ($ilDB->tableExists('wiki_imp_pages_tmp')) { 12892 $ilDB->dropTable('wiki_imp_pages_tmp'); 12893} 12894?> 12895<#4830> 12896<?php 12897//step 1/3 il_wiki_missing_page removes dublicates 12898 12899if ($ilDB->tableExists('il_wiki_missing_page')) { 12900 $res = $ilDB->query(" 12901 SELECT wiki_id, source_id, target_name 12902 FROM il_wiki_missing_page 12903 GROUP BY wiki_id, source_id, target_name 12904 HAVING COUNT(wiki_id) > 1 12905 "); 12906 12907 while ($row = $ilDB->fetchAssoc($res)) { 12908 $ilDB->manipulate( 12909 "DELETE FROM il_wiki_missing_page WHERE" . 12910 " wiki_id = " . $ilDB->quote($row['wiki_id'], 'integer') . 12911 " AND source_id = " . $ilDB->quote($row['source_id'], 'integer') . 12912 " AND target_name = " . $ilDB->quote($row['target_name'], 'text') 12913 ); 12914 12915 $ilDB->manipulate("INSERT INTO il_wiki_missing_page (wiki_id, source_id, target_name) " . 12916 "VALUES ( " . 12917 $ilDB->quote($row['wiki_id'], 'integer') . ', ' . 12918 $ilDB->quote($row['source_id'], 'integer') . ', ' . 12919 $ilDB->quote($row['target_name'], 'text') . 12920 ")"); 12921 } 12922} 12923?> 12924<#4831> 12925<?php 12926//step 2/3 il_wiki_missing_page drops not used indexes 12927 12928if ($ilDB->indexExistsByFields('il_wiki_missing_page', array('wiki_id'))) { 12929 $ilDB->dropIndexByFields('il_wiki_missing_page', array('wiki_id')); 12930} 12931?> 12932<#4832> 12933<?php 12934//step 3/3 il_wiki_missing_page adding primary key and removing index 12935if (!$ilDB->indexExistsByFields('il_wiki_missing_page', array('wiki_id', 'target_name'))) { 12936 $ilDB->addIndex('il_wiki_missing_page', array('wiki_id', 'target_name'), 'i1'); 12937} 12938 12939if ($ilDB->tableExists('il_wiki_missing_page')) { 12940 $ilDB->addPrimaryKey('il_wiki_missing_page', array('wiki_id', 'source_id', 'target_name')); 12941} 12942?> 12943<#4833> 12944<?php 12945//step 1/2 lo_access search for dublicates and remove them 12946/* 12947if ($ilDB->tableExists('lo_access')) 12948{ 12949 $res = $ilDB->query(" 12950 SELECT first.timestamp ts, first.usr_id ui, first.lm_id li, first.obj_id oi, first.lm_title lt 12951 FROM lo_access first 12952 WHERE EXISTS ( 12953 SELECT second.usr_id, second.lm_id 12954 FROM lo_access second 12955 WHERE first.usr_id = second.usr_id AND first.lm_id = second.lm_id 12956 GROUP BY second.usr_id, second.lm_id 12957 HAVING COUNT(second.lm_id) > 1 12958 ) 12959 "); 12960 $data = array(); 12961 12962 while($row = $ilDB->fetchAssoc($res)) 12963 { 12964 $data[$row['ui'] . '_' . $row['li']][] = $row; 12965 } 12966 12967 12968 foreach($data as $rows) { 12969 $newest = null; 12970 12971 foreach ($rows as $row) { 12972 12973 if($newest && ($newest['ts'] == $row['ts'] && $newest['oi'] == $row['oi'])) 12974 { 12975 $ilDB->manipulate("DELETE FROM lo_access WHERE" . 12976 " usr_id = " . $ilDB->quote($newest['ui'], 'integer') . 12977 " AND lm_id = " . $ilDB->quote($newest['li'], 'integer') . 12978 " AND timestamp = " . $ilDB->quote($newest['ts'], 'date') . 12979 " AND obj_id = " . $ilDB->quote($newest['oi'], 'integer') 12980 ); 12981 12982 $ilDB->manipulate("INSERT INTO lo_access (usr_id, lm_id, timestamp, obj_id) ". 12983 "VALUES ( ". 12984 $ilDB->quote($row['ui'] ,'integer').', '. 12985 $ilDB->quote($row['li'] ,'integer').', '. 12986 $ilDB->quote($row['ts'] ,'date').', '. 12987 $ilDB->quote($row['oi'] ,'integer'). 12988 ")"); 12989 } 12990 12991 if (!$newest || new DateTime($row["ts"]) > new DateTime($newest["ts"])) { 12992 $newest = $row; 12993 } 12994 } 12995 12996 $ilDB->manipulate("DELETE FROM lo_access WHERE" . 12997 " usr_id = " . $ilDB->quote($newest['ui'], 'integer') . 12998 " AND lm_id = " . $ilDB->quote($newest['li'], 'integer') . 12999 " AND (timestamp != " . $ilDB->quote($newest['ts'], 'date') . 13000 " XOR obj_id != " . $ilDB->quote($newest['oi'], 'integer') . ")" 13001 ); 13002 } 13003} 13004*/ 13005?> 13006<#4834> 13007<?php 13008 13009// fixes step 4833 13010 13011$set1 = $ilDB->query("SELECT DISTINCT usr_id, lm_id FROM lo_access ORDER BY usr_id"); 13012 13013while ($r1 = $ilDB->fetchAssoc($set1)) { 13014 $set2 = $ilDB->query("SELECT * FROM lo_access WHERE usr_id = " . $ilDB->quote($r1["usr_id"], "integer") . 13015 " AND lm_id = " . $ilDB->quote($r1["lm_id"], "integer") . " ORDER BY timestamp ASC"); 13016 $new_recs = array(); 13017 while ($r2 = $ilDB->fetchAssoc($set2)) { 13018 $new_recs[$r2["usr_id"] . ":" . $r2["lm_id"]] = $r2; 13019 } 13020 $ilDB->manipulate("DELETE FROM lo_access WHERE usr_id = " . $ilDB->quote($r1["usr_id"], "integer") . 13021 " AND lm_id = " . $ilDB->quote($r1["lm_id"], "integer")); 13022 foreach ($new_recs as $r) { 13023 $ilDB->manipulate("INSERT INTO lo_access " . 13024 "(timestamp, usr_id, lm_id, obj_id, lm_title) VALUES (" . 13025 $ilDB->quote($r["timestamp"], "timestamp") . "," . 13026 $ilDB->quote($r["usr_id"], "integer") . "," . 13027 $ilDB->quote($r["lm_id"], "integer") . "," . 13028 $ilDB->quote($r["obj_id"], "integer") . "," . 13029 $ilDB->quote($r["lm_title"], "text") . 13030 ")"); 13031 } 13032} 13033 13034 13035//step 2/2 lo_access adding primary key and removing indexes 13036 13037if ($ilDB->indexExistsByFields('lo_access', array('usr_id'))) { 13038 $ilDB->dropIndexByFields('lo_access', array('usr_id')); 13039} 13040 13041if ($ilDB->tableExists('lo_access')) { 13042 $ilDB->addPrimaryKey('lo_access', array('usr_id', 'lm_id')); 13043} 13044?> 13045<#4835> 13046<?php 13047//step 1/4 obj_stat search for dublicates and store it in obj_stat_tmp 13048 13049if ($ilDB->tableExists('obj_stat')) { 13050 $res = $ilDB->query(" 13051 SELECT obj_id, yyyy, mm, dd, hh 13052 FROM obj_stat 13053 GROUP BY obj_id, yyyy, mm, dd, hh 13054 HAVING COUNT(obj_id) > 1 13055 "); 13056 13057 if ($ilDB->numRows($res)) { 13058 if (!$ilDB->tableExists('obj_stat_tmpd')) { 13059 $ilDB->createTable('obj_stat_tmpd', array( 13060 'obj_id' => array( 13061 'type' => 'integer', 13062 'length' => 8, 13063 'notnull' => true, 13064 'default' => 0 13065 ), 13066 'yyyy' => array( 13067 'type' => 'integer', 13068 'length' => 8, 13069 'notnull' => true, 13070 'default' => 0 13071 ), 13072 'mm' => array( 13073 'type' => 'integer', 13074 'length' => 8, 13075 'notnull' => true, 13076 'default' => 0 13077 ), 13078 'dd' => array( 13079 'type' => 'integer', 13080 'length' => 8, 13081 'notnull' => true, 13082 'default' => 0 13083 ), 13084 'hh' => array( 13085 'type' => 'integer', 13086 'length' => 8, 13087 'notnull' => true, 13088 'default' => 0 13089 ) 13090 )); 13091 $ilDB->addPrimaryKey('obj_stat_tmpd', array('obj_id','yyyy','mm','dd','hh')); 13092 } 13093 13094 while ($row = $ilDB->fetchAssoc($res)) { 13095 $ilDB->replace('obj_stat_tmpd', array(), array( 13096 'obj_id' => array('integer', $row['obj_id']), 13097 'yyyy' => array('integer', $row['yyyy']), 13098 'mm' => array('integer', $row['mm']), 13099 'dd' => array('integer', $row['dd']), 13100 'hh' => array('integer', $row['hh']) 13101 )); 13102 } 13103 } 13104} 13105?> 13106<#4836> 13107<?php 13108//step 2/4 obj_stat deletes dublicates stored in obj_stat_tmpd 13109 13110if ($ilDB->tableExists('obj_stat_tmpd')) { 13111 $res = $ilDB->query(" 13112 SELECT obj_id, yyyy, mm, dd, hh 13113 FROM obj_stat_tmpd 13114 "); 13115 13116 while ($row = $ilDB->fetchAssoc($res)) { 13117 $res_data = $ilDB->query( 13118 " 13119 SELECT * 13120 FROM obj_stat 13121 WHERE 13122 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13123 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13124 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13125 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13126 hh = " . $ilDB->quote($row['hh'], 'integer') 13127 ); 13128 $data = $ilDB->fetchAssoc($res_data); 13129 13130 $ilDB->manipulate( 13131 " 13132 DELETE FROM obj_stat WHERE 13133 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13134 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13135 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13136 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13137 hh = " . $ilDB->quote($row['hh'], 'integer') 13138 ); 13139 13140 $ilDB->manipulate("INSERT INTO obj_stat " . 13141 "(obj_id, obj_type, yyyy, mm, dd, hh, read_count, childs_read_count, spent_seconds, childs_spent_seconds) " . 13142 "VALUES ( " . 13143 $ilDB->quote($data['obj_id'], 'integer') . ', ' . 13144 $ilDB->quote($data['obj_type'], 'text') . ', ' . 13145 $ilDB->quote($data['yyyy'], 'integer') . ', ' . 13146 $ilDB->quote($data['mm'], 'integer') . ', ' . 13147 $ilDB->quote($data['dd'], 'integer') . ', ' . 13148 $ilDB->quote($data['hh'], 'integer') . ', ' . 13149 $ilDB->quote($data['read_count'], 'integer') . ', ' . 13150 $ilDB->quote($data['childs_read_count'], 'integer') . ', ' . 13151 $ilDB->quote($data['spent_seconds'], 'integer') . ', ' . 13152 $ilDB->quote($data['childs_spent_seconds'], 'integer') . 13153 ")"); 13154 13155 $ilDB->manipulate( 13156 " 13157 DELETE FROM obj_stat_tmpd WHERE 13158 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13159 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13160 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13161 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13162 hh = " . $ilDB->quote($row['hh'], 'integer') 13163 ); 13164 } 13165} 13166?> 13167<#4837> 13168<?php 13169//step 3/4 obj_stat adding primary key 13170if ($ilDB->indexExistsByFields('obj_stat', array('obj_id','yyyy','mm'))) { 13171 $ilDB->dropIndexByFields('obj_stat', array('obj_id','yyyy','mm')); 13172} 13173 13174if ($ilDB->indexExistsByFields('obj_stat', array('obj_id'))) { 13175 $ilDB->dropIndexByFields('obj_stat', array('obj_id')); 13176} 13177 13178if ($ilDB->tableExists('obj_stat')) { 13179 $ilDB->addPrimaryKey('obj_stat', array('obj_id','yyyy','mm','dd','hh')); 13180} 13181?> 13182<#4838> 13183<?php 13184//step 4/4 obj_stat removes temp table 13185 13186if ($ilDB->tableExists('obj_stat_tmpd')) { 13187 $ilDB->dropTable('obj_stat_tmpd'); 13188} 13189?> 13190<#4839> 13191<?php 13192//step 1/4 obj_stat_log renames old table 13193 13194if ($ilDB->tableExists('obj_stat_log') && !$ilDB->tableExists('obj_stat_log_old')) { 13195 $ilDB->renameTable("obj_stat_log", "obj_stat_log_old"); 13196} 13197?> 13198<#4840> 13199<?php 13200//step 2/4 obj_stat_log creates new table with unique id and sequenz 13201 13202if (!$ilDB->tableExists('obj_stat_log')) { 13203 $ilDB->createTable('obj_stat_log', array( 13204 'log_id' => array( 13205 'type' => 'integer', 13206 'length' => 4, 13207 'notnull' => true 13208 ), 13209 'obj_id' => array( 13210 'type' => 'integer', 13211 'length' => 4, 13212 'notnull' => true 13213 ), 13214 'obj_type' => array( 13215 'type' => 'text', 13216 'length' => 10, 13217 'notnull' => true 13218 ), 13219 'tstamp' => array( 13220 'type' => 'integer', 13221 'length' => 4, 13222 'notnull' => false 13223 ), 13224 'yyyy' => array( 13225 'type' => 'integer', 13226 'length' => 2, 13227 'notnull' => false 13228 ), 13229 'mm' => array( 13230 'type' => 'integer', 13231 'length' => 1, 13232 'notnull' => false 13233 ), 13234 'dd' => array( 13235 'type' => 'integer', 13236 'length' => 1, 13237 'notnull' => false 13238 ), 13239 'hh' => array( 13240 'type' => 'integer', 13241 'length' => 1, 13242 'notnull' => false 13243 ), 13244 'read_count' => array( 13245 'type' => 'integer', 13246 'length' => 4, 13247 'notnull' => false 13248 ), 13249 'childs_read_count' => array( 13250 'type' => 'integer', 13251 'length' => 4, 13252 'notnull' => false 13253 ), 13254 'spent_seconds' => array( 13255 'type' => 'integer', 13256 'length' => 4, 13257 'notnull' => false 13258 ), 13259 'childs_spent_seconds' => array( 13260 'type' => 'integer', 13261 'length' => 4, 13262 'notnull' => false 13263 ), 13264 )); 13265 $ilDB->addPrimaryKey('obj_stat_log', array('log_id')); 13266 $ilDB->addIndex('obj_stat_log', array('tstamp'), 'i1'); 13267 $ilDB->createSequence('obj_stat_log'); 13268} 13269?> 13270<#4841> 13271<?php 13272//step 3/4 obj_stat_log moves all data to new table 13273 13274if ($ilDB->tableExists('obj_stat_log') && $ilDB->tableExists('obj_stat_log_old')) { 13275 $res = $ilDB->query(" 13276 SELECT * 13277 FROM obj_stat_log_old 13278 "); 13279 13280 while ($row = $ilDB->fetchAssoc($res)) { 13281 $id = $ilDB->nextId('obj_stat_log'); 13282 13283 $ilDB->manipulate( 13284 "INSERT INTO obj_stat_log " . 13285 "(log_id, obj_id, obj_type, tstamp, yyyy, mm, dd, hh, read_count, childs_read_count, spent_seconds, childs_spent_seconds) " . 13286 "VALUES ( " . 13287 $ilDB->quote($id, 'integer') . ', ' . 13288 $ilDB->quote($row['obj_id'], 'integer') . ', ' . 13289 $ilDB->quote($row['obj_type'], 'text') . ', ' . 13290 $ilDB->quote($row['tstamp'], 'integer') . ', ' . 13291 $ilDB->quote($row['yyyy'], 'integer') . ', ' . 13292 $ilDB->quote($row['mm'], 'integer') . ', ' . 13293 $ilDB->quote($row['dd'], 'integer') . ', ' . 13294 $ilDB->quote($row['hh'], 'integer') . ', ' . 13295 $ilDB->quote($row['read_count'], 'integer') . ', ' . 13296 $ilDB->quote($row['childs_read_count'], 'integer') . ', ' . 13297 $ilDB->quote($row['spent_seconds'], 'integer') . ', ' . 13298 $ilDB->quote($row['childs_spent_seconds'], 'integer') . 13299 ")" 13300 ); 13301 13302 $ilDB->manipulate( 13303 " 13304 DELETE FROM obj_stat_log_old WHERE 13305 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13306 obj_type = " . $ilDB->quote($row['obj_type'], 'integer') . " AND 13307 tstamp = " . $ilDB->quote($row['tstamp'], 'integer') . " AND 13308 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13309 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13310 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13311 hh = " . $ilDB->quote($row['hh'], 'integer') . " AND 13312 read_count = " . $ilDB->quote($row['read_count'], 'integer') . " AND 13313 childs_read_count = " . $ilDB->quote($row['childs_read_count'], 'integer') . " AND 13314 spent_seconds = " . $ilDB->quote($row['spent_seconds'], 'integer') . " AND 13315 childs_spent_seconds = " . $ilDB->quote($row['childs_spent_seconds'], 'integer') 13316 ); 13317 } 13318} 13319?> 13320<#4842> 13321<?php 13322//step 4/4 obj_stat_log removes old table 13323 13324if ($ilDB->tableExists('obj_stat_log_old')) { 13325 $ilDB->dropTable('obj_stat_log_old'); 13326} 13327?> 13328<#4843> 13329<?php 13330//step 1/4 obj_stat_tmp renames old table 13331 13332if ($ilDB->tableExists('obj_stat_tmp') && !$ilDB->tableExists('obj_stat_tmp_old')) { 13333 $ilDB->renameTable("obj_stat_tmp", "obj_stat_tmp_old"); 13334} 13335?> 13336<#4844> 13337<?php 13338//step 2/4 obj_stat_tmp creates new table with unique id 13339 13340if (!$ilDB->tableExists('obj_stat_tmp')) { 13341 $ilDB->createTable('obj_stat_tmp', array( 13342 'log_id' => array( 13343 'type' => 'integer', 13344 'length' => 4, 13345 'notnull' => true 13346 ), 13347 'obj_id' => array( 13348 'type' => 'integer', 13349 'length' => 4, 13350 'notnull' => true 13351 ), 13352 'obj_type' => array( 13353 'type' => 'text', 13354 'length' => 10, 13355 'notnull' => true 13356 ), 13357 'tstamp' => array( 13358 'type' => 'integer', 13359 'length' => 4, 13360 'notnull' => false 13361 ), 13362 'yyyy' => array( 13363 'type' => 'integer', 13364 'length' => 2, 13365 'notnull' => false 13366 ), 13367 'mm' => array( 13368 'type' => 'integer', 13369 'length' => 1, 13370 'notnull' => false 13371 ), 13372 'dd' => array( 13373 'type' => 'integer', 13374 'length' => 1, 13375 'notnull' => false 13376 ), 13377 'hh' => array( 13378 'type' => 'integer', 13379 'length' => 1, 13380 'notnull' => false 13381 ), 13382 'read_count' => array( 13383 'type' => 'integer', 13384 'length' => 4, 13385 'notnull' => false 13386 ), 13387 'childs_read_count' => array( 13388 'type' => 'integer', 13389 'length' => 4, 13390 'notnull' => false 13391 ), 13392 'spent_seconds' => array( 13393 'type' => 'integer', 13394 'length' => 4, 13395 'notnull' => false 13396 ), 13397 'childs_spent_seconds' => array( 13398 'type' => 'integer', 13399 'length' => 4, 13400 'notnull' => false 13401 ), 13402 )); 13403 $ilDB->addPrimaryKey('obj_stat_tmp', array('log_id')); 13404 $ilDB->addIndex('obj_stat_tmp', array('obj_id', 'obj_type', 'yyyy', 'mm', 'dd', 'hh'), 'i1'); 13405 $ilDB->createSequence('obj_stat_tmp'); 13406} 13407?> 13408<#4845> 13409<?php 13410//step 3/4 obj_stat_tmp moves all data to new table 13411 13412if ($ilDB->tableExists('obj_stat_tmp') && $ilDB->tableExists('obj_stat_tmp_old')) { 13413 $res = $ilDB->query(" 13414 SELECT * 13415 FROM obj_stat_tmp_old 13416"); 13417 13418 while ($row = $ilDB->fetchAssoc($res)) { 13419 $id = $ilDB->nextId('obj_stat_tmp'); 13420 13421 $ilDB->manipulate( 13422 "INSERT INTO obj_stat_tmp " . 13423 "(log_id, obj_id, obj_type, tstamp, yyyy, mm, dd, hh, read_count, childs_read_count, spent_seconds, childs_spent_seconds) " . 13424 "VALUES ( " . 13425 $ilDB->quote($id, 'integer') . ', ' . 13426 $ilDB->quote($row['obj_id'], 'integer') . ', ' . 13427 $ilDB->quote($row['obj_type'], 'text') . ', ' . 13428 $ilDB->quote($row['tstamp'], 'integer') . ', ' . 13429 $ilDB->quote($row['yyyy'], 'integer') . ', ' . 13430 $ilDB->quote($row['mm'], 'integer') . ', ' . 13431 $ilDB->quote($row['dd'], 'integer') . ', ' . 13432 $ilDB->quote($row['hh'], 'integer') . ', ' . 13433 $ilDB->quote($row['read_count'], 'integer') . ', ' . 13434 $ilDB->quote($row['childs_read_count'], 'integer') . ', ' . 13435 $ilDB->quote($row['spent_seconds'], 'integer') . ', ' . 13436 $ilDB->quote($row['childs_spent_seconds'], 'integer') . 13437 ")" 13438 ); 13439 13440 $ilDB->manipulate( 13441 " 13442 DELETE FROM obj_stat_tmp_old WHERE 13443 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13444 yyyy = " . $ilDB->quote($row['yyyy'], 'integer') . " AND 13445 mm = " . $ilDB->quote($row['mm'], 'integer') . " AND 13446 dd = " . $ilDB->quote($row['dd'], 'integer') . " AND 13447 hh = " . $ilDB->quote($row['hh'], 'integer') . " AND 13448 read_count = " . $ilDB->quote($row['read_count'], 'integer') . " AND 13449 childs_read_count = " . $ilDB->quote($row['childs_read_count'], 'integer') . " AND 13450 spent_seconds = " . $ilDB->quote($row['spent_seconds'], 'integer') . " AND 13451 childs_spent_seconds = " . $ilDB->quote($row['childs_spent_seconds'], 'integer') 13452 ); 13453 } 13454} 13455?> 13456<#4846> 13457<?php 13458//step 4/4 obj_stat_tmp_old removes old table 13459 13460if ($ilDB->tableExists('obj_stat_tmp_old')) { 13461 $ilDB->dropTable('obj_stat_tmp_old'); 13462} 13463?> 13464<#4847> 13465<?php 13466//page_question adding primary key 13467 13468if ($ilDB->tableExists('page_question')) { 13469 $ilDB->addPrimaryKey('page_question', array('page_id', 'question_id')); 13470} 13471?> 13472<#4848> 13473<?php 13474//step 1/4 page_style_usage renames old table 13475 13476if ($ilDB->tableExists('page_style_usage') && !$ilDB->tableExists('page_style_usage_old')) { 13477 $ilDB->renameTable("page_style_usage", "page_style_usage_old"); 13478} 13479?> 13480<#4849> 13481<?php 13482//step 2/4 page_style_usage creates new table with unique id and sequenz 13483 13484if (!$ilDB->tableExists('page_style_usage')) { 13485 $ilDB->createTable('page_style_usage', array( 13486 'id' => array( 13487 'type' => 'integer', 13488 'length' => 4, 13489 'notnull' => true 13490 ), 13491 'page_id' => array( 13492 'type' => 'integer', 13493 'length' => 4, 13494 'notnull' => true 13495 ), 13496 'page_type' => array( 13497 'type' => 'text', 13498 'length' => 10, 13499 'fixed' => true, 13500 'notnull' => true 13501 ), 13502 'page_nr' => array( 13503 'type' => 'integer', 13504 'length' => 4, 13505 'notnull' => true 13506 ), 13507 'template' => array( 13508 'type' => 'integer', 13509 'length' => 1, 13510 'notnull' => true, 13511 'default' => 0 13512 ), 13513 'stype' => array( 13514 'type' => 'text', 13515 'length' => 30, 13516 'fixed' => false, 13517 'notnull' => false 13518 ), 13519 'sname' => array( 13520 'type' => 'text', 13521 'length' => 30, 13522 'fixed' => true, 13523 'notnull' => false 13524 ), 13525 'page_lang' => array( 13526 'type' => 'text', 13527 'length' => 2, 13528 'notnull' => true, 13529 'default' => "-") 13530 )); 13531 $ilDB->addPrimaryKey('page_style_usage', array('id')); 13532 $ilDB->createSequence('page_style_usage'); 13533} 13534?> 13535<#4850> 13536<?php 13537//step 3/4 page_style_usage moves all data to new table 13538 13539if ($ilDB->tableExists('page_style_usage') && $ilDB->tableExists('page_style_usage_old')) { 13540 $res = $ilDB->query(" 13541 SELECT * 13542 FROM page_style_usage_old 13543 "); 13544 13545 $ilDB->manipulate("DELETE FROM page_style_usage"); 13546 13547 while ($row = $ilDB->fetchAssoc($res)) { 13548 $id = $ilDB->nextId('page_style_usage'); 13549 13550 $ilDB->manipulate("INSERT INTO page_style_usage " . 13551 "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (" . 13552 $ilDB->quote($id, "integer") . "," . 13553 $ilDB->quote($row['page_id'], "integer") . "," . 13554 $ilDB->quote($row['page_type'], "text") . "," . 13555 $ilDB->quote($row['page_lang'], "text") . "," . 13556 $ilDB->quote($row['page_nr'], "integer") . "," . 13557 $ilDB->quote($row['template'], "integer") . "," . 13558 $ilDB->quote($row['stype'], "text") . "," . 13559 $ilDB->quote($row['sname'], "text") . 13560 ")"); 13561 } 13562} 13563?> 13564<#4851> 13565<?php 13566//step 4/4 page_style_usage removes old table 13567 13568if ($ilDB->tableExists('page_style_usage_old')) { 13569 $ilDB->dropTable('page_style_usage_old'); 13570} 13571?> 13572<#4852> 13573<?php 13574//page_question adding primary key 13575 13576// fixes duplicate entries 13577$set1 = $ilDB->query("SELECT DISTINCT user_id FROM personal_pc_clipboard ORDER BY user_id"); 13578 13579while ($r1 = $ilDB->fetchAssoc($set1)) { 13580 $set2 = $ilDB->query("SELECT * FROM personal_pc_clipboard WHERE user_id = " . $ilDB->quote($r1["user_id"], "integer") . 13581 " ORDER BY insert_time ASC"); 13582 $new_recs = array(); 13583 while ($r2 = $ilDB->fetchAssoc($set2)) { 13584 $new_recs[$r2["user_id"] . ":" . $r2["insert_time"] . ":" . $r2["order_nr"]] = $r2; 13585 } 13586 $ilDB->manipulate("DELETE FROM personal_pc_clipboard WHERE user_id = " . $ilDB->quote($r1["user_id"], "integer")); 13587 foreach ($new_recs as $r) { 13588 $ilDB->insert("personal_pc_clipboard", array( 13589 "user_id" => array("integer", $r["user_id"]), 13590 "content" => array("clob", $r["content"]), 13591 "insert_time" => array("timestamp", $r["insert_time"]), 13592 "order_nr" => array("integer", $r["order_nr"]) 13593 )); 13594 } 13595} 13596 13597if ($ilDB->indexExistsByFields('personal_pc_clipboard', array('user_id'))) { 13598 $ilDB->dropIndexByFields('obj_stat', array('user_id')); 13599} 13600 13601if ($ilDB->tableExists('personal_pc_clipboard')) { 13602 $ilDB->addPrimaryKey('personal_pc_clipboard', array('user_id', 'insert_time', 'order_nr')); 13603} 13604?> 13605<#4853> 13606<?php 13607//step 1/4 ut_lp_collections search for dublicates and store it in ut_lp_collections_tmp 13608 13609if ($ilDB->tableExists('ut_lp_collections')) { 13610 $res = $ilDB->query(" 13611 SELECT obj_id, item_id 13612 FROM ut_lp_collections 13613 GROUP BY obj_id, item_id 13614 HAVING COUNT(obj_id) > 1 13615 "); 13616 13617 if ($ilDB->numRows($res)) { 13618 if (!$ilDB->tableExists('ut_lp_collections_tmp')) { 13619 $ilDB->createTable('ut_lp_collections_tmp', array( 13620 'obj_id' => array( 13621 'type' => 'integer', 13622 'length' => 8, 13623 'notnull' => true, 13624 'default' => 0 13625 ), 13626 'item_id' => array( 13627 'type' => 'integer', 13628 'length' => 8, 13629 'notnull' => true, 13630 'default' => 0 13631 ) 13632 )); 13633 $ilDB->addPrimaryKey('ut_lp_collections_tmp', array('obj_id','item_id')); 13634 } 13635 13636 while ($row = $ilDB->fetchAssoc($res)) { 13637 $ilDB->replace('ut_lp_collections_tmp', array(), array( 13638 'obj_id' => array('integer', $row['obj_id']), 13639 'item_id' => array('integer', $row['item_id']) 13640 )); 13641 } 13642 } 13643} 13644?> 13645<#4854> 13646<?php 13647//step 2/4 ut_lp_collections deletes dublicates stored in ut_lp_collections_tmp 13648 13649if ($ilDB->tableExists('ut_lp_collections_tmp')) { 13650 $res = $ilDB->query(" 13651 SELECT obj_id, item_id 13652 FROM ut_lp_collections_tmp 13653 "); 13654 13655 while ($row = $ilDB->fetchAssoc($res)) { 13656 $res_data = $ilDB->query( 13657 " 13658 SELECT * 13659 FROM ut_lp_collections 13660 WHERE 13661 obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . " AND 13662 item_id = " . $ilDB->quote($row['item_id'], 'integer') 13663 ); 13664 $data = $ilDB->fetchAssoc($res_data); 13665 13666 $ilDB->manipulate( 13667 "DELETE FROM ut_lp_collections WHERE" . 13668 " obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . 13669 " AND item_id = " . $ilDB->quote($row['item_id'], 'integer') 13670 ); 13671 13672 $ilDB->manipulate("INSERT INTO ut_lp_collections (obj_id, item_id, grouping_id, num_obligatory, active, lpmode) " . 13673 "VALUES ( " . 13674 $ilDB->quote($data['obj_id'], 'integer') . ', ' . 13675 $ilDB->quote($data['item_id'], 'integer') . ', ' . 13676 $ilDB->quote($data['grouping_id'], 'integer') . ', ' . 13677 $ilDB->quote($data['num_obligatory'], 'integer') . ', ' . 13678 $ilDB->quote($data['active'], 'integer') . ', ' . 13679 $ilDB->quote($data['lpmode'], 'text') . 13680 ")"); 13681 13682 $ilDB->manipulate( 13683 "DELETE FROM ut_lp_collections_tmp WHERE" . 13684 " obj_id = " . $ilDB->quote($row['obj_id'], 'integer') . 13685 " AND item_id = " . $ilDB->quote($row['item_id'], 'integer') 13686 ); 13687 } 13688} 13689?> 13690<#4855> 13691<?php 13692//step 3/4 ut_lp_collections adding primary key and removing indexes 13693 13694if ($ilDB->indexExistsByFields('ut_lp_collections', array('obj_id', 'item_id'))) { 13695 $ilDB->dropIndexByFields('ut_lp_collections', array('obj_id', 'item_id')); 13696} 13697 13698if ($ilDB->tableExists('ut_lp_collections')) { 13699 $ilDB->addPrimaryKey('ut_lp_collections', array('obj_id', 'item_id')); 13700} 13701?> 13702<#4856> 13703<?php 13704//step 4/4 ut_lp_collections removes temp table 13705 13706if ($ilDB->tableExists('ut_lp_collections_tmp')) { 13707 $ilDB->dropTable('ut_lp_collections_tmp'); 13708} 13709?> 13710<#4857> 13711<?php 13712//usr_session_stats adding primary key 13713$usr_session_stats_temp_num = " 13714SELECT COUNT(*) cnt 13715FROM ( 13716 SELECT slot_begin 13717 FROM usr_session_stats 13718 GROUP BY slot_begin 13719 HAVING COUNT(*) > 1 13720) duplicateSessionStats 13721"; 13722$res = $ilDB->query($usr_session_stats_temp_num); 13723$data = $ilDB->fetchAssoc($res); 13724if ($data['cnt']) { 13725 $usr_session_stats_dup_query = " 13726 SELECT * 13727 FROM usr_session_stats 13728 GROUP BY slot_begin 13729 HAVING COUNT(*) > 1 13730 "; 13731 $res = $ilDB->query($usr_session_stats_dup_query); 13732 13733 $stmt_del = $ilDB->prepareManip("DELETE FROM usr_session_stats WHERE slot_begin = ? ", array('integer')); 13734 $stmt_in = $ilDB->prepareManip( 13735 "INSERT INTO usr_session_stats (" 13736 . "slot_begin" 13737 . ",slot_end" 13738 . ",active_min" 13739 . ",active_max" 13740 . ",active_avg" 13741 . ",active_end" 13742 . ",opened" 13743 . ",closed_manual" 13744 . ",closed_expire" 13745 . ",closed_idle" 13746 . ",closed_idle_first" 13747 . ",closed_limit" 13748 . ",closed_login" 13749 . ",max_sessions" 13750 . ",closed_misc" 13751 . ") VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", 13752 array( 13753 'integer', 13754 'integer', 13755 'integer', 13756 'integer', 13757 'integer', 13758 'integer', 13759 'integer', 13760 'integer', 13761 'integer', 13762 'integer', 13763 'integer', 13764 'integer', 13765 'integer', 13766 'integer', 13767 'integer' 13768 ) 13769 ); 13770 13771 while ($row = $ilDB->fetchAssoc($res)) { 13772 $ilDB->execute($stmt_del, array($row['slot_begin'])); 13773 $ilDB->execute( 13774 $stmt_in, 13775 array( 13776 $row['slot_begin'], 13777 $row['slot_end'], 13778 $row['active_min'], 13779 $row['active_max'], 13780 $row['active_avg'], 13781 $row['active_end'], 13782 $row['opened'], 13783 $row['closed_manual'], 13784 $row['closed_expire'], 13785 $row['closed_idle'], 13786 $row['closed_idle_first'], 13787 $row['closed_limit'], 13788 $row['closed_login'], 13789 $row['max_sessions'], 13790 $row['closed_misc'] 13791 ) 13792 ); 13793 } 13794} 13795 13796$res = $ilDB->query($usr_session_stats_temp_num); 13797$data = $ilDB->fetchAssoc($res); 13798if ($data['cnt'] > 0) { 13799 die("There are still duplicate entries in table 'usr_session_stats'. Please execute this database update step again."); 13800} 13801 13802 13803if ($ilDB->tableExists('usr_session_stats')) { 13804 $ilDB->addPrimaryKey('usr_session_stats', array('slot_begin')); 13805} 13806?> 13807<#4858> 13808<?php 13809//step 1/2 usr_session_log search for dublicates and delete them 13810 13811if ($ilDB->tableExists('usr_session_log')) { 13812 $res = $ilDB->query(" 13813 SELECT tstamp, maxval, user_id 13814 FROM usr_session_log 13815 GROUP BY tstamp, maxval, user_id 13816 HAVING COUNT(tstamp) > 1 13817 "); 13818 13819 while ($row = $ilDB->fetchAssoc($res)) { 13820 $ilDB->manipulate( 13821 "DELETE FROM usr_session_log WHERE" . 13822 " tstamp = " . $ilDB->quote($row['tstamp'], 'integer') . 13823 " AND maxval = " . $ilDB->quote($row['maxval'], 'integer') . 13824 " AND user_id = " . $ilDB->quote($row['user_id'], 'integer') 13825 ); 13826 13827 $ilDB->manipulate("INSERT INTO usr_session_log (tstamp, maxval, user_id) " . 13828 "VALUES ( " . 13829 $ilDB->quote($row['tstamp'], 'integer') . ', ' . 13830 $ilDB->quote($row['maxval'], 'integer') . ', ' . 13831 $ilDB->quote($row['user_id'], 'integer') . 13832 ")"); 13833 } 13834} 13835?> 13836<#4859> 13837<?php 13838//step 2/2 usr_session_log adding primary key 13839 13840if ($ilDB->tableExists('usr_session_log')) { 13841 $ilDB->addPrimaryKey('usr_session_log', array('tstamp', 'maxval', 'user_id')); 13842} 13843?> 13844<#4860> 13845<?php 13846//step 1/2 style_template_class search for dublicates and delete them 13847 13848if ($ilDB->tableExists('style_template_class')) { 13849 $res = $ilDB->query(" 13850 SELECT template_id, class_type 13851 FROM style_template_class 13852 GROUP BY template_id, class_type 13853 HAVING COUNT(template_id) > 1 13854 "); 13855 13856 while ($row = $ilDB->fetchAssoc($res)) { 13857 $res_data = $ilDB->query( 13858 " 13859 SELECT * 13860 FROM style_template_class 13861 WHERE 13862 template_id = " . $ilDB->quote($row['template_id'], 'integer') . " AND 13863 class_type = " . $ilDB->quote($row['class_type'], 'integer') 13864 ); 13865 $data = $ilDB->fetchAssoc($res_data); 13866 13867 $ilDB->manipulate( 13868 "DELETE FROM style_template_class WHERE" . 13869 " template_id = " . $ilDB->quote($row['template_id'], 'integer') . 13870 " AND class_type = " . $ilDB->quote($row['class_type'], 'text') 13871 ); 13872 13873 $ilDB->manipulate("INSERT INTO style_template_class (template_id, class_type, class) " . 13874 "VALUES ( " . 13875 $ilDB->quote($row['template_id'], 'integer') . ', ' . 13876 $ilDB->quote($row['class_type'], 'text') . ', ' . 13877 $ilDB->quote($data['class'], 'text') . 13878 ")"); 13879 } 13880} 13881?> 13882<#4861> 13883<?php 13884//step 2/2 style_template_class adding primary key 13885 13886if ($ilDB->tableExists('style_template_class')) { 13887 $ilDB->addPrimaryKey('style_template_class', array('template_id', 'class_type', 'class')); 13888} 13889?> 13890<#4862> 13891<?php 13892//step 1/2 style_folder_styles search for dublicates and delete them 13893 13894if ($ilDB->tableExists('style_folder_styles')) { 13895 $res = $ilDB->query(" 13896 SELECT folder_id, style_id 13897 FROM style_folder_styles 13898 GROUP BY folder_id, style_id 13899 HAVING COUNT(folder_id) > 1 13900 "); 13901 13902 while ($row = $ilDB->fetchAssoc($res)) { 13903 $ilDB->manipulate( 13904 "DELETE FROM style_folder_styles WHERE" . 13905 " folder_id = " . $ilDB->quote($row['folder_id'], 'integer') . 13906 " AND style_id = " . $ilDB->quote($row['style_id'], 'integer') 13907 ); 13908 13909 $ilDB->manipulate("INSERT INTO style_folder_styles (folder_id, style_id) " . 13910 "VALUES ( " . 13911 $ilDB->quote($row['folder_id'], 'integer') . ', ' . 13912 $ilDB->quote($row['style_id'], 'integer') . 13913 ")"); 13914 } 13915} 13916?> 13917<#4863> 13918<?php 13919//step 2/2 style_folder_styles adding primary key 13920if ($ilDB->indexExistsByFields('style_folder_styles', array('folder_id'))) { 13921 $ilDB->dropIndexByFields('style_folder_styles', array('folder_id')); 13922} 13923 13924if ($ilDB->tableExists('style_folder_styles')) { 13925 $ilDB->addPrimaryKey('style_folder_styles', array('folder_id', 'style_id')); 13926} 13927?> 13928<#4864> 13929<?php 13930//step 1/4 mob_parameter search for dublicates and store it in mob_parameter_tmp 13931 13932if ($ilDB->tableExists('mob_parameter')) { 13933 $res = $ilDB->query(" 13934 SELECT med_item_id, name 13935 FROM mob_parameter 13936 GROUP BY med_item_id, name 13937 HAVING COUNT(med_item_id) > 1 13938 "); 13939 13940 if ($ilDB->numRows($res)) { 13941 if (!$ilDB->tableExists('mob_parameter_tmp')) { 13942 $ilDB->createTable('mob_parameter_tmp', array( 13943 'med_item_id' => array( 13944 'type' => 'integer', 13945 'length' => 8, 13946 'notnull' => true, 13947 'default' => 0 13948 ), 13949 'name' => array( 13950 'type' => 'text', 13951 'length' => 50, 13952 'notnull' => true, 13953 ) 13954 )); 13955 $ilDB->addPrimaryKey('mob_parameter_tmp', array('med_item_id','name')); 13956 } 13957 13958 while ($row = $ilDB->fetchAssoc($res)) { 13959 $ilDB->replace('mob_parameter_tmp', array(), array( 13960 'med_item_id' => array('integer', $row['med_item_id']), 13961 'name' => array('text', $row['name']) 13962 )); 13963 } 13964 } 13965} 13966?> 13967<#4865> 13968<?php 13969//step 2/4 mob_parameter deletes dublicates stored in mob_parameter_tmp 13970 13971if ($ilDB->tableExists('mob_parameter_tmp')) { 13972 $res = $ilDB->query(" 13973 SELECT med_item_id, name 13974 FROM mob_parameter_tmp 13975"); 13976 13977 while ($row = $ilDB->fetchAssoc($res)) { 13978 $res_data = $ilDB->query( 13979 " 13980 SELECT * 13981 FROM mob_parameter 13982 WHERE 13983 med_item_id = " . $ilDB->quote($row['med_item_id'], 'integer') . " AND 13984 name = " . $ilDB->quote($row['name'], 'text') 13985 ); 13986 $data = $ilDB->fetchAssoc($res_data); 13987 13988 $ilDB->manipulate( 13989 "DELETE FROM mob_parameter WHERE" . 13990 " med_item_id = " . $ilDB->quote($row['med_item_id'], 'integer') . 13991 " AND name = " . $ilDB->quote($row['name'], 'integer') 13992 ); 13993 13994 $ilDB->manipulate("INSERT INTO mob_parameter (med_item_id, name, value) " . 13995 "VALUES ( " . 13996 $ilDB->quote($data['med_item_id'], 'integer') . ', ' . 13997 $ilDB->quote($data['name'], 'text') . ', ' . 13998 $ilDB->quote($data['value'], 'text') . 13999 ")"); 14000 14001 $ilDB->manipulate( 14002 "DELETE FROM mob_parameter_tmp WHERE" . 14003 " med_item_id = " . $ilDB->quote($row['med_item_id'], 'integer') . 14004 " AND name = " . $ilDB->quote($row['name'], 'text') 14005 ); 14006 } 14007} 14008?> 14009<#4866> 14010<?php 14011//step 3/4 mob_parameter adding primary key 14012if ($ilDB->indexExistsByFields('mob_parameter', array('med_item_id'))) { 14013 $ilDB->dropIndexByFields('mob_parameter', array('med_item_id')); 14014} 14015 14016if ($ilDB->tableExists('mob_parameter')) { 14017 $ilDB->addPrimaryKey('mob_parameter', array('med_item_id', 'name')); 14018} 14019?> 14020<#4867> 14021<?php 14022//step 4/4 mob_parameter removes temp table 14023 14024if ($ilDB->tableExists('mob_parameter_tmp')) { 14025 $ilDB->dropTable('mob_parameter_tmp'); 14026} 14027?> 14028<#4868> 14029<?php 14030//step 1/4 link_check renames old table 14031 14032if ($ilDB->tableExists('link_check') && !$ilDB->tableExists('link_check_old')) { 14033 $ilDB->renameTable("link_check", "link_check_old"); 14034} 14035?> 14036<#4869> 14037<?php 14038//step 2/4 link_check creates new table with unique id and sequenz 14039 14040if (!$ilDB->tableExists('link_check')) { 14041 $ilDB->createTable('link_check', array( 14042 'id' => array( 14043 'type' => 'integer', 14044 'length' => 4, 14045 'notnull' => true 14046 ), 14047 'obj_id' => array( 14048 'type' => 'integer', 14049 'length' => 4, 14050 'notnull' => true 14051 ), 14052 'page_id' => array( 14053 'type' => 'integer', 14054 'length' => 4, 14055 'notnull' => true 14056 ), 14057 'url' => array( 14058 'type' => 'text', 14059 'length' => 255, 14060 'notnull' => false, 14061 'default' => null 14062 ), 14063 'parent_type' => array( 14064 'type' => 'text', 14065 'length' => 8, 14066 'notnull' => false, 14067 'default' => null 14068 ), 14069 'http_status_code' => array( 14070 'type' => 'integer', 14071 'length' => 4, 14072 'notnull' => true 14073 ), 14074 'last_check' => array( 14075 'type' => 'integer', 14076 'length' => 4, 14077 'notnull' => true 14078 ) 14079 )); 14080 $ilDB->addPrimaryKey('link_check', array('id')); 14081 $ilDB->addIndex('link_check', array('obj_id'), 'i1'); 14082 $ilDB->createSequence('link_check'); 14083} 14084?> 14085<#4870> 14086<?php 14087//step 3/4 link_check moves all data to new table 14088 14089if ($ilDB->tableExists('link_check') && $ilDB->tableExists('link_check_old')) { 14090 $res = $ilDB->query(" 14091 SELECT * 14092 FROM link_check_old 14093 "); 14094 14095 while ($row = $ilDB->fetchAssoc($res)) { 14096 $id = $ilDB->nextId('link_check'); 14097 14098 $ilDB->manipulate( 14099 "INSERT INTO link_check (id, obj_id, page_id, url, parent_type, http_status_code, last_check)" . 14100 " VALUES (" . 14101 $ilDB->quote($id, "integer") . 14102 "," . $ilDB->quote($row['obj_id'], "integer") . 14103 "," . $ilDB->quote($row['page_id'], "integer") . 14104 "," . $ilDB->quote($row['url'], "text") . 14105 "," . $ilDB->quote($row['parent_type'], "text") . 14106 "," . $ilDB->quote($row['http_status_code'], "integer") . 14107 "," . $ilDB->quote($row['last_check'], "integer") . 14108 ")" 14109 ); 14110 14111 $ilDB->manipulateF( 14112 "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", 14113 array('integer', 'integer', 'text', 'text', 'integer', 'integer'), 14114 array($row['obj_id'], $row['page_id'], $row['url'], $row['parent_type'], $row['http_status_code'], $row['last_check']) 14115 ); 14116 } 14117} 14118?> 14119<#4871> 14120<?php 14121//step 4/4 link_check removes old table 14122 14123if ($ilDB->tableExists('link_check_old')) { 14124 $ilDB->dropTable('link_check_old'); 14125} 14126?> 14127<#4872> 14128<?php 14129//$num_query = " 14130// SELECT COUNT(*) cnt 14131// FROM ( 14132// SELECT tree, child 14133// FROM bookmark_tree 14134// GROUP BY tree, child 14135// HAVING COUNT(*) > 1 14136// ) duplicateBookmarkTree 14137//"; 14138//$res = $ilDB->query($num_query); 14139//$data = $ilDB->fetchAssoc($res); 14140// 14141//if($data['cnt'] > 0) 14142//{ 14143// echo "<pre> 14144// 14145// Dear Administrator, 14146// 14147// DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 14148// 14149// The update process has been stopped due to a data consistency issue in table 'bookmark_tree'. 14150// The values in field 'tree' and 'child' should be unique together, but there are dublicated values in these fields. 14151// You have to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 14152// 14153// SELECT * 14154// FROM bookmark_tree first 14155// WHERE EXISTS ( 14156// SELECT second.tree, second.child 14157// FROM bookmark_tree second 14158// WHERE first.tree = second.tree AND first.child = second.child 14159// GROUP BY second.tree, second.child 14160// HAVING COUNT(second.tree) > 1 14161// ); 14162// 14163// If you have fixed the Problem and try to rerun the update process, this warning will be skipped. 14164// 14165// Please ensure to backup your current database before fixing the database. 14166// Furthermore disable your client while fixing the database. 14167// 14168// 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>. 14169// 14170// Best regards, 14171// The Bookmark maintainer 14172// 14173// </pre>"; 14174// 14175// exit(); 14176//} 14177// 14178// 14179//if($ilDB->tableExists('bookmark_tree')) 14180//{ 14181// $ilDB->addPrimaryKey('bookmark_tree', array('tree', 'child')); 14182//} 14183 14184?> 14185<#4873> 14186<?php 14187$num_query = " 14188 SELECT COUNT(*) cnt 14189 FROM ( 14190 SELECT lm_id, child 14191 FROM lm_tree 14192 GROUP BY lm_id, child 14193 HAVING COUNT(*) > 1 14194 ) duplicateLMTree 14195"; 14196$res = $ilDB->query($num_query); 14197$data = $ilDB->fetchAssoc($res); 14198 14199if ($data['cnt'] > 0) { 14200 echo "<pre> 14201 14202 Dear Administrator, 14203 14204 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 14205 14206 The update process has been stopped due to a data consistency issue in table 'lm_tree'. 14207 The values in field 'lm_id' and 'child' should be unique together, but there are dublicated values in these fields. 14208 You have to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 14209 14210 SELECT * 14211 FROM lm_tree first 14212 WHERE EXISTS ( 14213 SELECT second.lm_id, second.child 14214 FROM lm_tree second 14215 WHERE first.lm_id = second.lm_id AND first.child = second.child 14216 GROUP BY second.lm_id, second.child 14217 HAVING COUNT(second.lm_id) > 1 14218 ); 14219 14220 If you have fixed the Problem and try to rerun the update process, this warning will be skipped. 14221 14222 Please ensure to backup your current database before fixing the database. 14223 Furthermore disable your client while fixing the database. 14224 14225 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>. 14226 14227 Best regards, 14228 The Learning Modules maintainer 14229 14230 </pre>"; 14231 14232 exit(); 14233} 14234 14235 14236if ($ilDB->tableExists('lm_tree')) { 14237 $ilDB->addPrimaryKey('lm_tree', array('lm_id', 'child')); 14238} 14239 14240?> 14241<#4874> 14242<?php 14243$num_query = " 14244 SELECT COUNT(*) cnt 14245 FROM ( 14246 SELECT mep_id, child 14247 FROM mep_tree 14248 GROUP BY mep_id, child 14249 HAVING COUNT(*) > 1 14250 ) duplicateMEPTree 14251"; 14252$res = $ilDB->query($num_query); 14253$data = $ilDB->fetchAssoc($res); 14254 14255if ($data['cnt'] > 0) { 14256 echo "<pre> 14257 14258 Dear Administrator, 14259 14260 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 14261 14262 The update process has been stopped due to a data consistency issue in table 'mep_tree'. 14263 The values in field 'mep_id' and 'child' should be unique together, but there are dublicated values in these fields. 14264 You have to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 14265 14266 SELECT * 14267 FROM mep_tree first 14268 WHERE EXISTS ( 14269 SELECT second.mep_id, second.child 14270 FROM mep_tree second 14271 WHERE first.mep_id = second.mep_id AND first.child = second.child 14272 GROUP BY second.mep_id, second.child 14273 HAVING COUNT(second.mep_id) > 1 14274 ); 14275 14276 If you have fixed the Problem and try to rerun the update process, this warning will be skipped. 14277 14278 Please ensure to backup your current database before fixing the database. 14279 Furthermore disable your client while fixing the database. 14280 14281 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>. 14282 14283 Best regards, 14284 The Media Pool maintainer 14285 14286 </pre>"; 14287 14288 exit(); 14289} 14290 14291 14292if ($ilDB->tableExists('mep_tree')) { 14293 $ilDB->addPrimaryKey('mep_tree', array('mep_id', 'child')); 14294} 14295 14296?> 14297<#4875> 14298<?php 14299$num_query = " 14300 SELECT COUNT(*) cnt 14301 FROM ( 14302 SELECT skl_tree_id, child 14303 FROM skl_tree 14304 GROUP BY skl_tree_id, child 14305 HAVING COUNT(*) > 1 14306 ) duplicateSKLTree 14307"; 14308$res = $ilDB->query($num_query); 14309$data = $ilDB->fetchAssoc($res); 14310 14311if ($data['cnt'] > 0) { 14312 echo "<pre> 14313 14314 Dear Administrator, 14315 14316 DO NOT REFRESH THIS PAGE UNLESS YOU HAVE READ THE FOLLOWING INSTRUCTIONS 14317 14318 The update process has been stopped due to a data consistency issue in table 'skl_tree'. 14319 The values in field 'skl_tree_id' and 'child' should be unique together, but there are dublicated values in these fields. 14320 You have to review the data and apply manual fixes on your own risk. The duplicates can be determined with the following SQL string: 14321 14322 SELECT * 14323 FROM skl_tree first 14324 WHERE EXISTS ( 14325 SELECT second.skl_tree_id, second.child 14326 FROM skl_tree second 14327 WHERE first.skl_tree_id = second.skl_tree_id AND first.child = second.child 14328 GROUP BY second.skl_tree_id, second.child 14329 HAVING COUNT(second.skl_tree_id) > 1 14330 ); 14331 14332 If you have fixed the Problem and try to rerun the update process, this warning will be skipped. 14333 14334 Please ensure to backup your current database before fixing the database. 14335 Furthermore disable your client while fixing the database. 14336 14337 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>. 14338 14339 Best regards, 14340 The Competence Managment maintainer 14341 14342 </pre>"; 14343 14344 exit(); 14345} 14346 14347 14348if ($ilDB->tableExists('skl_tree')) { 14349 $ilDB->addPrimaryKey('skl_tree', array('skl_tree_id', 'child')); 14350} 14351 14352?> 14353<#4876> 14354<?php 14355//step 1/4 benchmark renames old table 14356 14357if ($ilDB->tableExists('benchmark') && !$ilDB->tableExists('benchmark_old')) { 14358 $ilDB->renameTable("benchmark", "benchmark_old"); 14359} 14360?> 14361<#4877> 14362<?php 14363//step 2/4 benchmark creates new table with unique id and sequenz 14364 14365if (!$ilDB->tableExists('benchmark')) { 14366 $ilDB->createTable('benchmark', array( 14367 'id' => array( 14368 'type' => 'integer', 14369 'length' => 4, 14370 'notnull' => true 14371 ), 14372 "cdate" => array( 14373 "notnull" => false, 14374 "type" => "timestamp" 14375 ), 14376 "module" => array( 14377 "notnull" => false, 14378 "length" => 150, 14379 "fixed" => false, 14380 "type" => "text" 14381 ), 14382 "benchmark" => array( 14383 "notnull" => false, 14384 "length" => 150, 14385 "fixed" => false, 14386 "type" => "text" 14387 ), 14388 "duration" => array( 14389 "notnull" => false, 14390 "type" => "float" 14391 ), 14392 "sql_stmt" => array( 14393 "notnull" => false, 14394 "type" => "clob" 14395 ) 14396 )); 14397 $ilDB->addPrimaryKey('benchmark', array('id')); 14398 $ilDB->addIndex('benchmark', array("module","benchmark"), 'i1'); 14399 $ilDB->createSequence('benchmark'); 14400} 14401?> 14402<#4878> 14403<?php 14404//step 3/4 benchmark moves all data to new table 14405 14406if ($ilDB->tableExists('benchmark') && $ilDB->tableExists('benchmark_old')) { 14407 $res = $ilDB->query(" 14408 SELECT * 14409 FROM benchmark_old 14410 "); 14411 14412 while ($row = $ilDB->fetchAssoc($res)) { 14413 $id = $ilDB->nextId('benchmark'); 14414 14415 $ilDB->insert("benchmark", array( 14416 "id" => array("integer", $id), 14417 "cdate" => array("timestamp", $row['cdate']), 14418 "module" => array("text",$row['module']), 14419 "benchmark" => array("text", $row['benchmark']), 14420 "duration" => array("float", $row['duration']), 14421 "sql_stmt" => array("clob", $row['sql_stmt']) 14422 )); 14423 14424 $ilDB->manipulateF( 14425 "DELETE FROM benchmark_old WHERE cdate = %s AND module = %s AND benchmark = %s AND duration = %s ", 14426 array('timestamp', 'text', 'text', 'float'), 14427 array($row['cdate'], $row['module'], $row['benchmark'], $row['duration']) 14428 ); 14429 } 14430} 14431?> 14432<#4879> 14433<?php 14434//step 4/4 benchmark removes old table 14435 14436if ($ilDB->tableExists('benchmark_old')) { 14437 $ilDB->dropTable('benchmark_old'); 14438} 14439?> 14440<#4880> 14441<?php 14442//step skl_user_skill_level adding primary key 14443if ($ilDB->tableExists('skl_user_skill_level')) { 14444 // get rid of duplicates 14445 $set = $ilDB->query("SELECT * FROM skl_user_skill_level ORDER BY status_date ASC"); 14446 while ($rec = $ilDB->fetchAssoc($set)) { 14447 $q = "DELETE FROM skl_user_skill_level WHERE " . 14448 " skill_id = " . $ilDB->quote($rec["skill_id"], "integer") . " AND " . 14449 " tref_id = " . $ilDB->quote($rec["tref_id"], "integer") . " AND " . 14450 " user_id = " . $ilDB->quote($rec["user_id"], "integer") . " AND " . 14451 " status_date = " . $ilDB->quote($rec["status_date"], "datetime") . " AND " . 14452 " status = " . $ilDB->quote($rec["status"], "integer") . " AND " . 14453 " trigger_obj_id = " . $ilDB->quote($rec["trigger_obj_id"], "integer") . " AND " . 14454 " self_eval = " . $ilDB->quote($rec["self_eval"], "integer"); 14455 //echo "<br>".$q; 14456 $ilDB->manipulate($q); 14457 14458 $q = "INSERT INTO skl_user_skill_level " . 14459 "(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 (" . 14460 $ilDB->quote($rec["skill_id"], "integer") . ", " . 14461 $ilDB->quote($rec["tref_id"], "integer") . ", " . 14462 $ilDB->quote($rec["user_id"], "integer") . ", " . 14463 $ilDB->quote($rec["status_date"], "datetime") . ", " . 14464 $ilDB->quote($rec["status"], "integer") . ", " . 14465 $ilDB->quote($rec["trigger_obj_id"], "integer") . ", " . 14466 $ilDB->quote($rec["self_eval"], "integer") . ", " . 14467 $ilDB->quote($rec["level_id"], "integer") . ", " . 14468 $ilDB->quote($rec["valid"], "integer") . ", " . 14469 $ilDB->quote($rec["trigger_ref_id"], "integer") . ", " . 14470 $ilDB->quote($rec["trigger_title"], "text") . ", " . 14471 $ilDB->quote($rec["trigger_obj_type"], "text") . ", " . 14472 $ilDB->quote($rec["unique_identifier"], "text") . ")"; 14473 //echo "<br>".$q; 14474 $ilDB->manipulate($q); 14475 } 14476 14477 $ilDB->addPrimaryKey('skl_user_skill_level', array('skill_id', 'tref_id', 'user_id', 'status_date', 'status', 'trigger_obj_id', 'self_eval')); 14478} 14479 14480?> 14481<#4881> 14482<?php 14483 14484 14485$ilDB->manipulate( 14486 'update usr_data set passwd = ' . 14487 $ilDB->quote('', 'text') . ' , auth_mode = ' . 14488 $ilDB->quote('local', 'text') . ', active = ' . 14489 $ilDB->quote(0, 'integer') . ' WHERE auth_mode = ' . 14490 $ilDB->quote('openid', 'text') 14491); 14492 14493?> 14494<#4882> 14495<?php 14496if (!$ilDB->indexExistsByFields('il_qpl_qst_fq_unit', array('question_fi'))) { 14497 $ilDB->addIndex('il_qpl_qst_fq_unit', array('question_fi'), 'i2'); 14498} 14499?> 14500<#4883> 14501<?php 14502 14503$query = 'SELECT * FROM settings WHERE module = ' . $ilDB->quote('common', 'text') . ' AND keyword = ' . $ilDB->quote('mail_send_html', 'text'); 14504$res = $ilDB->query($query); 14505 14506$found = false; 14507while ($row = $ilDB->fetchAssoc($res)) { 14508 $found = true; 14509 break; 14510} 14511 14512if (!$found) { 14513 $setting = new ilSetting(); 14514 $setting->set('mail_send_html', 1); 14515} 14516?> 14517<#4884> 14518<?php 14519if (!$ilDB->tableExists('lng_log')) { 14520 $ilDB->createTable( 14521 'lng_log', 14522 array( 14523 'module' => array( 14524 'type' => 'text', 14525 'length' => 30, 14526 'notnull' => true 14527 ), 14528 'identifier' => array( 14529 'type' => 'text', 14530 'length' => 60, 14531 'notnull' => true 14532 ) 14533 ) 14534 ); 14535 $ilDB->addPrimaryKey('lng_log', array('module', 'identifier')); 14536} 14537?> 14538<#4885> 14539<?php 14540$ilCtrlStructureReader->getStructure(); 14541?> 14542<#4886> 14543<?php 14544$payment_tables = array( 14545 'payment_coupons', 'payment_coupons_codes', 'payment_coupons_obj', 'payment_coupons_track', 14546 'payment_currencies', 'payment_erp', 'payment_erps', 'payment_news', 14547 'payment_objects', 'payment_paymethods', 'payment_prices', 'payment_settings', 14548 'payment_shopping_cart', 'payment_statistic', 'payment_statistic_coup', 'payment_topics', 14549 'payment_topic_usr_sort', 'payment_trustees', 'payment_vats', 'payment_vendors' 14550); 14551 14552foreach ($payment_tables as $payment_table) { 14553 if ($ilDB->tableExists($payment_table)) { 14554 $ilDB->dropTable($payment_table); 14555 } 14556 14557 if ($ilDB->sequenceExists($payment_table)) { 14558 $ilDB->dropSequence($payment_table); 14559 } 14560} 14561?> 14562<#4887> 14563<?php 14564$res = $ilDB->queryF( 14565 'SELECT obj_id FROM object_data WHERE type = %s', 14566 array('text'), 14567 array('pays') 14568); 14569$row = $ilDB->fetchAssoc($res); 14570if (is_array($row) && isset($row['obj_id'])) { 14571 $obj_id = $row['obj_id']; 14572 14573 $ref_res = $ilDB->queryF( 14574 'SELECT ref_id FROM object_reference WHERE obj_id = %s', 14575 array('integer'), 14576 array($obj_id) 14577 ); 14578 while ($ref_row = $ilDB->fetchAssoc($ref_res)) { 14579 if (is_array($ref_row) && isset($ref_row['ref_id'])) { 14580 $ref_id = $ref_row['ref_id']; 14581 14582 $ilDB->manipulateF( 14583 'DELETE FROM tree WHERE child = %s', 14584 array('integer'), 14585 array($ref_id) 14586 ); 14587 } 14588 } 14589 14590 $ilDB->manipulateF( 14591 'DELETE FROM object_reference WHERE obj_id = %s', 14592 array('integer'), 14593 array($obj_id) 14594 ); 14595 14596 $ilDB->manipulateF( 14597 'DELETE FROM object_data WHERE obj_id = %s', 14598 array('integer'), 14599 array($obj_id) 14600 ); 14601} 14602?> 14603<#4888> 14604<?php 14605$res = $ilDB->queryF( 14606 'SELECT obj_id FROM object_data WHERE type = %s AND title = %s', 14607 array('text', 'text'), 14608 array('typ', 'pays') 14609); 14610$row = $ilDB->fetchAssoc($res); 14611if (is_array($row) && isset($row['obj_id'])) { 14612 $obj_id = $row['obj_id']; 14613 14614 $ilDB->manipulateF( 14615 'DELETE FROM rbac_ta WHERE typ_id = %s', 14616 array('integer'), 14617 array($obj_id) 14618 ); 14619 14620 $ilDB->manipulateF( 14621 'DELETE FROM object_data WHERE obj_id = %s', 14622 array('integer'), 14623 array($obj_id) 14624 ); 14625} 14626?> 14627<#4889> 14628<?php 14629$ilDB->manipulateF( 14630 'DELETE FROM cron_job WHERE job_id = %s', 14631 array('text'), 14632 array('pay_notification') 14633); 14634?> 14635<#4890> 14636<?php 14637$ilDB->manipulateF( 14638 'DELETE FROM page_style_usage WHERE page_type = %s', 14639 array('text'), 14640 array('shop') 14641); 14642 14643$ilDB->manipulateF( 14644 'DELETE FROM page_history WHERE parent_type = %s', 14645 array('text'), 14646 array('shop') 14647); 14648 14649$ilDB->manipulateF( 14650 'DELETE FROM page_object WHERE parent_type = %s', 14651 array('text'), 14652 array('shop') 14653); 14654?> 14655<#4891> 14656<?php 14657 14658if (!$ilDB->tableColumnExists('booking_settings', 'rsv_filter_period')) { 14659 $ilDB->addTableColumn('booking_settings', 'rsv_filter_period', array( 14660 'type' => 'integer', 14661 'length' => 2, 14662 'notnull' => false, 14663 'default' => null 14664 )); 14665} 14666 14667?> 14668<#4892> 14669<?php 14670$ilCtrlStructureReader->getStructure(); 14671?> 14672<#4893> 14673<?php 14674$ilDB->manipulateF( 14675 'DELETE FROM settings WHERE keyword = %s', 14676 array('text'), 14677 array('pear_mail_enable') 14678); 14679?> 14680<#4894> 14681<?php 14682 14683include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14684$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('copy'); 14685if ($tgt_ops_id) { 14686 $book_type_id = ilDBUpdateNewObjectType::getObjectTypeId('book'); 14687 if ($book_type_id) { 14688 // add "copy" to booking tool - returns false if already exists 14689 if (ilDBUpdateNewObjectType::addRBACOperation($book_type_id, $tgt_ops_id)) { 14690 // clone settings from "write" to "copy" 14691 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 14692 ilDBUpdateNewObjectType::cloneOperation('book', $src_ops_id, $tgt_ops_id); 14693 } 14694 } 14695} 14696 14697?> 14698<#4895> 14699<?php 14700 14701if (!$ilDB->tableColumnExists('webr_items', 'internal')) { 14702 $ilDB->addTableColumn('webr_items', 'internal', array( 14703 'type' => 'integer', 14704 'length' => 1, 14705 'notnull' => false, 14706 'default' => null 14707 )); 14708} 14709 14710?> 14711<#4896> 14712<?php 14713if (!$ilDB->indexExistsByFields('usr_data_multi', array('usr_id'))) { 14714 $ilDB->addIndex('usr_data_multi', array('usr_id'), 'i1'); 14715} 14716?> 14717<#4897> 14718<?php 14719if (!$ilDB->tableColumnExists('tst_tests', 'starting_time_tmp')) { 14720 $ilDB->addTableColumn('tst_tests', 'starting_time_tmp', array( 14721 'type' => 'integer', 14722 'length' => 4, 14723 'notnull' => true, 14724 'default' => 0 14725 )); 14726} 14727?> 14728<#4898> 14729<?php 14730if ($ilDB->tableColumnExists('tst_tests', 'starting_time_tmp')) { 14731 $stmp_up = $ilDB->prepareManip("UPDATE tst_tests SET starting_time_tmp = ? WHERE test_id = ?", array('integer', 'integer')); 14732 14733 $res = $ilDB->query("SELECT test_id, starting_time FROM tst_tests WHERE starting_time_tmp = " . $ilDB->quote(0, 'integer')); 14734 while ($row = $ilDB->fetchAssoc($res)) { 14735 $new_starting_time = 0; 14736 $starting_time = $row['starting_time']; 14737 14738 if (strlen($starting_time) > 0) { 14739 if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $starting_time, $matches)) { 14740 if (is_array($matches)) { 14741 if (checkdate($matches[2], $matches[3], $matches[1])) { 14742 $new_starting_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 14743 } 14744 } 14745 } 14746 } 14747 14748 $ilDB->execute($stmp_up, array((int) $new_starting_time, $row['test_id'])); 14749 } 14750} 14751?> 14752<#4899> 14753<?php 14754if ($ilDB->tableColumnExists('tst_tests', 'starting_time')) { 14755 $ilDB->dropTableColumn('tst_tests', 'starting_time'); 14756} 14757?> 14758<#4900> 14759<?php 14760if (!$ilDB->tableColumnExists('tst_tests', 'starting_time') && $ilDB->tableColumnExists('tst_tests', 'starting_time_tmp')) { 14761 $ilDB->renameTableColumn('tst_tests', 'starting_time_tmp', 'starting_time'); 14762} 14763?> 14764<#4901> 14765<?php 14766if (!$ilDB->tableColumnExists('tst_tests', 'ending_time_tmp')) { 14767 $ilDB->addTableColumn('tst_tests', 'ending_time_tmp', array( 14768 'type' => 'integer', 14769 'length' => 4, 14770 'notnull' => true, 14771 'default' => 0 14772 )); 14773} 14774?> 14775<#4902> 14776<?php 14777if ($ilDB->tableColumnExists('tst_tests', 'ending_time_tmp')) { 14778 $stmp_up = $ilDB->prepareManip("UPDATE tst_tests SET ending_time_tmp = ? WHERE test_id = ?", array('integer', 'integer')); 14779 14780 $res = $ilDB->query("SELECT test_id, ending_time FROM tst_tests WHERE ending_time_tmp = " . $ilDB->quote(0, 'integer')); 14781 while ($row = $ilDB->fetchAssoc($res)) { 14782 $new_ending_time = 0; 14783 $ending_time = $row['ending_time']; 14784 14785 if (strlen($ending_time) > 0) { 14786 if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $ending_time, $matches)) { 14787 if (is_array($matches)) { 14788 if (checkdate($matches[2], $matches[3], $matches[1])) { 14789 $new_ending_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 14790 } 14791 } 14792 } 14793 } 14794 14795 $ilDB->execute($stmp_up, array((int) $new_ending_time, $row['test_id'])); 14796 } 14797} 14798?> 14799<#4903> 14800<?php 14801if ($ilDB->tableColumnExists('tst_tests', 'ending_time')) { 14802 $ilDB->dropTableColumn('tst_tests', 'ending_time'); 14803} 14804?> 14805<#4904> 14806<?php 14807if (!$ilDB->tableColumnExists('tst_tests', 'ending_time') && $ilDB->tableColumnExists('tst_tests', 'ending_time_tmp')) { 14808 $ilDB->renameTableColumn('tst_tests', 'ending_time_tmp', 'ending_time'); 14809} 14810?> 14811<#4905> 14812<?php 14813require_once('./Modules/DataCollection/classes/Fields/Base/class.ilDclFieldProperty.php'); 14814 14815if (!$ilDB->tableColumnExists('il_dcl_field_prop', 'name')) { 14816 $backup_table_name = 'il_dcl_field_prop_b'; 14817 $ilDB->renameTable('il_dcl_field_prop', $backup_table_name); 14818 $ilDB->renameTable('il_dcl_field_prop_seq', 'il_dcl_field_prop_s_b'); 14819 14820 $ilDB->createTable(ilDclFieldProperty::returnDbTableName(), array( 14821 'id' => array( 14822 'type' => 'integer', 14823 'length' => 8, 14824 'notnull' => true, 14825 'default' => 0 14826 ), 14827 'field_id' => array( 14828 'type' => 'integer', 14829 'length' => 8, 14830 'notnull' => true, 14831 'default' => 0 14832 ), 14833 'name' => array( 14834 'type' => 'text', 14835 'length' => 4000, 14836 'notnull' => true 14837 ), 14838 'value' => array( 14839 'type' => 'text', 14840 'length' => 4000, 14841 ), 14842 )); 14843 14844 $ilDB->addPrimaryKey(ilDclFieldProperty::returnDbTableName(), array('id')); 14845 $ilDB->createSequence(ilDclFieldProperty::returnDbTableName()); 14846 14847 if ($ilDB->tableExists('il_dcl_datatype_prop')) { 14848 $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"; 14849 $result = $ilDB->query($query); 14850 14851 while ($row = $ilDB->fetchAssoc($result)) { 14852 $new_entry = new ilDclFieldProperty(); 14853 $new_entry->setFieldId($row['field_id']); 14854 $new_entry->setInputformat($row['inputformat']); 14855 $new_entry->setName($row['title']); 14856 $new_entry->setValue($row['value']); 14857 $new_entry->store(); 14858 } 14859 } else { 14860 throw new Exception("The table 'il_dcl_datatype_prop' is missing for proper migration. Please check if the migration is already completed."); 14861 } 14862} 14863 14864?> 14865 14866<#4906> 14867<?php 14868 14869$result = $ilDB->query("SELECT * FROM il_dcl_datatype WHERE id = 12"); 14870if ($ilDB->numRows($result) == 0) { 14871 $ilDB->insert('il_dcl_datatype', array( 14872 'id' => array('integer', 12), 14873 'title' => array('text', 'plugin'), 14874 'ildb_type' => array('text', 'text'), 14875 'storage_location' => array('integer', 0), 14876 'sort' => array('integer', 100) 14877 )); 14878} 14879 14880 14881$ilDB->update( 14882 'il_dcl_datatype', 14883 array( 14884 'title' => array('text', 'fileupload'), 14885 ), 14886 array( 14887 'id' => array('integer', 6), 14888 ) 14889); 14890 14891$ilDB->update( 14892 'il_dcl_datatype', 14893 array( 14894 'title' => array('text', 'ilias_reference'), 14895 ), 14896 array( 14897 'id' => array('integer', 8), 14898 ) 14899); 14900 14901$ilDB->update( 14902 'il_dcl_datatype', 14903 array( 14904 'title' => array('text', 'number'), 14905 ), 14906 array( 14907 'id' => array('integer', 1), 14908 ) 14909); 14910 14911?> 14912 14913<#4907> 14914<?php 14915 14916include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14917 14918$dcl_type_id = ilDBUpdateNewObjectType::getObjectTypeId('dcl'); 14919 14920if ($dcl_type_id) { 14921 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_content'); 14922 if ($src_ops_id) { 14923 ilDBUpdateNewObjectType::addRBACOperation($dcl_type_id, $src_ops_id); 14924 } 14925} 14926 14927?> 14928 14929<#4908> 14930<?php 14931 14932global $ilDB; 14933 14934if (!$ilDB->tableColumnExists('il_dcl_table', 'save_confirmation')) { 14935 $ilDB->addTableColumn( 14936 'il_dcl_table', 14937 'save_confirmation', 14938 array( 14939 "type" => "integer", 14940 "notnull" => true, 14941 "length" => 1, 14942 "default" => 0 14943 ) 14944 ); 14945} 14946 14947?> 14948<#4909> 14949<?php 14950 14951$ilCtrlStructureReader->getStructure(); 14952 14953?> 14954<#4910> 14955<?php 14956$ilCtrlStructureReader->getStructure(); 14957?> 14958 14959<#4911> 14960<?php 14961include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14962 14963$type_id = ilDBUpdateNewObjectType::getObjectTypeId('prg'); 14964$new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('manage_members', 'Manage Members', 'object', 2400); 14965if ($type_id && $new_ops_id) { 14966 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 14967} 14968?> 14969 14970<#4912> 14971<?php 14972 $ilCtrlStructureReader->getStructure(); 14973?> 14974<#4913> 14975<?php 14976 $ilCtrlStructureReader->getStructure(); 14977?> 14978 14979<#4914> 14980<?php 14981 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14982 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 14983 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 14984 ilDBUpdateNewObjectType::cloneOperation('prg', $src_ops_id, $tgt_ops_id); 14985?> 14986<#4915> 14987<?php 14988include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 14989$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('copy'); 14990if ($tgt_ops_id) { 14991 $mep_type_id = ilDBUpdateNewObjectType::getObjectTypeId('mep'); 14992 if ($mep_type_id) { 14993 if (!ilDBUpdateNewObjectType::isRBACOperation($mep_type_id, $tgt_ops_id)) { 14994 // add "copy" to (external) feed 14995 ilDBUpdateNewObjectType::addRBACOperation($mep_type_id, $tgt_ops_id); 14996 14997 // clone settings from "write" to "copy" 14998 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 14999 ilDBUpdateNewObjectType::cloneOperation('mep', $src_ops_id, $tgt_ops_id); 15000 } 15001 } 15002} 15003?> 15004<#4916> 15005<?php 15006 $ilCtrlStructureReader->getStructure(); 15007?> 15008<#4917> 15009<?php 15010if (!$ilDB->tableColumnExists('il_dcl_table', 'import_enabled')) { 15011 $ilDB->addTableColumn('il_dcl_table', 'import_enabled', array( 15012 'type' => 'integer', 15013 'length' => 1, 15014 'notnull' => true, 15015 'default' => 1 15016 )); 15017} 15018?> 15019<#4918> 15020<?php 15021//tableview 15022$fields = array( 15023 'id' => array( 15024 'notnull' => '1', 15025 'type' => 'integer', 15026 'length' => '8', 15027 15028 ), 15029 'table_id' => array( 15030 'notnull' => '1', 15031 'type' => 'integer', 15032 'length' => '8', 15033 15034 ), 15035 'title' => array( 15036 'notnull' => '1', 15037 'type' => 'text', 15038 'length' => '128', 15039 15040 ), 15041 'roles' => array( 15042 'type' => 'clob', 15043 ), 15044 'description' => array( 15045 'type' => 'text', 15046 'length' => '128', 15047 15048 ), 15049 'tableview_order' => array( 15050 'type' => 'integer', 15051 'length' => '8', 15052 15053 ), 15054 15055); 15056if (!$ilDB->tableExists('il_dcl_tableview')) { 15057 $ilDB->createTable('il_dcl_tableview', $fields); 15058 $ilDB->addPrimaryKey('il_dcl_tableview', array( 'id' )); 15059 15060 if (!$ilDB->sequenceExists('il_dcl_tableview')) { 15061 $ilDB->createSequence('il_dcl_tableview'); 15062 } 15063 if (!$ilDB->indexExistsByFields('il_dcl_tableview', array('table_id'))) { 15064 $ilDB->addIndex('il_dcl_tableview', array('table_id'), 't1'); 15065 } 15066} 15067 15068//tableview_field_setting 15069$fields = array( 15070 'id' => array( 15071 'notnull' => '1', 15072 'type' => 'integer', 15073 'length' => '8', 15074 15075 ), 15076 'tableview_id' => array( 15077 'notnull' => '1', 15078 'type' => 'integer', 15079 'length' => '8', 15080 15081 ), 15082 'field' => array( 15083 'notnull' => '1', 15084 'type' => 'text', 15085 'length' => '128', 15086 15087 ), 15088 'visible' => array( 15089 'type' => 'integer', 15090 'length' => '1', 15091 15092 ), 15093 'in_filter' => array( 15094 'type' => 'integer', 15095 'length' => '1', 15096 15097 ), 15098 'filter_value' => array( 15099 'type' => 'clob', 15100 ), 15101 'filter_changeable' => array( 15102 'type' => 'integer', 15103 'length' => '1', 15104 15105 ), 15106 15107); 15108if (!$ilDB->tableExists('il_dcl_tview_set')) { 15109 $ilDB->createTable('il_dcl_tview_set', $fields); 15110 $ilDB->addPrimaryKey('il_dcl_tview_set', array( 'id' )); 15111 15112 if (!$ilDB->sequenceExists('il_dcl_tview_set')) { 15113 $ilDB->createSequence('il_dcl_tview_set'); 15114 } 15115} 15116 15117if (!$ilDB->tableExists('il_dcl_tview_set')) { 15118 $ilDB->createTable('il_dcl_tview_set', $fields); 15119 $ilDB->addPrimaryKey('il_dcl_tview_set', array( 'id' )); 15120 15121 if (!$ilDB->sequenceExists('il_dcl_tview_set')) { 15122 $ilDB->createSequence('il_dcl_tview_set'); 15123 } 15124 if (!$ilDB->indexExistsByFields('il_dcl_tview_set', array('tableview_id'))) { 15125 $ilDB->addIndex('il_dcl_tview_set', array('tableview_id'), 't1'); 15126 } 15127} 15128 15129$fields = array( 15130 'id' => array( 15131 'notnull' => '1', 15132 'type' => 'integer', 15133 'length' => '8', 15134 15135 ), 15136 'table_id' => array( 15137 'notnull' => '1', 15138 'type' => 'integer', 15139 'length' => '8', 15140 15141 ), 15142 'field' => array( 15143 'notnull' => '1', 15144 'type' => 'text', 15145 'length' => '128', 15146 15147 ), 15148 'field_order' => array( 15149 'type' => 'integer', 15150 'length' => '8', 15151 15152 ), 15153 'exportable' => array( 15154 'type' => 'integer', 15155 'length' => '1', 15156 15157 ), 15158 15159); 15160if (!$ilDB->tableExists('il_dcl_tfield_set')) { 15161 $ilDB->createTable('il_dcl_tfield_set', $fields); 15162 $ilDB->addPrimaryKey('il_dcl_tfield_set', array( 'id' )); 15163 15164 if (!$ilDB->sequenceExists('il_dcl_tfield_set')) { 15165 $ilDB->createSequence('il_dcl_tfield_set'); 15166 } 15167 if (!$ilDB->indexExistsByFields('il_dcl_tfield_set', array('table_id', 'field'))) { 15168 $ilDB->addIndex('il_dcl_tfield_set', array('table_id', 'field'), 't2'); 15169 } 15170} 15171?> 15172<#4919> 15173<?php 15174//migration for datacollections: 15175//ĉreate a standardview for each table, set visibility/filterability for each field 15176//and delete entries from old view tables 15177$roles = array(); 15178$query = $ilDB->query('SELECT rol_id FROM rbac_fa WHERE parent = ' . $ilDB->quote(ROLE_FOLDER_ID, 'integer') . " AND assign='y'"); 15179while ($global_role = $ilDB->fetchAssoc($query)) { 15180 $roles[] = $global_role['rol_id']; 15181} 15182 15183//set order of main tables, since main_table_id will be removed 15184if (!$ilDB->tableColumnExists('il_dcl_table', 'table_order')) { 15185 $ilDB->addTableColumn('il_dcl_table', 'table_order', array('type' => 'integer', 'length' => 8)); 15186} 15187 15188if ($ilDB->tableColumnExists('il_dcl_data', 'main_table_id')) { 15189 $main_table_query = $ilDB->query('SELECT main_table_id FROM il_dcl_data'); 15190 while ($rec = $ilDB->fetchAssoc($main_table_query)) { 15191 $ilDB->query('UPDATE il_dcl_table SET table_order = 10, is_visible = 1 WHERE id = ' . $ilDB->quote($rec['main_table_id'], 'integer')); 15192 } 15193 $ilDB->dropTableColumn('il_dcl_data', 'main_table_id'); 15194} 15195// 15196$table_query = $ilDB->query('SELECT id, ref_id FROM il_dcl_table 15197 INNER JOIN object_reference ON (object_reference.obj_id = il_dcl_table.obj_id)'); 15198 15199$mapping = array(); 15200while ($rec = $ilDB->fetchAssoc($table_query)) { 15201 $temp_sql = $ilDB->query('SELECT * FROM il_dcl_tableview WHERE table_id = ' . $ilDB->quote($rec['id'])); 15202 if ($ilDB->numRows($temp_sql)) { 15203 continue; 15204 } 15205 $query = $ilDB->query('SELECT rol_id FROM rbac_fa WHERE parent = ' . $ilDB->quote($rec['ref_id'], 'integer') . " AND assign='y'"); 15206 while ($local_role = $ilDB->fetchAssoc($query)) { 15207 $roles[] = $local_role['rol_id']; 15208 } 15209 //create standardviews for each DCL Table and set id mapping 15210 $next_id = $ilDB->nextId('il_dcl_tableview'); 15211 $ilDB->query('INSERT INTO il_dcl_tableview (id, table_id, title, roles, description, tableview_order) VALUES (' 15212 . $ilDB->quote($next_id, 'integer') . ', ' 15213 . $ilDB->quote($rec['id'], 'integer') . ', ' 15214 . $ilDB->quote('Standardview', 'text') . ', ' 15215 . $ilDB->quote(json_encode($roles), 'text') . ', ' 15216 . $ilDB->quote('', 'text') . ', ' 15217 . $ilDB->quote(10, 'integer') . ')'); 15218 $mapping[$rec['id']] = $next_id; 15219} 15220 15221if ($ilDB->tableExists('il_dcl_view') && $ilDB->tableExists('il_dcl_viewdefinition')) { 15222 15223 //fetch information about visibility/filterability 15224 $view_query = $ilDB->query( 15225 "SELECT il_dcl_view.table_id, tbl_visible.field, tbl_visible.is_set as visible, f.filterable 15226 FROM il_dcl_viewdefinition tbl_visible 15227 INNER JOIN il_dcl_view ON (il_dcl_view.id = tbl_visible.view_id 15228 AND il_dcl_view.type = 1) 15229 INNER JOIN 15230 (SELECT table_id, field, tbl_filterable.is_set as filterable 15231 FROM il_dcl_view 15232 INNER JOIN il_dcl_viewdefinition tbl_filterable ON (il_dcl_view.id = tbl_filterable.view_id 15233 AND il_dcl_view.type = 3)) f ON (f.field = tbl_visible.field AND f.table_id = il_dcl_view.table_id)" 15234 ); 15235 15236 //set visibility/filterability 15237 $view_id_cache = array(); 15238 while ($rec = $ilDB->fetchAssoc($view_query)) { 15239 if (!$mapping[$rec['table_id']]) { 15240 continue; 15241 } 15242 $next_id = $ilDB->nextId('il_dcl_tview_set'); 15243 $ilDB->query( 15244 'INSERT INTO il_dcl_tview_set (id, tableview_id, field, visible, in_filter, filter_value, 15245 filter_changeable) VALUES (' 15246 . $ilDB->quote($next_id, 'integer') . ', ' 15247 . $ilDB->quote($mapping[$rec['table_id']], 'integer') . ', ' 15248 . $ilDB->quote($rec['field'], 'text') . ', ' 15249 . $ilDB->quote($rec['visible'], 'integer') . ', ' 15250 . $ilDB->quote($rec['filterable'], 'integer') . ', ' 15251 . $ilDB->quote('', 'text') . ', ' 15252 . $ilDB->quote(1, 'integer') . ')' 15253 ); 15254 } 15255 15256 //fetch information about editability/exportability 15257 $view_query = $ilDB->query( 15258 "SELECT il_dcl_view.table_id, tbl_exportable.field, tbl_exportable.is_set as exportable, tbl_exportable.field_order 15259 FROM il_dcl_viewdefinition tbl_exportable 15260 INNER JOIN il_dcl_view ON (il_dcl_view.id = tbl_exportable.view_id 15261 AND il_dcl_view.type = 4)" 15262 ); 15263 15264 15265 //set editability/exportability 15266 while ($rec = $ilDB->fetchAssoc($view_query)) { 15267 $temp_sql = $ilDB->query('SELECT * FROM il_dcl_tfield_set 15268 WHERE table_id = ' . $ilDB->quote($rec['table_id'], 'integer') . ' 15269 AND field = ' . $ilDB->quote($rec['field'], 'text')); 15270 15271 if (!$ilDB->numRows($temp_sql)) { 15272 $next_id = $ilDB->nextId('il_dcl_tfield_set'); 15273 $ilDB->query( 15274 'INSERT INTO il_dcl_tfield_set (id, table_id, field, field_order, exportable) VALUES (' 15275 . $ilDB->quote($next_id, 'integer') . ', ' 15276 . $ilDB->quote($rec['table_id'], 'integer') . ', ' 15277 . $ilDB->quote($rec['field'], 'text') . ', ' 15278 . $ilDB->quote($rec['field_order'], 'integer') . ', ' 15279 . $ilDB->quote($rec['exportable'], 'integer') . ')' 15280 ); 15281 } 15282 } 15283 15284 //migrate page object 15285 $query = $ilDB->query('SELECT * 15286 FROM il_dcl_view 15287 INNER JOIN page_object on (il_dcl_view.id = page_object.page_id) 15288 WHERE il_dcl_view.type = 0 15289 AND page_object.parent_type = ' . $ilDB->quote('dclf', 'text')); 15290 15291 while ($rec = $ilDB->fetchAssoc($query)) { 15292 if (!$mapping[$rec['table_id']]) { 15293 continue; 15294 } 15295 15296 $temp_sql = $ilDB->query('SELECT * FROM page_object 15297 WHERE page_id = ' . $ilDB->quote($mapping[$rec['table_id']], 'integer') . ' 15298 AND parent_type = ' . $ilDB->quote('dclf', 'text')); 15299 15300 if ($ilDB->numRows($temp_sql)) { 15301 $ilDB->query('DELETE FROM page_object 15302 WHERE page_id = ' . $ilDB->quote($rec['id'], 'integer') . ' 15303 AND parent_type = ' . $ilDB->quote('dclf', 'text')); 15304 } else { 15305 $ilDB->query('UPDATE page_object 15306 SET page_id = ' . $ilDB->quote($mapping[$rec['table_id']], 'integer') . ' 15307 WHERE page_id = ' . $ilDB->quote($rec['id'], 'integer') . ' 15308 AND page_object.parent_type = ' . $ilDB->quote('dclf', 'text')); 15309 } 15310 } 15311 15312 //delete old tables 15313 $ilDB->dropTable('il_dcl_viewdefinition'); 15314 $ilDB->dropTable('il_dcl_view'); 15315} 15316 15317?> 15318<#4920> 15319<?php 15320$ilCtrlStructureReader->getStructure(); 15321?> 15322<#4921> 15323<?php 15324$ilCtrlStructureReader->getStructure(); 15325?> 15326<#4922> 15327<?php 15328require_once 'Services/Migration/DBUpdate_4922/classes/class.ilPasswordUtils.php'; 15329 15330$salt_location = CLIENT_DATA_DIR . '/pwsalt.txt'; 15331if (!is_file($salt_location) || !is_readable($salt_location)) { 15332 $result = @file_put_contents( 15333 $salt_location, 15334 substr(str_replace('+', '.', base64_encode(ilPasswordUtils::getBytes(16))), 0, 22) 15335 ); 15336 if (!$result) { 15337 die("Could not create the client salt for bcrypt password hashing."); 15338 } 15339} 15340 15341if (!is_file($salt_location) || !is_readable($salt_location)) { 15342 die("Could not determine the client salt for bcrypt password hashing."); 15343} 15344?> 15345<#4923> 15346<?php 15347$ilCtrlStructureReader->getStructure(); 15348?> 15349<#4924> 15350<?php 15351$ilCtrlStructureReader->getStructure(); 15352?> 15353<#4925> 15354<?php 15355 15356include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15357 15358$type_id = ilDBUpdateNewObjectType::getObjectTypeId('stys'); 15359if ($type_id) { 15360 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('sty_write_content', 'Edit Content Styles', 'object', 6101); 15361 if ($new_ops_id) { 15362 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 15363 15364 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 15365 if ($src_ops_id) { 15366 ilDBUpdateNewObjectType::cloneOperation('stys', $src_ops_id, $new_ops_id); 15367 } 15368 } 15369} 15370?> 15371<#4926> 15372<?php 15373 15374include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15375 15376$type_id = ilDBUpdateNewObjectType::getObjectTypeId('stys'); 15377if ($type_id) { 15378 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('sty_write_system', 'Edit System Styles', 'object', 6100); 15379 if ($new_ops_id) { 15380 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 15381 15382 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 15383 if ($src_ops_id) { 15384 ilDBUpdateNewObjectType::cloneOperation('stys', $src_ops_id, $new_ops_id); 15385 } 15386 } 15387} 15388?> 15389<#4927> 15390<?php 15391 15392include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15393 15394$type_id = ilDBUpdateNewObjectType::getObjectTypeId('stys'); 15395if ($type_id) { 15396 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('sty_write_page_layout', 'Edit Page Layouts', 'object', 6102); 15397 if ($new_ops_id) { 15398 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 15399 15400 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 15401 if ($src_ops_id) { 15402 ilDBUpdateNewObjectType::cloneOperation('stys', $src_ops_id, $new_ops_id); 15403 } 15404 } 15405} 15406?> 15407<#4928> 15408<?php 15409include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15410$ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 15411ilDBUpdateNewObjectType::deleteRBACOperation('stys', $ops_id); 15412?> 15413<#4929> 15414<?php 15415 $ilCtrlStructureReader->getStructure(); 15416?> 15417<#4930> 15418<?php 15419 if (!$ilDB->tableColumnExists('skl_tree_node', 'creation_date')) { 15420 $ilDB->addTableColumn('skl_tree_node', 'creation_date', array( 15421 "type" => "timestamp", 15422 "notnull" => false, 15423 )); 15424 } 15425?> 15426<#4931> 15427<?php 15428if (!$ilDB->tableColumnExists('skl_tree_node', 'import_id')) { 15429 $ilDB->addTableColumn('skl_tree_node', 'import_id', array( 15430 "type" => "text", 15431 "length" => 50, 15432 "notnull" => false 15433 )); 15434} 15435?> 15436<#4932> 15437<?php 15438if (!$ilDB->tableColumnExists('skl_level', 'creation_date')) { 15439 $ilDB->addTableColumn('skl_level', 'creation_date', array( 15440 "type" => "timestamp", 15441 "notnull" => false, 15442 )); 15443} 15444?> 15445<#4933> 15446<?php 15447if (!$ilDB->tableColumnExists('skl_level', 'import_id')) { 15448 $ilDB->addTableColumn('skl_level', 'import_id', array( 15449 "type" => "text", 15450 "length" => 50, 15451 "notnull" => false 15452 )); 15453} 15454?> 15455<#4934> 15456<?php 15457if (!$ilDB->tableColumnExists('qpl_qst_lome', 'min_auto_complete')) { 15458 $ilDB->addTableColumn( 15459 'qpl_qst_lome', 15460 'min_auto_complete', 15461 array( 15462 'type' => 'integer', 15463 'length' => 1, 15464 'default' => 1) 15465 ); 15466} 15467if ($ilDB->tableColumnExists('qpl_qst_lome', 'min_auto_complete')) { 15468 $ilDB->modifyTableColumn( 15469 'qpl_qst_lome', 15470 'min_auto_complete', 15471 array( 15472 'default' => 3) 15473 ); 15474} 15475?> 15476<#4935> 15477<?php 15478 15479if (!$ilDB->tableColumnExists('svy_svy', 'confirmation_mail')) { 15480 $ilDB->addTableColumn( 15481 'svy_svy', 15482 'confirmation_mail', 15483 array( 15484 'type' => 'integer', 15485 'length' => 1, 15486 'notnull' => false, 15487 'default' => null 15488 ) 15489 ); 15490} 15491 15492?> 15493<#4936> 15494<?php 15495 15496$ilDB->manipulate("UPDATE svy_svy" . 15497 " SET confirmation_mail = " . $ilDB->quote(1, "integer") . 15498 " WHERE own_results_mail = " . $ilDB->quote(1, "integer") . 15499 " AND confirmation_mail IS NULL"); 15500 15501?> 15502<#4937> 15503<?php 15504 15505if (!$ilDB->tableColumnExists('svy_svy', 'anon_user_list')) { 15506 $ilDB->addTableColumn( 15507 'svy_svy', 15508 'anon_user_list', 15509 array( 15510 'type' => 'integer', 15511 'length' => 1, 15512 'notnull' => false, 15513 'default' => 0 15514 ) 15515 ); 15516} 15517 15518?> 15519<#4938> 15520<?php 15521 15522 //Create new object type grpr 'Group Reference' 15523 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15524 15525 $grpr_type_id = ilDBUpdateNewObjectType::addNewType('grpr', 'Group Reference Object'); 15526 15527 $rbac_ops = array( 15528 ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS, 15529 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 15530 ilDBUpdateNewObjectType::RBAC_OP_READ, 15531 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 15532 ilDBUpdateNewObjectType::RBAC_OP_DELETE, 15533 ilDBUpdateNewObjectType::RBAC_OP_COPY 15534 ); 15535 ilDBUpdateNewObjectType::addRBACOperations($grpr_type_id, $rbac_ops); 15536 15537 $parent_types = array('root', 'cat', 'crs', 'fold', 'grp'); 15538 ilDBUpdateNewObjectType::addRBACCreate('create_grpr', 'Create Group Reference', $parent_types); 15539?> 15540<#4939> 15541<?php 15542$ilCtrlStructureReader->getStructure(); 15543?> 15544<#4940> 15545<?php 15546 $ilCtrlStructureReader->getStructure(); 15547?> 15548<#4941> 15549<?php 15550//step 1/2 il_request_token deletes old table 15551 15552if ($ilDB->tableExists('il_request_token')) { 15553 $ilDB->dropTable('il_request_token'); 15554} 15555 15556?> 15557<#4942> 15558<?php 15559//step 2/2 il_request_token creates table with primary key 15560 15561if (!$ilDB->tableExists('il_request_token')) { 15562 $fields = array( 15563 "user_id" => array( 15564 "notnull" => true 15565 , "length" => 4 15566 , "unsigned" => false 15567 , "default" => "0" 15568 , "type" => "integer" 15569 ) 15570 , "token" => array( 15571 "notnull" => false 15572 , "length" => 64 15573 , "fixed" => true 15574 , "type" => "text" 15575 ) 15576 , "stamp" => array( 15577 "notnull" => false 15578 , "type" => "timestamp" 15579 ) 15580 , "session_id" => array( 15581 "notnull" => false 15582 , "length" => 100 15583 , "fixed" => false 15584 , "type" => "text" 15585 ) 15586 ); 15587 15588 $ilDB->createTable("il_request_token", $fields); 15589 $ilDB->addPrimaryKey("il_request_token", array('token')); 15590 $ilDB->addIndex("il_request_token", array('user_id', 'session_id'), 'i1'); 15591 $ilDB->addIndex("il_request_token", array('user_id', 'stamp'), 'i2'); 15592} 15593?> 15594<#4943> 15595<?php 15596//step 1/3 il_event_handling deletes old table 15597if ($ilDB->tableExists('il_event_handling')) { 15598 $ilDB->dropTable('il_event_handling'); 15599} 15600 15601?> 15602<#4944> 15603<?php 15604//step 2/3 il_event_handling creates table with primary key 15605if (!$ilDB->tableExists('il_event_handling')) { 15606 $fields = array( 15607 'component' => array( 15608 'type' => 'text', 15609 'length' => 50, 15610 'notnull' => true, 15611 'fixed' => false 15612 ), 15613 'type' => array( 15614 'type' => 'text', 15615 'length' => 10, 15616 'notnull' => true, 15617 'fixed' => false 15618 ), 15619 'id' => array( 15620 'type' => 'text', 15621 'length' => 100, 15622 'notnull' => true, 15623 'fixed' => false 15624 )); 15625 $ilDB->createTable('il_event_handling', $fields); 15626 $ilDB->addPrimaryKey("il_event_handling", array('component', 'type', 'id')); 15627} 15628?> 15629<#4945> 15630<?php 15631//step 3/3 il_event_handling fill table 15632$ilCtrlStructureReader->getStructure(); 15633?> 15634<#4946> 15635<?php 15636//step 1/4 copg_section_timings renames old table 15637 15638if ($ilDB->tableExists('copg_section_timings') && !$ilDB->tableExists('copg_section_t_old')) { 15639 $ilDB->renameTable("copg_section_timings", "copg_section_t_old"); 15640} 15641?> 15642<#4947> 15643<?php 15644//step 2/4 copg_section_timings create new table with primary keys 15645if (!$ilDB->tableExists("copg_section_timings")) { 15646 $fields = array( 15647 "page_id" => array( 15648 "type" => "integer", 15649 "length" => 4, 15650 "notnull" => true 15651 ), 15652 "parent_type" => array( 15653 "type" => "text", 15654 "length" => 10, 15655 "notnull" => true 15656 ), 15657 "unix_ts" => array( 15658 "type" => "integer", 15659 "notnull" => true, 15660 "length" => 4, 15661 "default" => 0 15662 ) 15663 ); 15664 15665 $ilDB->createTable("copg_section_timings", $fields); 15666 $ilDB->addPrimaryKey("copg_section_timings", array('page_id', 'parent_type', 'unix_ts')); 15667} 15668?> 15669<#4948> 15670<?php 15671//step 3/4 copg_section_timings moves all data to new table 15672 15673if ($ilDB->tableExists('copg_section_timings') && $ilDB->tableExists('copg_section_t_old')) { 15674 $res = $ilDB->query(" 15675 SELECT * 15676 FROM copg_section_t_old 15677 "); 15678 15679 while ($row = $ilDB->fetchAssoc($res)) { 15680 $ilDB->replace("copg_section_timings", array( 15681 "page_id" => array("integer", $row['page_id']), 15682 "parent_type" => array("text", $row['parent_type']), 15683 "unix_ts" => array("integer",$row['unix_ts']) 15684 ), array()); 15685 15686 $ilDB->manipulateF( 15687 "DELETE FROM copg_section_t_old WHERE page_id = %s AND parent_type = %s AND unix_ts = %s ", 15688 array('integer', 'text', 'integer'), 15689 array($row['page_id'], $row['parent_type'], $row['unix_ts']) 15690 ); 15691 } 15692} 15693?> 15694<#4949> 15695<?php 15696//step 4/4 copg_section_timings removes old table 15697 15698if ($ilDB->tableExists('copg_section_t_old')) { 15699 $ilDB->dropTable('copg_section_t_old'); 15700} 15701?> 15702<#4950> 15703<?php 15704 15705include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 15706ilDBUpdateNewObjectType::addAdminNode('bdga', 'Badge Settings'); 15707 15708?> 15709<#4951> 15710<?php 15711 15712if (!$ilDB->tableExists('badge_badge')) { 15713 $ilDB->createTable('badge_badge', array( 15714 'id' => array( 15715 'type' => 'integer', 15716 'length' => 4, 15717 'notnull' => true, 15718 'default' => 0 15719 ), 15720 'parent_id' => array( 15721 'type' => 'integer', 15722 'length' => 4, 15723 'notnull' => true, 15724 'default' => 0 15725 ), 15726 'type_id' => array( 15727 'type' => 'text', 15728 'length' => 255, 15729 'notnull' => false 15730 ), 15731 'active' => array( 15732 'type' => 'integer', 15733 'length' => 1, 15734 'notnull' => true, 15735 'default' => 0 15736 ), 15737 'title' => array( 15738 'type' => 'text', 15739 'length' => 255, 15740 'notnull' => false 15741 ), 15742 'descr' => array( 15743 'type' => 'text', 15744 'length' => 4000, 15745 'notnull' => false 15746 ), 15747 'conf' => array( 15748 'type' => 'text', 15749 'length' => 4000, 15750 'notnull' => false 15751 ) 15752 )); 15753 $ilDB->addPrimaryKey('badge_badge', array('id')); 15754 $ilDB->createSequence('badge_badge'); 15755} 15756 15757?> 15758<#4952> 15759<?php 15760 15761if (!$ilDB->tableExists('badge_image_template')) { 15762 $ilDB->createTable('badge_image_template', array( 15763 'id' => array( 15764 'type' => 'integer', 15765 'length' => 4, 15766 'notnull' => true, 15767 'default' => 0 15768 ), 15769 'title' => array( 15770 'type' => 'text', 15771 'length' => 255, 15772 'notnull' => false 15773 ), 15774 'image' => array( 15775 'type' => 'text', 15776 'length' => 255, 15777 'notnull' => false 15778 ) 15779 )); 15780 $ilDB->addPrimaryKey('badge_image_template', array('id')); 15781 $ilDB->createSequence('badge_image_template'); 15782} 15783 15784?> 15785<#4953> 15786<?php 15787 15788if (!$ilDB->tableColumnExists('badge_badge', 'image')) { 15789 $ilDB->addTableColumn( 15790 'badge_badge', 15791 'image', 15792 array( 15793 'type' => 'text', 15794 'length' => 255, 15795 'notnull' => false) 15796 ); 15797} 15798 15799?> 15800<#4954> 15801<?php 15802 15803if (!$ilDB->tableExists('badge_image_templ_type')) { 15804 $ilDB->createTable('badge_image_templ_type', array( 15805 'tmpl_id' => array( 15806 'type' => 'integer', 15807 'length' => 4, 15808 'notnull' => true, 15809 'default' => 0 15810 ), 15811 'type_id' => array( 15812 'type' => 'text', 15813 'length' => 255, 15814 'notnull' => true, 15815 'default' => "" 15816 ) 15817 )); 15818 $ilDB->addPrimaryKey('badge_image_templ_type', array('tmpl_id', 'type_id')); 15819} 15820 15821?> 15822<#4955> 15823<?php 15824 15825if (!$ilDB->tableExists('badge_user_badge')) { 15826 $ilDB->createTable('badge_user_badge', array( 15827 'badge_id' => array( 15828 'type' => 'integer', 15829 'length' => 4, 15830 'notnull' => true, 15831 'default' => 0 15832 ), 15833 'user_id' => array( 15834 'type' => 'integer', 15835 'length' => 4, 15836 'notnull' => true, 15837 'default' => 0 15838 ), 15839 'tstamp' => array( 15840 'type' => 'integer', 15841 'length' => 4, 15842 'notnull' => true, 15843 'default' => 0 15844 ), 15845 'awarded_by' => array( 15846 'type' => 'integer', 15847 'length' => 4, 15848 'notnull' => false 15849 ), 15850 'pos' => array( 15851 'type' => 'integer', 15852 'length' => 2, 15853 'notnull' => false 15854 ) 15855 )); 15856 $ilDB->addPrimaryKey('badge_user_badge', array('badge_id', 'user_id')); 15857} 15858 15859?> 15860<#4956> 15861<?php 15862 15863if (!$ilDB->tableColumnExists('badge_badge', 'valid')) { 15864 $ilDB->addTableColumn( 15865 'badge_badge', 15866 'valid', 15867 array( 15868 'type' => 'text', 15869 'length' => 255, 15870 'notnull' => false) 15871 ); 15872} 15873 15874?> 15875<#4957> 15876<?php 15877 15878if (!$ilDB->tableExists('object_data_del')) { 15879 $ilDB->createTable('object_data_del', array( 15880 'obj_id' => array( 15881 'type' => 'integer', 15882 'length' => 4, 15883 'notnull' => true, 15884 'default' => 0 15885 ), 15886 'title' => array( 15887 'type' => 'text', 15888 'length' => 255, 15889 'notnull' => false 15890 ), 15891 'tstamp' => array( 15892 'type' => 'integer', 15893 'length' => 4, 15894 'notnull' => true, 15895 'default' => 0 15896 ), 15897 )); 15898 $ilDB->addPrimaryKey('object_data_del', array('obj_id')); 15899} 15900 15901?> 15902<#4958> 15903<?php 15904 15905if (!$ilDB->tableColumnExists('object_data_del', 'type')) { 15906 $ilDB->addTableColumn( 15907 'object_data_del', 15908 'type', 15909 array( 15910 'type' => 'text', 15911 'length' => 4, 15912 'fixed' => true, 15913 'notnull' => false) 15914 ); 15915} 15916 15917?> 15918<#4959> 15919<?php 15920 15921if (!$ilDB->tableColumnExists('badge_badge', 'crit')) { 15922 $ilDB->addTableColumn( 15923 'badge_badge', 15924 'crit', 15925 array( 15926 'type' => 'text', 15927 'length' => 4000, 15928 'notnull' => false 15929 ) 15930 ); 15931} 15932 15933?> 15934<#4960> 15935<?php 15936 15937$ilCtrlStructureReader->getStructure(); 15938 15939?> 15940<#4961> 15941<?php 15942 15943if (!$ilDB->tableExists('ut_lp_defaults')) { 15944 $ilDB->createTable('ut_lp_defaults', array( 15945 'type_id' => array( 15946 'type' => 'text', 15947 'length' => 10, 15948 'notnull' => true, 15949 'default' => "" 15950 ), 15951 'lp_mode' => array( 15952 'type' => 'integer', 15953 'length' => 1, 15954 'notnull' => true, 15955 'default' => 0 15956 ), 15957 )); 15958 $ilDB->addPrimaryKey('ut_lp_defaults', array('type_id')); 15959} 15960 15961?> 15962<#4962> 15963<?php 15964 15965$dubs_sql = "SELECT * FROM (" . 15966 "SELECT tree, child " . 15967 "FROM bookmark_tree " . 15968 "GROUP BY tree, child " . 15969 "HAVING COUNT(*) > 1 ) " . 15970 "duplicateBookmarkTree"; 15971 15972$res = $ilDB->query($dubs_sql); 15973$dublicates = array(); 15974 15975while ($row = $ilDB->fetchAssoc($res)) { 15976 $dublicates[] = $row; 15977} 15978 15979if (count($dublicates)) { 15980 $ilSetting = new ilSetting(); 15981 $ilSetting->set('bookmark_tree_renumber', 1); 15982 15983 foreach ($dublicates as $key => $row) { 15984 $res = $ilDB->query("SELECT * FROM bookmark_tree WHERE tree = " . $ilDB->quote($row["tree"], "integer") . 15985 " AND child = " . $ilDB->quote($row["child"], "integer")); 15986 15987 $first = $ilDB->fetchAssoc($res); 15988 15989 $ilDB->manipulate("DELETE FROM bookmark_tree WHERE tree = " . $ilDB->quote($row["tree"], "integer") . 15990 " AND child = " . $ilDB->quote($row["child"], "integer")); 15991 15992 $ilDB->query( 15993 'INSERT INTO bookmark_tree (tree, child, parent, lft, rgt, depth) VALUES (' 15994 . $ilDB->quote($first['tree'], 'integer') . ', ' 15995 . $ilDB->quote($first['child'], 'integer') . ', ' 15996 . $ilDB->quote($first['parent'], 'integer') . ', ' 15997 . $ilDB->quote($first['lft'], 'integer') . ', ' 15998 . $ilDB->quote($first['rgt'], 'integer') . ', ' 15999 . $ilDB->quote($first['depth'], 'integer') . ')' 16000 ); 16001 } 16002} 16003 16004?> 16005<#4963> 16006<?php 16007$ilSetting = new ilSetting(); 16008if ($ilSetting->get('bookmark_tree_renumber', "0") == "1") { 16009 include_once('./Services/Migration/DBUpdate_4963/classes/class.ilDBUpdate4963.php'); 16010 ilDBUpdate4963::renumberBookmarkTree(); 16011 $ilSetting->delete('bookmark_tree_renumber'); 16012} 16013 16014?> 16015<#4964> 16016<?php 16017$manager = $ilDB->loadModule('Manager'); 16018 16019if (!$manager) { 16020 $manager = $ilDB->loadModule('Manager'); 16021} 16022 16023$const = $manager->listTableConstraints("bookmark_tree"); 16024if (!in_array("primary", $const)) { 16025 $ilDB->addPrimaryKey('bookmark_tree', array('tree', 'child')); 16026} 16027 16028?> 16029<#4965> 16030<?php 16031if (!$ilDB->tableExists('frm_posts_drafts')) { 16032 $fields = array( 16033 'draft_id' => array( 16034 'type' => 'integer', 16035 'length' => 4, 16036 'notnull' => true, 16037 'default' => 0 16038 ), 16039 'post_id' => array( 16040 'type' => 'integer', 16041 'length' => 8, 16042 'notnull' => true, 16043 'default' => 0 16044 ), 16045 'thread_id' => array( 16046 'type' => 'integer', 16047 'length' => 8, 16048 'notnull' => true, 16049 'default' => 0 16050 ), 16051 'forum_id' => array( 16052 'type' => 'integer', 16053 'length' => 8, 16054 'notnull' => true, 16055 'default' => 0 16056 ), 16057 'post_author_id' => array( 16058 'type' => 'integer', 16059 'length' => 4, 16060 'notnull' => true, 16061 'default' => 0 16062 ), 16063 'post_subject' => array( 16064 'type' => 'text', 16065 'length' => 4000, 16066 'notnull' => true 16067 ), 16068 'post_message' => array( 16069 'type' => 'clob', 16070 'notnull' => true 16071 ), 16072 'post_notify' => array( 16073 'type' => 'integer', 16074 'length' => 1, 16075 'notnull' => true, 16076 'default' => 0 16077 ), 16078 'post_date' => array( 16079 'type' => 'timestamp', 16080 'notnull' => true 16081 ), 16082 'post_update' => array( 16083 'type' => 'timestamp', 16084 'notnull' => true 16085 ), 16086 'update_user_id' => array( 16087 'type' => 'integer', 16088 'length' => 4, 16089 'notnull' => true, 16090 'default' => 0 16091 ), 16092 'post_user_alias' => array( 16093 'type' => 'text', 16094 'length' => 255, 16095 'notnull' => false 16096 ), 16097 'pos_display_usr_id' => array( 16098 'type' => 'integer', 16099 'length' => 4, 16100 'notnull' => true, 16101 'default' => 0 16102 ), 16103 'notify' => array( 16104 'type' => 'integer', 16105 'length' => 1, 16106 'notnull' => true, 16107 'default' => 0 16108 ) 16109 16110 ); 16111 16112 $ilDB->createTable('frm_posts_drafts', $fields); 16113 $ilDB->addPrimaryKey('frm_posts_drafts', array('draft_id')); 16114 $ilDB->createSequence('frm_posts_drafts'); 16115} 16116?> 16117<#4966> 16118<?php 16119if (!$ilDB->indexExistsByFields('frm_posts_drafts', array('post_id'))) { 16120 $ilDB->addIndex('frm_posts_drafts', array('post_id'), 'i1'); 16121} 16122?> 16123<#4967> 16124<?php 16125if (!$ilDB->indexExistsByFields('frm_posts_drafts', array('thread_id'))) { 16126 $ilDB->addIndex('frm_posts_drafts', array('thread_id'), 'i2'); 16127} 16128?> 16129<#4968> 16130<?php 16131if (!$ilDB->indexExistsByFields('frm_posts_drafts', array('forum_id'))) { 16132 $ilDB->addIndex('frm_posts_drafts', array('forum_id'), 'i3'); 16133} 16134?> 16135<#4969> 16136<?php 16137if (!$ilDB->tableExists('frm_drafts_history')) { 16138 $fields = array( 16139 'history_id' => array( 16140 'type' => 'integer', 16141 'length' => 4, 16142 'notnull' => true, 16143 'default' => 0 16144 ), 16145 'draft_id' => array( 16146 'type' => 'integer', 16147 'length' => 4, 16148 'notnull' => true, 16149 'default' => 0 16150 ), 16151 'post_subject' => array( 16152 'type' => 'text', 16153 'length' => 4000, 16154 'notnull' => true 16155 ), 16156 'post_message' => array( 16157 'type' => 'clob', 16158 'notnull' => true 16159 ), 16160 'draft_date' => array( 16161 'type' => 'timestamp', 16162 'notnull' => true 16163 ) 16164 ); 16165 16166 $ilDB->createTable('frm_drafts_history', $fields); 16167 $ilDB->addPrimaryKey('frm_drafts_history', array('history_id')); 16168 $ilDB->createSequence('frm_drafts_history'); 16169} 16170?> 16171<#4970> 16172<?php 16173 if (!$ilDB->indexExistsByFields('frm_drafts_history', array('draft_id'))) { 16174 $ilDB->addIndex('frm_drafts_history', array('draft_id'), 'i1'); 16175 } 16176?> 16177<#4971> 16178<?php 16179$ilCtrlStructureReader->getStructure(); 16180?> 16181<#4972> 16182<?php 16183if (!$ilDB->tableColumnExists('tst_tests', 'pass_waiting')) { 16184 $ilDB->addTableColumn( 16185 'tst_tests', 16186 'pass_waiting', 16187 array( 16188 'type' => 'text', 16189 'length' => 15, 16190 'notnull' => false, 16191 'default' => null) 16192 ); 16193} 16194?> 16195<#4973> 16196<?php 16197if (!$ilDB->tableColumnExists('tst_active', 'last_started_pass')) { 16198 $ilDB->addTableColumn('tst_active', 'last_started_pass', array( 16199 'type' => 'integer', 16200 'length' => 4, 16201 'notnull' => false, 16202 'default' => null 16203 )); 16204} 16205?> 16206<#4974> 16207<?php 16208if ($ilDB->tableExists('bookmark_social_bm')) { 16209 $ilDB->dropTable('bookmark_social_bm'); 16210} 16211?> 16212<#4975> 16213<?php 16214if ($ilDB->sequenceExists('bookmark_social_bm')) { 16215 $ilDB->dropSequence('bookmark_social_bm'); 16216} 16217?> 16218<#4976> 16219<?php 16220$sbm_path = realpath(CLIENT_WEB_DIR . DIRECTORY_SEPARATOR . 'social_bm_icons'); 16221if (file_exists($sbm_path) && is_dir($sbm_path)) { 16222 $iter = new RecursiveIteratorIterator( 16223 new RecursiveDirectoryIterator($sbm_path, RecursiveDirectoryIterator::SKIP_DOTS), 16224 RecursiveIteratorIterator::CHILD_FIRST 16225 ); 16226 foreach ($iter as $fileinfo) { 16227 if ($fileinfo->isDir()) { 16228 @rmdir($fileinfo->getRealPath()); 16229 } else { 16230 @unlink($fileinfo->getRealPath()); 16231 } 16232 } 16233 16234 @rmdir($sbm_path); 16235} 16236?> 16237<#4977> 16238<?php 16239$ilSetting = new ilSetting(); 16240$ilSetting->delete('passwd_auto_generate'); 16241?> 16242<#4978> 16243<?php 16244if ($ilDB->tableColumnExists('usr_data', 'im_icq')) { 16245 $ilDB->dropTableColumn('usr_data', 'im_icq'); 16246} 16247?> 16248<#4979> 16249<?php 16250if ($ilDB->tableColumnExists('usr_data', 'im_yahoo')) { 16251 $ilDB->dropTableColumn('usr_data', 'im_yahoo'); 16252} 16253?> 16254<#4980> 16255<?php 16256if ($ilDB->tableColumnExists('usr_data', 'im_msn')) { 16257 $ilDB->dropTableColumn('usr_data', 'im_msn'); 16258} 16259?> 16260<#4981> 16261<?php 16262if ($ilDB->tableColumnExists('usr_data', 'im_aim')) { 16263 $ilDB->dropTableColumn('usr_data', 'im_aim'); 16264} 16265?> 16266<#4982> 16267<?php 16268if ($ilDB->tableColumnExists('usr_data', 'im_skype')) { 16269 $ilDB->dropTableColumn('usr_data', 'im_skype'); 16270} 16271?> 16272<#4983> 16273<?php 16274if ($ilDB->tableColumnExists('usr_data', 'im_voip')) { 16275 $ilDB->dropTableColumn('usr_data', 'im_voip'); 16276} 16277?> 16278<#4984> 16279<?php 16280if ($ilDB->tableColumnExists('usr_data', 'im_jabber')) { 16281 $ilDB->dropTableColumn('usr_data', 'im_jabber'); 16282} 16283?> 16284<#4985> 16285<?php 16286if ($ilDB->tableColumnExists('usr_data', 'delicious')) { 16287 $ilDB->dropTableColumn('usr_data', 'delicious'); 16288} 16289?> 16290<#4986> 16291<?php 16292$pd_set = new ilSetting('pd'); 16293$pd_set->delete('osi_host'); 16294?> 16295<#4987> 16296<?php 16297$dset = new ilSetting('delicious'); 16298$dset->deleteAll(); 16299?> 16300<#4988> 16301<?php 16302$fields = array('im_icq', 'im_yahoo', 'im_msn', 'im_aim', 'im_skype', 'im_jabber', 'im_voip', 'delicious'); 16303foreach ($fields as $field) { 16304 $ilDB->manipulateF( 16305 'DELETE FROM usr_pref WHERE keyword = %s', 16306 array('text'), 16307 array('public_' . $field) 16308 ); 16309} 16310?> 16311<#4989> 16312<?php 16313foreach (array('instant_messengers', 'delicous') as $field) { 16314 foreach (array( 16315 'usr_settings_hide', 'usr_settings_disable', 'usr_settings_visib_reg', 'usr_settings_changeable_lua', 16316 'usr_settings_export', 'usr_settings_course_export', 'usr_settings_group_export', 'require' 16317 ) as $type) { 16318 $ilDB->manipulateF( 16319 "DELETE FROM settings WHERE keyword = %s", 16320 array("text"), 16321 array($type . "_" . $field) 16322 ); 16323 } 16324} 16325?> 16326<#4990> 16327<?php 16328if (!$ilDB->tableExists('glo_glossaries')) { 16329 $ilDB->createTable('glo_glossaries', array( 16330 'id' => array( 16331 'type' => 'integer', 16332 'length' => 4, 16333 'notnull' => true, 16334 'default' => 0 16335 ), 16336 'glo_id' => array( 16337 'type' => 'integer', 16338 'length' => 4, 16339 'notnull' => true, 16340 'default' => 0 16341 ) 16342 )); 16343} 16344?> 16345<#4991> 16346<?php 16347if (!$ilDB->tableExists('glo_term_reference')) { 16348 $ilDB->createTable('glo_term_reference', array( 16349 'glo_id' => array( 16350 'type' => 'integer', 16351 'length' => 4, 16352 'notnull' => true, 16353 'default' => 0 16354 ), 16355 'term_id' => array( 16356 'type' => 'integer', 16357 'length' => 4, 16358 'notnull' => true, 16359 'default' => 0 16360 ) 16361 )); 16362} 16363?> 16364<#4992> 16365<?php 16366 $ilDB->addPrimaryKey('glo_term_reference', array('glo_id', 'term_id')); 16367?> 16368<#4993> 16369<?php 16370 $ilCtrlStructureReader->getStructure(); 16371?> 16372<#4994> 16373<?php 16374 if (!$ilDB->tableColumnExists('svy_svy', 'reminder_tmpl')) { 16375 $ilDB->addTableColumn('svy_svy', 'reminder_tmpl', array( 16376 "type" => "integer", 16377 "notnull" => false, 16378 "length" => 4 16379 )); 16380 } 16381?> 16382<#4995> 16383<?php 16384 $ilCtrlStructureReader->getStructure(); 16385?> 16386<#4996> 16387<?php 16388 16389if (!$ilDB->tableExists('exc_idl')) { 16390 $ilDB->createTable('exc_idl', array( 16391 'ass_id' => array( 16392 'type' => 'integer', 16393 'length' => 4, 16394 'notnull' => true, 16395 'default' => 0 16396 ), 16397 'member_id' => array( 16398 'type' => 'integer', 16399 'length' => 4, 16400 'notnull' => true, 16401 'default' => 0 16402 ), 16403 'is_team' => array( 16404 'type' => 'integer', 16405 'length' => 1, 16406 'notnull' => true, 16407 'default' => 0 16408 ), 16409 'tstamp' => array( 16410 'type' => 'integer', 16411 'length' => 4, 16412 'notnull' => false, 16413 'default' => 0 16414 ) 16415 )); 16416 16417 $ilDB->addPrimaryKey('exc_idl', array('ass_id', 'member_id', 'is_team')); 16418} 16419 16420?> 16421<#4997> 16422<?php 16423 if (!$ilDB->tableColumnExists('exc_data', 'tfeedback')) { 16424 $ilDB->addTableColumn('exc_data', 'tfeedback', array( 16425 "type" => "integer", 16426 "notnull" => true, 16427 "length" => 1, 16428 "default" => 7 16429 )); 16430 } 16431?> 16432<#4998> 16433<?php 16434$ilDB->modifyTableColumn( 16435 "usr_pref", 16436 "value", 16437 array( 16438 "type" => "text", 16439 "length" => 4000, 16440 "fixed" => false, 16441 "notnull" => false, 16442 "default" => null 16443 ) 16444); 16445?> 16446<#4999> 16447<?php 16448 $ilCtrlStructureReader->getStructure(); 16449?> 16450<#5000> 16451<?php 16452 // 16453?> 16454<#5001> 16455<?php 16456 $ilCtrlStructureReader->getStructure(); 16457?> 16458<#5002> 16459<?php 16460if (!$ilDB->tableExists('wfe_workflows')) { 16461 $fields = array( 16462 'workflow_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16463 'workflow_type' => array('type' => 'text', 'length' => 255), 16464 'workflow_content' => array('type' => 'text', 'length' => 255), 16465 'workflow_class' => array('type' => 'text', 'length' => 255), 16466 'workflow_location' => array('type' => 'text', 'length' => 255), 16467 'subject_type' => array('type' => 'text', 'length' => 30), 16468 'subject_id' => array('type' => 'integer', 'length' => 4), 16469 'context_type' => array('type' => 'text', 'length' => 30), 16470 'context_id' => array('type' => 'integer', 'length' => 4), 16471 'workflow_instance' => array('type' => 'clob', 'notnull' => false, 'default' => null), 16472 'active' => array('type' => 'integer', 'length' => 4) 16473 ); 16474 16475 $ilDB->createTable('wfe_workflows', $fields); 16476 $ilDB->addPrimaryKey('wfe_workflows', array('workflow_id')); 16477 $ilDB->createSequence('wfe_workflows'); 16478} 16479 16480if (!$ilDB->tableExists('wfe_det_listening')) { 16481 $fields = array( 16482 'detector_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16483 'workflow_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16484 'type' => array('type' => 'text', 'length' => 255), 16485 'content' => array('type' => 'text', 'length' => 255), 16486 'subject_type' => array('type' => 'text', 'length' => 30), 16487 'subject_id' => array('type' => 'integer', 'length' => 4), 16488 'context_type' => array('type' => 'text', 'length' => 30), 16489 'context_id' => array('type' => 'integer', 'length' => 4), 16490 'listening_start' => array('type' => 'integer', 'length' => 4), 16491 'listening_end' => array('type' => 'integer', 'length' => 4) 16492 ); 16493 16494 $ilDB->createTable('wfe_det_listening', $fields); 16495 $ilDB->addPrimaryKey('wfe_det_listening', array('detector_id')); 16496 $ilDB->createSequence('wfe_det_listening'); 16497} 16498 16499if (!$ilDB->tableExists('wfe_startup_events')) { 16500 $fields = array( 16501 'event_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16502 'workflow_id' => array('type' => 'text', 'length' => 60, 'notnull' => true), 16503 'type' => array('type' => 'text', 'length' => 255), 16504 'content' => array('type' => 'text', 'length' => 255), 16505 'subject_type' => array('type' => 'text', 'length' => 30), 16506 'subject_id' => array('type' => 'integer', 'length' => 4), 16507 'context_type' => array('type' => 'text', 'length' => 30), 16508 'context_id' => array('type' => 'integer', 'length' => 4) 16509 ); 16510 16511 $ilDB->createTable('wfe_startup_events', $fields); 16512 $ilDB->addPrimaryKey('wfe_startup_events', array('event_id')); 16513 $ilDB->createSequence('wfe_startup_events'); 16514} 16515 16516if (!$ilDB->tableExists('wfe_static_inputs')) { 16517 $fields = array( 16518 'input_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16519 'event_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 16520 'name' => array('type' => 'text', 'length' => 255), 16521 'value' => array('type' => 'clob') 16522 ); 16523 16524 $ilDB->createTable('wfe_static_inputs', $fields); 16525 $ilDB->addPrimaryKey('wfe_static_inputs', array('input_id')); 16526 $ilDB->createSequence('wfe_static_inputs'); 16527} 16528 16529require_once './Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 16530ilDBUpdateNewObjectType::addAdminNode('wfe', 'WorkflowEngine'); 16531 16532$ilCtrlStructureReader->getStructure(); 16533?> 16534<#5003> 16535<?php 16536//create il translation table to store translations for title and descriptions 16537if (!$ilDB->tableExists('il_translations')) { 16538 $fields = array( 16539 'id' => array( 16540 'type' => 'integer', 16541 'length' => 4, 16542 'notnull' => true 16543 ), 16544 'id_type' => array( 16545 'type' => 'text', 16546 'length' => 50, 16547 'notnull' => true 16548 ), 16549 'lang_code' => array( 16550 'type' => 'text', 16551 'length' => 2, 16552 'notnull' => true 16553 ), 16554 'title' => array( 16555 'type' => 'text', 16556 'length' => 256, 16557 'fixed' => false, 16558 ), 16559 'description' => array( 16560 'type' => 'text', 16561 'length' => 512, 16562 ), 16563 'lang_default' => array( 16564 'type' => 'integer', 16565 'length' => 1, 16566 'notnull' => true 16567 ) 16568 ); 16569 $ilDB->createTable('il_translations', $fields); 16570 $ilDB->addPrimaryKey("il_translations", array("id", "id_type", "lang_code")); 16571} 16572?> 16573<#5004> 16574<?php 16575//data migration didactic templates to il_translation 16576if ($ilDB->tableExists('didactic_tpl_settings') && $ilDB->tableExists('il_translations')) { 16577 $ini = new ilIniFile(ILIAS_ABSOLUTE_PATH . "/ilias.ini.php"); 16578 16579 $lang_default = $ini->readVariable("language", "default"); 16580 16581 $ilSetting = new ilSetting(); 16582 16583 if ($ilSetting->get("language") != "") { 16584 $lang_default = $ilSetting->get("language"); 16585 } 16586 16587 $set = $ilDB->query("SELECT id, title, description" . 16588 " FROM didactic_tpl_settings"); 16589 16590 while ($row = $ilDB->fetchAssoc($set)) { 16591 $fields = array("id" => array("integer", $row['id']), 16592 "id_type" => array("text", "dtpl"), 16593 "lang_code" => array("text", $lang_default), 16594 "title" => array("text", $row['title']), 16595 "description" => array("text", $row['description']), 16596 "lang_default" => array("integer", 1)); 16597 16598 $ilDB->insert("il_translations", $fields); 16599 } 16600} 16601 16602?> 16603<#5005> 16604<?php 16605//table to store "effective from" nodes for didactic templates 16606if (!$ilDB->tableExists('didactic_tpl_en')) { 16607 $fields = array( 16608 'id' => array( 16609 'type' => 'integer', 16610 'length' => 4, 16611 'notnull' => true 16612 ), 16613 'node' => array( 16614 'type' => 'integer', 16615 'length' => 4, 16616 'notnull' => true 16617 ) 16618 ); 16619 $ilDB->createTable('didactic_tpl_en', $fields); 16620 $ilDB->addPrimaryKey("didactic_tpl_en", array("id", "node")); 16621} 16622 16623?> 16624<#5006> 16625<?php 16626$ilCtrlStructureReader->getStructure(); 16627?> 16628<#5007> 16629<?php 16630if (!$ilDB->tableColumnExists('grp_settings', 'show_members')) { 16631 $ilDB->addTableColumn('grp_settings', 'show_members', array( 16632 "notnull" => true 16633 ,"length" => 1 16634 ,"unsigned" => false 16635 ,"default" => "1" 16636 ,"type" => "integer" 16637 )); 16638} 16639?> 16640<#5008> 16641<?php 16642include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16643 16644$type_id = ilDBUpdateNewObjectType::getObjectTypeId('crs'); 16645$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 16646 16647if ($type_id && $tgt_ops_id) { 16648 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 16649} 16650?> 16651<#5009> 16652<?php 16653include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16654 16655$type_id = ilDBUpdateNewObjectType::getObjectTypeId('grp'); 16656$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 16657 16658if ($type_id && $tgt_ops_id) { 16659 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 16660} 16661?> 16662<#5010> 16663<?php 16664 16665include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16666$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 16667$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 16668ilDBUpdateNewObjectType::cloneOperation('crs', $src_ops_id, $tgt_ops_id); 16669 16670?> 16671<#5011> 16672<?php 16673 16674include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16675$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 16676$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 16677ilDBUpdateNewObjectType::cloneOperation('grp', $src_ops_id, $tgt_ops_id); 16678 16679?> 16680<#5012> 16681<?php 16682if (!$ilDB->tableColumnExists('didactic_tpl_settings', 'auto_generated')) { 16683 $ilDB->addTableColumn('didactic_tpl_settings', 'auto_generated', array( 16684 "notnull" => true, 16685 "length" => 1, 16686 "default" => 0, 16687 "type" => "integer" 16688 )); 16689} 16690?> 16691<#5013> 16692<?php 16693if (!$ilDB->tableColumnExists('didactic_tpl_settings', 'exclusive_tpl')) { 16694 $ilDB->addTableColumn('didactic_tpl_settings', 'exclusive_tpl', array( 16695 "notnull" => true, 16696 "length" => 1, 16697 "default" => 0, 16698 "type" => "integer" 16699 )); 16700} 16701?> 16702 16703<#5014> 16704<?php 16705$id = $ilDB->nextId('didactic_tpl_settings'); 16706$query = 'INSERT INTO didactic_tpl_settings (id,enabled,type,title, description,info,auto_generated,exclusive_tpl) values( ' . 16707 $ilDB->quote($id, 'integer') . ', ' . 16708 $ilDB->quote(1, 'integer') . ', ' . 16709 $ilDB->quote(1, 'integer') . ', ' . 16710 $ilDB->quote('grp_closed', 'text') . ', ' . 16711 $ilDB->quote('grp_closed_info', 'text') . ', ' . 16712 $ilDB->quote('', 'text') . ', ' . 16713 $ilDB->quote(1, 'integer') . ', ' . 16714 $ilDB->quote(0, 'integer') . ' ' . 16715 ')'; 16716$ilDB->manipulate($query); 16717 16718$query = 'INSERT INTO didactic_tpl_sa (id, obj_type) values( ' . 16719 $ilDB->quote($id, 'integer') . ', ' . 16720 $ilDB->quote('grp', 'text') . 16721 ')'; 16722$ilDB->manipulate($query); 16723 16724 16725$aid = $ilDB->nextId('didactic_tpl_a'); 16726$query = 'INSERT INTO didactic_tpl_a (id, tpl_id, type_id) values( ' . 16727 $ilDB->quote($aid, 'integer') . ', ' . 16728 $ilDB->quote($id, 'integer') . ', ' . 16729 $ilDB->quote(1, 'integer') . 16730 ')'; 16731$ilDB->manipulate($query); 16732 16733$query = 'select obj_id from object_data where type = ' . $ilDB->quote('rolt', 'text') . ' and title = ' . $ilDB->quote('il_grp_status_closed', 'text'); 16734$res = $ilDB->query($query); 16735while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 16736 $closed_id = $row->obj_id; 16737} 16738 16739$query = 'INSERT INTO didactic_tpl_alp (action_id, filter_type, template_type, template_id) values( ' . 16740 $ilDB->quote($aid, 'integer') . ', ' . 16741 $ilDB->quote(3, 'integer') . ', ' . 16742 $ilDB->quote(2, 'integer') . ', ' . 16743 $ilDB->quote($closed_id, 'integer') . 16744 ')'; 16745$ilDB->manipulate($query); 16746 16747 16748$fid = $ilDB->nextId('didactic_tpl_fp'); 16749$query = 'INSERT INTO didactic_tpl_fp (pattern_id, pattern_type, pattern_sub_type, pattern, parent_id, parent_type ) values( ' . 16750 $ilDB->quote($fid, 'integer') . ', ' . 16751 $ilDB->quote(1, 'integer') . ', ' . 16752 $ilDB->quote(1, 'integer') . ', ' . 16753 $ilDB->quote('.*', 'text') . ', ' . 16754 $ilDB->quote($aid, 'integer') . ', ' . 16755 $ilDB->quote('action', 'text') . 16756 ')'; 16757$ilDB->manipulate($query); 16758 16759?> 16760<#5015> 16761<?php 16762$query = 16763 "SELECT id FROM didactic_tpl_settings " . 16764 "WHERE title = " . $ilDB->quote('grp_closed', 'text') . 16765 " AND description = " . $ilDB->quote('grp_closed_info', 'text') . 16766 " AND auto_generated = 1"; 16767 16768$closed_grp = $ilDB->query($query)->fetchRow(ilDBConstants::FETCHMODE_OBJECT)->id; 16769 16770$query = 16771 "SELECT objr.obj_id obj_id, objr.ref_id ref_id " . 16772 "FROM (grp_settings grps JOIN object_reference objr ON (grps.obj_id = objr.obj_id)) " . 16773 "LEFT JOIN didactic_tpl_objs dtplo ON (dtplo.obj_id = objr.obj_id) " . 16774 "WHERE grps.grp_type = 1 " . 16775 "AND (dtplo.tpl_id IS NULL OR dtplo.tpl_id = 0)"; 16776$res = $ilDB->query($query); 16777 16778while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 16779 $query = 'INSERT INTO didactic_tpl_objs (obj_id,tpl_id,ref_id) ' . 16780 'VALUES( ' . 16781 $ilDB->quote($row->obj_id, 'integer') . ', ' . 16782 $ilDB->quote($closed_grp, 'integer') . ', ' . 16783 $ilDB->quote($row->ref_id, 'integer') . 16784 ')'; 16785 $ilDB->manipulate($query); 16786} 16787 16788?> 16789<#5016> 16790<?php 16791 16792include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16793 16794$type_id = ilDBUpdateNewObjectType::getObjectTypeId('grp'); 16795if ($type_id) { 16796 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('news_add_news', 'Add News', 'object', 2100); 16797 if ($new_ops_id) { 16798 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 16799 } 16800} 16801?> 16802 16803<#5017> 16804<?php 16805if (!$ilDB->tableColumnExists('il_news_item', 'content_html')) { 16806 $ilDB->addTableColumn( 16807 'il_news_item', 16808 'content_html', 16809 array( 16810 "type" => "integer", 16811 "notnull" => true, 16812 "length" => 1, 16813 "default" => 0 16814 ) 16815 ); 16816} 16817?> 16818 16819<#5018> 16820<?php 16821if (!$ilDB->tableColumnExists('il_news_item', 'update_user_id')) { 16822 $ilDB->addTableColumn( 16823 'il_news_item', 16824 'update_user_id', 16825 array( 16826 "type" => "integer", 16827 "notnull" => true, 16828 "length" => 4, 16829 "default" => 0 16830 ) 16831 ); 16832} 16833?> 16834<#5019> 16835<?php 16836include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16837 16838$type_id = ilDBUpdateNewObjectType::getObjectTypeId('crs'); 16839if ($type_id) { 16840 $ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("news_add_news"); 16841 if ($ops_id) { 16842 ilDBUpdateNewObjectType::addRBACOperation($type_id, $ops_id); 16843 } 16844} 16845?> 16846 16847<#5020> 16848<?php 16849include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16850$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 16851$target_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('news_add_news'); 16852ilDBUpdateNewObjectType::cloneOperation("crs", $src_ops_id, $target_ops_id); 16853ilDBUpdateNewObjectType::cloneOperation("grp", $src_ops_id, $target_ops_id); 16854?> 16855<#5021> 16856<?php 16857 16858if (!$ilDB->tableExists('background_task')) { 16859 $ilDB->createTable('background_task', array( 16860 'id' => array( 16861 'type' => 'integer', 16862 'length' => 4, 16863 'notnull' => true, 16864 'default' => 0 16865 ), 16866 'user_id' => array( 16867 'type' => 'integer', 16868 'length' => 4, 16869 'notnull' => true, 16870 'default' => 0 16871 ), 16872 'handler' => array( 16873 'type' => 'text', 16874 'length' => 1000, 16875 'notnull' => false 16876 ), 16877 'steps' => array( 16878 'type' => 'integer', 16879 'length' => 3, 16880 'notnull' => true, 16881 'default' => 0 16882 ), 16883 'cstep' => array( 16884 'type' => 'integer', 16885 'length' => 3, 16886 'notnull' => false 16887 ), 16888 'start_date' => array( 16889 'type' => 'timestamp' 16890 ), 16891 'status' => array( 16892 'type' => 'text', 16893 'length' => 100, 16894 'notnull' => false 16895 ), 16896 'params' => array( 16897 'type' => 'text', 16898 'length' => 4000, 16899 'notnull' => false 16900 ) 16901 )); 16902 16903 $ilDB->addPrimaryKey('background_task', array('id')); 16904 $ilDB->createSequence('background_task'); 16905} 16906 16907?> 16908<#5022> 16909<?php 16910 $ilCtrlStructureReader->getStructure(); 16911?> 16912<#5023> 16913<?php 16914if (!$ilDB->tableColumnExists('qpl_qst_mc', 'selection_limit')) { 16915 $ilDB->addTableColumn('qpl_qst_mc', 'selection_limit', array( 16916 'type' => 'integer', 16917 'length' => 4, 16918 'notnull' => false, 16919 'default' => null 16920 )); 16921} 16922?> 16923 16924 16925<#5024> 16926 16927<?php 16928include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 16929$obj_type_id = ilDBUpdateNewObjectType::addNewType("mass", "Manual Assessment"); 16930$existing_ops = array('visible', 'read', 'write', 'copy', 'delete' 16931 , 'edit_permission', 'read_learning_progress', 'edit_learning_progress'); 16932foreach ($existing_ops as $op) { 16933 $op_id = ilDBUpdateNewObjectType::getCustomRBACOperationId($op); 16934 ilDBUpdateNewObjectType::addRBACOperation($obj_type_id, $op_id); 16935} 16936$parent_types = array('root', 'cat', 'crs'); 16937ilDBUpdateNewObjectType::addRBACCreate('create_mass', 'Create Manuall Assessment', $parent_types); 16938 16939if (!$ilDB->tableExists("mass_settings")) { 16940 $fields = array( 16941 'obj_id' => array( 16942 'type' => 'integer', 16943 'length' => 4, 16944 'notnull' => true, 16945 'default' => 0 16946 ), 16947 'content' => array( 16948 'type' => 'text', 16949 'length' => 1000, 16950 'notnull' => false, 16951 'default' => null 16952 ), 16953 'record_template' => array( 16954 'type' => 'text', 16955 'length' => 1000, 16956 'notnull' => false, 16957 'default' => null 16958 ) 16959 ); 16960 $ilDB->createTable('mass_settings', $fields); 16961} 16962 16963if (!$ilDB->tableExists('mass_members')) { 16964 $fields = array( 16965 'obj_id' => array( 16966 'type' => 'integer', 16967 'length' => 4, 16968 'notnull' => true, 16969 'default' => 0 16970 ), 16971 'usr_id' => array( 16972 'type' => 'integer', 16973 'length' => 4, 16974 'notnull' => true, 16975 'default' => 0 16976 ), 16977 'examiner_id' => array( 16978 'type' => 'integer', 16979 'length' => 4, 16980 'notnull' => false, 16981 'default' => 0 16982 ), 16983 'record' => array( 16984 'type' => 'text', 16985 'length' => 1000, 16986 'notnull' => false, 16987 'default' => '' 16988 ), 16989 'internal_note' => array( 16990 'type' => 'text', 16991 'length' => 1000, 16992 'notnull' => false, 16993 'default' => '' 16994 ), 16995 'notify' => array( 16996 'type' => 'integer', 16997 'length' => 1, 16998 'notnull' => true, 16999 'default' => 0 17000 ), 17001 'notification_ts' => array( 17002 'type' => 'integer', 17003 'length' => 4, 17004 'notnull' => true, 17005 'default' => -1 17006 ), 17007 'learning_progress' => array( 17008 'type' => 'integer', 17009 'length' => 1, 17010 'notnull' => false, 17011 'default' => 0 17012 ), 17013 'finalized' => array( 17014 'type' => 'integer', 17015 'length' => 1, 17016 'notnull' => true, 17017 'default' => 0 17018 ) 17019 ); 17020 $ilDB->createTable('mass_members', $fields); 17021} 17022 17023$mass_type_id = ilDBUpdateNewObjectType::getObjectTypeId('mass'); 17024if ($mass_type_id) { 17025 $custom_ops = array('edit_members' => 'Manage members'); 17026 $counter = 1; 17027 foreach ($custom_ops as $ops_id => $ops_description) { 17028 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation( 17029 $ops_id, 17030 $ops_description, 17031 'object', 17032 8000 + $counter * 100 17033 ); 17034 $counter++; 17035 if ($new_ops_id) { 17036 ilDBUpdateNewObjectType::addRBACOperation($mass_type_id, $new_ops_id); 17037 } 17038 } 17039 $rolt_title = 'il_mass_member'; 17040 $rec = $ilDB->fetchAssoc( 17041 $ilDB->query("SELECT obj_id FROM object_data " 17042 . " WHERE type = 'rolt' AND title = " . $ilDB->quote($rolt_title, 'text')) 17043 ); 17044 if ($rec) { 17045 $mass_member_tpl_id = $rec['obj_id']; 17046 } else { 17047 $mass_member_tpl_id = $ilDB->nextId('object_data'); 17048 $ilDB->manipulateF( 17049 " 17050 INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . 17051 "VALUES (%s, %s, %s, %s, %s, %s, %s)", 17052 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), 17053 array($mass_member_tpl_id, "rolt", $rolt_title, "Member of a manual assessment object", -1, ilUtil::now(), ilUtil::now()) 17054 ); 17055 } 17056 $ops = array(); 17057 $rec = $ilDB->fetchAssoc( 17058 $ilDB->query("SELECT ops_id FROM rbac_operations WHERE operation = 'visible'") 17059 ); 17060 $ops[] = $rec['ops_id']; 17061 $rec = $ilDB->fetchAssoc( 17062 $ilDB->query("SELECT ops_id FROM rbac_operations WHERE operation = 'read'") 17063 ); 17064 $ops[] = $rec['ops_id']; 17065 foreach ($ops as $op_id) { 17066 if (!$ilDB->fetchAssoc( 17067 $ilDB->query("SELECT * FROM rbac_templates " 17068 . " WHERE ops_id = " . $ilDB->quote($op_id, 'integer') 17069 . " AND rol_id = " . $ilDB->quote($mass_member_tpl_id, 'integer')) 17070 )) { 17071 $query = "INSERT INTO rbac_templates 17072 VALUES (" . $ilDB->quote($mass_member_tpl_id) . ", 'mass', " . $ilDB->quote($op_id) . ", 8)"; 17073 $ilDB->manipulate($query); 17074 } 17075 } 17076 $query = "INSERT INTO rbac_fa VALUES (" . $ilDB->quote($mass_member_tpl_id) . ", 8, 'n', 'n', 0)"; 17077 $ilDB->manipulate($query); 17078} 17079?> 17080 17081<#5025> 17082<?php 17083if (!$ilDB->tableExists("mass_info_settings")) { 17084 $fields = array( 17085 'obj_id' => array( 17086 'type' => 'integer', 17087 'length' => 4, 17088 'notnull' => true, 17089 'default' => 0 17090 ), 17091 'contact' => array( 17092 'type' => 'text', 17093 'length' => 100, 17094 'notnull' => false, 17095 'default' => null 17096 ), 17097 'responsibility' => array( 17098 'type' => 'text', 17099 'length' => 100, 17100 'notnull' => false, 17101 'default' => null 17102 ), 17103 'phone' => array( 17104 'type' => 'text', 17105 'length' => 100, 17106 'notnull' => false, 17107 'default' => null 17108 ), 17109 'mails' => array( 17110 'type' => 'text', 17111 'length' => 300, 17112 'notnull' => false, 17113 'default' => null 17114 ), 17115 'consultation_hours' => array( 17116 'type' => 'text', 17117 'length' => 500, 17118 'notnull' => false, 17119 'default' => null 17120 ), 17121 ); 17122 $ilDB->createTable('mass_info_settings', $fields); 17123} 17124?> 17125<#5026> 17126<?php 17127if (!$ilDB->indexExistsByFields('mass_settings', array('obj_id'))) { 17128 $ilDB->addPrimaryKey('mass_settings', array('obj_id')); 17129} 17130if (!$ilDB->indexExistsByFields('mass_info_settings', array('obj_id'))) { 17131 $ilDB->addPrimaryKey('mass_info_settings', array('obj_id')); 17132} 17133if (!$ilDB->indexExistsByFields('mass_members', array('obj_id','usr_id'))) { 17134 $ilDB->addPrimaryKey('mass_members', array('obj_id','usr_id')); 17135} 17136?> 17137<#5027> 17138<?php 17139 if (!$ilDB->indexExistsByFields('lng_data', array('local_change'))) { 17140 $ilDB->addIndex('lng_data', array('local_change'), 'i3'); 17141 } 17142?> 17143<#5028> 17144<?php 17145if (!$ilDB->tableExists('osc_activity')) { 17146 $ilDB->createTable( 17147 'osc_activity', 17148 array( 17149 'conversation_id' => array( 17150 'type' => 'text', 17151 'length' => 255, 17152 'notnull' => true 17153 ), 17154 'user_id' => array( 17155 'type' => 'integer', 17156 'length' => 4, 17157 'notnull' => true, 17158 'default' => 0 17159 ), 17160 'timestamp' => array( 17161 'type' => 'integer', 17162 'length' => 8, 17163 'notnull' => true, 17164 'default' => 0 17165 ) 17166 ) 17167 ); 17168 $ilDB->addPrimaryKey('osc_activity', array('conversation_id', 'user_id')); 17169} 17170?> 17171<#5029> 17172<?php 17173if (!$ilDB->tableExists('osc_messages')) { 17174 $ilDB->createTable( 17175 'osc_messages', 17176 array( 17177 'id' => array( 17178 'type' => 'text', 17179 'length' => 255, 17180 'notnull' => true 17181 ), 17182 'conversation_id' => array( 17183 'type' => 'text', 17184 'length' => 255, 17185 'notnull' => true 17186 ), 17187 'user_id' => array( 17188 'type' => 'integer', 17189 'length' => 4, 17190 'notnull' => true, 17191 'default' => 0 17192 ), 17193 'message' => array( 17194 'type' => 'clob', 17195 'notnull' => false, 17196 'default' => null 17197 ), 17198 'timestamp' => array( 17199 'type' => 'integer', 17200 'length' => 8, 17201 'notnull' => true, 17202 'default' => 0 17203 ) 17204 ) 17205 ); 17206 $ilDB->addPrimaryKey('osc_messages', array('id')); 17207} 17208?> 17209<#5030> 17210<?php 17211if (!$ilDB->tableExists('osc_conversation')) { 17212 $ilDB->createTable( 17213 'osc_conversation', 17214 array( 17215 'id' => array( 17216 'type' => 'text', 17217 'length' => 255, 17218 'notnull' => true 17219 ), 17220 'is_group' => array( 17221 'type' => 'integer', 17222 'length' => 1, 17223 'notnull' => true, 17224 'default' => 0 17225 ), 17226 'participants' => array( 17227 'type' => 'text', 17228 'length' => 4000, 17229 'notnull' => false, 17230 'default' => null 17231 ) 17232 ) 17233 ); 17234 $ilDB->addPrimaryKey('osc_conversation', array('id')); 17235} 17236?> 17237<#5031> 17238<?php 17239if (!$ilDB->tableColumnExists('osc_activity', 'is_closed')) { 17240 $ilDB->addTableColumn('osc_activity', 'is_closed', array( 17241 'type' => 'integer', 17242 'length' => 1, 17243 'notnull' => true, 17244 'default' => 0 17245 )); 17246} 17247?> 17248<#5032> 17249<?php 17250$ilCtrlStructureReader->getStructure(); 17251?> 17252<#5033> 17253<?php 17254if (!$ilDB->tableExists('user_action_activation')) { 17255 $ilDB->createTable('user_action_activation', array( 17256 'context_comp' => array( 17257 'type' => 'text', 17258 'length' => 30, 17259 'notnull' => true 17260 ), 17261 'context_id' => array( 17262 'type' => 'text', 17263 'length' => 30, 17264 'notnull' => true 17265 ), 17266 'action_comp' => array( 17267 'type' => 'text', 17268 'length' => 30, 17269 'notnull' => true 17270 ), 17271 'action_type' => array( 17272 'type' => 'text', 17273 'length' => 30, 17274 'notnull' => true 17275 ), 17276 'active' => array( 17277 'type' => 'integer', 17278 'length' => 1, 17279 'notnull' => true, 17280 'default' => 0 17281 ) 17282 )); 17283 17284 $ilDB->addPrimaryKey('user_action_activation', array('context_comp', 'context_id', 'action_comp', 'action_type')); 17285} 17286?> 17287<#5034> 17288<?php 17289$ilCtrlStructureReader->getStructure(); 17290?> 17291<#5035> 17292<?php 17293$fields = array( 17294 'ref_id' => array( 17295 'type' => 'integer', 17296 'length' => '8', 17297 17298 ), 17299 'obj_id' => array( 17300 'type' => 'integer', 17301 'length' => '8', 17302 17303 ), 17304 'path' => array( 17305 'type' => 'clob', 17306 17307 ), 17308 17309); 17310if (!$ilDB->tableExists('orgu_path_storage')) { 17311 $ilDB->createTable('orgu_path_storage', $fields); 17312 $ilDB->addPrimaryKey('orgu_path_storage', array( 'ref_id' )); 17313} 17314?> 17315<#5036> 17316<?php 17317$ilCtrlStructureReader->getStructure(); 17318?> 17319 17320<#5037> 17321<?php 17322 17323include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 17324ilDBUpdateNewObjectType::deleteRBACOperation('grpr', ilDBUpdateNewObjectType::RBAC_OP_READ); 17325 17326?> 17327<#5038> 17328<?php 17329$ilCtrlStructureReader->getStructure(); 17330?> 17331<#5039> 17332<?php 17333 17334// get badge administration ref_id 17335$set = $ilDB->query("SELECT oref.ref_id FROM object_reference oref" . 17336 " JOIN object_data od ON (od.obj_id = oref.obj_id)" . 17337 " WHERE od.type = " . $ilDB->quote("bdga")); 17338$bdga_ref_id = $ilDB->fetchAssoc($set); 17339$bdga_ref_id = (int) $bdga_ref_id["ref_id"]; 17340if ($bdga_ref_id) { 17341 // #18931 - check if ref_id can be found as child of admin node 17342 $set = $ilDB->query("SELECT parent FROM tree" . 17343 " WHERE child = " . $ilDB->quote($bdga_ref_id, "int") . 17344 " AND tree.tree = " . $ilDB->quote(1, "int")); 17345 $bdga_tree = $ilDB->fetchAssoc($set); 17346 $bdga_tree = (int) $bdga_tree["parent"]; 17347 if ($bdga_tree != SYSTEM_FOLDER_ID) { 17348 $tree = new ilTree(ROOT_FOLDER_ID); 17349 $tree->insertNode($bdga_ref_id, SYSTEM_FOLDER_ID); 17350 } 17351} 17352 17353?> 17354<#5040> 17355<?php 17356//step 1/5 il_verification removes dublicates 17357if ($ilDB->tableExists('il_verification')) { 17358 $res = $ilDB->query(" 17359 SELECT id, type 17360 FROM il_verification 17361 GROUP BY id, type 17362 HAVING COUNT(id) > 1 17363 "); 17364 17365 if ($ilDB->numRows($res)) { 17366 if (!$ilDB->tableExists('il_verification_tmp')) { 17367 $ilDB->createTable('il_verification_tmp', array( 17368 'id' => array( 17369 'type' => 'integer', 17370 'length' => 8, 17371 'notnull' => true, 17372 'default' => 0 17373 ) 17374 )); 17375 $ilDB->addPrimaryKey('il_verification_tmp', array('id', 'type')); 17376 } 17377 17378 while ($row = $ilDB->fetchAssoc($res)) { 17379 $ilDB->replace('il_verification_tmp', array(), array( 17380 'id' => array('integer', $row['id']), 17381 'type' => array('text', $row['type']) 17382 )); 17383 } 17384 } 17385} 17386?> 17387<#5041> 17388<?php 17389//step 2/5 il_verification deletes dublicates stored in il_verification_tmp 17390if ($ilDB->tableExists('il_verification_tmp')) { 17391 $res = $ilDB->query(" 17392 SELECT id, type 17393 FROM il_verification_tmp 17394 "); 17395 17396 while ($row = $ilDB->fetchAssoc($res)) { 17397 $res_data = $ilDB->query( 17398 " 17399 SELECT * 17400 FROM il_verification 17401 WHERE 17402 id = " . $ilDB->quote($row['id'], 'integer') . " AND 17403 type = " . $ilDB->quote($row['type'], 'text') 17404 ); 17405 $data = $ilDB->fetchAssoc($res_data); 17406 17407 $ilDB->manipulate( 17408 "DELETE FROM il_verification WHERE" . 17409 " id = " . $ilDB->quote($row['id'], 'integer') . 17410 " AND type = " . $ilDB->quote($row['type'], 'text') 17411 ); 17412 17413 $ilDB->manipulate("INSERT INTO il_verification (id, type, parameters, raw_data) " . 17414 "VALUES ( " . 17415 $ilDB->quote($data['id'], 'integer') . ', ' . 17416 $ilDB->quote($data['type'], 'text') . ', ' . 17417 $ilDB->quote($data['parameters'], 'text') . ', ' . 17418 $ilDB->quote($data['raw_data'], 'text') . 17419 ")"); 17420 17421 $ilDB->manipulate( 17422 "DELETE FROM il_verification_tmp WHERE" . 17423 " id = " . $ilDB->quote($row['id'], 'integer') . 17424 " AND type = " . $ilDB->quote($row['type'], 'text') 17425 ); 17426 } 17427} 17428?> 17429<#5042> 17430<?php 17431//step 3/5 il_verification drops not used indexes 17432if ($ilDB->indexExistsByFields('il_verification', array('id'))) { 17433 $ilDB->dropIndexByFields('il_verification', array('id')); 17434} 17435?> 17436<#5043> 17437<?php 17438//step 4/5 il_verification adding primary key 17439if ($ilDB->tableExists('il_verification')) { 17440 $ilDB->dropPrimaryKey('il_verification'); 17441 $ilDB->addPrimaryKey('il_verification', array('id', 'type')); 17442} 17443?> 17444<#5044> 17445<?php 17446//step 5/5 il_verification removes temp table 17447if ($ilDB->tableExists('il_verification_tmp')) { 17448 $ilDB->dropTable('il_verification_tmp'); 17449} 17450?> 17451<#5045> 17452<?php 17453$ilCtrlStructureReader->getStructure(); 17454?> 17455<#5046> 17456<?php 17457 $ilDB->addPrimaryKey('glo_glossaries', array('id', 'glo_id')); 17458?> 17459<#5047> 17460<?php 17461 $ilCtrlStructureReader->getStructure(); 17462?> 17463<#5048> 17464<?php 17465if ($ilDB->sequenceExists('mail_obj_data')) { 17466 $ilDB->dropSequence('mail_obj_data'); 17467} 17468 17469if ($ilDB->sequenceExists('mail_obj_data')) { 17470 die("Sequence could not be dropped!"); 17471} else { 17472 $res1 = $ilDB->query("SELECT MAX(child) max_id FROM mail_tree"); 17473 $row1 = $ilDB->fetchAssoc($res1); 17474 17475 $res2 = $ilDB->query("SELECT MAX(obj_id) max_id FROM mail_obj_data"); 17476 $row2 = $ilDB->fetchAssoc($res2); 17477 17478 $start = max($row1['max_id'], $row2['max_id']) + 2; // add + 2 to be save 17479 17480 $ilDB->createSequence('mail_obj_data', $start); 17481} 17482?> 17483<#5049> 17484<?php 17485 $ilCtrlStructureReader->getStructure(); 17486?> 17487<#5050> 17488<?php 17489 require_once 'Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 17490 17491 ilDBUpdateNewObjectType::updateOperationOrder("edit_members", 2400); 17492?> 17493<#5051> 17494<?php 17495 $ilCtrlStructureReader->getStructure(); 17496?> 17497<#5052> 17498<?php 17499 $ilCtrlStructureReader->getStructure(); 17500?> 17501<#5053> 17502<?php 17503 $ilCtrlStructureReader->getStructure(); 17504?> 17505<#5054> 17506<?php 17507 $ilCtrlStructureReader->getStructure(); 17508?> 17509<#5055> 17510<?php 17511// 1. Select all the questions of surveys 17512$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"; 17513$res = $ilDB->query($q); 17514 17515while ($svy_data = $res->fetchAssoc()) { 17516 $question_id = $svy_data['question_id']; 17517 $svy_id = $svy_data['survey_fi']; 17518 17519 $q = "SELECT obj_fi FROM svy_svy WHERE survey_id = " . $ilDB->quote($svy_id, "integer"); 17520 $res2 = $ilDB->query($q); 17521 $row = $res2->fetchAssoc(); 17522 $obj_id = $row['obj_fi']; 17523 17524 $u = "UPDATE svy_question SET obj_fi = " . $ilDB->quote($obj_id, "integer") . " WHERE question_id = " . $ilDB->quote($question_id, "integer"); 17525 $ilDB->query($u); 17526} 17527?> 17528<#5056> 17529<?php 17530$ilDB->update( 17531 'il_dcl_datatype', 17532 array( 17533 "ildb_type" => array("text", "text"), 17534 "storage_location" => array("integer", 1) 17535 ), 17536 array( 17537 "title" => array("text", "reference") 17538 ) 17539); 17540?> 17541<#5057> 17542<?php 17543if (!$ilDB->tableColumnExists('qpl_qst_type', 'plugin_name')) { 17544 $ilDB->addTableColumn('qpl_qst_type', 'plugin_name', array( 17545 'type' => 'text', 17546 'length' => 40, 17547 'notnull' => false, 17548 'default' => null 17549 )); 17550} 17551?> 17552<#5058> 17553<?php 17554if (!$ilDB->tableColumnExists('qpl_a_ordering', 'order_position')) { 17555 $ilDB->addTableColumn('qpl_a_ordering', 'order_position', array( 17556 'type' => 'integer', 17557 'length' => 3, 17558 'notnull' => false, 17559 'default' => null 17560 )); 17561 17562 $ilDB->manipulate("UPDATE qpl_a_ordering SET order_position = solution_order"); 17563 $ilDB->renameTableColumn('qpl_a_ordering', 'solution_order', 'solution_keyvalue'); 17564} 17565?> 17566<#5059> 17567<?php 17568if ($ilDB->tableColumnExists('qpl_a_ordering', 'solution_keyvalue')) { 17569 $ilDB->renameTableColumn('qpl_a_ordering', 'solution_keyvalue', 'solution_key'); 17570} 17571?> 17572<#5060> 17573<?php 17574if ($ilDB->tableColumnExists('qpl_a_ordering', 'order_position')) { 17575 $ilDB->renameTableColumn('qpl_a_ordering', 'order_position', 'position'); 17576} 17577?> 17578<#5061> 17579<?php 17580 $ilCtrlStructureReader->getStructure(); 17581?> 17582 17583<#5062> 17584<?php 17585 //rename tables 17586 if ($ilDB->tableExists('mass_info_settings') && !$ilDB->tableExists('iass_info_settings')) { 17587 $ilDB->renameTable('mass_info_settings', 'iass_info_settings'); 17588 } 17589 17590 if ($ilDB->tableExists('mass_settings') && !$ilDB->tableExists('iass_settings')) { 17591 $ilDB->renameTable('mass_settings', 'iass_settings'); 17592 } 17593 17594 if ($ilDB->tableExists('mass_members') && !$ilDB->tableExists('iass_members')) { 17595 $ilDB->renameTable('mass_members', 'iass_members'); 17596 } 17597 17598 //change obj type 17599 $ilDB->manipulate('UPDATE object_data SET type = ' . $ilDB->quote('iass', 'text') 17600 . ' WHERE type = ' . $ilDB->quote('mass', 'text')); 17601 17602 //change name of role template for iass member 17603 $ilDB->manipulate('UPDATE object_data SET title = ' . $ilDB->quote('il_iass_member', 'text') 17604 . ' WHERE type = ' . $ilDB->quote('rolt', 'text') 17605 . ' AND title =' . $ilDB->quote('il_mass_member', 'text')); 17606 17607 //change names of existing iass member roles 17608 $ilDB->manipulate('UPDATE object_data SET title = REPLACE(title,' . $ilDB->quote('_mass_', 'text') . ',' . $ilDB->quote('_iass_', 'text') . ')' 17609 . ' WHERE type = ' . $ilDB->quote('role', 'text') 17610 . ' AND title LIKE ' . $ilDB->quote('il_mass_member_%', 'text')); 17611 17612 //change typ name 17613 $ilDB->manipulate('UPDATE object_data SET title = ' . $ilDB->quote('iass', 'text') 17614 . ' ,description = ' . $ilDB->quote('Individual Assessment', 'text') 17615 . ' WHERE type = ' . $ilDB->quote('typ', 'text') 17616 . ' AND title = ' . $ilDB->quote('mass', 'text')); 17617 17618 //adapt object declaration in rbac 17619 $ilDB->manipulate('UPDATE rbac_templates SET type = ' . $ilDB->quote('iass', 'text') 17620 . ' WHERE type = ' . $ilDB->quote('mass', 'text')); 17621 17622 //change op names 17623 $ilDB->manipulate('UPDATE rbac_operations SET operation = ' . $ilDB->quote('create_iass', 'text') 17624 . ' ,description = ' . $ilDB->quote('Create Individual Assessment', 'text') 17625 . ' WHERE operation = ' . $ilDB->quote('create_mass', 'text')); 17626 17627 $ilCtrlStructureReader->getStructure(); 17628?> 17629<#5063> 17630<?php 17631if ($ilDB->tableExists('svy_qst_oblig')) { 17632 $ilDB->manipulate("UPDATE svy_question" . 17633 " INNER JOIN svy_qst_oblig" . 17634 " ON svy_question.question_id = svy_qst_oblig.question_fi" . 17635 " SET svy_question.obligatory = svy_qst_oblig.obligatory"); 17636} 17637?> 17638<#5064> 17639<?php 17640$ilDB->modifyTableColumn( 17641 'mail_attachment', 17642 'path', 17643 array( 17644 "type" => "text", 17645 "length" => 500, 17646 "notnull" => false, 17647 'default' => null 17648 ) 17649); 17650?> 17651<#5065> 17652<?php 17653 $ilCtrlStructureReader->getStructure(); 17654?> 17655<#5066> 17656<?php 17657 $ilCtrlStructureReader->getStructure(); 17658?> 17659<#5067> 17660<?php 17661 17662 if (!$ilDB->tableColumnExists('qpl_a_mterm', 'ident')) { 17663 $ilDB->addTableColumn('qpl_a_mterm', 'ident', array( 17664 'type' => 'integer', 'length' => 4, 17665 'notnull' => false, 'default' => null 17666 )); 17667 17668 $ilDB->manipulate("UPDATE qpl_a_mterm SET ident = term_id WHERE ident IS NULL"); 17669 } 17670 17671 if (!$ilDB->tableColumnExists('qpl_a_mdef', 'ident')) { 17672 require_once 'Services/Database/classes/class.ilDBAnalyzer.php'; 17673 $ilDB->renameTableColumn('qpl_a_mdef', 'morder', 'ident'); 17674 } 17675 17676?> 17677<#5068> 17678<?php 17679$ilDB->modifyTableColumn( 17680 'exc_returned', 17681 'mimetype', 17682 array( 17683 'type' => 'text', 17684 'length' => 150, 17685 'notnull' => false) 17686); 17687?> 17688<#5069> 17689<?php 17690include_once('./Services/Migration/DBUpdate_5069/classes/class.ilDBUpdate5069.php'); 17691ilDBUpdate5069::fix19795(); 17692?> 17693 17694<#5070> 17695<?php 17696 17697// remove role entries in obj_members 17698$query = 'update obj_members set admin = ' . $ilDB->quote(0, 'integer') . ', ' . 17699 'tutor = ' . $ilDB->quote(0, 'integer') . ', member = ' . $ilDB->quote(0, 'integer'); 17700$ilDB->manipulate($query); 17701 17702// iterate through all courses 17703$offset = 0; 17704$limit = 100; 17705do { 17706 $ilDB->setLimit($limit, $offset); 17707 $query = 'SELECT obr.ref_id, obr.obj_id FROM object_reference obr ' . 17708 'join object_data obd on obr.obj_id = obd.obj_id where (type = ' . $ilDB->quote('crs', 'text') . ' or type = ' . $ilDB->quote('grp', 'text') . ') '; 17709 $res = $ilDB->query($query); 17710 17711 if (!$res->numRows()) { 17712 break; 17713 } 17714 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 17715 // find course members roles 17716 $query = 'select rol_id, title from rbac_fa ' . 17717 'join object_data on rol_id = obj_id ' . 17718 'where parent = ' . $ilDB->quote($row->ref_id, 'integer') . ' ' . 17719 'and assign = ' . $ilDB->quote('y', 'text'); 17720 $rol_res = $ilDB->query($query); 17721 while ($rol_row = $rol_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 17722 // find users which are not assigned to obj_members and create a default entry 17723 $query = 'select ua.usr_id from rbac_ua ua ' . 17724 'left join obj_members om on (ua.usr_id = om.usr_id and om.obj_id = ' . $ilDB->quote($row->obj_id, 'integer') . ') ' . 17725 'where om.usr_id IS NULL ' . 17726 'and rol_id = ' . $ilDB->quote($rol_row->rol_id, 'integer'); 17727 $ua_res = $ilDB->query($query); 17728 while ($ua_row = $ua_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 17729 $query = 'insert into obj_members (obj_id, usr_id) ' . 17730 'values(' . 17731 $ilDB->quote($row->obj_id, 'integer') . ', ' . 17732 $ilDB->quote($ua_row->usr_id, 'integer') . ' ' . 17733 ')'; 17734 $ilDB->manipulate($query); 17735 } 17736 17737 // find users which are assigned to obj_members and update their role assignment 17738 $query = 'select usr_id from rbac_ua ' . 17739 'where rol_id = ' . $ilDB->quote($rol_row->rol_id, 'integer'); 17740 17741 $ua_res = $ilDB->query($query); 17742 while ($ua_row = $ua_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 17743 $admin = $tutor = $member = 0; 17744 switch (substr($rol_row->title, 0, 8)) { 17745 case 'il_crs_a': 17746 case 'il_grp_a': 17747 $admin = 1; 17748 break; 17749 17750 case 'il_crs_t': 17751 $tutor = 1; 17752 break; 17753 17754 default: 17755 case 'il_grp_m': 17756 case 'il_crs_m': 17757 $member = 1; 17758 break; 17759 } 17760 17761 $query = 'update obj_members ' . 17762 'set admin = admin + ' . $ilDB->quote($admin, 'integer') . ', ' . 17763 'tutor = tutor + ' . $ilDB->quote($tutor, 'integer') . ', ' . 17764 'member = member + ' . $ilDB->quote($member, 'integer') . ' ' . 17765 'WHERE usr_id = ' . $ilDB->quote($ua_row->usr_id, 'integer') . ' ' . 17766 'AND obj_id = ' . $ilDB->quote($row->obj_id, 'integer'); 17767 $ilDB->manipulate($query); 17768 } 17769 } 17770 } 17771 // increase offset 17772 $offset += $limit; 17773} while (true); 17774?> 17775 17776<#5071> 17777<?php 17778 17779$ilDB->manipulate( 17780 'delete from obj_members where admin = ' . 17781 $ilDB->quote(0, 'integer') . ' and tutor = ' . 17782 $ilDB->quote(0, 'integer') . ' and member = ' . 17783 $ilDB->quote(0, 'integer') 17784); 17785?> 17786<#5072> 17787<?php 17788 $ilCtrlStructureReader->getStructure(); 17789?> 17790<#5073> 17791<?php 17792$ilDB->modifyTableColumn( 17793 'wiki_stat_page', 17794 'num_ratings', 17795 array( 17796 'type' => 'integer', 17797 'length' => 4, 17798 'notnull' => true, 17799 'default' => 0 17800 ) 17801); 17802?> 17803<#5074> 17804<?php 17805$ilDB->modifyTableColumn( 17806 'wiki_stat_page', 17807 'avg_rating', 17808 array( 17809 'type' => 'integer', 17810 'length' => 4, 17811 'notnull' => true, 17812 'default' => 0 17813 ) 17814); 17815?> 17816<#5075> 17817<?php 17818$query = "SELECT value FROM settings WHERE module = %s AND keyword = %s"; 17819$res = $ilDB->queryF($query, array('text', 'text'), array("mobs", "black_list_file_types")); 17820if (!$ilDB->fetchAssoc($res)) { 17821 $mset = new ilSetting("mobs"); 17822 $mset->set("black_list_file_types", "html"); 17823} 17824?> 17825<#5076> 17826<?php 17827// #0020342 17828$query = $ilDB->query('SELECT 17829 stloc.* 17830FROM 17831 il_dcl_stloc2_value stloc 17832 INNER JOIN 17833 il_dcl_record_field rf ON stloc.record_field_id = rf.id 17834 INNER JOIN 17835 il_dcl_field f ON rf.field_id = f.id 17836WHERE 17837 f.datatype_id = 3 17838ORDER BY stloc.id ASC'); 17839while ($row = $query->fetchAssoc()) { 17840 $query2 = $ilDB->query('SELECT * FROM il_dcl_stloc1_value WHERE record_field_id = ' . $ilDB->quote($row['record_field_id'], 'integer')); 17841 if ($ilDB->numRows($query2)) { 17842 $rec = $ilDB->fetchAssoc($query2); 17843 if ($rec['value'] != null) { 17844 continue; 17845 } 17846 } 17847 $id = $ilDB->nextId('il_dcl_stloc1_value'); 17848 $ilDB->insert('il_dcl_stloc1_value', array( 17849 'id' => array('integer', $id), 17850 'record_field_id' => array('integer', $row['record_field_id']), 17851 'value' => array('text', $row['value']), 17852 )); 17853 $ilDB->manipulate('DELETE FROM il_dcl_stloc2_value WHERE id = ' . $ilDB->quote($row['id'], 'integer')); 17854} 17855?> 17856<#5077> 17857<?php 17858 17859$ilDB->manipulate( 17860 'update grp_settings set registration_start = ' . $ilDB->quote(null, 'integer') . ', ' . 17861 'registration_end = ' . $ilDB->quote(null, 'integer') . ' ' . 17862 'where registration_unlimited = ' . $ilDB->quote(1, 'integer') 17863); 17864?> 17865 17866<#5078> 17867<?php 17868$ilDB->manipulate( 17869 'update crs_settings set ' 17870 . 'sub_start = ' . $ilDB->quote(null, 'integer') . ', ' 17871 . 'sub_end = ' . $ilDB->quote(null, 'integer') . ' ' 17872 . 'WHERE sub_limitation_type != ' . $ilDB->quote(2, 'integer') 17873); 17874 17875?> 17876<#5079> 17877<?php 17878if (!$ilDB->tableColumnExists('grp_settings', 'grp_start')) { 17879 $ilDB->addTableColumn( 17880 'grp_settings', 17881 'grp_start', 17882 array( 17883 "type" => "integer", 17884 "notnull" => false, 17885 "length" => 4 17886 ) 17887 ); 17888} 17889if (!$ilDB->tableColumnExists('grp_settings', 'grp_end')) { 17890 $ilDB->addTableColumn( 17891 'grp_settings', 17892 'grp_end', 17893 array( 17894 "type" => "integer", 17895 "notnull" => false, 17896 "length" => 4 17897 ) 17898 ); 17899} 17900?> 17901<#5080> 17902<?php 17903if (!$ilDB->tableColumnExists('frm_posts', 'pos_activation_date')) { 17904 $ilDB->addTableColumn( 17905 'frm_posts', 17906 'pos_activation_date', 17907 array('type' => 'timestamp', 'notnull' => false) 17908 ); 17909} 17910?> 17911<#5081> 17912<?php 17913if ($ilDB->tableColumnExists('frm_posts', 'pos_activation_date')) { 17914 $ilDB->manipulate( 17915 ' 17916 UPDATE frm_posts SET pos_activation_date = pos_date 17917 WHERE pos_status = ' . $ilDB->quote(1, 'integer') 17918 . ' AND pos_activation_date is NULL' 17919 ); 17920} 17921?> 17922<#5082> 17923<?php 17924if ($ilDB->tableExists('svy_answer')) { 17925 if ($ilDB->tableColumnExists('svy_answer', 'textanswer')) { 17926 $ilDB->modifyTableColumn('svy_answer', 'textanswer', array( 17927 'type' => 'clob', 17928 'notnull' => false 17929 )); 17930 } 17931} 17932?> 17933 17934<#5083> 17935<?php 17936 17937include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 17938 17939$rp_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("read_learning_progress"); 17940$ep_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 17941$w_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 17942if ($rp_ops_id && $ep_ops_id && $w_ops_id) { 17943 // see ilObjectLP 17944 $lp_types = array('file'); 17945 17946 foreach ($lp_types as $lp_type) { 17947 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId($lp_type); 17948 if ($lp_type_id) { 17949 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $rp_ops_id); 17950 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ep_ops_id); 17951 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $rp_ops_id); 17952 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $ep_ops_id); 17953 } 17954 } 17955} 17956?> 17957 17958<#5084> 17959<?php 17960// #0020342 17961$query = $ilDB->query('SELECT 17962 stloc.*, 17963 fp.value as fp_value, 17964 fp.name as fp_name 17965FROM 17966 il_dcl_stloc1_value stloc 17967 INNER JOIN 17968 il_dcl_record_field rf ON stloc.record_field_id = rf.id 17969 INNER JOIN 17970 il_dcl_field f ON rf.field_id = f.id 17971 INNER JOIN 17972 il_dcl_field_prop fp ON rf.field_id = fp.field_id 17973WHERE 17974 f.datatype_id = 3 17975 AND fp.name = ' . $ilDB->quote("multiple_selection", 'text') . ' 17976 AND fp.value = ' . $ilDB->quote("1", 'text') . ' 17977ORDER BY stloc.id ASC'); 17978 17979while ($row = $query->fetchAssoc()) { 17980 if (!is_numeric($row['value'])) { 17981 continue; 17982 } 17983 17984 $value_array = array($row['value']); 17985 17986 $query2 = $ilDB->query('SELECT * FROM il_dcl_stloc2_value WHERE record_field_id = ' . $ilDB->quote($row['record_field_id'], 'integer')); 17987 while ($row2 = $ilDB->fetchAssoc($query2)) { 17988 $value_array[] = $row2['value']; 17989 } 17990 17991 $ilDB->update('il_dcl_stloc1_value', array( 17992 'id' => array('integer', $row['id']), 17993 'record_field_id' => array('integer', $row['record_field_id']), 17994 'value' => array('text', json_encode($value_array)), 17995 ), array('id' => array('integer', $row['id']))); 17996 $ilDB->manipulate('DELETE FROM il_dcl_stloc2_value WHERE record_field_id = ' . $ilDB->quote($row['record_field_id'], 'integer')); 17997} 17998?> 17999<#5085> 18000<?php 18001$set = $ilDB->query( 18002 "SELECT * FROM mep_item JOIN mep_tree ON (mep_item.obj_id = mep_tree.child) " . 18003 " WHERE mep_item.type = " . $ilDB->quote("pg", "text") 18004); 18005while ($rec = $ilDB->fetchAssoc($set)) { 18006 $q = "UPDATE page_object SET " . 18007 " parent_id = " . $ilDB->quote($rec["mep_id"], "integer") . 18008 " WHERE parent_type = " . $ilDB->quote("mep", "text") . 18009 " AND page_id = " . $ilDB->quote($rec["obj_id"], "integer"); 18010 //echo "<br>".$q; 18011 $ilDB->manipulate($q); 18012} 18013?> 18014<#5086> 18015<?php 18016 // fix 20706 (and 22921) 18017 require_once('./Services/Database/classes/class.ilDBAnalyzer.php'); 18018 $analyzer = new ilDBAnalyzer(); 18019 $cons = $analyzer->getPrimaryKeyInformation('page_question'); 18020 if (is_array($cons["fields"]) && count($cons["fields"]) > 0) { 18021 $ilDB->dropPrimaryKey('page_question'); 18022 } 18023 $ilDB->addPrimaryKey('page_question', array('page_parent_type', 'page_id', 'question_id', 'page_lang')); 18024?> 18025<#5087> 18026<?php 18027 // fix 20409 and 20638 18028 $old = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; 18029 $new = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML'; 18030 18031 $ilDB->manipulateF( 18032 "UPDATE settings SET value=%s WHERE module='MathJax' AND keyword='path_to_mathjax' AND value=%s", 18033 array('text','text'), 18034 array($new, $old) 18035 ); 18036?> 18037<#5088> 18038<?php 18039 require_once('./Services/Component/classes/class.ilPluginAdmin.php'); 18040 require_once('./Services/Component/classes/class.ilPlugin.php'); 18041 require_once('./Services/UICore/classes/class.ilCtrl.php'); 18042 18043 // Mantis #17842 18044 /** @var $ilCtrl ilCtrl */ 18045 global $ilCtrl, $ilPluginAdmin, $DIC; 18046 if (is_null($ilPluginAdmin)) { 18047 $GLOBALS['ilPluginAdmin'] = new ilPluginAdmin(); 18048 $DIC["ilPluginAdmin"] = function ($c) { 18049 return $GLOBALS['ilPluginAdmin']; 18050 }; 18051 } 18052 if (is_null($ilCtrl)) { 18053 $GLOBALS['ilCtrl'] = new ilCtrl(); 18054 $DIC["ilCtrl"] = function ($c) { 18055 return $GLOBALS['ilCtrl']; 18056 }; 18057 } 18058 global $ilCtrl; 18059 18060 function writeCtrlClassEntry(ilPluginSlot $slot, array $plugin_data) 18061 { 18062 global $ilCtrl; 18063 $prefix = $slot->getPrefix() . '_' . $plugin_data['id']; 18064 $ilCtrl->insertCtrlCalls("ilobjcomponentsettingsgui", ilPlugin::getConfigureClassName($plugin_data), $prefix); 18065 } 18066 18067 include_once("./Services/Component/classes/class.ilModule.php"); 18068 $modules = ilModule::getAvailableCoreModules(); 18069 foreach ($modules as $m) { 18070 $plugin_slots = ilComponent::lookupPluginSlots(IL_COMP_MODULE, $m["subdir"]); 18071 foreach ($plugin_slots as $ps) { 18072 include_once("./Services/Component/classes/class.ilPluginSlot.php"); 18073 $slot = new ilPluginSlot(IL_COMP_MODULE, $m["subdir"], $ps["id"]); 18074 foreach ($slot->getPluginsInformation() as $p) { 18075 $plugin_db_data = ilPlugin::getPluginRecord($p["component_type"], $p["component_name"], $p["slot_id"], $p["name"]); 18076 if (ilPlugin::hasConfigureClass($slot->getPluginsDirectory(), $p, $plugin_db_data) && $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($p))) { 18077 writeCtrlClassEntry($slot, $p); 18078 } 18079 } 18080 } 18081 } 18082 include_once("./Services/Component/classes/class.ilService.php"); 18083 $services = ilService::getAvailableCoreServices(); 18084 foreach ($services as $s) { 18085 $plugin_slots = ilComponent::lookupPluginSlots(IL_COMP_SERVICE, $s["subdir"]); 18086 foreach ($plugin_slots as $ps) { 18087 $slot = new ilPluginSlot(IL_COMP_SERVICE, $s["subdir"], $ps["id"]); 18088 foreach ($slot->getPluginsInformation() as $p) { 18089 $plugin_db_data = ilPlugin::getPluginRecord($p["component_type"], $p["component_name"], $p["slot_id"], $p["name"]); 18090 if (ilPlugin::hasConfigureClass($slot->getPluginsDirectory(), $p, $plugin_db_data) && $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($p))) { 18091 writeCtrlClassEntry($slot, $p); 18092 } 18093 } 18094 } 18095 } 18096?> 18097<#5089> 18098<?php 18099$signature = "\n\n* * * * *\n"; 18100$signature .= "[CLIENT_NAME]\n"; 18101$signature .= "[CLIENT_DESC]\n"; 18102$signature .= "[CLIENT_URL]\n"; 18103 18104$ilSetting = new ilSetting(); 18105 18106$prevent_smtp_globally = $ilSetting->get('prevent_smtp_globally', 0); 18107$mail_system_sender_name = $ilSetting->get('mail_system_sender_name', ''); 18108$mail_external_sender_noreply = $ilSetting->get('mail_external_sender_noreply', ''); 18109$mail_system_return_path = $ilSetting->get('mail_system_return_path', ''); 18110 18111$ilSetting->set('mail_allow_external', !(int) $prevent_smtp_globally); 18112 18113$ilSetting->set('mail_system_usr_from_addr', $mail_external_sender_noreply); 18114$ilSetting->set('mail_system_usr_from_name', $mail_system_sender_name); 18115$ilSetting->set('mail_system_usr_env_from_addr', $mail_system_return_path); 18116 18117$ilSetting->set('mail_system_sys_from_addr', $mail_external_sender_noreply); 18118$ilSetting->set('mail_system_sys_from_name', $mail_system_sender_name); 18119$ilSetting->set('mail_system_sys_reply_to_addr', $mail_external_sender_noreply); 18120$ilSetting->set('mail_system_sys_env_from_addr', $mail_system_return_path); 18121 18122$ilSetting->set('mail_system_sys_signature', $signature); 18123 18124$ilSetting->delete('prevent_smtp_globally'); 18125$ilSetting->delete('mail_system_return_path'); 18126$ilSetting->delete('mail_system_sender_name'); 18127$ilSetting->delete('mail_external_sender_noreply'); 18128?> 18129<#5090> 18130<?php 18131$fields = array( 18132 'id' => array( 18133 'type' => 'integer', 18134 'length' => '8', 18135 18136 ), 18137 'user_id' => array( 18138 'type' => 'integer', 18139 'length' => '8', 18140 18141 ), 18142 'root_task_id' => array( 18143 'type' => 'integer', 18144 'length' => '8', 18145 18146 ), 18147 'current_task_id' => array( 18148 'type' => 'integer', 18149 'length' => '8', 18150 18151 ), 18152 'state' => array( 18153 'type' => 'integer', 18154 'length' => '2', 18155 18156 ), 18157 'total_number_of_tasks' => array( 18158 'type' => 'integer', 18159 'length' => '4', 18160 18161 ), 18162 'percentage' => array( 18163 'type' => 'integer', 18164 'length' => '2', 18165 18166 ), 18167 'title' => array( 18168 'type' => 'text', 18169 'length' => '255', 18170 18171 ), 18172 'description' => array( 18173 'type' => 'text', 18174 'length' => '255', 18175 18176 ), 18177 18178); 18179if (!$ilDB->tableExists('il_bt_bucket')) { 18180 $ilDB->createTable('il_bt_bucket', $fields); 18181 $ilDB->addPrimaryKey('il_bt_bucket', array( 'id' )); 18182 18183 if (!$ilDB->sequenceExists('il_bt_bucket')) { 18184 $ilDB->createSequence('il_bt_bucket'); 18185 } 18186} 18187 18188$fields = array( 18189 'id' => array( 18190 'type' => 'integer', 18191 'length' => '8', 18192 18193 ), 18194 'type' => array( 18195 'type' => 'text', 18196 'length' => '256', 18197 18198 ), 18199 'class_path' => array( 18200 'type' => 'text', 18201 'length' => '256', 18202 18203 ), 18204 'class_name' => array( 18205 'type' => 'text', 18206 'length' => '256', 18207 18208 ), 18209 'bucket_id' => array( 18210 'type' => 'integer', 18211 'length' => '8', 18212 18213 ), 18214 18215); 18216if (!$ilDB->tableExists('il_bt_task')) { 18217 $ilDB->createTable('il_bt_task', $fields); 18218 $ilDB->addPrimaryKey('il_bt_task', array( 'id' )); 18219 18220 if (!$ilDB->sequenceExists('il_bt_task')) { 18221 $ilDB->createSequence('il_bt_task'); 18222 } 18223} 18224 18225$fields = array( 18226 'id' => array( 18227 'type' => 'integer', 18228 'length' => '8', 18229 18230 ), 18231 'has_parent_task' => array( 18232 'type' => 'integer', 18233 'length' => '1', 18234 18235 ), 18236 'parent_task_id' => array( 18237 'type' => 'integer', 18238 'length' => '8', 18239 18240 ), 18241 'hash' => array( 18242 'type' => 'text', 18243 'length' => '256', 18244 18245 ), 18246 'type' => array( 18247 'type' => 'text', 18248 'length' => '256', 18249 18250 ), 18251 'class_path' => array( 18252 'type' => 'text', 18253 'length' => '256', 18254 18255 ), 18256 'class_name' => array( 18257 'type' => 'text', 18258 'length' => '256', 18259 18260 ), 18261 'serialized' => array( 18262 'type' => 'clob', 18263 18264 ), 18265 'bucket_id' => array( 18266 'type' => 'integer', 18267 'length' => '8', 18268 18269 ), 18270 18271); 18272if (!$ilDB->tableExists('il_bt_value')) { 18273 $ilDB->createTable('il_bt_value', $fields); 18274 $ilDB->addPrimaryKey('il_bt_value', array( 'id' )); 18275 18276 if (!$ilDB->sequenceExists('il_bt_value')) { 18277 $ilDB->createSequence('il_bt_value'); 18278 } 18279} 18280 18281$fields = array( 18282 'id' => array( 18283 'type' => 'integer', 18284 'length' => '8', 18285 18286 ), 18287 'task_id' => array( 18288 'type' => 'integer', 18289 'length' => '8', 18290 18291 ), 18292 'value_id' => array( 18293 'type' => 'integer', 18294 'length' => '8', 18295 18296 ), 18297 'bucket_id' => array( 18298 'type' => 'integer', 18299 'length' => '8', 18300 18301 ), 18302 18303); 18304if (!$ilDB->tableExists('il_bt_value_to_task')) { 18305 $ilDB->createTable('il_bt_value_to_task', $fields); 18306 $ilDB->addPrimaryKey('il_bt_value_to_task', array( 'id' )); 18307 18308 if (!$ilDB->sequenceExists('il_bt_value_to_task')) { 18309 $ilDB->createSequence('il_bt_value_to_task'); 18310 } 18311} 18312?> 18313<#5091> 18314<?php 18315 $ilCtrlStructureReader->getStructure(); 18316?> 18317<#5092> 18318<?php 18319if (!$ilDB->tableColumnExists('chatroom_settings', 'online_status')) { 18320 $ilDB->addTableColumn('chatroom_settings', 'online_status', array( 18321 'type' => 'integer', 18322 'length' => 1, 18323 'notnull' => true, 18324 'default' => 0 18325 )); 18326} 18327 18328$ilDB->manipulateF("UPDATE chatroom_settings SET online_status = %s", array('integer'), array(1)); 18329?> 18330<#5093> 18331<?php 18332if (!$ilDB->tableColumnExists('chatroom_bans', 'actor_id')) { 18333 $ilDB->addTableColumn( 18334 'chatroom_bans', 18335 'actor_id', 18336 array( 18337 'type' => 'integer', 18338 'length' => 4, 18339 'notnull' => false, 18340 'default' => null 18341 ) 18342 ); 18343} 18344?> 18345<#5094> 18346<?php 18347 $ilCtrlStructureReader->getStructure(); 18348?> 18349<#5095> 18350<?php 18351if (!$ilDB->tableColumnExists('usr_data', 'second_email')) { 18352 $ilDB->addTableColumn( 18353 'usr_data', 18354 'second_email', 18355 array('type' => 'text', 18356 'length' => 80, 18357 'notnull' => false 18358 ) 18359 ); 18360} 18361?> 18362<#5096> 18363<?php 18364if (!$ilDB->tableColumnExists('mail_options', 'mail_address_option')) { 18365 $ilDB->addTableColumn( 18366 'mail_options', 18367 'mail_address_option', 18368 array('type' => 'integer', 18369 'length' => 1, 18370 'notnull' => true, 18371 'default' => 3 18372 ) 18373 ); 18374} 18375?> 18376<#5097> 18377<?php 18378$ilCtrlStructureReader->getStructure(); 18379?> 18380<#5098> 18381<?php 18382include_once './Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 18383ilDBUpdateNewObjectType::addRBACTemplate( 18384 'sess', 18385 'il_sess_participant', 18386 'Session participant template', 18387 [ 18388 ilDBUpdateNewObjectType::getCustomRBACOperationId('visible'), 18389 ilDBUpdateNewObjectType::getCustomRBACOperationId('read') 18390 ] 18391); 18392?> 18393<#5099> 18394<?php 18395 18396// add new role entry for each session 18397$query = 'SELECT obd.obj_id,ref_id,owner FROM object_data obd ' . 18398 'join object_reference obr on obd.obj_id = obr.obj_id' . ' ' . 18399 'where type = ' . $ilDB->quote('sess', 'text'); 18400$res = $ilDB->query($query); 18401while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 18402 // add role entry 18403 $id = $ilDB->nextId("object_data"); 18404 $q = "INSERT INTO object_data " . 18405 "(obj_id,type,title,description,owner,create_date,last_update) " . 18406 "VALUES " . 18407 "(" . 18408 $ilDB->quote($id, "integer") . "," . 18409 $ilDB->quote('role', "text") . "," . 18410 $ilDB->quote('il_sess_participant_' . $row->ref_id, "text") . "," . 18411 $ilDB->quote('Participant of session obj_no.' . $row->obj_id, "text") . "," . 18412 $ilDB->quote($row->owner, "integer") . "," . 18413 $ilDB->now() . "," . 18414 $ilDB->now() . ")"; 18415 18416 $ilDB->manipulate($q); 18417 18418 // add role data 18419 $rd = 'INSERT INTO role_data (role_id) VALUES (' . $id . ')'; 18420 $ilDB->manipulate($rd); 18421 18422 // assign to session 18423 $fa = 'INSERT INTO rbac_fa (rol_id,parent,assign,protected,blocked ) VALUES(' . 18424 $ilDB->quote($id, 'integer') . ', ' . 18425 $ilDB->quote($row->ref_id, 'integer') . ', ' . 18426 $ilDB->quote('y', 'text') . ', ' . 18427 $ilDB->quote('n', 'text') . ', ' . 18428 $ilDB->quote(0, 'integer') . ' ' . 18429 ')'; 18430 18431 $ilDB->manipulate($fa); 18432 18433 // assign template permissions 18434 $temp = 'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES(' . 18435 $ilDB->quote($id, 'integer') . ', ' . 18436 $ilDB->quote('sess', 'text') . ', ' . 18437 $ilDB->quote(2, 'integer') . ', ' . 18438 $ilDB->quote($row->ref_id, 'integer') . ') '; 18439 $ilDB->manipulate($temp); 18440 18441 // assign template permissions 18442 $temp = 'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES(' . 18443 $ilDB->quote($id, 'integer') . ', ' . 18444 $ilDB->quote('sess', 'text') . ', ' . 18445 $ilDB->quote(3, 'integer') . ', ' . 18446 $ilDB->quote($row->ref_id, 'integer') . ') '; 18447 $ilDB->manipulate($temp); 18448 18449 // assign permission 18450 $pa = 'INSERT INTO rbac_pa (rol_id,ops_id,ref_id) VALUES(' . 18451 $ilDB->quote($id, 'integer') . ', ' . 18452 $ilDB->quote(serialize([2,3]), 'text') . ', ' . 18453 $ilDB->quote($row->ref_id, 'integer') . ')'; 18454 $ilDB->manipulate($pa); 18455 18456 // assign users 18457 $users = 'SELECT usr_id from event_participants WHERE event_id = ' . $ilDB->quote($row->obj_id, 'integer'); 18458 $user_res = $ilDB->query($users); 18459 while ($user_row = $user_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 18460 $ua = 'INSERT INTO rbac_ua (usr_id,rol_id) VALUES(' . 18461 $ilDB->quote($user_row->usr_id, 'integer') . ', ' . 18462 $ilDB->quote($id, 'integer') . ')'; 18463 $ilDB->manipulate($ua); 18464 } 18465} 18466?> 18467<#5100> 18468<?php 18469$id = $ilDB->nextId("object_data"); 18470$q = "INSERT INTO object_data " . 18471 "(obj_id,type,title,description,owner,create_date,last_update) " . 18472 "VALUES " . 18473 "(" . 18474 $ilDB->quote($id, "integer") . "," . 18475 $ilDB->quote('rolt', "text") . "," . 18476 $ilDB->quote('il_sess_status_closed', "text") . "," . 18477 $ilDB->quote('Closed session template', 'text') . ', ' . 18478 $ilDB->quote(0, "integer") . "," . 18479 $ilDB->now() . "," . 18480 $ilDB->now() . ")"; 18481 18482$ilDB->manipulate($q); 18483 18484$query = "INSERT INTO rbac_fa VALUES (" . $ilDB->quote($id) . ", 8, 'n', 'n', 0)"; 18485$ilDB->manipulate($query); 18486 18487?> 18488 18489<#5101> 18490<?php 18491$id = $ilDB->nextId('didactic_tpl_settings'); 18492$query = 'INSERT INTO didactic_tpl_settings (id,enabled,type,title, description,info,auto_generated,exclusive_tpl) values( ' . 18493 $ilDB->quote($id, 'integer') . ', ' . 18494 $ilDB->quote(1, 'integer') . ', ' . 18495 $ilDB->quote(1, 'integer') . ', ' . 18496 $ilDB->quote('sess_closed', 'text') . ', ' . 18497 $ilDB->quote('sess_closed_info', 'text') . ', ' . 18498 $ilDB->quote('', 'text') . ', ' . 18499 $ilDB->quote(1, 'integer') . ', ' . 18500 $ilDB->quote(0, 'integer') . ' ' . 18501 ')'; 18502$ilDB->manipulate($query); 18503 18504$query = 'INSERT INTO didactic_tpl_sa (id, obj_type) values( ' . 18505 $ilDB->quote($id, 'integer') . ', ' . 18506 $ilDB->quote('sess', 'text') . 18507 ')'; 18508$ilDB->manipulate($query); 18509 18510 18511$aid = $ilDB->nextId('didactic_tpl_a'); 18512$query = 'INSERT INTO didactic_tpl_a (id, tpl_id, type_id) values( ' . 18513 $ilDB->quote($aid, 'integer') . ', ' . 18514 $ilDB->quote($id, 'integer') . ', ' . 18515 $ilDB->quote(1, 'integer') . 18516 ')'; 18517$ilDB->manipulate($query); 18518 18519$query = 'select obj_id from object_data where type = ' . $ilDB->quote('rolt', 'text') . ' and title = ' . $ilDB->quote('il_sess_status_closed', 'text'); 18520$res = $ilDB->query($query); 18521while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 18522 $closed_id = $row->obj_id; 18523} 18524 18525$query = 'INSERT INTO didactic_tpl_alp (action_id, filter_type, template_type, template_id) values( ' . 18526 $ilDB->quote($aid, 'integer') . ', ' . 18527 $ilDB->quote(3, 'integer') . ', ' . 18528 $ilDB->quote(2, 'integer') . ', ' . 18529 $ilDB->quote($closed_id, 'integer') . 18530 ')'; 18531$ilDB->manipulate($query); 18532 18533 18534$fid = $ilDB->nextId('didactic_tpl_fp'); 18535$query = 'INSERT INTO didactic_tpl_fp (pattern_id, pattern_type, pattern_sub_type, pattern, parent_id, parent_type ) values( ' . 18536 $ilDB->quote($fid, 'integer') . ', ' . 18537 $ilDB->quote(1, 'integer') . ', ' . 18538 $ilDB->quote(1, 'integer') . ', ' . 18539 $ilDB->quote('.*', 'text') . ', ' . 18540 $ilDB->quote($aid, 'integer') . ', ' . 18541 $ilDB->quote('action', 'text') . 18542 ')'; 18543$ilDB->manipulate($query); 18544?> 18545<#5102> 18546<?php 18547 18548$sessions = []; 18549 18550$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'); 18551$res = $ilDB->query($query); 18552while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 18553 $tmp['obj_id'] = $row->obj_id; 18554 $tmp['title'] = $row->title; 18555 $tmp['description'] = $row->description; 18556 18557 $sessions[] = $tmp; 18558} 18559 18560foreach ($sessions as $idx => $sess_info) { 18561 $meta_id = $ilDB->nextId('il_meta_general'); 18562 $insert = 'INSERT INTO il_meta_general (meta_general_id, rbac_id, obj_id, obj_type, general_structure, title, title_language, coverage, coverage_language) ' . 18563 'VALUES( ' . 18564 $ilDB->quote($meta_id, 'integer') . ', ' . 18565 $ilDB->quote($sess_info['obj_id'], 'integer') . ', ' . 18566 $ilDB->quote($sess_info['obj_id'], 'integer') . ', ' . 18567 $ilDB->quote('sess', 'text') . ', ' . 18568 $ilDB->quote('Hierarchical', 'text') . ', ' . 18569 $ilDB->quote($sess_info['title'], 'text') . ', ' . 18570 $ilDB->quote('en', 'text') . ', ' . 18571 $ilDB->quote('', 'text') . ', ' . 18572 $ilDB->quote('en', 'text') . ' ' . 18573 ')'; 18574 18575 $ilDB->manipulate($insert); 18576 18577 $meta_des_id = $ilDB->nextId('il_meta_description'); 18578 $insert = 'INSERT INTO il_meta_description (meta_description_id, rbac_id, obj_id, obj_type, parent_type, parent_id, description, description_language) ' . 18579 'VALUES( ' . 18580 $ilDB->quote($meta_des_id, 'integer') . ', ' . 18581 $ilDB->quote($sess_info['obj_id'], 'integer') . ', ' . 18582 $ilDB->quote($sess_info['obj_id'], 'integer') . ', ' . 18583 $ilDB->quote('sess', 'text') . ', ' . 18584 $ilDB->quote('meta_general', 'text') . ', ' . 18585 $ilDB->quote($meta_id, 'integer') . ', ' . 18586 $ilDB->quote($sess_info['description'], 'text') . ', ' . 18587 $ilDB->quote('en', 'text') . ' ' . 18588 ')'; 18589 $ilDB->manipulate($insert); 18590} 18591?> 18592<#5103> 18593<?php 18594 18595if (!$ilDB->tableExists('adv_md_record_scope')) { 18596 $ilDB->createTable('adv_md_record_scope', array( 18597 'scope_id' => array( 18598 'type' => 'integer', 18599 'length' => 4, 18600 'notnull' => true, 18601 'default' => 0 18602 ), 18603 'record_id' => array( 18604 'type' => 'integer', 18605 'length' => 4, 18606 'notnull' => true 18607 ), 18608 'ref_id' => array( 18609 'type' => 'integer', 18610 'length' => 4, 18611 'notnull' => true, 18612 ) 18613 )); 18614 $ilDB->addPrimaryKey('adv_md_record_scope', ['scope_id']); 18615 $ilDB->createSequence('adv_md_record_scope'); 18616} 18617?> 18618<#5104> 18619<?php 18620 18621if (!$ilDB->tableExists('adv_md_values_extlink')) { 18622 $ilDB->createTable('adv_md_values_extlink', array( 18623 'obj_id' => array( 18624 'type' => 'integer', 18625 'length' => 4, 18626 'notnull' => true, 18627 'default' => 0 18628 ), 18629 'sub_type' => array( 18630 'type' => 'text', 18631 'length' => 10, 18632 'notnull' => true, 18633 'default' => "-" 18634 ), 18635 'sub_id' => array( 18636 'type' => 'integer', 18637 'length' => 4, 18638 'notnull' => true, 18639 'default' => 0 18640 ), 18641 'field_id' => array( 18642 'type' => 'integer', 18643 'length' => 4, 18644 'notnull' => true, 18645 'default' => 0 18646 ), 18647 'value' => array( 18648 'type' => 'text', 18649 'length' => 500, 18650 'notnull' => false 18651 ), 18652 'title' => array( 18653 'type' => 'text', 18654 'length' => 500, 18655 'notnull' => false 18656 ), 18657 'disabled' => [ 18658 "type" => "integer", 18659 "length" => 1, 18660 "notnull" => true, 18661 "default" => 0 18662 ] 18663 18664 )); 18665 18666 $ilDB->addPrimaryKey('adv_md_values_extlink', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 18667} 18668?> 18669<#5105> 18670<?php 18671 18672if (!$ilDB->tableExists('adv_md_values_intlink')) { 18673 $ilDB->createTable('adv_md_values_intlink', array( 18674 'obj_id' => array( 18675 'type' => 'integer', 18676 'length' => 4, 18677 'notnull' => true, 18678 'default' => 0 18679 ), 18680 'sub_type' => array( 18681 'type' => 'text', 18682 'length' => 10, 18683 'notnull' => true, 18684 'default' => "-" 18685 ), 18686 'sub_id' => array( 18687 'type' => 'integer', 18688 'length' => 4, 18689 'notnull' => true, 18690 'default' => 0 18691 ), 18692 'field_id' => array( 18693 'type' => 'integer', 18694 'length' => 4, 18695 'notnull' => true, 18696 'default' => 0 18697 ), 18698 'value' => array( 18699 'type' => 'integer', 18700 'length' => 4, 18701 'notnull' => true 18702 ), 18703 'disabled' => [ 18704 "type" => "integer", 18705 "length" => 1, 18706 "notnull" => true, 18707 "default" => 0 18708 ] 18709 18710 )); 18711 18712 $ilDB->addPrimaryKey('adv_md_values_intlink', array('obj_id', 'sub_type', 'sub_id', 'field_id')); 18713} 18714?> 18715<#5106> 18716<?php 18717 $ilCtrlStructureReader->getStructure(); 18718?> 18719<#5107> 18720<?php 18721if (!$ilDB->tableColumnExists('iass_settings', 'event_time_place_required')) { 18722 $ilDB->addTableColumn('iass_settings', 'event_time_place_required', array( 18723 "type" => "integer", 18724 "length" => 1, 18725 "notnull" => true, 18726 "default" => 0 18727 )); 18728} 18729?> 18730<#5108> 18731<?php 18732if (!$ilDB->tableColumnExists('iass_members', 'place')) { 18733 $ilDB->addTableColumn('iass_members', 'place', array( 18734 "type" => "text", 18735 "length" => 255 18736 )); 18737} 18738?> 18739<#5109> 18740<?php 18741if (!$ilDB->tableColumnExists('iass_members', 'event_time')) { 18742 $ilDB->addTableColumn('iass_members', 'event_time', array( 18743 "type" => "integer", 18744 "length" => 8 18745 )); 18746} 18747?> 18748<#5110> 18749<?php 18750 18751if (!$ilDB->tableColumnExists("il_object_def", "orgunit_permissions")) { 18752 $def = array( 18753 'type' => 'integer', 18754 'length' => 1, 18755 'notnull' => true, 18756 'default' => 0 18757 ); 18758 $ilDB->addTableColumn("il_object_def", "orgunit_permissions", $def); 18759} 18760 18761$ilCtrlStructureReader->getStructure(); 18762?> 18763<#5111> 18764<?php 18765if (!$ilDB->tableExists('orgu_obj_type_settings')) { 18766 $ilDB->createTable( 18767 'orgu_obj_type_settings', 18768 array( 18769 'obj_type' => array( 18770 'type' => 'text', 18771 'length' => 10, 18772 'notnull' => true 18773 ), 18774 'active' => array( 18775 'type' => 'integer', 18776 'length' => 1, 18777 'notnull' => false, 18778 'default' => 0 18779 ), 18780 'activation_default' => array( 18781 'type' => 'integer', 18782 'length' => 1, 18783 'notnull' => false, 18784 'default' => 0 18785 ), 18786 'changeable' => array( 18787 'type' => 'integer', 18788 'length' => 1, 18789 'notnull' => false, 18790 'default' => 0 18791 ) 18792 ) 18793 ); 18794 $ilDB->addPrimaryKey('orgu_obj_type_settings', array('obj_type')); 18795} 18796?> 18797<#5112> 18798<?php 18799 $ilCtrlStructureReader->getStructure(); 18800?> 18801<#5113> 18802<?php 18803if (!$ilDB->tableColumnExists('grp_settings', 'grp_start')) { 18804 $ilDB->addTableColumn('grp_settings', 'grp_start', array( 18805 "type" => "integer", 18806 "notnull" => false, 18807 "length" => 4 18808 )); 18809} 18810if (!$ilDB->tableColumnExists('grp_settings', 'grp_end')) { 18811 $ilDB->addTableColumn('grp_settings', 'grp_end', array( 18812 "type" => "integer", 18813 "notnull" => false, 18814 "length" => 4 18815 )); 18816} 18817?> 18818<#5114> 18819<?php 18820if (!$ilDB->tableExists("usr_starting_point")) { 18821 $ilDB->createTable("usr_starting_point", array( 18822 "id" => array( 18823 "type" => "integer", 18824 "length" => 4, 18825 "notnull" => true, 18826 "default" => 0 18827 ), 18828 "position" => array( 18829 "type" => "integer", 18830 "length" => 4, 18831 "notnull" => false, 18832 "default" => 0 18833 ), 18834 "starting_point" => array( 18835 "type" => "integer", 18836 "length" => 4, 18837 "notnull" => false, 18838 "default" => 0 18839 ), 18840 "starting_object" => array( 18841 "type" => "integer", 18842 "length" => 4, 18843 "notnull" => false, 18844 "default" => 0 18845 ), 18846 "rule_type" => array( 18847 "type" => "integer", 18848 "length" => 4, 18849 "notnull" => false, 18850 "default" => 0 18851 ), 18852 "rule_options" => array( 18853 "type" => "text", 18854 "length" => 4000, 18855 "notnull" => false, 18856 ) 18857 )); 18858 18859 $ilDB->addPrimaryKey('usr_starting_point', array('id')); 18860 $ilDB->createSequence('usr_starting_point'); 18861} 18862?> 18863<#5115> 18864<?php 18865$ilCtrlStructureReader->getStructure(); 18866?> 18867<#5116> 18868<?php 18869if ($ilDB->tableExists("exc_assignment")) { 18870 if (!$ilDB->tableColumnExists('exc_assignment', 'portfolio_template')) { 18871 $ilDB->addTableColumn("exc_assignment", "portfolio_template", array("type" => "integer", "length" => 4)); 18872 } 18873 if (!$ilDB->tableColumnExists('exc_assignment', 'min_char_limit')) { 18874 $ilDB->addTableColumn("exc_assignment", "min_char_limit", array("type" => "integer", "length" => 4)); 18875 } 18876 if (!$ilDB->tableColumnExists('exc_assignment', 'max_char_limit')) { 18877 $ilDB->addTableColumn("exc_assignment", "max_char_limit", array("type" => "integer", "length" => 4)); 18878 } 18879} 18880?> 18881<#5117> 18882<?php 18883if (!$ilDB->tableExists("exc_ass_file_order")) { 18884 $fields = array( 18885 "id" => array( 18886 "type" => "integer", 18887 "length" => 4, 18888 "notnull" => true, 18889 "default" => 0 18890 ), 18891 "assignment_id" => array( 18892 "type" => "integer", 18893 "length" => 4, 18894 "notnull" => true, 18895 "default" => 0 18896 ), 18897 "filename" => array( 18898 "type" => "text", 18899 "length" => 150, 18900 "notnull" => true, 18901 ), 18902 "order_nr" => array( 18903 "type" => "integer", 18904 "length" => 4, 18905 "notnull" => true, 18906 "default" => 0 18907 ), 18908 ); 18909 18910 $ilDB->createTable("exc_ass_file_order", $fields); 18911 $ilDB->addPrimaryKey('exc_ass_file_order', array('id')); 18912 18913 $ilDB->createSequence("exc_ass_file_order"); 18914} 18915?> 18916<#5118> 18917<?php 18918 // 18919?> 18920<#5119> 18921<?php 18922 if (!$ilDB->tableExists("obj_noti_settings")) { 18923 $fields = array( 18924 "obj_id" => array( 18925 "type" => "integer", 18926 "length" => 4, 18927 "notnull" => true, 18928 "default" => 0 18929 ), 18930 "noti_mode" => array( 18931 "type" => "integer", 18932 "length" => 1, 18933 "notnull" => true, 18934 "default" => 0 18935 ) 18936 ); 18937 18938 $ilDB->createTable("obj_noti_settings", $fields); 18939 $ilDB->addPrimaryKey('obj_noti_settings', array('obj_id')); 18940 } 18941?> 18942<#5120> 18943<?php 18944 $ilCtrlStructureReader->getStructure(); 18945?> 18946<#5121> 18947<?php 18948 18949if (!$ilDB->tableColumnExists('notification', 'activated')) { 18950 $ilDB->addTableColumn( 18951 'notification', 18952 'activated', 18953 array( 18954 'type' => 'integer', 18955 'length' => 1, 18956 'notnull' => false, 18957 'default' => 0 18958 ) 18959 ); 18960 18961 $ilDB->manipulate("UPDATE notification SET " . 18962 " activated = " . $this->db->quote(1, "integer")); 18963} 18964?> 18965<#5122> 18966<?php 18967 $ilCtrlStructureReader->getStructure(); 18968?> 18969<#5123> 18970<?php 18971 $ilCtrlStructureReader->getStructure(); 18972?> 18973<#5124> 18974<?php 18975 $ilCtrlStructureReader->getStructure(); 18976?> 18977<#5125> 18978<?php 18979if (!$ilDB->tableColumnExists('itgr_data', 'behaviour')) { 18980 $ilDB->addTableColumn( 18981 'itgr_data', 18982 'behaviour', 18983 array( 18984 'type' => 'integer', 18985 'length' => 1, 18986 'notnull' => false, 18987 'default' => 0 18988 ) 18989 ); 18990} 18991?> 18992<#5126> 18993<?php 18994 $ilSetting = new ilSetting(); 18995 $ilSetting->set('letter_avatars', 1); 18996?> 18997<#5127> 18998<?php 18999 19000 if (!$ilDB->tableExists('pdfgen_conf')) { 19001 $fields = array( 19002 'conf_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 19003 'renderer' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19004 'service' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19005 'purpose' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19006 'config' => array('type' => 'clob') 19007 ); 19008 19009 $ilDB->createTable('pdfgen_conf', $fields); 19010 $ilDB->addPrimaryKey('pdfgen_conf', array('conf_id')); 19011 $ilDB->createSequence('pdfgen_conf'); 19012 } 19013 19014 if (!$ilDB->tableExists('pdfgen_map')) { 19015 $fields = array( 19016 'map_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 19017 'service' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19018 'purpose' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19019 'preferred' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19020 'selected' => array('type' => 'text', 'length' => 255, 'notnull' => true) 19021 ); 19022 19023 $ilDB->createTable('pdfgen_map', $fields); 19024 $ilDB->addPrimaryKey('pdfgen_map', array('map_id')); 19025 $ilDB->createSequence('pdfgen_map'); 19026 } 19027?> 19028<#5128> 19029 <?php 19030 if (!$ilDB->tableExists('pdfgen_purposes')) { 19031 $fields = array( 19032 'purpose_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 19033 'service' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19034 'purpose' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19035 ); 19036 19037 $ilDB->createTable('pdfgen_purposes', $fields); 19038 $ilDB->addPrimaryKey('pdfgen_purposes', array('purpose_id')); 19039 $ilDB->createSequence('pdfgen_purposes'); 19040 } 19041 ?> 19042<#5129> 19043<?php 19044 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19045 ilDBUpdateNewObjectType::addAdminNode('pdfg', 'PDFGeneration'); 19046?> 19047<#5130> 19048<?php 19049 $ilCtrlStructureReader->getStructure(); 19050?> 19051<#5131> 19052<?php 19053 if (!$ilDB->tableExists('pdfgen_renderer')) { 19054 $fields = array( 19055 'renderer_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 19056 'renderer' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19057 'path' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19058 ); 19059 19060 $ilDB->createTable('pdfgen_renderer', $fields); 19061 $ilDB->addPrimaryKey('pdfgen_renderer', array('renderer_id')); 19062 $ilDB->createSequence('pdfgen_renderer'); 19063 } 19064 19065 if (!$ilDB->tableExists('pdfgen_renderer_avail')) { 19066 $fields = array( 19067 'availability_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 19068 'service' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19069 'purpose' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19070 'renderer' => array('type' => 'text', 'length' => 255, 'notnull' => true), 19071 ); 19072 19073 $ilDB->createTable('pdfgen_renderer_avail', $fields); 19074 $ilDB->addPrimaryKey('pdfgen_renderer_avail', array('availability_id')); 19075 $ilDB->createSequence('pdfgen_renderer_avail'); 19076 } 19077?> 19078<#5132> 19079<?php 19080 $ilCtrlStructureReader->getStructure(); 19081?> 19082<#5133> 19083<?php 19084 $ilDB->insert( 19085 'pdfgen_renderer', 19086 array( 19087 'renderer_id' => array('integer', $ilDB->nextId('pdfgen_renderer')), 19088 'renderer' => array('text', 'TCPDF'), 19089 'path' => array('text', 'Services/PDFGeneration/classes/renderer/tcpdf/class.ilTCPDFRenderer.php') 19090 ) 19091); 19092?> 19093<#5134> 19094<?php 19095 $ilDB->insert( 19096 'pdfgen_renderer', 19097 array( 19098 'renderer_id' => array('integer',$ilDB->nextId('pdfgen_renderer')), 19099 'renderer' => array('text','PhantomJS'), 19100 'path' => array('text','Services/PDFGeneration/classes/renderer/phantomjs/class.ilPhantomJSRenderer.php') 19101 ) 19102); 19103?> 19104<#5135> 19105<?php 19106 $ilDB->insert( 19107 'pdfgen_renderer_avail', 19108 array( 19109 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 19110 'service' => array('text', 'Test'), 19111 'purpose' => array('text', 'PrintViewOfQuestions'), 19112 'renderer' => array('text', 'PhantomJS') 19113 ) 19114); 19115?> 19116<#5136> 19117<?php 19118 $ilDB->insert( 19119 'pdfgen_renderer_avail', 19120 array( 19121 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 19122 'service' => array('text', 'Test'), 19123 'purpose' => array('text', 'UserResult'), 19124 'renderer' => array('text', 'PhantomJS') 19125 ) 19126); 19127?> 19128<#5137> 19129<?php 19130 $ilDB->insert( 19131 'pdfgen_renderer_avail', 19132 array( 19133 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 19134 'service' => array('text', 'Test'), 19135 'purpose' => array('text', 'PrintViewOfQuestions'), 19136 'renderer' => array('text', 'TCPDF') 19137 ) 19138); 19139?> 19140<#5138> 19141<?php 19142$ilDB->insert( 19143 'pdfgen_renderer_avail', 19144 array( 19145 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 19146 'service' => array('text', 'Test'), 19147 'purpose' => array('text', 'UserResult'), 19148 'renderer' => array('text', 'TCPDF') 19149 ) 19150); 19151?> 19152<#5139> 19153<?php 19154 $ilCtrlStructureReader->getStructure(); 19155?> 19156<#5140> 19157<?php 19158 $ilCtrlStructureReader->getStructure(); 19159?> 19160<#5141> 19161<?php 19162if (!$ilDB->tableColumnExists('lm_data', 'short_title')) { 19163 $ilDB->addTableColumn( 19164 'lm_data', 19165 'short_title', 19166 array( 19167 'type' => 'text', 19168 'length' => 200, 19169 'default' => '' 19170 ) 19171 ); 19172} 19173?> 19174<#5142> 19175<?php 19176if (!$ilDB->tableColumnExists('lm_data_transl', 'short_title')) { 19177 $ilDB->addTableColumn( 19178 'lm_data_transl', 19179 'short_title', 19180 array( 19181 'type' => 'text', 19182 'length' => 200, 19183 'default' => '' 19184 ) 19185 ); 19186} 19187?> 19188<#5143> 19189<?php 19190include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19191$iass_type_id = ilDBUpdateNewObjectType::getObjectTypeId('iass'); 19192if ($iass_type_id) { 19193 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation( 19194 'amend_grading', 19195 'Amend grading', 19196 'object', 19197 8200 19198 ); 19199 if ($new_ops_id) { 19200 ilDBUpdateNewObjectType::addRBACOperation($iass_type_id, $new_ops_id); 19201 } 19202} 19203?> 19204<#5144> 19205<?php 19206if (!$ilDB->tableExists('cont_skills')) { 19207 $ilDB->createTable('cont_skills', array( 19208 'id' => array( 19209 'type' => 'integer', 19210 'length' => 4, 19211 'notnull' => true, 19212 'default' => 0 19213 ), 19214 'skill_id' => array( 19215 'type' => 'integer', 19216 'length' => 4, 19217 'notnull' => true, 19218 'default' => 0 19219 ), 19220 'tref_id' => array( 19221 'type' => 'integer', 19222 'length' => 4, 19223 'notnull' => true, 19224 'default' => 0 19225 ) 19226 )); 19227 19228 $ilDB->addPrimaryKey('cont_skills', array('id','skill_id','tref_id')); 19229} 19230?> 19231<#5145> 19232<?php 19233if (!$ilDB->tableExists('cont_member_skills')) { 19234 $ilDB->createTable('cont_member_skills', array( 19235 'obj_id' => array( 19236 'type' => 'integer', 19237 'length' => 4, 19238 'notnull' => true, 19239 'default' => 0 19240 ), 19241 'user_id' => array( 19242 'type' => 'integer', 19243 'length' => 4, 19244 'notnull' => true, 19245 'default' => 0 19246 ), 19247 'tref_id' => array( 19248 'type' => 'integer', 19249 'length' => 4, 19250 'notnull' => true, 19251 'default' => 0 19252 ), 19253 'skill_id' => array( 19254 'type' => 'integer', 19255 'length' => 4, 19256 'notnull' => true, 19257 'default' => 0 19258 ), 19259 'level_id' => array( 19260 'type' => 'integer', 19261 'length' => 4, 19262 'notnull' => true, 19263 'default' => 0 19264 ), 19265 'published' => array( 19266 'type' => 'integer', 19267 'length' => 1, 19268 'notnull' => true, 19269 'default' => 0 19270 ) 19271 )); 19272 19273 $ilDB->addPrimaryKey('cont_member_skills', array('obj_id','user_id','skill_id', 'tref_id')); 19274} 19275?> 19276<#5146> 19277<?php 19278 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19279 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('grade', 'Grade', 'object', 2410); 19280 $type_id = ilDBUpdateNewObjectType::getObjectTypeId('crs'); 19281 if ($type_id && $new_ops_id) { 19282 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 19283 } 19284 $type_id2 = ilDBUpdateNewObjectType::getObjectTypeId('grp'); 19285 if ($type_id2 && $new_ops_id) { 19286 ilDBUpdateNewObjectType::addRBACOperation($type_id2, $new_ops_id); 19287 } 19288?> 19289<#5147> 19290<?php 19291include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19292 19293 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 19294 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('grade'); 19295 ilDBUpdateNewObjectType::cloneOperation('crs', $src_ops_id, $tgt_ops_id); 19296 ilDBUpdateNewObjectType::cloneOperation('grp', $src_ops_id, $tgt_ops_id); 19297?> 19298 19299<#5148> 19300<?php 19301include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19302 19303 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 19304 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('grade'); 19305 ilDBUpdateNewObjectType::cloneOperation('crs', $src_ops_id, $tgt_ops_id); 19306 ilDBUpdateNewObjectType::cloneOperation('grp', $src_ops_id, $tgt_ops_id); 19307?> 19308 19309<#5149> 19310<?php 19311if (!$ilDB->tableColumnExists('tst_rnd_quest_set_qpls', 'origin_tax_filter')) { 19312 $ilDB->addTableColumn( 19313 'tst_rnd_quest_set_qpls', 19314 'origin_tax_filter', 19315 array('type' => 'text', 'length' => 4000, 'notnull' => false, 'default' => null) 19316 ); 19317} 19318?> 19319 19320<#5150> 19321<?php 19322if (!$ilDB->tableColumnExists('tst_rnd_quest_set_qpls', 'mapped_tax_filter')) { 19323 $ilDB->addTableColumn( 19324 'tst_rnd_quest_set_qpls', 19325 'mapped_tax_filter', 19326 array('type' => 'text', 'length' => 4000, 'notnull' => false, 'default' => null) 19327 ); 19328} 19329?> 19330 19331<#5151> 19332<?php 19333$query = "SELECT * FROM tst_rnd_quest_set_qpls WHERE origin_tax_fi IS NOT NULL OR mapped_tax_fi IS NOT NULL"; 19334$result = $ilDB->query($query); 19335while ($row = $ilDB->fetchObject($result)) { 19336 if (!empty($row->origin_tax_fi)) { 19337 $origin_tax_filter = serialize(array((int) $row->origin_tax_fi => array((int) $row->origin_node_fi))); 19338 } else { 19339 $origin_tax_filter = null; 19340 } 19341 19342 if (!empty($row->mapped_tax_fi)) { 19343 $mapped_tax_filter = serialize(array((int) $row->mapped_tax_fi => array((int) $row->mapped_node_fi))); 19344 } else { 19345 $mapped_tax_filter = null; 19346 } 19347 19348 $update = "UPDATE tst_rnd_quest_set_qpls SET " 19349 . " origin_tax_fi = NULL, origin_node_fi = NULL, mapped_tax_fi = NULL, mapped_node_fi = NULL, " 19350 . " origin_tax_filter = " . $ilDB->quote($origin_tax_filter, 'text') . ", " 19351 . " mapped_tax_filter = " . $ilDB->quote($mapped_tax_filter, 'text') 19352 . " WHERE def_id = " . $ilDB->quote($row->def_id); 19353 19354 $ilDB->manipulate($update); 19355} 19356?> 19357<#5152> 19358<?php 19359if (!$ilDB->tableColumnExists('tst_rnd_quest_set_qpls', 'type_filter')) { 19360 $ilDB->addTableColumn( 19361 'tst_rnd_quest_set_qpls', 19362 'type_filter', 19363 array('type' => 'text', 'length' => 250, 'notnull' => false, 'default' => null) 19364 ); 19365} 19366?> 19367<#5153> 19368<?php 19369 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19370 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('edit_page_meta', 'Edit Page Metadata', 'object', 3050); 19371 $type_id = ilDBUpdateNewObjectType::getObjectTypeId('wiki'); 19372 if ($type_id && $new_ops_id) { 19373 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 19374 } 19375?> 19376<#5154> 19377<?php 19378 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 19379 19380 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 19381 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_page_meta'); 19382 ilDBUpdateNewObjectType::cloneOperation('wiki', $src_ops_id, $tgt_ops_id); 19383?> 19384<#5155> 19385<?php 19386 $ilCtrlStructureReader->getStructure(); 19387?> 19388<#5156> 19389<?php 19390if (!$ilDB->tableExists('saml_attribute_mapping')) { 19391 $ilDB->createTable( 19392 'saml_attribute_mapping', 19393 array( 19394 'idp_id' => array( 19395 'type' => 'integer', 19396 'length' => 4, 19397 'notnull' => true 19398 ), 19399 'attribute' => array( 19400 'type' => 'text', 19401 'length' => '75', 19402 'notnull' => true 19403 ), 19404 'idp_attribute' => array( 19405 'type' => 'text', 19406 'length' => '1000', 19407 'notnull' => false, 19408 'default' => null 19409 ), 19410 ) 19411 ); 19412} 19413?> 19414 19415<#5157> 19416<?php 19417$ilDB->addPrimaryKey('saml_attribute_mapping', array('idp_id', 'attribute')); 19418?> 19419<#5158> 19420<?php 19421if (!$ilDB->tableColumnExists('saml_attribute_mapping', 'idp_attribute')) { 19422 $ilDB->modifyTableColumn('saml_attribute_mapping', 'idp_attribute', array( 19423 'type' => 'text', 19424 'length' => '1000', 19425 'notnull' => false, 19426 'default' => null 19427 )); 19428} 19429?> 19430<#5159> 19431<?php 19432if (!$ilDB->tableColumnExists('saml_attribute_mapping', 'update_automatically')) { 19433 $ilDB->addTableColumn('saml_attribute_mapping', 'update_automatically', array( 19434 'type' => 'integer', 19435 'length' => 1, 19436 'notnull' => true, 19437 'default' => 0 19438 )); 19439} 19440?> 19441<#5160> 19442<?php 19443$ilCtrlStructureReader->getStructure(); 19444?> 19445<#5161> 19446<?php 19447if (!$ilDB->tableExists('saml_idp_settings')) { 19448 $ilDB->createTable( 19449 'saml_idp_settings', 19450 array( 19451 'idp_id' => array( 19452 'type' => 'integer', 19453 'length' => 4, 19454 'notnull' => true 19455 ), 19456 'is_active' => array( 19457 'type' => 'integer', 19458 'length' => 1, 19459 'notnull' => true 19460 ) 19461 ) 19462 ); 19463} 19464?> 19465<#5162> 19466<?php 19467$ilDB->addPrimaryKey('saml_idp_settings', array('idp_id')); 19468?> 19469<#5163> 19470<?php 19471if (!$ilDB->tableColumnExists('saml_idp_settings', 'allow_local_auth')) { 19472 $ilDB->addTableColumn( 19473 'saml_idp_settings', 19474 'allow_local_auth', 19475 array( 19476 'type' => 'integer', 19477 'length' => 1, 19478 'notnull' => true, 19479 'default' => 0 19480 ) 19481 ); 19482} 19483if (!$ilDB->tableColumnExists('saml_idp_settings', 'default_role_id')) { 19484 $ilDB->addTableColumn( 19485 'saml_idp_settings', 19486 'default_role_id', 19487 array( 19488 'type' => 'integer', 19489 'length' => 4, 19490 'notnull' => true, 19491 'default' => 0 19492 ) 19493 ); 19494} 19495if (!$ilDB->tableColumnExists('saml_idp_settings', 'uid_claim')) { 19496 $ilDB->addTableColumn( 19497 'saml_idp_settings', 19498 'uid_claim', 19499 array( 19500 'type' => 'text', 19501 'length' => 1000, 19502 'notnull' => false, 19503 'default' => null 19504 ) 19505 ); 19506} 19507if (!$ilDB->tableColumnExists('saml_idp_settings', 'login_claim')) { 19508 $ilDB->addTableColumn( 19509 'saml_idp_settings', 19510 'login_claim', 19511 array( 19512 'type' => 'text', 19513 'length' => 1000, 19514 'notnull' => false, 19515 'default' => null 19516 ) 19517 ); 19518} 19519if (!$ilDB->tableColumnExists('saml_idp_settings', 'sync_status')) { 19520 $ilDB->addTableColumn( 19521 'saml_idp_settings', 19522 'sync_status', 19523 array( 19524 'type' => 'integer', 19525 'length' => 1, 19526 'notnull' => true, 19527 'default' => 0 19528 ) 19529 ); 19530} 19531if (!$ilDB->tableColumnExists('saml_idp_settings', 'account_migr_status')) { 19532 $ilDB->addTableColumn( 19533 'saml_idp_settings', 19534 'account_migr_status', 19535 array( 19536 'type' => 'integer', 19537 'length' => 1, 19538 'notnull' => true, 19539 'default' => 0 19540 ) 19541 ); 19542} 19543?> 19544<#5164> 19545<?php 19546if (!$ilDB->tableExists('auth_ext_attr_mapping') && $ilDB->tableExists('saml_attribute_mapping')) { 19547 $ilDB->renameTable('saml_attribute_mapping', 'auth_ext_attr_mapping'); 19548} 19549?> 19550<#5165> 19551<?php 19552if (!$ilDB->tableColumnExists('auth_ext_attr_mapping', 'auth_src_id') && $ilDB->tableColumnExists('auth_ext_attr_mapping', 'idp_id')) { 19553 $ilDB->renameTableColumn('auth_ext_attr_mapping', 'idp_id', 'auth_src_id'); 19554} 19555?> 19556<#5166> 19557<?php 19558if (!$ilDB->tableColumnExists('auth_ext_attr_mapping', 'auth_mode')) { 19559 $ilDB->addTableColumn('auth_ext_attr_mapping', 'auth_mode', array( 19560 'type' => 'text', 19561 'notnull' => false, 19562 'length' => 50 19563 )); 19564} 19565?> 19566<#5167> 19567<?php 19568// This migrates existing records 19569$ilDB->manipulate('UPDATE auth_ext_attr_mapping SET auth_mode = ' . $ilDB->quote('saml', 'text')); 19570?> 19571<#5168> 19572<?php 19573$ilDB->dropPrimaryKey('auth_ext_attr_mapping'); 19574?> 19575<#5169> 19576<?php 19577$ilDB->addPrimaryKey('auth_ext_attr_mapping', array('auth_mode', 'auth_src_id', 'attribute')); 19578?> 19579<#5170> 19580<?php 19581if (!$ilDB->tableColumnExists('auth_ext_attr_mapping', 'ext_attribute') && $ilDB->tableColumnExists('auth_ext_attr_mapping', 'idp_attribute')) { 19582 $ilDB->renameTableColumn('auth_ext_attr_mapping', 'idp_attribute', 'ext_attribute'); 19583} 19584?> 19585<#5171> 19586<?php 19587if (!$ilDB->sequenceExists('saml_idp_settings')) { 19588 $ilDB->createSequence('saml_idp_settings'); 19589} 19590?> 19591<#5172> 19592<?php 19593if (!$ilDB->tableColumnExists('saml_idp_settings', 'entity_id')) { 19594 $ilDB->addTableColumn( 19595 'saml_idp_settings', 19596 'entity_id', 19597 array( 19598 'type' => 'text', 19599 'length' => 1000, 19600 'notnull' => false, 19601 'default' => null 19602 ) 19603 ); 19604} 19605?> 19606 19607<#5173> 19608<?php 19609if ($ilDB->tableExists('cal_categories_hidden')) { 19610 $ilDB->renameTable('cal_categories_hidden', 'cal_cat_visibility'); 19611 $ilDB->addTableColumn('cal_cat_visibility', 'obj_id', array( 19612 "type" => "integer", 19613 "length" => 4, 19614 "notnull" => true, 19615 "default" => 0 19616 )); 19617 $ilDB->addTableColumn('cal_cat_visibility', 'visible', array( 19618 "type" => "integer", 19619 "length" => 1, 19620 "notnull" => true, 19621 "default" => 0 19622 )); 19623} 19624?> 19625<#5174> 19626<?php 19627if ($ilDB->tableExists('cal_cat_visibility')) { 19628 $ilDB->dropPrimaryKey('cal_cat_visibility'); 19629 $ilDB->addPrimaryKey('cal_cat_visibility', array('user_id','cat_id','obj_id')); 19630} 19631?> 19632<#5175> 19633<?php 19634 $ilCtrlStructureReader->getStructure(); 19635?> 19636<#5176> 19637<?php 19638$fields = array( 19639 'id' => array( 19640 'type' => 'integer', 19641 'length' => '8', 19642 19643 ), 19644 'title' => array( 19645 'type' => 'text', 19646 'length' => '512', 19647 19648 ), 19649 'description' => array( 19650 'type' => 'text', 19651 'length' => '4000', 19652 19653 ), 19654 'core_position' => array( 19655 'type' => 'integer', 19656 'length' => '1', 19657 19658 ), 19659 'core_identifier' => array( 19660 'type' => 'integer', 19661 'length' => '1', 19662 ), 19663 19664); 19665if (!$ilDB->tableExists('il_orgu_positions')) { 19666 $ilDB->createTable('il_orgu_positions', $fields); 19667 $ilDB->addPrimaryKey('il_orgu_positions', array( 'id' )); 19668 19669 if (!$ilDB->sequenceExists('il_orgu_positions')) { 19670 $ilDB->createSequence('il_orgu_positions'); 19671 } 19672} 19673?> 19674<#5177> 19675<?php 19676$fields = array( 19677 'id' => array( 19678 'type' => 'integer', 19679 'length' => '8', 19680 19681 ), 19682 'over' => array( 19683 'type' => 'integer', 19684 'length' => '1', 19685 19686 ), 19687 'scope' => array( 19688 'type' => 'integer', 19689 'length' => '1', 19690 19691 ), 19692 'position_id' => array( 19693 'type' => 'integer', 19694 'length' => '1', 19695 19696 ), 19697 19698); 19699if (!$ilDB->tableExists('il_orgu_authority')) { 19700 $ilDB->createTable('il_orgu_authority', $fields); 19701 $ilDB->addPrimaryKey('il_orgu_authority', array( 'id' )); 19702 19703 if (!$ilDB->sequenceExists('il_orgu_authority')) { 19704 $ilDB->createSequence('il_orgu_authority'); 19705 } 19706} 19707?> 19708<#5178> 19709<?php 19710$fields = array( 19711 'id' => array( 19712 'type' => 'integer', 19713 'length' => '8', 19714 19715 ), 19716 'user_id' => array( 19717 'type' => 'integer', 19718 'length' => '8', 19719 19720 ), 19721 'position_id' => array( 19722 'type' => 'integer', 19723 'length' => '8', 19724 19725 ), 19726 'orgu_id' => array( 19727 'type' => 'integer', 19728 'length' => '8', 19729 19730 ), 19731 19732); 19733if (!$ilDB->tableExists('il_orgu_ua')) { 19734 $ilDB->createTable('il_orgu_ua', $fields); 19735 $ilDB->addPrimaryKey('il_orgu_ua', array( 'id' )); 19736 19737 if (!$ilDB->sequenceExists('il_orgu_ua')) { 19738 $ilDB->createSequence('il_orgu_ua'); 19739 } 19740} 19741?> 19742<#5179> 19743<?php 19744$fields = array( 19745 'operation_id' => array( 19746 'type' => 'integer', 19747 'length' => '8', 19748 19749 ), 19750 'operation_string' => array( 19751 'type' => 'text', 19752 'length' => '16', 19753 19754 ), 19755 'description' => array( 19756 'type' => 'text', 19757 'length' => '512', 19758 19759 ), 19760 'list_order' => array( 19761 'type' => 'integer', 19762 'length' => '8', 19763 19764 ), 19765 'context_id' => array( 19766 'type' => 'integer', 19767 'length' => '8', 19768 19769 ), 19770 19771); 19772if (!$ilDB->tableExists('il_orgu_operations')) { 19773 $ilDB->createTable('il_orgu_operations', $fields); 19774 $ilDB->addPrimaryKey('il_orgu_operations', array( 'operation_id' )); 19775 19776 if (!$ilDB->sequenceExists('il_orgu_operations')) { 19777 $ilDB->createSequence('il_orgu_operations'); 19778 } 19779} 19780?> 19781<#5180> 19782<?php 19783$fields = array( 19784 'id' => array( 19785 'type' => 'integer', 19786 'length' => '8', 19787 19788 ), 19789 'context' => array( 19790 'type' => 'text', 19791 'length' => '16', 19792 19793 ), 19794 'parent_context_id' => array( 19795 'type' => 'integer', 19796 'length' => '8', 19797 19798 ), 19799 19800); 19801if (!$ilDB->tableExists('il_orgu_op_contexts')) { 19802 $ilDB->createTable('il_orgu_op_contexts', $fields); 19803 $ilDB->addPrimaryKey('il_orgu_op_contexts', array( 'id' )); 19804 19805 if (!$ilDB->sequenceExists('il_orgu_op_contexts')) { 19806 $ilDB->createSequence('il_orgu_op_contexts'); 19807 } 19808} 19809?> 19810<#5181> 19811<?php 19812$fields = array( 19813 'id' => array( 19814 'type' => 'integer', 19815 'length' => '8', 19816 19817 ), 19818 'context_id' => array( 19819 'type' => 'integer', 19820 'length' => '8', 19821 19822 ), 19823 'operations' => array( 19824 'type' => 'text', 19825 'length' => '2048', 19826 19827 ), 19828 'parent_id' => array( 19829 'type' => 'integer', 19830 'length' => '8', 19831 19832 ), 19833 'position_id' => array( 19834 'type' => 'integer', 19835 'length' => '8', 19836 19837 ), 19838 19839); 19840if (!$ilDB->tableExists('il_orgu_permissions')) { 19841 $ilDB->createTable('il_orgu_permissions', $fields); 19842 $ilDB->addPrimaryKey('il_orgu_permissions', array( 'id' )); 19843 19844 if (!$ilDB->sequenceExists('il_orgu_permissions')) { 19845 $ilDB->createSequence('il_orgu_permissions'); 19846 } 19847} 19848?> 19849<#5182> 19850<?php 19851$ilOrgUnitPositionEmployee = new ilOrgUnitPosition(); 19852$ilOrgUnitPositionEmployee->setTitle("Employees"); 19853$ilOrgUnitPositionEmployee->setDescription("Employees of a OrgUnit"); 19854$ilOrgUnitPositionEmployee->setCorePosition(true); 19855$ilOrgUnitPositionEmployee->create(); 19856$employee_position_id = $ilOrgUnitPositionEmployee->getId(); 19857 19858$ilOrgUnitPositionSuperior = new ilOrgUnitPosition(); 19859$ilOrgUnitPositionSuperior->setTitle("Superiors"); 19860$ilOrgUnitPositionSuperior->setDescription("Superiors of a OrgUnit"); 19861$ilOrgUnitPositionSuperior->setCorePosition(true); 19862 19863// Authority 19864$Sup = new ilOrgUnitAuthority(); 19865$Sup->setScope(ilOrgUnitAuthority::SCOPE_SAME_ORGU); 19866$Sup->setOver($ilOrgUnitPositionEmployee->getId()); 19867$ilOrgUnitPositionSuperior->setAuthorities([ $Sup ]); 19868$ilOrgUnitPositionSuperior->create(); 19869$superiors_position_id = $ilOrgUnitPositionSuperior->getId(); 19870 19871?> 19872<#5183> 19873<?php 19874 19875try { 19876 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_OBJECT); 19877 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_IASS, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19878 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_CRS, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19879 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_GRP, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19880 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_TST, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19881 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_EXC, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19882 ilOrgUnitOperationContextQueries::registerNewContext(ilOrgUnitOperationContext::CONTEXT_SVY, ilOrgUnitOperationContext::CONTEXT_OBJECT); 19883 19884 // These actions will be registred in step 5186 19885// ilOrgUnitOperationQueries::registerNewOperationForMultipleContexts(ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, 'Read the learning Progress of a User', array( 19886// ilOrgUnitOperationContext::CONTEXT_CRS, 19887// ilOrgUnitOperationContext::CONTEXT_GRP, 19888// ilOrgUnitOperationContext::CONTEXT_IASS, 19889// ilOrgUnitOperationContext::CONTEXT_EXC, 19890// ilOrgUnitOperationContext::CONTEXT_SVY, 19891// )); 19892// 19893// ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_MANAGE_MEMBERS, 'Edit Members in a course', ilOrgUnitOperationContext::CONTEXT_CRS); 19894// ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_MANAGE_MEMBERS, 'Edit Members in a group', ilOrgUnitOperationContext::CONTEXT_GRP); 19895// ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_EDIT_SUBMISSION_GRADES, '', ilOrgUnitOperationContext::CONTEXT_EXC); 19896// ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_ACCESS_RESULTS, '', ilOrgUnitOperationContext::CONTEXT_SVY); 19897} catch (ilException $e) { 19898} 19899 19900 19901?> 19902 19903<#5184> 19904<?php 19905if (!$ilDB->tableColumnExists('prg_usr_progress', 'deadline')) { 19906 $ilDB->addTableColumn( 19907 'prg_usr_progress', 19908 'deadline', 19909 array('type' => 'text', 19910 'length' => 15, 19911 'notnull' => false 19912 ) 19913 ); 19914} 19915 19916?> 19917<#5185> 19918<?php 19919 if (!$ilDB->tableColumnExists('sahs_lm', 'id_setting')) { 19920 $ilDB->addTableColumn( 19921 'sahs_lm', 19922 'id_setting', 19923 array( 19924 'type' => 'integer', 19925 'length' => 1, 19926 'notnull' => true, 19927 'default' => 0 19928 ) 19929 ); 19930 $ilDB->query("UPDATE sahs_lm SET id_setting = 0"); 19931 } 19932?> 19933<#5186> 19934<?php 19935 19936$ilDB->modifyTableColumn( 19937 'il_orgu_operations', 19938 'operation_string', 19939 array( 19940 "length" => 127 19941 ) 19942); 19943 ilOrgUnitOperation::resetDB(); 19944 ilOrgUnitOperationQueries::registerNewOperationForMultipleContexts(ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, 'Read the learning Progress of a User', array( 19945 ilOrgUnitOperationContext::CONTEXT_CRS, 19946 ilOrgUnitOperationContext::CONTEXT_GRP, 19947 ilOrgUnitOperationContext::CONTEXT_IASS, 19948 ilOrgUnitOperationContext::CONTEXT_EXC, 19949 ilOrgUnitOperationContext::CONTEXT_SVY, 19950 )); 19951 19952 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_MANAGE_MEMBERS, 'Edit Members in a course', ilOrgUnitOperationContext::CONTEXT_CRS); 19953 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_MANAGE_MEMBERS, 'Edit Members in a group', ilOrgUnitOperationContext::CONTEXT_GRP); 19954 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_EDIT_SUBMISSION_GRADES, '', ilOrgUnitOperationContext::CONTEXT_EXC); 19955 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_ACCESS_RESULTS, '', ilOrgUnitOperationContext::CONTEXT_SVY); 19956?> 19957<#5187> 19958<?php 19959 if (!$ilDB->tableColumnExists('sahs_lm', 'name_setting')) { 19960 $ilDB->addTableColumn( 19961 'sahs_lm', 19962 'name_setting', 19963 array( 19964 'type' => 'integer', 19965 'length' => 1, 19966 'notnull' => true, 19967 'default' => 0 19968 ) 19969 ); 19970 $ilDB->query("UPDATE sahs_lm SET name_setting = 0"); 19971 } 19972?> 19973<#5188> 19974<?php 19975if (!$ilDB->tableExists('orgu_obj_type_settings')) { 19976 $ilDB->createTable( 19977 'orgu_obj_type_settings', 19978 array( 19979 'obj_type' => array( 19980 'type' => 'text', 19981 'length' => 10, 19982 'notnull' => true 19983 ), 19984 'active' => array( 19985 'type' => 'integer', 19986 'length' => 1, 19987 'notnull' => false, 19988 'default' => 0 19989 ), 19990 'activation_default' => array( 19991 'type' => 'integer', 19992 'length' => 1, 19993 'notnull' => false, 19994 'default' => 0 19995 ), 19996 'changeable' => array( 19997 'type' => 'integer', 19998 'length' => 1, 19999 'notnull' => false, 20000 'default' => 0 20001 ) 20002 ) 20003 ); 20004 $ilDB->addPrimaryKey('orgu_obj_type_settings', array('obj_type')); 20005} 20006?> 20007<#5189> 20008<?php 20009if (!$ilDB->tableExists('orgu_obj_pos_settings')) { 20010 $ilDB->createTable( 20011 'orgu_obj_pos_settings', 20012 array( 20013 'obj_id' => array( 20014 'type' => 'integer', 20015 'length' => 4, 20016 'notnull' => false 20017 ), 20018 'active' => array( 20019 'type' => 'integer', 20020 'length' => 1, 20021 'notnull' => false, 20022 'default' => 0 20023 ) 20024 ) 20025 ); 20026 $ilDB->addPrimaryKey('orgu_obj_pos_settings', array('obj_id')); 20027} 20028 20029?> 20030<#5190> 20031<?php 20032 20033ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_WRITE_LEARNING_PROGRESS, 'Write the learning Progress of a User', ilOrgUnitOperationContext::CONTEXT_IASS); 20034 20035?> 20036<#5191> 20037<?php 20038// "make place" for two new datatypes, text_selection comes after text, date_selection comes after datetime 20039$ilDB->manipulate("UPDATE il_dcl_datatype SET sort = (sort + 10) WHERE title in ('number', 'boolean', 'datetime')"); 20040$ilDB->manipulate("UPDATE il_dcl_datatype SET sort = (sort + 20) WHERE title not in ('text', 'number', 'boolean', 'datetime')"); 20041?> 20042<#5192> 20043<?php 20044// Datacollection: Add text_selection fieldtype 20045$ilDB->insert('il_dcl_datatype', array( 20046 'id' => array('integer', ilDclDatatype::INPUTFORMAT_TEXT_SELECTION), 20047 'title' => array('text', 'text_selection'), 20048 'ildb_type' => array('text', 'text'), 20049 'storage_location' => array('integer', 1), 20050 'sort' => array('integer', 10), 20051 )); 20052// Datacollection: Add date_selection fieldtype 20053$ilDB->insert('il_dcl_datatype', array( 20054 'id' => array('integer', ilDclDatatype::INPUTFORMAT_DATE_SELECTION), 20055 'title' => array('text', 'date_selection'), 20056 'ildb_type' => array('text', 'text'), 20057 'storage_location' => array('integer', 1), 20058 'sort' => array('integer', 50), 20059)); 20060?> 20061<#5193> 20062<?php 20063$fields = array( 20064 'id' => array( 20065 'notnull' => '1', 20066 'type' => 'integer', 20067 'length' => '8', 20068 20069 ), 20070 'field_id' => array( 20071 'notnull' => '1', 20072 'type' => 'integer', 20073 'length' => '8', 20074 20075 ), 20076 'opt_id' => array( 20077 'notnull' => '1', 20078 'type' => 'integer', 20079 'length' => '8', 20080 20081 ), 20082 'sorting' => array( 20083 'notnull' => '1', 20084 'type' => 'integer', 20085 'length' => '8', 20086 20087 ), 20088 'value' => array( 20089 'notnull' => '1', 20090 'type' => 'text', 20091 'length' => '128', 20092 20093 ), 20094 20095); 20096if (!$ilDB->tableExists('il_dcl_sel_opts')) { 20097 $ilDB->createTable('il_dcl_sel_opts', $fields); 20098 $ilDB->addPrimaryKey('il_dcl_sel_opts', array( 'id' )); 20099 20100 if (!$ilDB->sequenceExists('il_dcl_sel_opts')) { 20101 $ilDB->createSequence('il_dcl_sel_opts'); 20102 } 20103} 20104?> 20105<#5194> 20106<?php 20107 20108if (!$ilDB->tableColumnExists('il_orgu_positions', 'core_identifier')) { 20109 $ilDB->addTableColumn( 20110 'il_orgu_positions', 20111 'core_identifier', 20112 array( 20113 'type' => 'integer', 20114 'length' => 4, 20115 'default' => 0 20116 ) 20117 ); 20118 $ilDB->query("UPDATE il_orgu_positions SET core_identifier = 0"); 20119} 20120$employee = ilOrgUnitPosition::where(['title' => "Employees", 'core_position' => true])->first(); 20121$employee->setCoreIdentifier(ilOrgUnitPosition::CORE_POSITION_EMPLOYEE); 20122$employee->update(); 20123 20124$superior = ilOrgUnitPosition::where(['title' => "Superiors", 'core_position' => true])->first(); 20125$superior->setCoreIdentifier(ilOrgUnitPosition::CORE_POSITION_SUPERIOR); 20126$superior->update(); 20127 20128?> 20129 20130 20131<#5195> 20132<?php 20133$ilDB->insert( 20134 'pdfgen_renderer_avail', 20135 array( 20136 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 20137 'service' => array('text', 'Wiki'), 20138 'purpose' => array('text', 'ContentExport'), 20139 'renderer' => array('text', 'PhantomJS') 20140 ) 20141); 20142?> 20143<#5196> 20144<?php 20145$ilDB->insert( 20146 'pdfgen_renderer_avail', 20147 array( 20148 'availability_id' => array('integer', $ilDB->nextId('pdfgen_renderer_avail')), 20149 'service' => array('text', 'Portfolio'), 20150 'purpose' => array('text', 'ContentExport'), 20151 'renderer' => array('text', 'PhantomJS') 20152 ) 20153); 20154?> 20155<#5197> 20156<?php 20157 ilOrgUnitOperationQueries::registerNewOperation(ilOrgUnitOperation::OP_ACCESS_ENROLMENTS, 'Access Enrolments in a course', ilOrgUnitOperationContext::CONTEXT_CRS); 20158?> 20159<#5198> 20160<?php 20161if (!$ilDB->tableColumnExists('crs_settings', 'show_members_export')) { 20162 $ilDB->addTableColumn('crs_settings', 'show_members_export', array( 20163 "type" => "integer", 20164 "notnull" => false, 20165 "length" => 4 20166 )); 20167} 20168?> 20169<#5199> 20170<?php 20171 $ilCtrlStructureReader->getStructure(); 20172?> 20173 20174<#5200> 20175<?php 20176include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 20177ilDBUpdateNewObjectType::addAdminNode('ltis', 'LTI Settings'); 20178 20179if (!$ilDB->tableExists('lti_ext_consumer')) { 20180 $ilDB->createTable('lti_ext_consumer', array( 20181 'id' => array( 20182 'type' => 'integer', 20183 'length' => 4, 20184 'notnull' => true, 20185 'default' => 0 20186 ), 20187 'title' => array( 20188 'type' => 'text', 20189 'length' => 255, 20190 'notnull' => true, 20191 ), 20192 'description' => array( 20193 'type' => 'text', 20194 'length' => 255, 20195 'notnull' => true, 20196 ), 20197 'prefix' => array( 20198 'type' => 'text', 20199 'length' => 255, 20200 'notnull' => true, 20201 ), 20202 'consumer_key' => array( 20203 'type' => 'text', 20204 'length' => 255, 20205 'notnull' => true, 20206 ), 20207 'consumer_secret' => array( 20208 'type' => 'text', 20209 'length' => 255, 20210 'notnull' => true, 20211 ), 20212 'user_language' => array( 20213 'type' => 'text', 20214 'length' => 255, 20215 'notnull' => true, 20216 ), 20217 'role' => array( 20218 'type' => 'integer', 20219 'length' => 4, 20220 'notnull' => true, 20221 'default' => 0 20222 ), 20223 'active' => array( 20224 'type' => 'integer', 20225 'length' => 1, 20226 'notnull' => true, 20227 'default' => 0 20228 ) 20229 )); 20230 $ilDB->addPrimaryKey('lti_ext_consumer', array('id')); 20231 $ilDB->createSequence('lti_ext_consumer'); 20232} 20233 20234if (!$ilDB->tableExists('lti_ext_consumer_otype')) { 20235 $ilDB->createTable('lti_ext_consumer_otype', array( 20236 'consumer_id' => array( 20237 'type' => 'integer', 20238 'length' => 4, 20239 'notnull' => true, 20240 'default' => 0 20241 ), 20242 'object_type' => array( 20243 'type' => 'text', 20244 'length' => 255, 20245 'notnull' => true 20246 ), 20247 )); 20248 $ilDB->addPrimaryKey('lti_ext_consumer_otype', array('consumer_id', 'object_type')); 20249} 20250?> 20251<#5201> 20252<?php 20253if (!$ilDB->tableExists('lti2_consumer')) { 20254 $ilDB->createTable('lti2_consumer', array( 20255 'consumer_pk' => array( 20256 'type' => 'integer', 20257 'length' => 4, 20258 'notnull' => true 20259 ), 20260 'name' => array( 20261 'type' => 'text', 20262 'length' => 50, 20263 'notnull' => true 20264 ), 20265 'consumer_key256' => array( 20266 'type' => 'text', 20267 'length' => 256, 20268 'notnull' => true 20269 ), 20270 'consumer_key' => array( 20271 'type' => 'blob', 20272 'default' => null 20273 ), 20274 'secret' => array( 20275 'type' => 'text', 20276 'length' => 1024, 20277 'notnull' => true 20278 ), 20279 'lti_version' => array( 20280 'type' => 'text', 20281 'length' => 10, 20282 'default' => null 20283 ), 20284 'consumer_name' => array( 20285 'type' => 'text', 20286 'length' => 255, 20287 'default' => null 20288 ), 20289 'consumer_version' => array( 20290 'type' => 'text', 20291 'length' => 255, 20292 'default' => null 20293 ), 20294 'consumer_guid' => array( 20295 'type' => 'text', 20296 'length' => 1024, 20297 'default' => null 20298 ), 20299 'profile' => array( 20300 'type' => 'blob', 20301 'default' => null 20302 ), 20303 'tool_proxy' => array( 20304 'type' => 'blob', 20305 'default' => null 20306 ), 20307 'settings' => array( 20308 'type' => 'blob', 20309 'default' => null 20310 ), 20311 'protected' => array( 20312 'type' => 'integer', 20313 'length' => 1, 20314 'notnull' => true 20315 ), 20316 'enabled' => array( 20317 'type' => 'integer', 20318 'length' => 1, 20319 'notnull' => true 20320 ), 20321 'enable_from' => array( 20322 'type' => 'timestamp', 20323 'default' => null 20324 ), 20325 'enable_until' => array( 20326 'type' => 'timestamp', 20327 'default' => null 20328 ), 20329 'last_access' => array( 20330 'type' => 'timestamp', 20331 'default' => null 20332 ), 20333 'created' => array( 20334 'type' => 'timestamp', 20335 'notnull' => true 20336 ), 20337 'updated' => array( 20338 'type' => 'timestamp', 20339 'notnull' => true 20340 ) 20341 )); 20342 $ilDB->addPrimaryKey('lti2_consumer', array('consumer_pk')); 20343 $ilDB->createSequence('lti2_consumer'); 20344} 20345?> 20346<#5202> 20347<?php 20348if (!$ilDB->tableExists('lti2_tool_proxy')) { 20349 $ilDB->createTable('lti2_tool_proxy', array( 20350 'tool_proxy_pk' => array( 20351 'type' => 'integer', 20352 'length' => 4, 20353 'notnull' => true 20354 ), 20355 'tool_proxy_id' => array( 20356 'type' => 'text', 20357 'length' => 32, 20358 'notnull' => true 20359 ), 20360 'consumer_pk' => array( 20361 'type' => 'integer', 20362 'length' => 4, 20363 'notnull' => true 20364 ), 20365 'tool_proxy' => array( 20366 'type' => 'blob', 20367 'notnull' => true 20368 ), 20369 'created' => array( 20370 'type' => 'timestamp', 20371 'notnull' => true 20372 ), 20373 'updated' => array( 20374 'type' => 'timestamp', 20375 'notnull' => true 20376 ) 20377 )); 20378 $ilDB->addPrimaryKey('lti2_tool_proxy', array('tool_proxy_pk')); 20379 $ilDB->addIndex('lti2_tool_proxy', array('consumer_pk'), 'i1'); 20380 $ilDB->addUniqueConstraint('lti2_tool_proxy', array('tool_proxy_id'), 'u1'); 20381 $ilDB->createSequence('lti2_tool_proxy'); 20382} 20383?> 20384<#5203> 20385<?php 20386if (!$ilDB->tableExists('lti2_nonce')) { 20387 $ilDB->createTable('lti2_nonce', array( 20388 'consumer_pk' => array( 20389 'type' => 'integer', 20390 'length' => 4, 20391 'notnull' => true 20392 ), 20393 'value' => array( 20394 'type' => 'text', 20395 'length' => 32, 20396 'notnull' => true 20397 ), 20398 'expires' => array( 20399 'type' => 'timestamp', 20400 'notnull' => true 20401 ) 20402 )); 20403 $ilDB->addPrimaryKey('lti2_nonce', array('consumer_pk','value')); 20404} 20405?> 20406<#5204> 20407<?php 20408if (!$ilDB->tableExists('lti2_context')) { 20409 $ilDB->createTable('lti2_context', array( 20410 'context_pk' => array( 20411 'type' => 'integer', 20412 'length' => 4, 20413 'notnull' => true 20414 ), 20415 'consumer_pk' => array( 20416 'type' => 'integer', 20417 'length' => 4, 20418 'notnull' => true 20419 ), 20420 'lti_context_id' => array( 20421 'type' => 'text', 20422 'length' => 255, 20423 'notnull' => true 20424 ), 20425 'settings' => array( 20426 'type' => 'blob', 20427 'default' => null 20428 ), 20429 'created' => array( 20430 'type' => 'timestamp', 20431 'notnull' => true 20432 ), 20433 'updated' => array( 20434 'type' => 'timestamp', 20435 'notnull' => true 20436 ) 20437 )); 20438 $ilDB->addPrimaryKey('lti2_context', array('context_pk')); 20439 $ilDB->addIndex('lti2_context', array('consumer_pk'), 'i1'); 20440 $ilDB->createSequence('lti2_context'); 20441} 20442?> 20443<#5205> 20444<?php 20445if (!$ilDB->tableExists('lti2_resource_link')) { 20446 $ilDB->createTable('lti2_resource_link', array( 20447 'resource_link_pk' => array( 20448 'type' => 'integer', 20449 'length' => 4 20450 ), 20451 'context_pk' => array( 20452 'type' => 'integer', 20453 'length' => 4, 20454 'default' => null 20455 ), 20456 'consumer_pk' => array( 20457 'type' => 'integer', 20458 'length' => 4, 20459 'default' => null 20460 ), 20461 'lti_resource_link_id' => array( 20462 'type' => 'text', 20463 'length' => 255, 20464 'notnull' => true 20465 ), 20466 'settings' => array( 20467 'type' => 'blob' 20468 ), 20469 'primary_resource_link_pk' => array( 20470 'type' => 'integer', 20471 'length' => 4, 20472 'default' => null 20473 ), 20474 'share_approved' => array( 20475 'type' => 'integer', 20476 'length' => 1, 20477 'default' => null 20478 ), 20479 'created' => array( 20480 'type' => 'timestamp', 20481 'notnull' => true 20482 ), 20483 'updated' => array( 20484 'type' => 'timestamp', 20485 'notnull' => true 20486 ) 20487 )); 20488 $ilDB->addPrimaryKey('lti2_resource_link', array('resource_link_pk')); 20489 $ilDB->addIndex('lti2_resource_link', array('consumer_pk'), 'i1'); 20490 $ilDB->addIndex('lti2_resource_link', array('context_pk'), 'i2'); 20491 $ilDB->createSequence('lti2_resource_link'); 20492} 20493?> 20494<#5206> 20495<?php 20496if (!$ilDB->tableExists('lti2_user_result')) { 20497 $ilDB->createTable('lti2_user_result', array( 20498 'user_pk' => array( 20499 'type' => 'integer', 20500 'length' => 4 20501 ), 20502 'resource_link_pk' => array( 20503 'type' => 'integer', 20504 'length' => 4, 20505 'notnull' => true 20506 ), 20507 'lti_user_id' => array( 20508 'type' => 'text', 20509 'length' => 255, 20510 'notnull' => true 20511 ), 20512 'lti_result_sourcedid' => array( 20513 'type' => 'text', 20514 'length' => 1024, 20515 'notnull' => true 20516 ), 20517 'created' => array( 20518 'type' => 'timestamp', 20519 'notnull' => true 20520 ), 20521 'updated' => array( 20522 'type' => 'timestamp', 20523 'notnull' => true 20524 ) 20525 )); 20526 $ilDB->addPrimaryKey('lti2_user_result', array('user_pk')); 20527 $ilDB->addIndex('lti2_user_result', array('resource_link_pk'), 'i1'); 20528 $ilDB->createSequence('lti2_user_result'); 20529} 20530?> 20531<#5207> 20532<?php 20533if (!$ilDB->tableExists('lti2_share_key')) { 20534 $ilDB->createTable('lti2_share_key', array( 20535 'share_key_id' => array( 20536 'type' => 'text', 20537 'length' => 32, 20538 'notnull' => true 20539 ), 20540 'resource_link_pk' => array( 20541 'type' => 'integer', 20542 'length' => 4, 20543 'notnull' => true 20544 ), 20545 'auto_approve' => array( 20546 'type' => 'integer', 20547 'length' => 1, 20548 'notnull' => true 20549 ), 20550 'expires' => array( 20551 'type' => 'timestamp', 20552 'notnull' => true 20553 ) 20554 )); 20555 $ilDB->addPrimaryKey('lti2_share_key', array('share_key_id')); 20556 $ilDB->addIndex('lti2_share_key', array('resource_link_pk'), 'i1'); 20557} 20558?> 20559<#5208> 20560<?php 20561if (!$ilDB->tableColumnExists('lti_ext_consumer', 'local_role_always_member')) { 20562 $ilDB->addTableColumn('lti_ext_consumer', 'local_role_always_member', array( 20563 'type' => 'integer', 20564 'length' => 1, 20565 'notnull' => true, 20566 'default' => 0 20567 )); 20568} 20569?> 20570<#5209> 20571<?php 20572if (!$ilDB->tableColumnExists('lti_ext_consumer', 'default_skin')) { 20573 $ilDB->addTableColumn('lti_ext_consumer', 'default_skin', array( 20574 'type' => 'text', 20575 'length' => 50, 20576 'default' => null 20577 )); 20578} 20579?> 20580<#5210> 20581<?php 20582if ($ilDB->tableColumnExists('lti_ext_consumer', 'consumer_key')) { 20583 $ilDB->dropTableColumn('lti_ext_consumer', 'consumer_key'); 20584} 20585if ($ilDB->tableColumnExists('lti_ext_consumer', 'consumer_secret')) { 20586 $ilDB->dropTableColumn('lti_ext_consumer', 'consumer_secret'); 20587} 20588if ($ilDB->tableColumnExists('lti_ext_consumer', 'active')) { 20589 $ilDB->dropTableColumn('lti_ext_consumer', 'active'); 20590} 20591?> 20592<#5211> 20593<?php 20594if (!$ilDB->tableExists('lti_int_provider_obj')) { 20595 $ilDB->createTable('lti_int_provider_obj', array( 20596 'ref_id' => array( 20597 'type' => 'integer', 20598 'length' => 4, 20599 'notnull' => false 20600 ), 20601 'consumer_id' => array( 20602 'type' => 'integer', 20603 'length' => 4, 20604 'notnull' => false 20605 ), 20606 20607 'enabled' => array( 20608 'type' => 'integer', 20609 'length' => 1, 20610 'notnull' => false 20611 ), 20612 'admin' => array( 20613 'type' => 'integer', 20614 'length' => 1, 20615 'notnull' => false 20616 ), 20617 'tutor' => array( 20618 'type' => 'integer', 20619 'length' => 1, 20620 'notnull' => false 20621 ), 20622 'member' => array( 20623 'type' => 'integer', 20624 'length' => 1, 20625 'notnull' => false 20626 ) 20627 )); 20628 $ilDB->addPrimaryKey('lti_int_provider_obj', array('ref_id','consumer_id')); 20629} 20630?> 20631<#5212> 20632<?php 20633if ($ilDB->tableExists('lti_int_provider_obj')) { 20634 $ilDB->dropTable('lti_int_provider_obj'); 20635} 20636?> 20637<#5213> 20638<?php 20639include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 20640$type_id = ilDBUpdateNewObjectType::getObjectTypeId('ltis'); 20641 20642$ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('release_objects', 'Release objects', 'object', 500); 20643if ($ops_id && $type_id) { 20644 ilDBUpdateNewObjectType::addRBACOperation($type_id, $ops_id); 20645} 20646?> 20647<#5214> 20648<?php 20649if (!$ilDB->tableColumnExists("il_object_def", "lti_provider")) { 20650 $def = array( 20651 'type' => 'integer', 20652 'length' => 1, 20653 'notnull' => true, 20654 'default' => 0 20655 ); 20656 $ilDB->addTableColumn("il_object_def", "lti_provider", $def); 20657} 20658?> 20659<#5215> 20660<?php 20661if (!$ilDB->tableColumnExists('lti2_consumer', 'ext_consumer_id')) { 20662 $ilDB->addTableColumn( 20663 'lti2_consumer', 20664 'ext_consumer_id', 20665 array( 20666 "type" => "integer", 20667 "notnull" => true, 20668 "length" => 4 20669 ) 20670 ); 20671} 20672?> 20673 20674<#5216> 20675<?php 20676if (!$ilDB->tableColumnExists('lti2_consumer', 'ref_id')) { 20677 $ilDB->addTableColumn( 20678 'lti2_consumer', 20679 'ref_id', 20680 array( 20681 "type" => "integer", 20682 "notnull" => true, 20683 "length" => 4 20684 ) 20685 ); 20686} 20687?> 20688<#5217> 20689<?php 20690if (!$ilDB->tableColumnExists('lti_ext_consumer', 'active')) { 20691 $ilDB->addTableColumn( 20692 'lti_ext_consumer', 20693 'active', 20694 [ 20695 'type' => 'integer', 20696 'length' => 1, 20697 'notnull' => true, 20698 'default' => 0 20699 ] 20700 ); 20701} 20702?> 20703<#5218> 20704<?php 20705if (!$ilDB->tableExists('lti_int_provider_obj')) { 20706 $ilDB->createTable('lti_int_provider_obj', array( 20707 'ref_id' => array( 20708 'type' => 'integer', 20709 'length' => 4, 20710 'notnull' => false 20711 ), 20712 'ext_consumer_id' => [ 20713 'type' => 'integer', 20714 'length' => 4, 20715 'notnull' => false 20716 ], 20717 'admin' => array( 20718 'type' => 'integer', 20719 'length' => 4, 20720 'notnull' => false 20721 ), 20722 'tutor' => array( 20723 'type' => 'integer', 20724 'length' => 4, 20725 'notnull' => false 20726 ), 20727 'member' => array( 20728 'type' => 'integer', 20729 'length' => 4, 20730 'notnull' => false 20731 ) 20732 )); 20733 $ilDB->addPrimaryKey('lti_int_provider_obj', array('ref_id','ext_consumer_id')); 20734} 20735?> 20736<#5219> 20737<?php 20738 $ilCtrlStructureReader->getStructure(); 20739?> 20740<#5220> 20741<?php 20742if (!$ilDB->tableColumnExists('file_data', 'page_count')) { 20743 $ilDB->addTableColumn( 20744 'file_data', 20745 'page_count', 20746 array( 20747 'type' => 'integer', 20748 'length' => 8, 20749 ) 20750 ); 20751} 20752?> 20753<#5221> 20754<?php 20755if (!$ilDB->tableColumnExists('il_blog', 'nav_list_mon_with_post')) { 20756 $ilDB->addTableColumn( 20757 'il_blog', 20758 'nav_list_mon_with_post', 20759 array( 20760 'type' => 'integer', 20761 'length' => 4, 20762 'default' => 3 20763 ) 20764 ); 20765} 20766?> 20767 20768<#5222> 20769<?php 20770 if (!$ilDB->tableColumnExists('iass_settings', 'file_required')) { 20771 $ilDB->addTableColumn('iass_settings', 'file_required', array( 20772 "type" => "integer", 20773 "length" => 1, 20774 "notnull" => true, 20775 "default" => 0 20776 )); 20777 } 20778?> 20779 20780<#5223> 20781<?php 20782 if (!$ilDB->tableColumnExists('iass_members', 'file_name')) { 20783 $ilDB->addTableColumn('iass_members', 'file_name', array( 20784 "type" => "text", 20785 "length" => 255 20786 )); 20787 } 20788 if (!$ilDB->tableColumnExists('iass_members', 'user_view_file')) { 20789 $ilDB->addTableColumn('iass_members', 'user_view_file', array( 20790 "type" => "integer", 20791 "length" => 1 20792 )); 20793 } 20794?> 20795<#5224> 20796<?php 20797$ilCtrlStructureReader->getStructure(); 20798?> 20799<#5225> 20800<?php 20801if ($ilDB->tableColumnExists('reg_registration_codes', 'generated')) { 20802 $ilDB->renameTableColumn('reg_registration_codes', "generated", 'generated_on'); 20803} 20804?> 20805<#5226> 20806<?php 20807if ($ilDB->tableColumnExists('il_orgu_operations', 'operation_string')) { 20808 $ilDB->modifyTableColumn( 20809 'il_orgu_operations', 20810 'operation_string', 20811 array( 20812 "length" => 127 20813 ) 20814 ); 20815} 20816?> 20817<#5227> 20818<?php 20819 $ilCtrlStructureReader->getStructure(); 20820?> 20821<#5228> 20822<?php 20823 $ilCtrlStructureReader->getStructure(); 20824?> 20825<#5229> 20826<?php 20827 if (!$ilDB->tableColumnExists('il_bt_bucket', 'last_heartbeat')) { 20828 $ilDB->addTableColumn('il_bt_bucket', 'last_heartbeat', array( 20829 "type" => "integer", 20830 "length" => 4 20831 )); 20832 } 20833?> 20834<#5230> 20835<?php 20836 $ilCtrlStructureReader->getStructure(); 20837?> 20838<#5231> 20839<?php 20840if (!$ilDB->indexExistsByFields('style_parameter', array('style_id'))) { 20841 $ilDB->addIndex('style_parameter', array('style_id'), 'i1'); 20842} 20843?> 20844<#5232> 20845<?php 20846include_once("./Services/Migration/DBUpdate_3136/classes/class.ilDBUpdate3136.php"); 20847ilDBUpdate3136::addStyleClass( 20848 "OrderListHorizontal", 20849 "qordul", 20850 "ul", 20851 array("margin" => "0px", 20852 "padding" => "0px", 20853 "list-style" => "none", 20854 "list-style-position" => "outside" 20855 ) 20856); 20857ilDBUpdate3136::addStyleClass( 20858 "OrderListItemHorizontal", 20859 "qordli", 20860 "li", 20861 array( 20862 "float" => "left", 20863 "margin-top" => "5px", 20864 "margin-bottom" => "5px", 20865 "margin-right" => "10px", 20866 "border-width" => "1px", 20867 "border-style" => "solid", 20868 "border-color" => "#D0D0FF", 20869 "padding" => "10px", 20870 "cursor" => "move" 20871 ) 20872); 20873?> 20874<#5233> 20875<?php 20876 $ilCtrlStructureReader->getStructure(); 20877?> 20878<#5234> 20879<?php 20880if ($ilDB->tableColumnExists('wiki_stat', 'del_pages')) { 20881 $ilDB->modifyTableColumn('wiki_stat', 'del_pages', array( 20882 'type' => 'integer', 20883 'length' => 4, 20884 'notnull' => true, 20885 'default' => 0 20886 )); 20887} 20888?> 20889<#5235> 20890<?php 20891if ($ilDB->tableColumnExists('wiki_stat', 'avg_rating')) { 20892 $ilDB->modifyTableColumn('wiki_stat', 'avg_rating', array( 20893 'type' => 'integer', 20894 'length' => 4, 20895 'notnull' => true, 20896 'default' => 0 20897 )); 20898} 20899?> 20900<#5236> 20901<?php 20902 20903 $ilDB->dropPrimaryKey('loc_rnd_qpl'); 20904?> 20905 20906<#5237> 20907<?php 20908 20909 $ilDB->addPrimaryKey('loc_rnd_qpl', ['container_id', 'objective_id', 'tst_type', 'tst_id', 'qp_seq']); 20910 20911?> 20912<#5238> 20913<?php 20914 $ilCtrlStructureReader->getStructure(); 20915?> 20916<#5239> 20917<?php 20918$ilDB->modifyTableColumn( 20919 'adv_md_record', 20920 'record_id', 20921 array( 20922 "type" => "integer", 20923 "length" => 4, 20924 "notnull" => true 20925 ) 20926); 20927?> 20928<#5240> 20929<?php 20930$ilDB->modifyTableColumn( 20931 'adv_md_record_objs', 20932 'record_id', 20933 array( 20934 "type" => "integer", 20935 "length" => 4, 20936 "notnull" => true 20937 ) 20938); 20939?> 20940<#5241> 20941<?php 20942 $ilCtrlStructureReader->getStructure(); 20943?> 20944<#5242> 20945<?php 20946 20947/** 20948 * This will move all the exercise instruction files from outside document root to inside. 20949 */ 20950 20951$result = $ilDB->query("SELECT id,exc_id FROM exc_assignment"); 20952 20953while ($row = $ilDB->fetchAssoc($result)) { 20954 include_once("./Services/Migration/DBUpdate_5242/classes/class.ilFSStorageExc5242.php"); 20955 $storage = new ilFSStorageExc5242($row['exc_id'], $row['id']); 20956 20957 $files = $storage->getFiles(); 20958 if (!empty($files)) { 20959 foreach ($files as $file) { 20960 $file_name = $file['name']; 20961 $file_full_path = $file['fullpath']; 20962 $file_relative_path = str_replace(ILIAS_DATA_DIR, "", $file_full_path); 20963 $directory_relative_path = str_replace($file_name, "", $file_relative_path); 20964 20965 if (!is_dir(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . $directory_relative_path)) { 20966 //echo "<br> makeDirParents: ".ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR.$directory_relative_path; 20967 ilUtil::makeDirParents(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . $directory_relative_path); 20968 } 20969 if (!file_exists(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . $file_relative_path) && 20970 file_exists($file_full_path)) { 20971 //echo "<br> rename: $file_full_path TO ".ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR.$file_relative_path; 20972 rename($file_full_path, ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . $file_relative_path); 20973 } 20974 } 20975 } 20976} 20977?> 20978<#5243> 20979<?php 20980if (!$ilDB->tableColumnExists('usr_session', 'context')) { 20981 $ilDB->addTableColumn( 20982 'usr_session', 20983 'context', 20984 array( 20985 'type' => 'text', 20986 'length' => '80', 20987 'notnull' => false) 20988 ); 20989} 20990?> 20991<#5244> 20992<?php 20993 //add table column 20994 if (!$ilDB->tableColumnExists('iass_members', 'changer_id')) { 20995 $ilDB->addTableColumn("iass_members", "changer_id", array( 20996 'type' => 'integer', 20997 'length' => 4, 20998 'notnull' => false 20999 )); 21000 } 21001?> 21002<#5245> 21003<?php 21004 //add table column 21005 if (!$ilDB->tableColumnExists('iass_members', 'change_time')) { 21006 $ilDB->addTableColumn("iass_members", "change_time", array( 21007 'type' => 'text', 21008 'length' => 20, 21009 'notnull' => false 21010 )); 21011 } 21012?> 21013 21014<#5246> 21015<?php 21016 include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 21017 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('edit_submissions_grades', 'Edit Submissions Grades', 'object', 3800); 21018 $type_id = ilDBUpdateNewObjectType::getObjectTypeId('exc'); 21019 if ($type_id && $new_ops_id) { 21020 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 21021 } 21022?> 21023<#5247> 21024<?php 21025include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 21026 21027 $src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 21028 $tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_submissions_grades'); 21029 ilDBUpdateNewObjectType::cloneOperation('exc', $src_ops_id, $tgt_ops_id); 21030?> 21031<#5248> 21032<?php 21033$ilCtrlStructureReader->getStructure(); 21034?> 21035<#5249> 21036<?php 21037 21038$ilSetting = new ilSetting(); 21039 21040if (!$ilSetting->get('dbupwarn_tstfixqstseq', 0)) { 21041 $res = $ilDB->query(" 21042 SELECT COUNT(DISTINCT test_fi) num_tst, COUNT(test_question_id) num_qst 21043 FROM tst_test_question WHERE test_fi IN( 21044 SELECT test_fi FROM tst_test_question 21045 GROUP BY test_fi HAVING COUNT(test_fi) < MAX(sequence) 21046 ) 21047 "); 21048 21049 $row = $ilDB->fetchAssoc($res); 21050 21051 if ($row) { 21052 $numTests = $row['num_tst']; 21053 $numQuestions = $row['num_qst']; 21054 echo "<pre> 21055 21056 DEAR ADMINISTRATOR !! 21057 21058 Please read the following instructions CAREFULLY! 21059 21060 -> Due to a bug in almost all earlier versions of ILIAS question orderings 21061 from the assessment component are broken but repairable. 21062 21063 -> The following dbupdate step can exhaust any php enviroment settings like 21064 max_execution_time or memory_limit for example. 21065 21066 -> In the case of any php fatal error during the following dbupdate step 21067 that is about exhausting any ressource or time restriction you just need 21068 to refresh the page by using F5 for example. 21069 21070 => To proceed the update process you now need to refresh the page as well (F5) 21071 21072 Mantis Bug Report: https://ilias.de/mantis/view.php?id=20382 21073 21074 In your database there were > {$numTests} tests < detected having > {$numQuestions} questions < overall, 21075 that are stored with gaps in the ordering index. 21076 21077 </pre>"; 21078 21079 $ilSetting->set('dbupwarn_tstfixqstseq', 1); 21080 exit; 21081 } 21082 21083 $ilSetting->set('dbupwarn_tstfixqstseq', 1); 21084} 21085 21086?> 21087<#5250> 21088<?php 21089 21090$res = $ilDB->query(" 21091 SELECT test_fi, test_question_id 21092 FROM tst_test_question WHERE test_fi IN( 21093 SELECT test_fi FROM tst_test_question 21094 GROUP BY test_fi HAVING COUNT(test_fi) < MAX(sequence) 21095 ) ORDER BY test_fi ASC, sequence ASC 21096"); 21097 21098$tests = array(); 21099 21100while ($row = $ilDB->fetchAssoc($res)) { 21101 if (!isset($tests[ $row['test_fi'] ])) { 21102 $tests[ $row['test_fi'] ] = array(); 21103 } 21104 21105 $tests[ $row['test_fi'] ][] = $row['test_question_id']; 21106} 21107 21108foreach ($tests as $testFi => $testQuestions) { 21109 for ($i = 0, $m = count($testQuestions); $i <= $m; $i++) { 21110 $testQuestionId = $testQuestions[$i]; 21111 21112 $position = $i + 1; 21113 21114 $ilDB->update( 21115 'tst_test_question', 21116 array( 'sequence' => array('integer', $position) ), 21117 array( 'test_question_id' => array('integer', $testQuestionId) ) 21118 ); 21119 } 21120} 21121 21122?> 21123<#5251> 21124<?php 21125global $DIC; 21126if (!$DIC->offsetExists("ilAppEventHandler")) { 21127 $DIC->offsetSet("ilAppEventHandler", new ilAppEventHandler()); 21128} 21129$set = $ilDB->query(" 21130 SELECT obj_id, title, description, role_id, usr_id FROM object_data 21131 INNER JOIN role_data role ON role.role_id = object_data.obj_id 21132 INNER JOIN rbac_ua on role.role_id = rol_id 21133 WHERE title LIKE '%il_orgu_superior%' OR title LIKE '%il_orgu_employee%' 21134"); 21135$assigns = []; 21136$superior_position_id = ilOrgUnitPosition::getCorePositionId(ilOrgUnitPosition::CORE_POSITION_SUPERIOR); 21137$employee_position_id = ilOrgUnitPosition::getCorePositionId(ilOrgUnitPosition::CORE_POSITION_EMPLOYEE); 21138 21139while ($res = $ilDB->fetchAssoc($set)) { 21140 $user_id = $res['usr_id']; 21141 21142 $tmp = explode("_", $res['title']); 21143 $orgu_ref_id = (int) $tmp[3]; 21144 if ($orgu_ref_id == 0) { 21145 //$ilLog->write("User $user_id could not be assigned to position. Role description does not contain object id of orgu. Skipping."); 21146 continue; 21147 } 21148 21149 $tmp = explode("_", $res['title']); //il_orgu_[superior|employee]_[$ref_id] 21150 $role_type = $tmp[2]; // [superior|employee] 21151 21152 if ($role_type == 'superior') { 21153 $position_id = $superior_position_id; 21154 } elseif ($role_type == 'employee') { 21155 $position_id = $employee_position_id; 21156 } else { 21157 //$ilLog->write("User $user_id could not be assigned to position. Role type seems to be neither superior nor employee. Skipping."); 21158 continue; 21159 } 21160 if (!ilOrgUnitUserAssignment::findOrCreateAssignment( 21161 $user_id, 21162 $position_id, 21163 $orgu_ref_id 21164 )) { 21165 //$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."); 21166 } 21167} 21168?> 21169<#5252> 21170<?php 21171$ilDB->query(" 21172UPDATE il_dcl_stloc1_value 21173SET value = NULL 21174WHERE value = '[]' 21175 AND record_field_id IN ( 21176 SELECT rf.id 21177 FROM il_dcl_record_field rf 21178 INNER JOIN il_dcl_field f ON f.id = rf.field_id 21179 WHERE f.datatype_id = 14 21180 ) 21181"); 21182?> 21183<#5253> 21184<?php 21185 21186$query = " 21187 SELECT qpl.question_id qid, 21188 qpl.points qpl_points, 21189 answ.points answ_points 21190 21191 FROM qpl_questions qpl 21192 21193 INNER JOIN qpl_qst_essay qst 21194 ON qst.question_fi = qpl.question_id 21195 21196 INNER JOIN qpl_a_essay answ 21197 ON answ.question_fi = qst.question_fi 21198 21199 WHERE qpl.question_id IN( 21200 21201 SELECT keywords.question_fi 21202 21203 FROM qpl_a_essay keywords 21204 21205 INNER JOIN qpl_qst_essay question 21206 ON question.question_fi = keywords.question_fi 21207 AND question.keyword_relation = {$ilDB->quote('', 'text')} 21208 21209 WHERE keywords.answertext = {$ilDB->quote('', 'text')} 21210 GROUP BY keywords.question_fi 21211 HAVING COUNT(keywords.question_fi) = {$ilDB->quote(1, 'integer')} 21212 21213 ) 21214"; 21215 21216$res = $ilDB->query($query); 21217 21218while ($row = $ilDB->fetchAssoc($res)) { 21219 if ($row['answ_points'] > $row['qpl_points']) { 21220 $ilDB->update( 21221 'qpl_questions', 21222 array('points' => array('float', $row['answ_points'])), 21223 array('question_id' => array('integer', $row['qid'])) 21224 ); 21225 } 21226 21227 $ilDB->manipulateF( 21228 "DELETE FROM qpl_a_essay WHERE question_fi = %s", 21229 array('integer'), 21230 array($row['qid']) 21231 ); 21232 21233 $ilDB->update( 21234 'qpl_qst_essay', 21235 array('keyword_relation' => array('text', 'non')), 21236 array('question_fi' => array('integer', $row['qid'])) 21237 ); 21238} 21239 21240?> 21241<#5254> 21242<?php 21243$ilCtrlStructureReader->getStructure(); 21244?> 21245<#5255> 21246<?php 21247if (!$ilDB->tableColumnExists(ilOrgUnitPermission::TABLE_NAME, 'protected')) { 21248 $ilDB->addTableColumn(ilOrgUnitPermission::TABLE_NAME, 'protected', [ 21249 "type" => "integer", 21250 "length" => 1, 21251 "default" => 0, 21252 ]); 21253} 21254$ilDB->manipulate("UPDATE il_orgu_permissions SET protected = 1 WHERE parent_id = -1"); 21255?> 21256<#5256> 21257<?php 21258if ($ilDB->indexExistsByFields('cmi_objective', array('id'))) { 21259 $ilDB->dropIndexByFields('cmi_objective', array('id')); 21260} 21261?> 21262<#5257> 21263<?php 21264if (!$ilDB->indexExistsByFields('page_style_usage', array('page_id', 'page_type', 'page_lang', 'page_nr'))) { 21265 $ilDB->addIndex('page_style_usage', array('page_id', 'page_type', 'page_lang', 'page_nr'), 'i1'); 21266} 21267?> 21268<#5258> 21269<?php 21270 21271include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 21272 21273$rp_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("read_learning_progress"); 21274$ep_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 21275$w_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 21276if ($rp_ops_id && $ep_ops_id && $w_ops_id) { 21277 // see ilObjectLP 21278 $lp_types = array('mcst'); 21279 21280 foreach ($lp_types as $lp_type) { 21281 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId($lp_type); 21282 if ($lp_type_id) { 21283 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $rp_ops_id); 21284 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ep_ops_id); 21285 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $rp_ops_id); 21286 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $ep_ops_id); 21287 } 21288 } 21289} 21290?> 21291<#5259> 21292<?php 21293 $ilDB->manipulate('UPDATE exc_mem_ass_status SET status=' . $ilDB->quote('notgraded', 'text') . ' WHERE status = ' . $ilDB->quote('', 'text')); 21294?> 21295<#5260> 21296<?php 21297$ilCtrlStructureReader->getStructure(); 21298?> 21299<#5261> 21300<?php 21301$ilCtrlStructureReader->getStructure(); 21302?> 21303<#5262> 21304<?php 21305 21306$query = 'select id from adm_settings_template ' . 21307 'where title = ' . $ilDB->quote('il_astpl_loc_initial', 'text') . 21308 'or title = ' . $ilDB->quote('il_astpl_loc_qualified', 'text'); 21309$res = $ilDB->query($query); 21310while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 21311 $ilDB->replace( 21312 'adm_set_templ_value', 21313 [ 21314 'template_id' => ['integer', $row->id], 21315 'setting' => ['text', 'pass_scoring'] 21316 ], 21317 [ 21318 'value' => ['integer',0], 21319 'hide' => ['integer',1] 21320 ] 21321 ); 21322} 21323?> 21324<#5263> 21325<?php 21326$ilDB->modifyTableColumn('il_dcl_tableview', 'roles', array('type' => 'clob')); 21327?> 21328<#5264> 21329<?php 21330// get tst type id 21331$row = $ilDB->fetchAssoc($ilDB->queryF( 21332 "SELECT obj_id tst_type_id FROM object_data WHERE type = %s AND title = %s", 21333 array('text', 'text'), 21334 array('typ', 'tst') 21335)); 21336$tstTypeId = $row['tst_type_id']; 21337 21338// get 'write' operation id 21339$row = $ilDB->fetchAssoc($ilDB->queryF( 21340 "SELECT ops_id FROM rbac_operations WHERE operation = %s AND class = %s", 21341 array('text', 'text'), 21342 array('write', 'general') 21343)); 21344$writeOperationId = $row['ops_id']; 21345 21346// register new 'object' rbac operation for tst 21347$resultsOperationId = $ilDB->nextId('rbac_operations'); 21348$ilDB->insert('rbac_operations', array( 21349 'ops_id' => array('integer', $resultsOperationId), 21350 'operation' => array('text', 'tst_results'), 21351 'description' => array('text', 'view the results of test participants'), 21352 'class' => array('text', 'object'), 21353 'op_order' => array('integer', 7050) 21354)); 21355$ilDB->insert('rbac_ta', array( 21356 'typ_id' => array('integer', $tstTypeId), 21357 'ops_id' => array('integer', $resultsOperationId) 21358)); 21359 21360// update existing role templates and grant new operation for all templates having 'write' granted 21361$res = $ilDB->queryF( 21362 "SELECT rol_id, parent FROM rbac_templates WHERE type = %s AND ops_id = %s", 21363 array('text', 'integer'), 21364 array('tst', $writeOperationId) 21365); 21366$stmt = $ilDB->prepareManip( 21367 " 21368 INSERT INTO rbac_templates (rol_id, type, ops_id, parent) VALUES (?, ?, ?, ?) 21369 ", 21370 array('integer', 'text', 'integer', 'integer') 21371); 21372while ($row = $ilDB->fetchAssoc($res)) { 21373 $ilDB->execute($stmt, array($row['rol_id'], 'tst', $resultsOperationId, $row['parent'])); 21374} 21375?> 21376<#5265> 21377<?php 21378// get 'write' operation id 21379$row = $ilDB->fetchAssoc($ilDB->queryF( 21380 "SELECT ops_id FROM rbac_operations WHERE operation = %s AND class = %s", 21381 array('text', 'text'), 21382 array('tst_results', 'object') 21383)); 21384$resultsOperationId = $row['ops_id']; 21385 21386// get 'write' operation id 21387$row = $ilDB->fetchAssoc($ilDB->queryF( 21388 "SELECT ops_id FROM rbac_operations WHERE operation = %s AND class = %s", 21389 array('text', 'text'), 21390 array('write', 'general') 21391)); 21392$writeOperationId = $row['ops_id']; 21393 21394// get roles (not rolts) having 'tst_results' registered in rbac_template 21395$res = $ilDB->queryF( 21396 " 21397 SELECT rol_id FROM rbac_templates INNER JOIN object_data 21398 ON obj_id = rol_id AND object_data.type = %s WHERE rbac_templates.type = %s AND ops_id = %s 21399 ", 21400 array('text', 'text', 'integer'), 21401 array('role', 'tst', $resultsOperationId) 21402); 21403$roleIds = array(); 21404while ($row = $ilDB->fetchAssoc($res)) { 21405 $roleIds[] = $row['rol_id']; 21406} 21407 21408// get existing test object references 21409$res = $ilDB->queryF( 21410 " 21411 SELECT oref.ref_id FROM object_data odat INNER JOIN object_reference oref 21412 ON oref.obj_id = odat.obj_id WHERE odat.type = %s 21413 ", 21414 array('text'), 21415 array('tst') 21416); 21417$tstRefs = array(); 21418while ($row = $ilDB->fetchAssoc($res)) { 21419 $tstRefs[] = $row['ref_id']; 21420} 21421 21422// complete 'tst_results' permission for all existing role/reference combination that have 'write' permission 21423$stmt = $ilDB->prepareManip( 21424 " 21425 UPDATE rbac_pa SET ops_id = ? WHERE rol_id = ? AND ref_id = ? 21426 ", 21427 array('text', 'integer', 'integer') 21428); 21429$IN_roles = $ilDB->in('rol_id', $roleIds, false, 'integer'); 21430$IN_tstrefs = $ilDB->in('ref_id', $tstRefs, false, 'integer'); 21431$res = $ilDB->query("SELECT * FROM rbac_pa WHERE {$IN_roles} AND {$IN_tstrefs}"); 21432while ($row = $ilDB->fetchAssoc($res)) { 21433 $perms = unserialize($row['ops_id']); 21434 21435 if (in_array($writeOperationId, $perms) && !in_array($resultsOperationId, $perms)) { 21436 $perms[] = $resultsOperationId; 21437 $ilDB->execute($stmt, array(serialize($perms), $row['rol_id'], $row['ref_id'])); 21438 } 21439} 21440?> 21441<#5266> 21442<?php 21443$ilCtrlStructureReader->getStructure(); 21444?> 21445<#5267> 21446<?php 21447$ilCtrlStructureReader->getStructure(); 21448?> 21449<#5268> 21450<?php 21451$fields = array( 21452 'id' => array( 21453 'notnull' => '1', 21454 'type' => 'integer', 21455 'length' => '4', 21456 21457 ), 21458 'identifier' => array( 21459 'notnull' => '1', 21460 'type' => 'text', 21461 'length' => '50', 21462 21463 ), 21464 'data_type' => array( 21465 'notnull' => '1', 21466 'type' => 'integer', 21467 'length' => '1', 21468 21469 ), 21470 'position' => array( 21471 'type' => 'integer', 21472 'length' => '3', 21473 21474 ), 21475 'is_standard_field' => array( 21476 'notnull' => '1', 21477 'type' => 'integer', 21478 'length' => '1', 21479 21480 ), 21481 'object_id' => array( 21482 'notnull' => '1', 21483 'type' => 'integer', 21484 'length' => '4', 21485 21486 ), 21487); 21488global $ilDB; 21489if (!$ilDB->tableExists('il_bibl_field')) { 21490 $ilDB->createTable('il_bibl_field', $fields); 21491 $ilDB->addPrimaryKey('il_bibl_field', array( 'id' )); 21492 21493 if (!$ilDB->sequenceExists('il_bibl_field')) { 21494 $ilDB->createSequence('il_bibl_field'); 21495 } 21496} 21497?> 21498<#5269> 21499<?php 21500$fields = array( 21501 'id' => array( 21502 'notnull' => '1', 21503 'type' => 'integer', 21504 'length' => '4', 21505 21506 ), 21507 'field_id' => array( 21508 'notnull' => '1', 21509 'type' => 'integer', 21510 'length' => '4', 21511 21512 ), 21513 'object_id' => array( 21514 'notnull' => '1', 21515 'type' => 'integer', 21516 'length' => '4', 21517 21518 ), 21519 'filter_type' => array( 21520 'type' => 'integer', 21521 'length' => '1', 21522 21523 ), 21524 21525); 21526if (!$ilDB->tableExists('il_bibl_filter')) { 21527 $ilDB->createTable('il_bibl_filter', $fields); 21528 $ilDB->addPrimaryKey('il_bibl_filter', array( 'id' )); 21529 21530 if (!$ilDB->sequenceExists('il_bibl_filter')) { 21531 $ilDB->createSequence('il_bibl_filter'); 21532 } 21533} 21534?> 21535<#5270> 21536<?php 21537if (!$ilDB->tableColumnExists("il_bibl_data", "file_type")) { 21538 $ilDB->addTableColumn("il_bibl_data", "file_type", [ 21539 "type" => "integer", 21540 "notnull" => true, 21541 "length" => 1, 21542 "default" => 1 21543 ]); 21544} 21545 21546$type = function ($filename) { 21547 if (strtolower(substr($filename, -6)) == "bibtex" 21548 || strtolower(substr($filename, -3)) == "bib") { 21549 return 2; 21550 } 21551 return 1; 21552}; 21553 21554$res = $ilDB->query("SELECT * FROM il_bibl_data"); 21555while ($d = $ilDB->fetchObject($res)) { 21556 $type_id = (int) $type($d->filname); 21557 $ilDB->update("il_bibl_data", [ 21558 "file_type" => [ "integer", $type_id ] 21559 ], [ "id" => $d->id ]); 21560} 21561?> 21562<#5271> 21563<?php 21564$fields = array( 21565 'id' => array( 21566 'notnull' => '1', 21567 'type' => 'integer', 21568 'length' => '4', 21569 21570 ), 21571 'field_id' => array( 21572 'notnull' => '1', 21573 'type' => 'integer', 21574 'length' => '8', 21575 21576 ), 21577 'language_key' => array( 21578 'notnull' => '1', 21579 'type' => 'text', 21580 'length' => '2', 21581 21582 ), 21583 'translation' => array( 21584 'type' => 'text', 21585 'length' => '256', 21586 21587 ), 21588 'description' => array( 21589 'type' => 'clob', 21590 21591 ), 21592 21593); 21594if (!$ilDB->tableExists('il_bibl_translation')) { 21595 $ilDB->createTable('il_bibl_translation', $fields); 21596 $ilDB->addPrimaryKey('il_bibl_translation', array( 'id' )); 21597 21598 if (!$ilDB->sequenceExists('il_bibl_translation')) { 21599 $ilDB->createSequence('il_bibl_translation'); 21600 } 21601} 21602?> 21603<#5272> 21604<?php 21605$ilCtrlStructureReader->getStructure(); 21606?> 21607<#5273> 21608<?php 21609// TODO fill filetype_id with the correct values 21610if ($ilDB->tableExists('il_bibl_overview_model')) { 21611 if ($ilDB->tableColumnExists('il_bibl_overview_model', 'filetype')) { 21612 $type = function ($filetype_string) { 21613 if (strtolower($filetype_string) == "bib" 21614 || strtolower($filetype_string) == "bibtex" 21615 ) { 21616 return 2; // see ilBiblTypeFactoryInterface::DATA_TYPE_BIBTEX 21617 } 21618 21619 return 1; // ilBiblTypeFactoryInterface::DATA_TYPE_RIS 21620 }; 21621 21622 if (!$ilDB->tableColumnExists('il_bibl_overview_model', 'file_type_id')) { 21623 $ilDB->addTableColumn('il_bibl_overview_model', 'file_type_id', array("type" => "integer", 'length' => 4)); 21624 } 21625 21626 $res = $ilDB->query("SELECT * FROM il_bibl_overview_model"); 21627 while ($d = $ilDB->fetchObject($res)) { 21628 $type_id = (int) $type($d->filetype); 21629 $ilDB->update( 21630 "il_bibl_overview_model", 21631 [ 21632 "file_type_id" => ["integer", $type_id], 21633 ], 21634 ["ovm_id" => ["integer", $d->ovm_id]] 21635 ); 21636 } 21637 21638 $ilDB->dropTableColumn('il_bibl_overview_model', 'filetype'); 21639 } 21640} 21641?> 21642<#5274> 21643<?php 21644/* 21645* This hotfix removes org unit assignments of user who don't exist anymore 21646* 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 21647*/ 21648global $ilDB; 21649$q = "DELETE FROM il_orgu_ua WHERE user_id NOT IN (SELECT usr_id FROM usr_data)"; 21650$ilDB->manipulate($q); 21651?> 21652<#5275> 21653<?php 21654$ilCtrlStructureReader->getStructure(); 21655?> 21656<#5276> 21657<?php 21658if (!$ilDB->tableColumnExists('qpl_qst_lome', 'identical_scoring')) { 21659 $ilDB->addTableColumn('qpl_qst_lome', 'identical_scoring', array( 21660 'type' => 'integer', 21661 'length' => 1, 21662 'default' => 1 21663 )); 21664} 21665?> 21666<#5277> 21667<?php 21668$ilSetting = new ilSetting(); 21669 21670if ($ilSetting->get('show_mail_settings', false) === false) { 21671 $ilSetting->set('show_mail_settings', 1); 21672} 21673?> 21674<#5278> 21675<?php 21676require_once './Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 21677 21678$type_id = ilDBUpdateNewObjectType::addNewType('copa', 'Content Page Object'); 21679 21680ilDBUpdateNewObjectType::addRBACOperations($type_id, [ 21681 ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS, 21682 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 21683 ilDBUpdateNewObjectType::RBAC_OP_READ, 21684 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 21685 ilDBUpdateNewObjectType::RBAC_OP_DELETE, 21686 ilDBUpdateNewObjectType::RBAC_OP_COPY 21687]); 21688 21689ilDBUpdateNewObjectType::addRBACCreate('create_copa', 'Create Content Page Object', [ 21690 'root', 21691 'cat', 21692 'crs', 21693 'fold', 21694 'grp' 21695]); 21696?> 21697<#5279> 21698<?php 21699require_once 'Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 21700 21701$rp_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("read_learning_progress"); 21702$ep_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress'); 21703$w_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 21704if ($rp_ops_id && $ep_ops_id && $w_ops_id) { 21705 $lp_types = array('copa'); 21706 21707 foreach ($lp_types as $lp_type) { 21708 $lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId($lp_type); 21709 21710 if ($lp_type_id) { 21711 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $rp_ops_id); 21712 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ep_ops_id); 21713 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $rp_ops_id); 21714 ilDBUpdateNewObjectType::cloneOperation($lp_type, $w_ops_id, $ep_ops_id); 21715 } 21716 } 21717} 21718?> 21719<#5280> 21720<?php 21721$ilCtrlStructureReader->getStructure(); 21722?> 21723<#5281> 21724<?php 21725require_once 'Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 21726ilDBUpdateNewObjectType::applyInitialPermissionGuideline('copa', true); 21727?> 21728<#5282> 21729<?php 21730$ilCtrlStructureReader->getStructure(); 21731?> 21732<#5283> 21733<?php 21734if (!$ilDB->tableExists('content_page_data')) { 21735 $fields = array( 21736 'content_page_id' => array( 21737 'type' => 'integer', 21738 'length' => 4, 21739 'notnull' => true, 21740 'default' => 0 21741 ), 21742 'stylesheet' => array( 21743 'type' => 'integer', 21744 'notnull' => true, 21745 'length' => 4, 21746 'default' => 0 21747 ) 21748 ); 21749 21750 $ilDB->createTable('content_page_data', $fields); 21751 $ilDB->addPrimaryKey('content_page_data', array('content_page_id')); 21752} 21753?> 21754<#5284> 21755<?php 21756$res = $ilDB->queryF( 21757 'SELECT * FROM object_data WHERE type = %s', 21758 ['text'], 21759 ['copa'] 21760); 21761 21762while ($data = $ilDB->fetchAssoc($res)) { 21763 $ilDB->replace( 21764 'content_page_data', 21765 [ 21766 'content_page_id' => ['integer', (int) $data['obj_id']] 21767 ], 21768 [] 21769 ); 21770} 21771?> 21772<#5285> 21773<?php 21774if (!$ilDB->tableColumnExists('qpl_fb_specific', 'question')) { 21775 // add new table column for indexing different question gaps in assClozeTest 21776 $ilDB->addTableColumn('qpl_fb_specific', 'question', array( 21777 'type' => 'integer', 'length' => 4, 'notnull' => false, 'default' => null 21778 )); 21779 21780 // give all other qtypes having a single subquestion the question index 0 21781 $ilDB->manipulateF( 21782 "UPDATE qpl_fb_specific SET question = %s WHERE question_fi NOT IN( 21783 SELECT question_id FROM qpl_questions 21784 INNER JOIN qpl_qst_type ON question_type_id = question_type_fi 21785 WHERE type_tag = %s 21786 )", 21787 array('integer', 'text'), 21788 array(0, 'assClozeTest') 21789 ); 21790 21791 // for all assClozeTest entries - migrate the gap feedback indexes from answer field to questin field 21792 $ilDB->manipulateF( 21793 "UPDATE qpl_fb_specific SET question = answer WHERE question_fi IN( 21794 SELECT question_id FROM qpl_questions 21795 INNER JOIN qpl_qst_type ON question_type_id = question_type_fi 21796 WHERE type_tag = %s 21797 )", 21798 array('text'), 21799 array('assClozeTest') 21800 ); 21801 21802 // for all assClozeTest entries - initialize the answer field with 0 for the formaly stored gap feedback 21803 $ilDB->manipulateF( 21804 "UPDATE qpl_fb_specific SET answer = %s WHERE question_fi IN( 21805 SELECT question_id FROM qpl_questions 21806 INNER JOIN qpl_qst_type ON question_type_id = question_type_fi 21807 WHERE type_tag = %s 21808 )", 21809 array('integer', 'text'), 21810 array(0, 'assClozeTest') 21811 ); 21812 21813 // finaly set the question index field to notnull = true (not nullable) as it is now initialized 21814 $ilDB->modifyTableColumn('qpl_fb_specific', 'question', array( 21815 'notnull' => true, 'default' => 0 21816 )); 21817 21818 // add unique constraint on qid and the two specific feedback indentification index fields 21819 $ilDB->addUniqueConstraint('qpl_fb_specific', array( 21820 'question_fi', 'question', 'answer' 21821 )); 21822} 21823 21824if (!$ilDB->tableColumnExists('qpl_qst_cloze', 'feedback_mode')) { 21825 $ilDB->addTableColumn('qpl_qst_cloze', 'feedback_mode', array( 21826 'type' => 'text', 'length' => 16, 'notnull' => false, 'default' => null 21827 )); 21828 21829 $ilDB->manipulateF( 21830 "UPDATE qpl_qst_cloze SET feedback_mode = %s", 21831 array('text'), 21832 array('gapQuestion') 21833 ); 21834 21835 $ilDB->modifyTableColumn('qpl_qst_cloze', 'feedback_mode', array( 21836 'notnull' => true, 'default' => 'gapQuestion' 21837 )); 21838} 21839?> 21840<#5286> 21841<?php 21842if (!$ilDB->tableColumnExists('tst_tests', 'follow_qst_answer_fixation')) { 21843 $ilDB->addTableColumn('tst_tests', 'follow_qst_answer_fixation', array( 21844 'type' => 'integer', 'notnull' => false, 'length' => 1, 'default' => 0 21845 )); 21846 21847 $ilDB->manipulateF( 21848 'UPDATE tst_tests SET follow_qst_answer_fixation = %s', 21849 array('integer'), 21850 array(0) 21851 ); 21852} 21853 21854if (!$ilDB->tableExists('tst_seq_qst_presented')) { 21855 $ilDB->createTable('tst_seq_qst_presented', array( 21856 'active_fi' => array( 21857 'type' => 'integer', 21858 'length' => 4, 21859 'notnull' => true, 21860 'default' => 0 21861 ), 21862 'pass' => array( 21863 'type' => 'integer', 21864 'length' => 4, 21865 'notnull' => true, 21866 'default' => 0 21867 ), 21868 'question_fi' => array( 21869 'type' => 'integer', 21870 'length' => 4, 21871 'notnull' => true, 21872 'default' => 0 21873 ) 21874 )); 21875 21876 $ilDB->addPrimaryKey('tst_seq_qst_presented', array( 21877 'active_fi','pass', 'question_fi' 21878 )); 21879} 21880?> 21881<#5287> 21882<?php 21883if ($ilDB->tableColumnExists('qpl_fb_specific', 'answer')) { 21884 $ilDB->manipulateF( 21885 " 21886 UPDATE qpl_fb_specific SET answer = %s WHERE question_fi IN( 21887 SELECT question_fi FROM qpl_qst_cloze WHERE feedback_mode = %s 21888 ) 21889 ", 21890 array('integer', 'text'), 21891 array(-10, 'gapQuestion') 21892 ); 21893} 21894?> 21895<#5288> 21896<?php 21897$setting = new ilSetting(); 21898$ilrqtix = $setting->get('iloscmsgidx1', 0); 21899if (!$ilrqtix) { 21900 $ilDB->addIndex('osc_messages', array('user_id'), 'i1'); 21901 $setting->set('iloscmsgidx1', 1); 21902} 21903?> 21904<#5289> 21905<?php 21906$setting = new ilSetting(); 21907$ilrqtix = $setting->get('iloscmsgidx2', 0); 21908if (!$ilrqtix) { 21909 $ilDB->addIndex('osc_messages', array('conversation_id'), 'i2'); 21910 $setting->set('iloscmsgidx2', 1); 21911} 21912?> 21913<#5290> 21914<?php 21915$setting = new ilSetting(); 21916$ilrqtix = $setting->get('iloscmsgidx3', 0); 21917if (!$ilrqtix) { 21918 $ilDB->addIndex('osc_messages', array('conversation_id', 'user_id', 'timestamp'), 'i3'); 21919 $setting->set('iloscmsgidx3', 1); 21920} 21921?> 21922<#5291> 21923<?php 21924$ilCtrlStructureReader->getStructure(); 21925?> 21926<#5292> 21927<?php 21928try { 21929 require_once 'Modules/OrgUnit/classes/Positions/Operation/class.ilOrgUnitOperationQueries.php'; 21930 21931 ilOrgUnitOperationQueries::registerNewOperation( 21932 ilOrgUnitOperation::OP_READ_LEARNING_PROGRESS, 21933 'Read Test Participants Learning Progress', 21934 ilOrgUnitOperationContext::CONTEXT_TST 21935 ); 21936 21937 ilOrgUnitOperationQueries::registerNewOperation( 21938 ilOrgUnitOperation::OP_ACCESS_RESULTS, 21939 'Access Test Participants Results', 21940 ilOrgUnitOperationContext::CONTEXT_TST 21941 ); 21942 21943 ilOrgUnitOperationQueries::registerNewOperation( 21944 ilOrgUnitOperation::OP_MANAGE_PARTICIPANTS, 21945 'Manage Test Participants', 21946 ilOrgUnitOperationContext::CONTEXT_TST 21947 ); 21948 21949 ilOrgUnitOperationQueries::registerNewOperation( 21950 ilOrgUnitOperation::OP_SCORE_PARTICIPANTS, 21951 'Score Test Participants', 21952 ilOrgUnitOperationContext::CONTEXT_TST 21953 ); 21954} catch (ilException $e) { 21955} 21956?> 21957<#5293> 21958<?php 21959$ilCtrlStructureReader->getStructure(); 21960?> 21961<#5294> 21962<?php 21963$setting = new ilSetting(); 21964 21965if (!$setting->get('tst_score_rep_consts_cleaned', 0)) { 21966 $ilDB->queryF( 21967 "UPDATE tst_tests SET score_reporting = %s WHERE score_reporting = %s", 21968 array('integer', 'integer'), 21969 array(0, 4) 21970 ); 21971 21972 $setting->set('tst_score_rep_consts_cleaned', 1); 21973} 21974?> 21975<#5295> 21976<?php 21977if (!$ilDB->tableColumnExists('tst_result_cache', 'passed_once')) { 21978 $ilDB->addTableColumn('tst_result_cache', 'passed_once', array( 21979 'type' => 'integer', 'length' => 1, 'notnull' => false, 'default' => 0 21980 )); 21981} 21982?> 21983<#5296> 21984<?php 21985if (!$ilDB->tableColumnExists('exc_assignment', 'fb_date_custom')) { 21986 $ilDB->addTableColumn('exc_assignment', 'fb_date_custom', [ 21987 "type" => "integer", 21988 "length" => 4, 21989 "default" => null, 21990 ]); 21991} 21992if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_submit_status')) { 21993 $ilDB->addTableColumn('exc_assignment', 'rmd_submit_status', [ 21994 "type" => "integer", 21995 "length" => 1, 21996 "default" => null, 21997 ]); 21998} 21999if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_submit_start')) { 22000 $ilDB->addTableColumn('exc_assignment', 'rmd_submit_start', [ 22001 "type" => "integer", 22002 "length" => 4, 22003 "default" => null, 22004 ]); 22005} 22006if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_submit_end')) { 22007 $ilDB->addTableColumn('exc_assignment', 'rmd_submit_end', [ 22008 "type" => "integer", 22009 "length" => 4, 22010 "default" => null, 22011 ]); 22012} 22013if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_submit_freq')) { 22014 $ilDB->addTableColumn('exc_assignment', 'rmd_submit_freq', [ 22015 "type" => "integer", 22016 "length" => 4, 22017 "default" => null, 22018 ]); 22019} 22020if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_grade_status')) { 22021 $ilDB->addTableColumn('exc_assignment', 'rmd_grade_status', [ 22022 "type" => "integer", 22023 "length" => 1, 22024 "default" => null, 22025 ]); 22026} 22027if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_grade_start')) { 22028 $ilDB->addTableColumn('exc_assignment', 'rmd_grade_start', [ 22029 "type" => "integer", 22030 "length" => 4, 22031 "default" => null, 22032 ]); 22033} 22034if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_grade_end')) { 22035 $ilDB->addTableColumn('exc_assignment', 'rmd_grade_end', [ 22036 "type" => "integer", 22037 "length" => 4, 22038 "default" => null, 22039 ]); 22040} 22041if (!$ilDB->tableColumnExists('exc_assignment', 'rmd_grade_freq')) { 22042 $ilDB->addTableColumn('exc_assignment', 'rmd_grade_freq', [ 22043 "type" => "integer", 22044 "length" => 4, 22045 "default" => null, 22046 ]); 22047} 22048if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rmd_status')) { 22049 $ilDB->addTableColumn('exc_assignment', 'peer_rmd_status', [ 22050 "type" => "integer", 22051 "length" => 1, 22052 "default" => null, 22053 ]); 22054} 22055if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rmd_start')) { 22056 $ilDB->addTableColumn('exc_assignment', 'peer_rmd_start', [ 22057 "type" => "integer", 22058 "length" => 4, 22059 "default" => null, 22060 ]); 22061} 22062if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rmd_end')) { 22063 $ilDB->addTableColumn('exc_assignment', 'peer_rmd_end', [ 22064 "type" => "integer", 22065 "length" => 4, 22066 "default" => null, 22067 ]); 22068} 22069if (!$ilDB->tableColumnExists('exc_assignment', 'peer_rmd_freq')) { 22070 $ilDB->addTableColumn('exc_assignment', 'peer_rmd_freq', [ 22071 "type" => "integer", 22072 "length" => 4, 22073 "default" => null, 22074 ]); 22075} 22076if (!$ilDB->tableExists('exc_ass_reminders')) { 22077 $ilDB->createTable('exc_ass_reminders', array( 22078 'type' => array( 22079 'type' => 'text', 22080 'length' => 32, 22081 ), 22082 'ass_id' => array( 22083 "type" => "integer", 22084 "length" => 4, 22085 "default" => null 22086 ), 22087 'exc_id' => array( 22088 "type" => "integer", 22089 "length" => 4, 22090 "default" => null 22091 ), 22092 'status' => array( 22093 "type" => "integer", 22094 "length" => 1, 22095 "default" => null 22096 ), 22097 'start' => array( 22098 "type" => "integer", 22099 "length" => 4, 22100 "default" => null 22101 ), 22102 'end' => array( 22103 "type" => "integer", 22104 "length" => 4, 22105 "default" => null 22106 ), 22107 'freq' => array( 22108 "type" => "integer", 22109 "length" => 4, 22110 "default" => null 22111 ), 22112 'last_send' => array( 22113 "type" => "integer", 22114 "length" => 4, 22115 "default" => null 22116 ), 22117 'template_id' => array( 22118 "type" => "integer", 22119 "length" => 4, 22120 "default" => null 22121 ) 22122 )); 22123 $ilDB->addPrimaryKey("exc_ass_reminders", array("ass_id", "exc_id", "type")); 22124} 22125?> 22126<#5297> 22127<?php 22128if ($ilDB->tableColumnExists('svy_svy', 'mode_360')) { 22129 $ilDB->renameTableColumn('svy_svy', 'mode_360', 'mode'); 22130} 22131?> 22132<#5298> 22133<?php 22134if (!$ilDB->tableColumnExists('svy_svy', 'mode_self_eval_results')) { 22135 $ilDB->addTableColumn( 22136 'svy_svy', 22137 'mode_self_eval_results', 22138 array( 22139 'type' => 'integer', 22140 'length' => 1, 22141 'notnull' => false, 22142 'default' => 0 22143 ) 22144 ); 22145} 22146?> 22147<#5299> 22148<?php 22149if ($ilDB->tableColumnExists('svy_svy', 'mode_360_skill_service')) { 22150 $ilDB->renameTableColumn('svy_svy', 'mode_360_skill_service', 'mode_skill_service'); 22151} 22152?> 22153<#5300> 22154<?php 22155$ilCtrlStructureReader->getStructure(); 22156?> 22157<#5301> 22158<?php 22159if (!$ilDB->tableColumnExists('file_data', 'max_version')) { 22160 $ilDB->addTableColumn('file_data', 'max_version', array( 22161 'type' => 'integer', 22162 'length' => 4 22163 )); 22164} 22165?> 22166<#5302> 22167<?php 22168include_once './Services/Migration/DBUpdate_5295/classes/class.ilMDCreator.php'; 22169include_once './Services/Migration/DBUpdate_5295/classes/class.ilMD.php'; 22170 22171ilMD::_deleteAllByType('grp'); 22172 22173$group_ids = []; 22174$query = 'SELECT obd.obj_id, title, od.description FROM object_data obd ' . 22175 'JOIN object_description od on obd.obj_id = od.obj_id ' . 22176 'WHERE type = ' . $ilDB->quote('grp', 'text'); 22177$res = $ilDB->query($query); 22178while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) { 22179 $md_creator = new ilMDCreator($row->obj_id, $row->obj_id, 'grp'); 22180 $md_creator->setTitle($row->title); 22181 $md_creator->setTitleLanguage('en'); 22182 $md_creator->setDescription($row->description); 22183 $md_creator->setDescriptionLanguage('en'); 22184 $md_creator->setKeywordLanguage('en'); 22185 $md_creator->setLanguage('en'); 22186 22187 $md_creator->create(); 22188} 22189?> 22190<#5303> 22191<?php 22192$ilCtrlStructureReader->getStructure(); 22193?> 22194<#5304> 22195<?php 22196$ilCtrlStructureReader->getStructure(); 22197?> 22198<#5305> 22199<?php 22200$ilCtrlStructureReader->getStructure(); 22201?> 22202<#5306> 22203<?php 22204if (!$ilDB->tableColumnExists('mail_man_tpl', 'is_default')) { 22205 $ilDB->addTableColumn( 22206 'mail_man_tpl', 22207 'is_default', 22208 [ 22209 'type' => 'integer', 22210 'length' => 1, 22211 'notnull' => true, 22212 'default' => 0, 22213 ] 22214 ); 22215} 22216?> 22217<#5307> 22218<?php 22219$ilCtrlStructureReader->getStructure(); 22220?> 22221<#5308> 22222<?php 22223if ($ilDB->tableExists('object_data_del')) { 22224 if (!$ilDB->tableColumnExists('object_data_del', 'description')) { 22225 $ilDB->addTableColumn( 22226 'object_data_del', 22227 'description', 22228 [ 22229 'type' => 'clob', 22230 'notnull' => false, 22231 'default' => null, 22232 ] 22233 ); 22234 } 22235} 22236?> 22237<#5309> 22238<?php 22239$ilCtrlStructureReader->getStructure(); 22240?> 22241<#5310> 22242<?php 22243 $ilCtrlStructureReader->getStructure(); 22244?> 22245<#5311> 22246<?php 22247if (!$ilDB->tableExists("exc_ass_wiki_team")) { 22248 $fields = array( 22249 "id" => array( 22250 "type" => "integer", 22251 "notnull" => true, 22252 "length" => 4, 22253 "default" => 0 22254 ), 22255 "container_ref_id" => array( 22256 "type" => "integer", 22257 "notnull" => true, 22258 "length" => 4, 22259 "default" => 0 22260 ), 22261 "template_ref_id" => array( 22262 "type" => "integer", 22263 "notnull" => true, 22264 "length" => 4, 22265 "default" => 0 22266 ) 22267 ); 22268 $ilDB->createTable("exc_ass_wiki_team", $fields); 22269 $ilDB->addPrimaryKey("exc_ass_wiki_team", array("id")); 22270} 22271?> 22272<#5312> 22273<?php 22274 $ilCtrlStructureReader->getStructure(); 22275?> 22276<#5313> 22277<?php 22278 22279 if (!$ilDB->tableColumnExists('exc_returned', 'team_id')) { 22280 $ilDB->addTableColumn('exc_returned', 'team_id', array( 22281 "type" => "integer", 22282 "notnull" => true, 22283 "length" => 4, 22284 "default" => 0 22285 )); 22286 } 22287 22288?> 22289<#5314> 22290<?php 22291if ($ilDB->tableExists('object_data_del')) { 22292 if (!$ilDB->tableColumnExists('object_data_del', 'description')) { 22293 $ilDB->addTableColumn( 22294 'object_data_del', 22295 'description', 22296 [ 22297 'type' => 'clob', 22298 'notnull' => false, 22299 'default' => null, 22300 ] 22301 ); 22302 } 22303} 22304?> 22305<#5315> 22306<?php 22307if (!$ilDB->tableExists('tos_documents')) { 22308 $fields = [ 22309 'id' => [ 22310 'type' => 'integer', 22311 'length' => 4, 22312 'notnull' => true, 22313 'default' => 0 22314 ], 22315 'title' => [ 22316 'type' => 'text', 22317 'length' => 255, 22318 'notnull' => false, 22319 'default' => null 22320 ], 22321 'creation_ts' => [ 22322 'type' => 'integer', 22323 'length' => 4, 22324 'notnull' => true, 22325 'default' => 0 22326 ], 22327 'modification_ts' => [ 22328 'type' => 'integer', 22329 'length' => 4, 22330 'notnull' => true, 22331 'default' => 0 22332 ], 22333 'sorting' => [ 22334 'type' => 'integer', 22335 'length' => 4, 22336 'notnull' => true, 22337 'default' => 0 22338 ], 22339 'owner_usr_id' => [ 22340 'type' => 'integer', 22341 'length' => 4, 22342 'notnull' => true, 22343 'default' => 0 22344 ], 22345 'last_modified_usr_id' => [ 22346 'type' => 'integer', 22347 'length' => 4, 22348 'notnull' => true, 22349 'default' => 0 22350 ] 22351 ]; 22352 22353 $ilDB->createTable('tos_documents', $fields); 22354 $ilDB->addPrimaryKey('tos_documents', ['id']); 22355 $ilDB->createSequence('tos_documents'); 22356} 22357?> 22358<#5316> 22359<?php 22360if (!$ilDB->tableColumnExists('tos_documents', 'text')) { 22361 $ilDB->addTableColumn('tos_documents', 'text', [ 22362 'type' => 'clob', 22363 'notnull' => false, 22364 'default' => null 22365 ]); 22366} 22367?> 22368<#5317> 22369<?php 22370if (!$ilDB->tableExists('tos_criterion_to_doc')) { 22371 $fields = [ 22372 'id' => [ 22373 'type' => 'integer', 22374 'length' => 4, 22375 'notnull' => true, 22376 'default' => 0 22377 ], 22378 'doc_id' => [ 22379 'type' => 'integer', 22380 'length' => 4, 22381 'notnull' => true, 22382 'default' => 0 22383 ], 22384 'criterion_id' => [ 22385 'type' => 'text', 22386 'length' => 50, 22387 'notnull' => true 22388 ], 22389 'criterion_value' => [ 22390 'type' => 'text', 22391 'length' => 255, 22392 'notnull' => false, 22393 'default' => null, 22394 ], 22395 'assigned_ts' => [ 22396 'type' => 'integer', 22397 'length' => 4, 22398 'notnull' => true, 22399 'default' => 0 22400 ], 22401 'modification_ts' => [ 22402 'type' => 'integer', 22403 'length' => 4, 22404 'notnull' => true, 22405 'default' => 0 22406 ], 22407 'owner_usr_id' => [ 22408 'type' => 'integer', 22409 'length' => 4, 22410 'notnull' => true, 22411 'default' => 0 22412 ], 22413 'last_modified_usr_id' => [ 22414 'type' => 'integer', 22415 'length' => 4, 22416 'notnull' => true, 22417 'default' => 0 22418 ] 22419 ]; 22420 22421 $ilDB->createTable('tos_criterion_to_doc', $fields); 22422 $ilDB->addPrimaryKey('tos_criterion_to_doc', ['id']); 22423 $ilDB->createSequence('tos_criterion_to_doc'); 22424} 22425?> 22426<#5318> 22427<?php 22428if (!$ilDB->tableColumnExists('tos_versions', 'doc_id')) { 22429 $ilDB->addTableColumn('tos_versions', 'doc_id', [ 22430 'type' => 'integer', 22431 'length' => 4, 22432 'notnull' => true, 22433 'default' => 0 22434 ]); 22435} 22436 22437if (!$ilDB->tableColumnExists('tos_versions', 'title')) { 22438 $ilDB->addTableColumn('tos_versions', 'title', [ 22439 'type' => 'text', 22440 'notnull' => false, 22441 'default' => null 22442 ]); 22443} 22444 22445if (!$ilDB->tableColumnExists('tos_acceptance_track', 'criteria')) { 22446 $ilDB->addTableColumn('tos_acceptance_track', 'criteria', [ 22447 'type' => 'clob', 22448 'notnull' => false, 22449 'default' => null 22450 ]); 22451} 22452?> 22453<#5319> 22454<?php 22455if ($ilDB->indexExistsByFields('tos_versions', ['hash', 'lng'])) { 22456 $ilDB->dropIndexByFields('tos_versions', ['hash', 'lng']); 22457} 22458?> 22459<#5320> 22460<?php 22461if (!$ilDB->indexExistsByFields('tos_versions', ['hash', 'doc_id'])) { 22462 $ilDB->addIndex('tos_versions', ['hash', 'doc_id'], 'i1'); 22463} 22464?> 22465<#5321> 22466<?php 22467$dbStep = $nr; 22468$globalAgreementPath = './Customizing/global/agreement'; 22469$clientAgreementPath = './Customizing/clients/' . basename(CLIENT_DATA_DIR) . '/agreement'; 22470 22471$ilSetting = new \ilSetting(); 22472 22473$documentDirectoriesExist = false; 22474if ( 22475 (file_exists($globalAgreementPath) && is_dir($globalAgreementPath) && is_readable($globalAgreementPath)) || 22476 (file_exists($clientAgreementPath) && is_dir($clientAgreementPath) && is_readable($clientAgreementPath)) 22477) { 22478 $documentDirectoriesExist = true; 22479} 22480 22481if ($documentDirectoriesExist && !$ilSetting->get('dbupwarn_tos_migr_54x', 0)) { 22482 echo "<pre> 22483 22484 DEAR ADMINISTRATOR !! 22485 22486 Because of the ILIAS 5.4.x feature 'User: Criteria-based »User Agreement« documents' 22487 (see: https://www.ilias.de/docu/goto_docu_wiki_wpage_5225_1357.html) the file system 22488 based user agreements in '{$globalAgreementPath}' and '{$clientAgreementPath}' will 22489 be migrated according to https://www.ilias.de/docu/goto_docu_wiki_wpage_5225_1357.html#ilPageTocA27 . 22490 22491 The client-independent user agreements will be abandoned at all and migrated to 22492 client-related documents. 22493 22494 With ILIAS 5.4.x user agreement documents can be managed in the global ILIAS administration. 22495 The contents of a document can be uploaded as text or HTML file and will be stored (after purification) in the database. 22496 22497 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. 22498 </pre>"; 22499 22500 $ilSetting->set('dbupwarn_tos_migr_54x', 1); 22501 exit; 22502} elseif (!$documentDirectoriesExist) { 22503 $ilSetting->set('dbupwarn_tos_migr_54x', 1); 22504} 22505 22506if (!$ilDB->tableExists('agreement_migr')) { 22507 $fields = [ 22508 'agr_type' => [ 22509 'type' => 'text', 22510 'length' => 20, 22511 'notnull' => true 22512 ], 22513 'agr_lng' => [ 22514 'type' => 'text', 22515 'length' => 2, 22516 'notnull' => true 22517 ] 22518 ]; 22519 22520 $ilDB->createTable('agreement_migr', $fields); 22521 $ilDB->addPrimaryKey('agreement_migr', ['agr_type', 'agr_lng']); 22522 $GLOBALS['ilLog']->info(sprintf( 22523 'Created agreement migration table: agreement_migr' 22524 )); 22525} 22526 22527// Determine system language 22528$ilIliasIniFile = new \ilIniFile(ILIAS_ABSOLUTE_PATH . '/ilias.ini.php'); 22529$ilIliasIniFile->read(); 22530 22531$language = $ilIliasIniFile->readVariable('language', 'default'); 22532$ilSetting = new \ilSetting(); 22533if ($ilSetting->get('language') != '') { 22534 $language = $ilSetting->get('language'); 22535} 22536 22537$docTitlePrefix = 'Document'; 22538if ('de' === strtolower($language)) { 22539 $docTitlePrefix = 'Dokument'; 22540} 22541 22542$res = $ilDB->query("SELECT * FROM agreement_migr"); 22543$i = (int) $ilDB->numRows($res); 22544 22545if ($documentDirectoriesExist) { 22546 foreach ([ 22547 'client-independent' => $globalAgreementPath, 22548 'client-related' => $clientAgreementPath, 22549 ] as $type => $path) { 22550 if (!file_exists($path) || !is_dir($path)) { 22551 $GLOBALS['ilLog']->info(sprintf( 22552 "DB Step %s: Skipped 'Terms of Service' migration, path '%s' not found or not a directory", 22553 $dbStep, 22554 $path 22555 )); 22556 continue; 22557 } 22558 22559 if (!is_readable($path)) { 22560 $GLOBALS['ilLog']->error(sprintf( 22561 "DB Step %s: Skipped 'Terms of Service' migration, path '%s' is not readable", 22562 $dbStep, 22563 $path 22564 )); 22565 continue; 22566 } 22567 22568 try { 22569 foreach (new \RegexIterator( 22570 new \DirectoryIterator($path), 22571 '/agreement_[a-zA-Z]{2,2}\.(html)$/i' 22572 ) as $file) { 22573 $GLOBALS['ilLog']->info(sprintf( 22574 "DB Step %s: Started migration of %s user agreement file '%s'", 22575 $dbStep, 22576 $type, 22577 $file->getPathname() 22578 )); 22579 22580 $matches = null; 22581 if (!preg_match('/agreement_([a-zA-Z]{2,2})\.html/', $file->getBasename(), $matches)) { 22582 $GLOBALS['ilLog']->info(sprintf( 22583 "DB Step %s: Ignored migration of %s user agreement file '%s' because the basename is not valid", 22584 $dbStep, 22585 $type, 22586 $file->getPathname() 22587 )); 22588 continue; 22589 } 22590 $languageValue = $matches[1]; 22591 22592 $res = $ilDB->queryF( 22593 "SELECT * FROM agreement_migr WHERE agr_type = %s AND agr_lng = %s", 22594 ['text', 'text'], 22595 [$type, $languageValue] 22596 ); 22597 if ($ilDB->numRows($res) > 0) { 22598 $GLOBALS['ilLog']->info(sprintf( 22599 "DB Step %s: Ignored migration of %s user agreement file '%s' because it has been already migrated", 22600 $dbStep, 22601 $type, 22602 $file->getPathname() 22603 )); 22604 continue; 22605 } 22606 22607 $i++; 22608 22609 $sorting = $i; 22610 $docTitle = $docTitlePrefix . ' ' . $i; 22611 22612 $text = file_get_contents($file->getPathname()); 22613 if (strip_tags($text) === $text) { 22614 $text = nl2br($text); 22615 } 22616 22617 $docId = $ilDB->nextId('tos_documents'); 22618 $ilDB->insert( 22619 'tos_documents', 22620 [ 22621 'id' => ['integer', $docId], 22622 'sorting' => ['integer', $sorting], 22623 'title' => ['text', $docTitle], 22624 'owner_usr_id' => ['integer', -1], 22625 'creation_ts' => ['integer', $file->getMTime() > 0 ? $file->getMTime() : 0], 22626 'text' => ['clob', $text], 22627 ] 22628 ); 22629 $GLOBALS['ilLog']->info(sprintf( 22630 "DB Step %s: Created new document with id %s and title '%s' for file '%s'", 22631 $dbStep, 22632 $docId, 22633 $docTitle, 22634 $file->getPathname() 22635 )); 22636 22637 $assignmentId = $ilDB->nextId('tos_criterion_to_doc'); 22638 $ilDB->insert( 22639 'tos_criterion_to_doc', 22640 [ 22641 'id' => ['integer', $assignmentId], 22642 'doc_id' => ['integer', $docId], 22643 'criterion_id' => ['text', 'usr_language'], 22644 'criterion_value' => ['text', json_encode(['lng' => $languageValue])], 22645 'owner_usr_id' => ['integer', -1], 22646 'assigned_ts' => ['integer', $file->getMTime() > 0 ? $file->getMTime() : 0] 22647 ] 22648 ); 22649 $GLOBALS['ilLog']->info(sprintf( 22650 "DB Step %s: Created new language criterion assignment with id %s and value '%s' to document with id %s for file '%s'", 22651 $dbStep, 22652 $assignmentId, 22653 $languageValue, 22654 $docId, 22655 $file->getPathname() 22656 )); 22657 22658 // Determine all accepted version with lng = $criterion and hash = hash and src = file 22659 $docTypeIn = ' AND ' . $ilDB->like('src', 'text', '%%/client/%%', false); 22660 if ($type === 'client-independent') { 22661 $docTypeIn = ' AND ' . $ilDB->like('src', 'text', '%%/global/%%', false); 22662 } 22663 22664 $ilDB->manipulateF( 22665 'UPDATE tos_versions SET doc_id = %s, title = %s WHERE lng = %s AND hash = %s' . $docTypeIn, 22666 ['integer', 'text', 'text', 'text'], 22667 [$docId, $docTitle, $languageValue, md5($text)] 22668 ); 22669 $GLOBALS['ilLog']->info(sprintf( 22670 "DB Step %s: Migrated %s user agreement file '%s'", 22671 $dbStep, 22672 $type, 22673 $file->getPathname() 22674 )); 22675 22676 $ilDB->replace( 22677 'agreement_migr', 22678 [ 22679 'agr_type' => ['text', $type], 22680 'agr_lng' => ['text', $languageValue], 22681 ], 22682 [] 22683 ); 22684 } 22685 } catch (\Exception $e) { 22686 $GLOBALS['ilLog']->error(sprintf( 22687 "DB Step %s: %s", 22688 $dbStep, 22689 $e->getMessage() 22690 )); 22691 } 22692 } 22693} 22694 22695// Migrate title for all tos_version entries without a doc_id 22696$numDocumentsData = $ilDB->fetchAssoc( 22697 $ilDB->query('SELECT COUNT(id) num_docs FROM tos_documents') 22698); 22699 22700$numDocs = 0; 22701if (is_array($numDocumentsData) && $numDocumentsData['num_docs']) { 22702 $numDocs = $numDocumentsData['num_docs']; 22703} 22704 22705$res = $ilDB->query('SELECT lng, src FROM tos_versions WHERE title IS NULL GROUP BY lng, src'); 22706$i = 0; 22707while ($row = $ilDB->fetchAssoc($res)) { 22708 $docTitle = $docTitlePrefix . ' ' . ($numDocs + (++$i)); 22709 $ilDB->manipulateF( 22710 'UPDATE tos_versions SET title = %s WHERE lng = %s AND src = %s AND title IS NULL', 22711 ['text', 'text', 'text'], 22712 [$docTitle, $row['lng'], $row['src']] 22713 ); 22714} 22715?> 22716<#5322> 22717<?php 22718/** @var $ilDB ilDBInterface */ 22719if (in_array($ilDB->getDBType(), [ilDBConstants::TYPE_PDO_POSTGRE, ilDBConstants::TYPE_POSTGRES])) { 22720 // Migrate accepted criteria for missing documents (file did not exists during migration) 22721 $res = $ilDB->query( 22722 " 22723 SELECT tos_acceptance_track.* 22724 FROM tos_acceptance_track 22725 INNER JOIN tos_versions ON tos_versions.id = tos_acceptance_track.tosv_id 22726 WHERE tos_versions.doc_id = 0 AND tos_acceptance_track.criteria IS NULL AND tos_versions.lng IS NOT NULL 22727 " 22728 ); 22729 while ($row = $ilDB->fetchAssoc($res)) { 22730 $ilDB->manipulateF( 22731 " 22732 UPDATE tos_acceptance_track 22733 SET tos_acceptance_track.criteria = CONCAT(%s, CONCAT(tos_versions.lng, %s)) 22734 WHERE tos_acceptance_track.tosv_id = %s AND tos_acceptance_track.usr_id = %s AND tos_acceptance_track.ts = %s 22735 ", 22736 ['text', 'text', 'integer', 'integer', 'integer'], 22737 ['[{"id":"usr_language","value":{"lng":"', '"}}]', $row['tosv_id'], $row['usr_id'], $row['ts']] 22738 ); 22739 } 22740 22741 // Migrate accepted criteria for already migrated documents 22742 $res = $ilDB->queryF( 22743 " 22744 SELECT tos_acceptance_track.* 22745 FROM tos_acceptance_track 22746 INNER JOIN tos_versions 22747 ON tos_versions.id = tos_acceptance_track.tosv_id 22748 INNER JOIN tos_documents 22749 ON tos_documents.id = tos_versions.doc_id 22750 INNER JOIN tos_criterion_to_doc 22751 ON tos_criterion_to_doc.doc_id = tos_documents.id AND criterion_id = %s 22752 WHERE tos_versions.lng IS NOT NULL AND tos_acceptance_track.criteria IS NULL 22753 ", 22754 ['text'], 22755 ['usr_language'] 22756 ); 22757 while ($row = $ilDB->fetchAssoc($res)) { 22758 $ilDB->manipulateF( 22759 " 22760 UPDATE tos_acceptance_track 22761 SET tos_acceptance_track.criteria = CONCAT(%s, CONCAT(tos_versions.lng, %s)) 22762 WHERE tos_acceptance_track.tosv_id = %s AND tos_acceptance_track.usr_id = %s AND tos_acceptance_track.ts = %s 22763 ", 22764 ['text', 'text', 'integer', 'integer', 'integer'], 22765 ['[{"id":"usr_language","value":', '}]', $row['tosv_id'], $row['usr_id'], $row['ts']] 22766 ); 22767 } 22768} else { 22769 // Migrate accepted criteria for missing documents (file did not exists during migration) 22770 $ilDB->manipulateF( 22771 " 22772 UPDATE tos_acceptance_track 22773 INNER JOIN tos_versions 22774 ON tos_versions.id = tos_acceptance_track.tosv_id 22775 SET tos_acceptance_track.criteria = CONCAT(%s, CONCAT(tos_versions.lng, %s)) 22776 WHERE tos_versions.doc_id = 0 AND tos_acceptance_track.criteria IS NULL AND tos_versions.lng IS NOT NULL 22777 ", 22778 ['text', 'text'], 22779 ['[{"id":"usr_language","value":{"lng":"', '"}}]'] 22780 ); 22781 22782 // Migrate accepted criteria for already migrated documents 22783 $ilDB->manipulateF( 22784 " 22785 UPDATE tos_acceptance_track 22786 INNER JOIN tos_versions 22787 ON tos_versions.id = tos_acceptance_track.tosv_id 22788 INNER JOIN tos_documents 22789 ON tos_documents.id = tos_versions.doc_id 22790 INNER JOIN tos_criterion_to_doc 22791 ON tos_criterion_to_doc.doc_id = tos_documents.id AND criterion_id = %s 22792 SET tos_acceptance_track.criteria = CONCAT(%s, CONCAT(tos_criterion_to_doc.criterion_value, %s)) 22793 WHERE tos_versions.lng IS NOT NULL AND tos_acceptance_track.criteria IS NULL 22794 ", 22795 ['text', 'text', 'text'], 22796 ['usr_language', '[{"id":"usr_language","value":', '}]'] 22797 ); 22798} 22799?> 22800<#5323> 22801<?php 22802if ($ilDB->tableColumnExists('tos_versions', 'lng')) { 22803 $ilDB->dropTableColumn('tos_versions', 'lng'); 22804} 22805 22806if ($ilDB->tableColumnExists('tos_versions', 'src_type')) { 22807 $ilDB->dropTableColumn('tos_versions', 'src_type'); 22808} 22809 22810if ($ilDB->tableColumnExists('tos_versions', 'src')) { 22811 $ilDB->dropTableColumn('tos_versions', 'src'); 22812} 22813?> 22814<#5324> 22815<?php 22816if ($ilDB->tableExists('agreement_migr')) { 22817 $ilDB->dropTable('agreement_migr'); 22818 $GLOBALS['ilLog']->info(sprintf( 22819 'Dropped agreement migration table: agreement_migr' 22820 )); 22821} 22822?> 22823<#5325> 22824<?php 22825$ilCtrlStructureReader->getStructure(); 22826?> 22827<#5326> 22828<?php 22829if (!$ilDB->tableExists('like_data')) { 22830 $ilDB->createTable('like_data', array( 22831 'user_id' => array( 22832 'type' => 'integer', 22833 'length' => 4, 22834 'notnull' => true, 22835 'default' => 0 22836 ), 22837 'obj_id' => array( 22838 'type' => 'integer', 22839 'length' => 4, 22840 'notnull' => true, 22841 'default' => 0 22842 ), 22843 'obj_type' => array( 22844 'type' => 'text', 22845 'length' => 40, 22846 'notnull' => true 22847 ), 22848 'sub_obj_id' => array( 22849 'type' => 'integer', 22850 'length' => 4, 22851 'notnull' => true, 22852 'default' => 0 22853 ), 22854 'sub_obj_type' => array( 22855 'type' => 'text', 22856 'length' => 40, 22857 'notnull' => true 22858 ), 22859 'news_id' => array( 22860 'type' => 'integer', 22861 'length' => 4, 22862 'notnull' => true, 22863 'default' => 0 22864 ), 22865 'like_type' => array( 22866 'type' => 'integer', 22867 'length' => 4, 22868 'notnull' => true, 22869 'default' => 0 22870 ) 22871 )); 22872 22873 $ilDB->addPrimaryKey('like_data', array('user_id','obj_id','obj_type','sub_obj_id','sub_obj_type','news_id','like_type')); 22874 22875 $ilDB->addIndex('like_data', array('obj_id'), 'i1'); 22876} 22877?> 22878<#5327> 22879<?php 22880if (!$ilDB->tableColumnExists('like_data', 'exp_ts')) { 22881 $ilDB->addTableColumn('like_data', 'exp_ts', array( 22882 'type' => 'timestamp', 22883 'notnull' => true 22884 )); 22885} 22886?> 22887<#5328> 22888<?php 22889if (!$ilDB->tableColumnExists('note', 'news_id')) { 22890 $ilDB->addTableColumn('note', 'news_id', array( 22891 'type' => 'integer', 22892 'length' => 4, 22893 'notnull' => true, 22894 'default' => 0 22895 )); 22896} 22897?> 22898<#5329> 22899<?php 22900$ilCtrlStructureReader->getStructure(); 22901?> 22902<#5330> 22903<?php 22904 22905if (!$ilDB->tableColumnExists('media_item', 'upload_hash')) { 22906 $ilDB->addTableColumn('media_item', 'upload_hash', array( 22907 "type" => "text", 22908 "length" => 100 22909 )); 22910} 22911 22912?> 22913<#5331> 22914<?php 22915 if (!$ilDB->tableColumnExists('booking_settings', 'reminder_status')) { 22916 $ilDB->addTableColumn('booking_settings', 'reminder_status', array( 22917 "type" => "integer", 22918 "notnull" => true, 22919 "length" => 1, 22920 "default" => 0 22921 )); 22922 } 22923?> 22924<#5332> 22925<?php 22926 if (!$ilDB->tableColumnExists('booking_settings', 'reminder_day')) { 22927 $ilDB->addTableColumn('booking_settings', 'reminder_day', array( 22928 "type" => "integer", 22929 "notnull" => true, 22930 "length" => 4, 22931 "default" => 0 22932 )); 22933 } 22934?> 22935<#5333> 22936<?php 22937 $ilCtrlStructureReader->getStructure(); 22938?> 22939<#5334> 22940<?php 22941 if (!$ilDB->tableColumnExists('booking_settings', 'last_remind_ts')) { 22942 $ilDB->addTableColumn('booking_settings', 'last_remind_ts', array( 22943 "type" => "integer", 22944 "notnull" => true, 22945 "length" => 4, 22946 "default" => 0 22947 )); 22948 } 22949?> 22950<#5335> 22951<?php 22952 $ilCtrlStructureReader->getStructure(); 22953?> 22954<#5336> 22955<?php 22956 22957if ($ilDB->indexExistsByFields('read_event', array('usr_id'))) { 22958 $ilDB->dropIndexByFields('read_event', array('usr_id')); 22959} 22960$ilDB->addIndex('read_event', array('usr_id'), 'i1'); 22961 22962if (!$ilDB->tableColumnExists('usr_data', 'first_login')) { 22963 $ilDB->addTableColumn('usr_data', 'first_login', array( 22964 "type" => "timestamp", 22965 "notnull" => false 22966 )); 22967 22968 // since we do not have this date for existing users we take the minimum of last login 22969 // and first access to any repo object 22970 $set = $ilDB->queryF( 22971 "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", 22972 array(), 22973 array() 22974 ); 22975 while ($rec = $ilDB->fetchAssoc($set)) { 22976 $first_login = $rec["last_login"]; 22977 if ($rec["first_access"] != "" && ($rec["first_access"] < $rec["last_login"])) { 22978 $first_login = $rec["first_access"]; 22979 } 22980 22981 if ($first_login != "") { 22982 $ilDB->update("usr_data", array( 22983 "first_login" => array("timestamp", $first_login) 22984 ), array( // where 22985 "usr_id" => array("integer", $rec["usr_id"]) 22986 )); 22987 } 22988 } 22989} 22990?> 22991<#5337> 22992<?php 22993if (!$ilDB->tableColumnExists('usr_data', 'last_profile_prompt')) { 22994 $ilDB->addTableColumn('usr_data', 'last_profile_prompt', array( 22995 "type" => "timestamp", 22996 "notnull" => false 22997 )); 22998} 22999?> 23000<#5338> 23001<?php 23002 $ilCtrlStructureReader->getStructure(); 23003?> 23004<#5339> 23005<?php 23006if (!$ilDB->tableExists('certificate_template')) { 23007 $ilDB->createTable('certificate_template', array( 23008 'id' => array( 23009 'type' => 'integer', 23010 'length' => 4, 23011 'notnull' => true, 23012 'default' => 0 23013 ), 23014 'obj_id' => array( 23015 'type' => 'integer', 23016 'length' => 4, 23017 'notnull' => true, 23018 'default' => 0 23019 ), 23020 'obj_type' => array( 23021 'type' => 'text', 23022 'length' => 255, 23023 'notnull' => true, 23024 'default' => '' 23025 ), 23026 'certificate_content' => array( 23027 'type' => 'clob', 23028 'notnull' => true, 23029 ), 23030 'certificate_hash' => array( 23031 'type' => 'text', 23032 'length' => 255, 23033 'notnull' => true 23034 ), 23035 'template_values' => array( 23036 'type' => 'clob', 23037 'notnull' => true, 23038 ), 23039 'background_image_path' => array( 23040 'type' => 'text', 23041 'notnull' => false, 23042 'length' => 255 23043 ), 23044 'version' => array( 23045 'type' => 'text', 23046 'length' => 255, 23047 'notnull' => true, 23048 'default' => 'v1' 23049 ), 23050 'ilias_version' => array( 23051 'type' => 'text', 23052 'length' => 255, 23053 'notnull' => true, 23054 'default' => 'v5.4.0' 23055 ), 23056 'created_timestamp' => array( 23057 'type' => 'integer', 23058 'length' => 4, 23059 'notnull' => true, 23060 'default' => 0 23061 ), 23062 'currently_active' => array( 23063 'type' => 'integer', 23064 'length' => 1, 23065 'notnull' => true, 23066 'default' => 0 23067 ), 23068 )); 23069 23070 $ilDB->addPrimaryKey('certificate_template', array('id')); 23071 $ilDB->createSequence('certificate_template'); 23072 $ilDB->addIndex('certificate_template', array('obj_id'), 'i1'); 23073} 23074 23075if (!$ilDB->tableExists('user_certificates')) { 23076 $ilDB->createTable('user_certificates', array( 23077 'id' => array( 23078 'type' => 'integer', 23079 'length' => 4, 23080 'notnull' => true, 23081 'default' => 0 23082 ), 23083 'pattern_certificate_id' => array( 23084 'type' => 'integer', 23085 'length' => 4, 23086 'notnull' => true, 23087 'default' => 0 23088 ), 23089 'obj_id' => array( 23090 'type' => 'integer', 23091 'length' => 4, 23092 'notnull' => true, 23093 'default' => 0 23094 ), 23095 'obj_type' => array( 23096 'type' => 'text', 23097 'length' => 255, 23098 'notnull' => true, 23099 'default' => 0 23100 ), 23101 'user_id' => array( 23102 'type' => 'integer', 23103 'length' => 4, 23104 'notnull' => true, 23105 'default' => 0 23106 ), 23107 'user_name' => array( 23108 'type' => 'text', 23109 'length' => 255, 23110 'notnull' => true, 23111 'default' => 0 23112 ), 23113 'acquired_timestamp' => array( 23114 'type' => 'integer', 23115 'length' => 4, 23116 'notnull' => true, 23117 'default' => 0 23118 ), 23119 'certificate_content' => array( 23120 'type' => 'clob', 23121 'notnull' => true, 23122 ), 23123 'template_values' => array( 23124 'type' => 'clob', 23125 'notnull' => true, 23126 ), 23127 'valid_until' => array( 23128 'type' => 'integer', 23129 'length' => 4, 23130 'notnull' => false, 23131 'default' => null 23132 ), 23133 'background_image_path' => array( 23134 'type' => 'text', 23135 'notnull' => false, 23136 'length' => 255 23137 ), 23138 'version' => array( 23139 'type' => 'text', 23140 'length' => 255, 23141 'notnull' => true, 23142 'default' => '1' 23143 ), 23144 'ilias_version' => array( 23145 'type' => 'text', 23146 'length' => 255, 23147 'notnull' => true, 23148 'default' => 'v5.4.0' 23149 ), 23150 'currently_active' => array( 23151 'type' => 'integer', 23152 'length' => 1, 23153 'notnull' => true, 23154 'default' => 0 23155 ), 23156 )); 23157 23158 $ilDB->addPrimaryKey('user_certificates', array('id')); 23159 $ilDB->createSequence('user_certificates'); 23160 $ilDB->addIndex('user_certificates', array('obj_id', 'pattern_certificate_id'), 'i1'); 23161} 23162 23163if (!$ilDB->tableExists('certificate_cron_queue')) { 23164 $ilDB->createTable('certificate_cron_queue', array( 23165 'id' => array( 23166 'type' => 'integer', 23167 'length' => 4, 23168 'notnull' => true, 23169 'default' => 0 23170 ), 23171 'obj_id' => array( 23172 'type' => 'integer', 23173 'length' => 4, 23174 'notnull' => true, 23175 'default' => 0 23176 ), 23177 'usr_id' => array( 23178 'type' => 'integer', 23179 'length' => 4, 23180 'notnull' => true, 23181 'default' => 0 23182 ), 23183 'adapter_class' => array( 23184 'type' => 'text', 23185 'length' => '255', 23186 'notnull' => true, 23187 ), 23188 'state' => array( 23189 'type' => 'text', 23190 'length' => '255', 23191 'notnull' => true 23192 ), 23193 'started_timestamp' => array( 23194 'type' => 'integer', 23195 'length' => 4, 23196 'notnull' => true, 23197 'default' => 0 23198 ), 23199 )); 23200 23201 $ilDB->addPrimaryKey('certificate_cron_queue', array('id')); 23202 $ilDB->createSequence('certificate_cron_queue'); 23203 $ilDB->addIndex('certificate_cron_queue', array('obj_id', 'usr_id'), 'i1'); 23204} 23205?> 23206<#5340> 23207<?php 23208$ilCtrlStructureReader->getStructure(); 23209?> 23210<#5341> 23211<?php 23212if ($ilDB->tableExists('certificate_template')) { 23213 $web_path = CLIENT_WEB_DIR; 23214 23215 $directories = array( 23216 'exc' => '/exercise/certificates/', 23217 'crs' => '/course/certificates/', 23218 'tst' => '/assessment/certificates/', 23219 'sahs' => '/certificates/scorm/', 23220 'lti' => '/lti_data/certficates/', 23221 'cmix' => '/cmix_data/certficates/', 23222 ); 23223 23224 $GLOBALS['ilLog']->info(sprintf( 23225 "Started certificate template XML file migration" 23226 )); 23227 23228 $migratedObjectIds = []; 23229 $has_errors = false; 23230 $stmtSelectObjCertWithTemplate = $ilDB->prepare( 23231 " 23232 SELECT od.obj_id, COUNT(certificate_template.obj_id) as num_migrated_cer_templates 23233 FROM object_data od 23234 LEFT JOIN certificate_template ON certificate_template.obj_id = od.obj_id 23235 WHERE od.obj_id = ? 23236 GROUP BY od.obj_id 23237 ", 23238 ['integer'] 23239 ); 23240 23241 foreach ($directories as $type => $relativePath) { 23242 try { 23243 $directory = $web_path . $relativePath; 23244 23245 $GLOBALS['ilLog']->info(sprintf( 23246 "Started migration for object type directory: %s", 23247 $directory 23248 )); 23249 23250 $iter = new \RegExIterator( 23251 new \RecursiveIteratorIterator( 23252 new \RecursiveDirectoryIterator( 23253 $directory, 23254 \RecursiveDirectoryIterator::SKIP_DOTS 23255 ), 23256 \RecursiveIteratorIterator::CHILD_FIRST 23257 ), 23258 '/certificate\.xml$/' 23259 ); 23260 23261 foreach ($iter as $certificateFile) { 23262 /** @var $certificateFile \SplFileInfo */ 23263 $pathToFile = $certificateFile->getPathname(); 23264 23265 $GLOBALS['ilLog']->info(sprintf( 23266 "Found certificate template XML file (type: %s): %s", 23267 $type, 23268 $pathToFile 23269 )); 23270 23271 $objectId = basename($certificateFile->getPathInfo()); 23272 if (!is_numeric($objectId) || !($objectId > 0)) { 23273 $GLOBALS['ilLog']->warning(sprintf( 23274 "Could not extract valid obj_id, cannot migrate certificate XML template file: %s", 23275 $pathToFile 23276 )); 23277 continue; 23278 } 23279 23280 $GLOBALS['ilLog']->info(sprintf( 23281 "Extracted obj_id %s from certificate file: %s", 23282 $objectId, 23283 $pathToFile 23284 )); 23285 23286 if (isset($migratedObjectIds[$objectId])) { 23287 $GLOBALS['ilLog']->warning(sprintf( 23288 "Already created a database based certificate template for obj_id %s, cannot migrate file: %s", 23289 $objectId, 23290 $pathToFile 23291 )); 23292 continue; 23293 } 23294 23295 $res = $ilDB->execute($stmtSelectObjCertWithTemplate, [$objectId]); 23296 if (0 === (int) $ilDB->numRows($res)) { 23297 $GLOBALS['ilLog']->warning(sprintf( 23298 "Could not find an existing ILIAS object for obj_id %s, cannot migrate file: %s", 23299 $objectId, 23300 $pathToFile 23301 )); 23302 continue; 23303 } 23304 23305 $row = $ilDB->fetchAssoc($res); 23306 if ((int) $row['num_migrated_cer_templates'] > 0) { 23307 $GLOBALS['ilLog']->warning(sprintf( 23308 "Already created a database based certificate template for obj_id %s, cannot migrate file: %s", 23309 $objectId, 23310 $pathToFile 23311 )); 23312 continue; 23313 } 23314 23315 $content = file_get_contents($pathToFile); 23316 $timestamp = $certificateFile->getMTime(); 23317 23318 if (false !== $content) { 23319 $backgroundImagePath = ''; 23320 23321 if (file_exists($web_path . $relativePath . $objectId . '/background.jpg')) { 23322 $backgroundImagePath = $relativePath . $objectId . '/background.jpg'; 23323 } 23324 23325 if ('' === $backgroundImagePath && file_exists($web_path . '/certificates/default/background.jpg')) { 23326 $backgroundImagePath = '/certificates/default/background.jpg'; 23327 } 23328 23329 $id = $ilDB->nextId('certificate_template'); 23330 $columns = [ 23331 'id' => ['integer', $id], 23332 'obj_id' => ['integer', $objectId], 23333 'obj_type' => ['text', $type], 23334 'certificate_content' => ['text', $content], 23335 'certificate_hash' => ['text', md5($content)], 23336 'template_values' => ['text', ''], 23337 'version' => ['text', '1'], 23338 'ilias_version' => ['text', ILIAS_VERSION_NUMERIC], 23339 'created_timestamp' => ['integer', $timestamp], 23340 'currently_active' => ['integer', 1], 23341 'background_image_path' => ['text', $backgroundImagePath], 23342 ]; 23343 23344 $ilDB->insert('certificate_template', $columns); 23345 $migratedObjectIds[$objectId] = true; 23346 23347 $GLOBALS['ilLog']->info(sprintf( 23348 "Successfully migrated certificate template XML file for obj_id: %s/type: %s/id: %s", 23349 $objectId, 23350 $type, 23351 $id 23352 )); 23353 } else { 23354 $GLOBALS['ilLog']->warning(sprintf( 23355 "Empty content, cannot migrate certificate XML template file: %s", 23356 $pathToFile 23357 )); 23358 } 23359 } 23360 23361 $GLOBALS['ilLog']->info(sprintf( 23362 "Finished migration for directory: %s", 23363 $directory 23364 )); 23365 } catch (\Exception $e) { 23366 $has_errors = true; 23367 $GLOBALS['ilLog']->error(sprintf( 23368 "Cannot migrate directory, exception raised: %s", 23369 $e->getMessage() 23370 )); 23371 } catch (\Throwable $e) { 23372 $has_errors = true; 23373 $GLOBALS['ilLog']->error(sprintf( 23374 "Cannot migrate directory, exception raised: %s", 23375 $e->getMessage() 23376 )); 23377 } 23378 } 23379 23380 $GLOBALS['ilLog']->info(sprintf( 23381 "Finished certificate template (%s templates created) XML file migration%s", 23382 count($migratedObjectIds), 23383 ($has_errors ? ' with errors' : '') 23384 )); 23385} 23386?> 23387<#5342> 23388<?php 23389if (!$ilDB->tableExists('bgtask_cert_migration')) { 23390 $ilDB->createTable('bgtask_cert_migration', array( 23391 'id' => array( 23392 'type' => 'integer', 23393 'length' => 4, 23394 'notnull' => true, 23395 'default' => 0 23396 ), 23397 'usr_id' => array( 23398 'type' => 'integer', 23399 'length' => 4, 23400 'notnull' => true, 23401 'default' => 0 23402 ), 23403 'lock' => array( 23404 'type' => 'integer', 23405 'length' => 4, 23406 'notnull' => true, 23407 'default' => 0 23408 ), 23409 'found_items' => array( 23410 'type' => 'integer', 23411 'length' => 4, 23412 'notnull' => true, 23413 'default' => 0 23414 ), 23415 'processed_items' => array( 23416 'type' => 'integer', 23417 'length' => 4, 23418 'notnull' => true, 23419 'default' => 0 23420 ), 23421 'migrated_items' => array( 23422 'type' => 'integer', 23423 'length' => 4, 23424 'notnull' => true, 23425 'default' => 0 23426 ), 23427 'progress' => array( 23428 'type' => 'integer', 23429 'length' => 4, 23430 'notnull' => true, 23431 'default' => 0 23432 ), 23433 'state' => array( 23434 'type' => 'text', 23435 'length' => '255', 23436 'notnull' => true 23437 ), 23438 'started_ts' => array( 23439 'type' => 'integer', 23440 'length' => 4, 23441 'notnull' => false, 23442 'default' => 0 23443 ), 23444 'finished_ts' => array( 23445 'type' => 'integer', 23446 'length' => 4, 23447 'notnull' => false, 23448 ), 23449 )); 23450 $ilDB->addPrimaryKey('bgtask_cert_migration', array('id')); 23451 $ilDB->createSequence('bgtask_cert_migration'); 23452 $ilDB->addUniqueConstraint('bgtask_cert_migration', array('id', 'usr_id')); 23453} 23454$ilCtrlStructureReader->getStructure(); 23455?> 23456<#5343> 23457<?php 23458$ilCtrlStructureReader->getStructure(); 23459?> 23460<#5344> 23461<?php 23462if (!$ilDB->tableColumnExists('certificate_template', 'deleted')) { 23463 $ilDB->addTableColumn( 23464 'certificate_template', 23465 'deleted', 23466 array( 23467 'type' => 'integer', 23468 'length' => 1, 23469 'notnull' => true, 23470 'default' => 0 23471 ) 23472 ); 23473} 23474?> 23475<#5345> 23476<?php 23477if (!$ilDB->tableColumnExists('certificate_cron_queue', 'template_id')) { 23478 $ilDB->addTableColumn( 23479 'certificate_cron_queue', 23480 'template_id', 23481 array( 23482 'type' => 'integer', 23483 'length' => 4, 23484 'notnull' => true, 23485 'default' => 0 23486 ) 23487 ); 23488} 23489?> 23490<#5346> 23491<?php 23492/** @var \ilDBInterface $ilDB */ 23493if ($ilDB->tableExists('certificate_cron_queue') && !$ilDB->tableExists('il_cert_cron_queue')) { 23494 $ilDB->renameTable('certificate_cron_queue', 'il_cert_cron_queue'); 23495} 23496if ($ilDB->sequenceExists('certificate_cron_queue')) { 23497 $ilDB->dropSequence('certificate_cron_queue'); 23498} 23499if (!$ilDB->sequenceExists('il_cert_cron_queue')) { 23500 $query = "SELECT MAX(id) AS max_id FROM il_cert_cron_queue"; 23501 $row = $ilDB->fetchAssoc($ilDB->query($query)); 23502 $ilDB->createSequence('il_cert_cron_queue', (int) $row['max_id'] + 1); 23503} 23504?> 23505<#5347> 23506<?php 23507if ($ilDB->tableExists('certificate_template') && !$ilDB->tableExists('il_cert_template')) { 23508 $ilDB->renameTable('certificate_template', 'il_cert_template'); 23509} 23510if ($ilDB->sequenceExists('certificate_template')) { 23511 $ilDB->dropSequence('certificate_template'); 23512} 23513if (!$ilDB->sequenceExists('il_cert_template')) { 23514 $query = "SELECT MAX(id) AS max_id FROM il_cert_template"; 23515 $row = $ilDB->fetchAssoc($ilDB->query($query)); 23516 $ilDB->createSequence('il_cert_template', (int) $row['max_id'] + 1); 23517} 23518?> 23519<#5348> 23520<?php 23521if ($ilDB->tableExists('user_certificates') && !$ilDB->tableExists('il_cert_user_cert')) { 23522 $ilDB->renameTable('user_certificates', 'il_cert_user_cert'); 23523} 23524if ($ilDB->sequenceExists('user_certificates')) { 23525 $ilDB->dropSequence('user_certificates'); 23526} 23527if (!$ilDB->sequenceExists('il_cert_user_cert')) { 23528 $query = "SELECT MAX(id) AS max_id FROM il_cert_user_cert"; 23529 $row = $ilDB->fetchAssoc($ilDB->query($query)); 23530 $ilDB->createSequence('il_cert_user_cert', (int) $row['max_id'] + 1); 23531} 23532?> 23533<#5349> 23534<?php 23535if ($ilDB->tableExists('bgtask_cert_migration') && !$ilDB->tableExists('il_cert_bgtask_migr')) { 23536 $ilDB->renameTable('bgtask_cert_migration', 'il_cert_bgtask_migr'); 23537} 23538if ($ilDB->sequenceExists('bgtask_cert_migration')) { 23539 $ilDB->dropSequence('bgtask_cert_migration'); 23540} 23541if (!$ilDB->sequenceExists('il_cert_bgtask_migr')) { 23542 $query = "SELECT MAX(id) AS max_id FROM il_cert_bgtask_migr"; 23543 $row = $ilDB->fetchAssoc($ilDB->query($query)); 23544 $ilDB->createSequence('il_cert_bgtask_migr', (int) $row['max_id'] + 1); 23545} 23546?> 23547<#5350> 23548<?php 23549$ilCtrlStructureReader->getStructure(); 23550?> 23551<#5351> 23552<?php 23553$ilCtrlStructureReader->getStructure(); 23554?> 23555<#5352> 23556<?php 23557if (!$ilDB->tableColumnExists('il_cert_template', 'thumbnail_image_path')) { 23558 $ilDB->addTableColumn( 23559 'il_cert_template', 23560 'thumbnail_image_path', 23561 array( 23562 'type' => 'text', 23563 'notnull' => false, 23564 'length' => 255 23565 ) 23566 ); 23567} 23568 23569if (!$ilDB->tableColumnExists('il_cert_user_cert', 'thumbnail_image_path')) { 23570 $ilDB->addTableColumn( 23571 'il_cert_user_cert', 23572 'thumbnail_image_path', 23573 array( 23574 'type' => 'text', 23575 'notnull' => false, 23576 'length' => 255 23577 ) 23578 ); 23579} 23580?> 23581<#5353> 23582<?php 23583if ($ilDB->tableColumnExists('svy_svy', 'mode_360')) { 23584 $ilDB->renameTableColumn('svy_svy', 'mode_360', 'mode'); 23585} 23586?> 23587<#5354> 23588<?php 23589if (!$ilDB->tableColumnExists('svy_svy', 'mode_self_eval_results')) { 23590 $ilDB->addTableColumn( 23591 'svy_svy', 23592 'mode_self_eval_results', 23593 array( 23594 'type' => 'integer', 23595 'length' => 1, 23596 'notnull' => false, 23597 'default' => 0 23598 ) 23599 ); 23600} 23601?> 23602<#5355> 23603<?php 23604if ($ilDB->tableColumnExists('svy_svy', 'mode_360_skill_service')) { 23605 $ilDB->renameTableColumn('svy_svy', 'mode_360_skill_service', 'mode_skill_service'); 23606} 23607?> 23608<#5356> 23609<?php 23610if (!$ilDB->indexExistsByFields('il_cert_template', ['obj_id', 'deleted'])) { 23611 $ilDB->addIndex('il_cert_template', ['obj_id', 'deleted'], 'i2'); 23612} 23613?> 23614<#5357> 23615<?php 23616if (!$ilDB->indexExistsByFields('il_cert_template', ['obj_id', 'currently_active', 'deleted'])) { 23617 $ilDB->addIndex('il_cert_template', ['obj_id', 'currently_active', 'deleted'], 'i3'); 23618} 23619?> 23620<#5358> 23621<?php 23622if (!$ilDB->indexExistsByFields('il_cert_template', ['obj_type'])) { 23623 $ilDB->addIndex('il_cert_template', ['obj_type'], 'i4'); 23624} 23625?> 23626<#5359> 23627<?php 23628if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['user_id', 'currently_active'])) { 23629 $ilDB->addIndex('il_cert_user_cert', ['user_id', 'currently_active'], 'i2'); 23630} 23631?> 23632<#5360> 23633<?php 23634if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['user_id', 'currently_active', 'acquired_timestamp'])) { 23635 $ilDB->addIndex('il_cert_user_cert', ['user_id', 'currently_active', 'acquired_timestamp'], 'i3'); 23636} 23637?> 23638<#5361> 23639<?php 23640if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['user_id', 'obj_type', 'currently_active'])) { 23641 $ilDB->addIndex('il_cert_user_cert', ['user_id', 'obj_type', 'currently_active'], 'i4'); 23642} 23643?> 23644<#5362> 23645<?php 23646if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['obj_id', 'currently_active'])) { 23647 $ilDB->addIndex('il_cert_user_cert', ['obj_id', 'currently_active'], 'i5'); 23648} 23649?> 23650<#5363> 23651<?php 23652if (!$ilDB->indexExistsByFields('il_cert_user_cert', ['user_id', 'obj_id', 'currently_active'])) { 23653 $ilDB->addIndex('il_cert_user_cert', ['user_id', 'obj_id', 'currently_active'], 'i6'); 23654} 23655?> 23656<#5364> 23657<?php 23658if (!$ilDB->tableColumnExists('exc_assignment', 'deadline_mode')) { 23659 $ilDB->addTableColumn( 23660 'exc_assignment', 23661 'deadline_mode', 23662 array( 23663 'type' => 'integer', 23664 'length' => 1, 23665 'notnull' => false, 23666 'default' => 0 23667 ) 23668 ); 23669} 23670?> 23671<#5365> 23672<?php 23673if (!$ilDB->tableColumnExists('exc_assignment', 'relative_deadline')) { 23674 $ilDB->addTableColumn( 23675 'exc_assignment', 23676 'relative_deadline', 23677 array( 23678 'type' => 'integer', 23679 'length' => 4, 23680 'notnull' => false, 23681 'default' => 0 23682 ) 23683 ); 23684} 23685?> 23686<#5366> 23687<?php 23688if (!$ilDB->tableColumnExists('exc_idl', 'starting_ts')) { 23689 $ilDB->addTableColumn( 23690 'exc_idl', 23691 'starting_ts', 23692 array( 23693 'type' => 'integer', 23694 'length' => 4, 23695 'notnull' => false, 23696 'default' => 0 23697 ) 23698 ); 23699} 23700?> 23701<#5367> 23702<?php 23703// BEGIN MME 23704$fields = array( 23705 'identification' => array( 23706 'type' => 'text', 23707 'length' => '64', 23708 23709 ), 23710 'active' => array( 23711 'type' => 'integer', 23712 'length' => '1', 23713 23714 ), 23715 'position' => array( 23716 'type' => 'integer', 23717 'length' => '4', 23718 23719 ), 23720 'parent_identification' => array( 23721 'type' => 'text', 23722 'length' => '255', 23723 23724 ) 23725); 23726if (!$ilDB->tableExists('il_mm_items')) { 23727 $ilDB->createTable('il_mm_items', $fields); 23728 $ilDB->addPrimaryKey('il_mm_items', array( 'identification' )); 23729} 23730?> 23731<#5368> 23732<?php 23733$fields = array( 23734 'id' => array( 23735 'type' => 'text', 23736 'length' => '255', 23737 23738 ), 23739 'identification' => array( 23740 'type' => 'text', 23741 'length' => '255', 23742 ), 23743 'translation' => array( 23744 'type' => 'text', 23745 'length' => '4000', 23746 23747 ), 23748 'language_key' => array( 23749 'type' => 'text', 23750 'length' => '8', 23751 23752 ), 23753); 23754if (!$ilDB->tableExists('il_mm_translation')) { 23755 $ilDB->createTable('il_mm_translation', $fields); 23756 $ilDB->addPrimaryKey('il_mm_translation', array( 'id' )); 23757} 23758?> 23759<#5369> 23760<?php 23761$fields = array( 23762 'provider_class' => array( 23763 'type' => 'text', 23764 'length' => '255', 23765 23766 ), 23767 'purpose' => array( 23768 'type' => 'text', 23769 'length' => '255', 23770 23771 ), 23772 'dynamic' => array( 23773 'type' => 'integer', 23774 'length' => '1', 23775 23776 ), 23777 23778); 23779if (!$ilDB->tableExists('il_gs_providers')) { 23780 $ilDB->createTable('il_gs_providers', $fields); 23781 $ilDB->addPrimaryKey('il_gs_providers', array('provider_class')); 23782} 23783?> 23784<#5370> 23785<?php 23786$fields = array( 23787 'identification' => array( 23788 'type' => 'text', 23789 'length' => '64', 23790 23791 ), 23792 'provider_class' => array( 23793 'type' => 'text', 23794 'length' => '255', 23795 23796 ), 23797 'active' => array( 23798 'type' => 'integer', 23799 'length' => '1', 23800 23801 ), 23802 23803); 23804if (!$ilDB->tableExists('il_gs_identifications')) { 23805 $ilDB->createTable('il_gs_identifications', $fields); 23806 $ilDB->addPrimaryKey('il_gs_identifications', array('identification')); 23807} 23808?> 23809<#5371> 23810<?php 23811$fields = array( 23812 'identifier' => array( 23813 'type' => 'text', 23814 'length' => '255', 23815 23816 ), 23817 'type' => array( 23818 'type' => 'text', 23819 'length' => '128', 23820 23821 ), 23822 'action' => array( 23823 'type' => 'text', 23824 'length' => '4000', 23825 23826 ), 23827 'top_item' => array( 23828 'type' => 'integer', 23829 'length' => '1', 23830 23831 ), 23832 'default_title' => array( 23833 'type' => 'text', 23834 'length' => '4000', 23835 23836 ), 23837 23838); 23839if (!$ilDB->tableExists('il_mm_custom_items')) { 23840 $ilDB->createTable('il_mm_custom_items', $fields); 23841 $ilDB->addPrimaryKey('il_mm_custom_items', array( 'identifier' )); 23842} 23843?> 23844<#5372> 23845<?php 23846$fields = array( 23847 'identification' => array( 23848 'type' => 'text', 23849 'length' => '255', 23850 23851 ), 23852 'action' => array( 23853 'type' => 'text', 23854 'length' => '4000', 23855 23856 ), 23857 'external' => array( 23858 'type' => 'integer', 23859 'length' => '1', 23860 23861 ) 23862); 23863if (!$ilDB->tableExists('il_mm_actions')) { 23864 $ilDB->createTable('il_mm_actions', $fields); 23865 $ilDB->addPrimaryKey('il_mm_actions', array( 'identification' )); 23866} 23867?> 23868<#5373> 23869<?php 23870require_once './Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'; 23871ilDBUpdateNewObjectType::addAdminNode('mme', 'Main Menu'); 23872 23873$ilCtrlStructureReader->getStructure(); 23874// END MME 23875?> 23876<#5374> 23877<?php 23878if (!$ilDB->tableColumnExists("il_object_def", "offline_handling")) { 23879 $def = array( 23880 'type' => 'integer', 23881 'length' => 1, 23882 'notnull' => true, 23883 'default' => 0 23884 ); 23885 $ilDB->addTableColumn("il_object_def", "offline_handling", $def); 23886} 23887?> 23888<#5375> 23889<?php 23890$ilCtrlStructureReader->getStructure(); 23891?> 23892<#5376> 23893<?php 23894if (!$ilDB->tableColumnExists('object_data', 'offline')) { 23895 $def = [ 23896 'type' => 'integer', 23897 'length' => 1, 23898 'notnull' => false, 23899 'default' => null 23900 ]; 23901 $ilDB->addTableColumn('object_data', 'offline', $def); 23902} 23903?> 23904 23905<#5377> 23906<?php 23907 23908// migration of course offline status 23909$query = 'update object_data od set offline = ' . 23910 '(select if( activation_type = 0,1,0) from crs_settings ' . 23911 'where obj_id = od.obj_id) where type = ' . $ilDB->quote('crs', 'text'); 23912$ilDB->manipulate($query); 23913?> 23914 23915<#5378> 23916<?php 23917 23918// migration of lm offline status 23919$query = 'update object_data od set offline = ' . 23920 '(select if( is_online = ' . $ilDB->quote('n', 'text') . ',1,0) from content_object ' . 23921 'where id = od.obj_id) where type = ' . $ilDB->quote('lm', 'text'); 23922$ilDB->manipulate($query); 23923 23924?> 23925<#5379> 23926<?php 23927 23928// migration of lm offline status 23929$query = 'update object_data od set offline = ' . 23930 '(select if( is_online = ' . $ilDB->quote('n', 'text') . ',1,0) from file_based_lm ' . 23931 'where id = od.obj_id) where type = ' . $ilDB->quote('htlm', 'text'); 23932$ilDB->manipulate($query); 23933 23934?> 23935<#5380> 23936<?php 23937 23938// migration of svy offline status 23939$query = 'update object_data od set offline = ' . 23940 '(select if( status = 0,1,0) from svy_svy ' . 23941 'where obj_fi = od.obj_id) where type = ' . $ilDB->quote('svy', 'text'); 23942$ilDB->manipulate($query); 23943?> 23944<#5381> 23945<?php 23946$ilCtrlStructureReader->getStructure(); 23947?> 23948 23949<#5382> 23950<?php 23951include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23952 23953$type_id = ilDBUpdateNewObjectType::getObjectTypeId('sess'); 23954$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 23955 23956if ($type_id && $tgt_ops_id) { 23957 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 23958} 23959?> 23960<#5383> 23961<?php 23962 23963include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23964$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 23965$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_members'); 23966ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 23967 23968?> 23969 23970<#5384> 23971<?php 23972include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23973ilDBUpdateNewObjectType::addCustomRBACOperation( 23974 'manage_materials', 23975 'Manage Materials', 23976 'object', 23977 6500 23978); 23979?> 23980<#5385> 23981<?php 23982 23983include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23984$type_id = ilDBUpdateNewObjectType::getObjectTypeId('sess'); 23985$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_materials'); 23986 23987if ($tgt_ops_id && $type_id) { 23988 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 23989} 23990 23991?> 23992<#5386> 23993<?php 23994include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 23995$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 23996$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('manage_materials'); 23997ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 23998?> 23999 24000 24001<#5387> 24002<?php 24003include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24004ilDBUpdateNewObjectType::addCustomRBACOperation( 24005 'edit_metadata', 24006 'Edit Metadata', 24007 'object', 24008 5800 24009); 24010?> 24011 24012 24013<#5388> 24014<?php 24015 24016include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24017$type_id = ilDBUpdateNewObjectType::getObjectTypeId('sess'); 24018$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_metadata'); 24019 24020if ($tgt_ops_id && $type_id) { 24021 ilDBUpdateNewObjectType::addRBACOperation($type_id, $tgt_ops_id); 24022} 24023 24024?> 24025<#5389> 24026<?php 24027include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24028$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 24029$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_metadata'); 24030ilDBUpdateNewObjectType::cloneOperation('sess', $src_ops_id, $tgt_ops_id); 24031?> 24032 24033<#5390> 24034<?php 24035if (!$ilDB->tableColumnExists('adv_md_record', 'gpos')) { 24036 $ilDB->addTableColumn( 24037 'adv_md_record', 24038 'gpos', 24039 array( 24040 "type" => "integer", 24041 "notnull" => false, 24042 "length" => 4 24043 ) 24044 ); 24045} 24046?> 24047<#5391> 24048<?php 24049if (!$ilDB->tableExists('adv_md_record_obj_ord')) { 24050 $ilDB->createTable( 24051 'adv_md_record_obj_ord', 24052 [ 24053 'record_id' => [ 24054 'type' => 'integer', 24055 'length' => 4, 24056 'notnull' => true 24057 ], 24058 'obj_id' => [ 24059 'type' => 'integer', 24060 'length' => 4, 24061 'notnull' => true 24062 ], 24063 'position' => [ 24064 'type' => 'integer', 24065 'length' => 4, 24066 'notnull' => true 24067 ] 24068 ] 24069 ); 24070 $ilDB->addPrimaryKey( 24071 'adv_md_record_obj_ord', 24072 [ 24073 'record_id', 24074 'obj_id' 24075 ] 24076 ); 24077} 24078?> 24079 24080<#5392> 24081<?php 24082if (!$ilDB->tableColumnExists('event', 'show_members')) { 24083 $ilDB->addTableColumn( 24084 'event', 24085 'show_members', 24086 [ 24087 "notnull" => true, 24088 "length" => 1, 24089 "type" => "integer", 24090 'default' => 0 24091 ] 24092 ); 24093} 24094?> 24095 24096<#5393> 24097<?php 24098$ilCtrlStructureReader->getStructure(); 24099?> 24100 24101<#5394> 24102<?php 24103if (!$ilDB->tableColumnExists('event', 'mail_members')) { 24104 $ilDB->addTableColumn( 24105 'event', 24106 'mail_members', 24107 [ 24108 "notnull" => true, 24109 "length" => 1, 24110 "type" => "integer", 24111 'default' => 0 24112 ] 24113 ); 24114} 24115?> 24116 24117<#5395> 24118<?php 24119if (!$ilDB->tableColumnExists('event_participants', 'contact')) { 24120 $ilDB->addTableColumn( 24121 'event_participants', 24122 'contact', 24123 [ 24124 "notnull" => true, 24125 "length" => 1, 24126 "type" => "integer", 24127 'default' => 0 24128 ] 24129 ); 24130} 24131?> 24132<#5396> 24133<?php 24134if (!$ilDB->tableExists('post_conditions')) { 24135 $ilDB->createTable('post_conditions', array( 24136 'ref_id' => array( 24137 "type" => "integer", 24138 "length" => 4, 24139 'notnull' => true 24140 ), 24141 'condition_type' => array( 24142 "type" => "integer", 24143 "length" => 4, 24144 'notnull' => true 24145 ), 24146 'value' => array( 24147 "type" => "integer", 24148 "length" => 4, 24149 "default" => null 24150 ) 24151 )); 24152 $ilDB->addPrimaryKey("post_conditions", array("ref_id", "condition_type", "value")); 24153} 24154?> 24155 24156<#5397> 24157<?php 24158$ilSetting = new ilSetting('certificate'); 24159$setting = $ilSetting->set('persisting_cers_introduced_ts', time()); 24160?> 24161 24162<#5398> 24163<?php 24164// migration of svy offline status 24165$query = 'update object_data od set offline = ' . 24166 '(select if( online_status = 0,1,0) from tst_tests ' . 24167 'where obj_fi = od.obj_id) where type = ' . $ilDB->quote('tst', 'text'); 24168$ilDB->manipulate($query); 24169?> 24170 24171<#5399> 24172<?php 24173if (!$ilDB->tableExists('lso_states')) { 24174 $ilDB->createTable('lso_states', array( 24175 'lso_ref_id' => array( 24176 "type" => "integer", 24177 "length" => 4, 24178 'notnull' => true 24179 ), 24180 'usr_id' => array( 24181 "type" => "integer", 24182 "length" => 4, 24183 'notnull' => true 24184 ), 24185 'current_item' => array( 24186 "type" => "integer", 24187 "length" => 4, 24188 "default" => null 24189 ), 24190 'states' => array( 24191 "type" => "clob" 24192 ) 24193 )); 24194 $ilDB->addPrimaryKey("lso_states", array("lso_ref_id", "usr_id")); 24195} 24196?> 24197 24198<#5400> 24199<?php 24200global $ilDB; 24201 24202include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24203 24204$lso_type_id = ilDBUpdateNewObjectType::addNewType('lso', 'Learning Sequence'); 24205 24206$rbac_ops = array( 24207 ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS, 24208 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 24209 ilDBUpdateNewObjectType::RBAC_OP_READ, 24210 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 24211 ilDBUpdateNewObjectType::RBAC_OP_DELETE, 24212 ilDBUpdateNewObjectType::RBAC_OP_COPY 24213); 24214ilDBUpdateNewObjectType::addRBACOperations($lso_type_id, $rbac_ops); 24215 24216$parent_types = array('root', 'cat', 'crs', 'fold', 'grp'); 24217ilDBUpdateNewObjectType::addRBACCreate('create_lso', 'Create Learning Sequence', $parent_types); 24218ilDBUpdateNewObjectType::applyInitialPermissionGuideline('lso', true); 24219 24220if ($lso_type_id) { 24221 ilDBUpdateNewObjectType::addRBACTemplate( 24222 'lso', 24223 'il_lso_admin', 24224 'Admin template for learning sequences', 24225 array( 24226 ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS, 24227 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 24228 ilDBUpdateNewObjectType::RBAC_OP_READ, 24229 ilDBUpdateNewObjectType::RBAC_OP_WRITE, 24230 ilDBUpdateNewObjectType::RBAC_OP_DELETE, 24231 ilDBUpdateNewObjectType::RBAC_OP_COPY, 24232 $lso_type_id 24233 ) 24234 ); 24235 ilDBUpdateNewObjectType::addRBACTemplate( 24236 'lso', 24237 'il_lso_member', 24238 'Member template for learning sequences', 24239 array( 24240 ilDBUpdateNewObjectType::RBAC_OP_VISIBLE, 24241 ilDBUpdateNewObjectType::RBAC_OP_READ, 24242 $lso_type_id 24243 ) 24244 ); 24245} 24246?> 24247 24248<#5401> 24249<?php 24250if (!$ilDB->tableExists('lso_settings')) { 24251 $ilDB->createTable('lso_settings', array( 24252 'obj_id' => array( 24253 "type" => "integer", 24254 "length" => 4, 24255 'notnull' => true 24256 ), 24257 'abstract' => array( 24258 "type" => "clob" 24259 ), 24260 'extro' => array( 24261 "type" => "clob" 24262 ), 24263 'abstract_image' => array( 24264 'type' => 'text', 24265 'length' => 128, 24266 'default' => null, 24267 ), 24268 'extro_image' => array( 24269 'type' => 'text', 24270 'length' => 128, 24271 'default' => null, 24272 ) 24273 )); 24274 $ilDB->addPrimaryKey("lso_settings", array("obj_id")); 24275} 24276?> 24277 24278<#5402> 24279<?php 24280if (!$ilDB->tableColumnExists('lso_settings', 'online')) { 24281 $ilDB->addTableColumn('lso_settings', 'online', array( 24282 "type" => "integer", 24283 "notnull" => true, 24284 "length" => 1, 24285 "default" => 0 24286 )); 24287} 24288?> 24289 24290<#5403> 24291<?php 24292if (!$ilDB->tableColumnExists('lso_settings', 'gallery')) { 24293 $ilDB->addTableColumn('lso_settings', 'gallery', array( 24294 "type" => "integer", 24295 "notnull" => true, 24296 "length" => 1, 24297 "default" => 0 24298 )); 24299} 24300?> 24301 24302<#5404> 24303<?php 24304include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24305$lp_type_id = ilDBUpdateNewObjectType::getObjectTypeId("lso"); 24306if ($lp_type_id) { 24307 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation( 24308 'participate', 24309 'Participate to Learning Sequence', 24310 'object', 24311 9950 24312 ); 24313 if ($new_ops_id) { 24314 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $new_ops_id); 24315 } 24316 $new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation( 24317 'unparticipate', 24318 'Unparticipate from Learning Sequence', 24319 'object', 24320 9960 24321 ); 24322 if ($new_ops_id) { 24323 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $new_ops_id); 24324 } 24325 24326 $ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("manage_members"); 24327 if ($ops_id) { 24328 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ops_id); 24329 } 24330 24331 $ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId("edit_learning_progress"); 24332 if ($ops_id) { 24333 ilDBUpdateNewObjectType::addRBACOperation($lp_type_id, $ops_id); 24334 } 24335} 24336?> 24337 24338<#5405> 24339<?php 24340if (!$ilDB->tableColumnExists('lso_states', 'first_access')) { 24341 $ilDB->addTableColumn('lso_states', 'first_access', array( 24342 "type" => "text", 24343 "notnull" => false, 24344 "length" => 32, 24345 )); 24346} 24347?> 24348 24349<#5406> 24350<?php 24351if (!$ilDB->tableColumnExists('lso_states', 'last_access')) { 24352 $ilDB->addTableColumn('lso_states', 'last_access', array( 24353 "type" => "text", 24354 "notnull" => false, 24355 "length" => 32, 24356 )); 24357} 24358?> 24359 24360<#5407> 24361<?php 24362include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24363$lso_type_id = ilDBUpdateNewObjectType::getObjectTypeId("lso"); 24364 24365$op_ids = [ 24366 ilDBUpdateNewObjectType::getCustomRBACOperationId("manage_members"), 24367 ilDBUpdateNewObjectType::getCustomRBACOperationId("edit_learning_progress"), 24368 ilDBUpdateNewObjectType::getCustomRBACOperationId("unparticipate"), 24369 ilDBUpdateNewObjectType::getCustomRBACOperationId("participate") 24370]; 24371 24372foreach ($op_ids as $op_id) { 24373 $ilDB->manipulateF( 24374 "INSERT INTO rbac_templates (rol_id, type, ops_id, parent)" . PHP_EOL 24375 . "VALUES (%s, %s, %s, %s)", 24376 array("integer", "text", "integer", "integer"), 24377 array($lso_type_id, "lso", $op_id, 8) 24378 ) 24379 ; 24380} 24381 24382$ilCtrlStructureReader->getStructure(); 24383?> 24384<#5408> 24385<?php 24386$ilCtrlStructureReader->getStructure(); 24387// migration of scorm offline status 24388$query = 'update object_data od set offline = ' . 24389 '(select if( c_online = ' . $ilDB->quote('n', 'text') . ',1,0) from sahs_lm ' . 24390 'where id = od.obj_id) where type = ' . $ilDB->quote('sahs', 'text'); 24391$ilDB->manipulate($query); 24392 24393?> 24394 24395<#5409> 24396<?php 24397 24398if (!$ilDB->tableExists('il_meta_oer_stat')) { 24399 $ilDB->createTable('il_meta_oer_stat', array( 24400 'obj_id' => array( 24401 'type' => 'integer', 24402 'length' => 4, 24403 'notnull' => true, 24404 ), 24405 'href_id' => array( 24406 'type' => 'integer', 24407 'length' => 4, 24408 'notnull' => true 24409 ), 24410 'blocked' => array( 24411 'type' => 'integer', 24412 'length' => 1, 24413 'notnull' => true, 24414 'default' => 0 24415 ) 24416 )); 24417} 24418?> 24419<#5410> 24420<?php 24421 24422if ($ilDB->tableExists('il_md_cpr_selections')) { 24423 if (!$ilDB->tableColumnExists('il_md_cpr_selections', 'is_default')) { 24424 $ilDB->addTableColumn('il_md_cpr_selections', 'is_default', array( 24425 'type' => 'integer', 24426 'length' => 1, 24427 'notnull' => true, 24428 'default' => 0 24429 )); 24430 } 24431 24432 $id = $ilDB->nextId('il_md_cpr_selections'); 24433 $ilDB->insert( 24434 "il_md_cpr_selections", 24435 array( 24436 'entry_id' => array('integer',$id), 24437 'title' => array('text', 'All rights reserved'), 24438 'description' => array('clob', ''), 24439 'copyright' => array('clob', 'This work has all rights reserved by the owner.'), 24440 'language' => array('text', 'en'), 24441 'costs' => array('integer', '0'), 24442 'cpr_restrictions' => array('integer', '1'), 24443 'is_default' => array('integer', '1') 24444 ) 24445 ); 24446} 24447?> 24448<#5411> 24449<?php 24450if ($ilDB->tableExists('il_md_cpr_selections')) { 24451 if (!$ilDB->tableColumnExists('il_md_cpr_selections', 'outdated')) { 24452 $ilDB->addTableColumn('il_md_cpr_selections', 'outdated', array( 24453 'type' => 'integer', 24454 'length' => 1, 24455 'notnull' => true, 24456 'default' => 0 24457 )); 24458 } 24459} 24460?> 24461<#5412> 24462<?php 24463if ($ilDB->tableExists('il_md_cpr_selections')) { 24464 if (!$ilDB->tableColumnExists('il_md_cpr_selections', 'position')) { 24465 $ilDB->addTableColumn('il_md_cpr_selections', 'position', array( 24466 'type' => 'integer', 24467 'length' => 1, 24468 'notnull' => true, 24469 'default' => 0 24470 )); 24471 } 24472} 24473?> 24474<#5413> 24475<?php 24476if (!$ilDB->tableColumnExists('crs_settings', 'timing_mode')) { 24477 $ilDB->addTableColumn( 24478 'crs_settings', 24479 'timing_mode', 24480 array( 24481 'type' => 'integer', 24482 'length' => 1, 24483 'notnull' => false, 24484 'default' => 0 24485 ) 24486 ); 24487} 24488?> 24489<#5414> 24490<?php 24491if (!$ilDB->tableColumnExists('crs_items', 'suggestion_start_rel')) { 24492 $ilDB->addTableColumn( 24493 'crs_items', 24494 'suggestion_start_rel', 24495 array( 24496 'type' => 'integer', 24497 'length' => 4, 24498 'notnull' => false, 24499 'default' => 0 24500 ) 24501 ); 24502} 24503?> 24504<#5415> 24505<?php 24506 24507if (!$ilDB->tableColumnExists('crs_items', 'suggestion_end_rel')) { 24508 $ilDB->addTableColumn( 24509 'crs_items', 24510 'suggestion_end_rel', 24511 array( 24512 'type' => 'integer', 24513 'length' => 4, 24514 'notnull' => false, 24515 'default' => 0 24516 ) 24517 ); 24518} 24519?> 24520<#5416> 24521<?php 24522 24523if (!$ilDB->tableColumnExists('crs_items', 'earliest_start_rel')) { 24524 $ilDB->addTableColumn( 24525 'crs_items', 24526 'earliest_start_rel', 24527 array( 24528 'type' => 'integer', 24529 'length' => 4, 24530 'notnull' => false, 24531 'default' => 0 24532 ) 24533 ); 24534} 24535?> 24536<#5417> 24537<?php 24538 24539if (!$ilDB->tableColumnExists('crs_items', 'latest_end_rel')) { 24540 $ilDB->addTableColumn( 24541 'crs_items', 24542 'latest_end_rel', 24543 array( 24544 'type' => 'integer', 24545 'length' => 4, 24546 'notnull' => false, 24547 'default' => 0 24548 ) 24549 ); 24550} 24551?> 24552 24553<#5418> 24554<?php 24555 24556if ($ilDB->tableColumnExists('crs_items', 'earliest_start')) { 24557 $ilDB->dropTableColumn('crs_items', 'earliest_start'); 24558} 24559if ($ilDB->tableColumnExists('crs_items', 'latest_end')) { 24560 $ilDB->dropTableColumn('crs_items', 'latest_end'); 24561} 24562if ($ilDB->tableColumnExists('crs_items', 'earliest_start_rel')) { 24563 $ilDB->dropTableColumn('crs_items', 'earliest_start_rel'); 24564} 24565if ($ilDB->tableColumnExists('crs_items', 'latest_end_rel')) { 24566 $ilDB->dropTableColumn('crs_items', 'latest_end_rel'); 24567} 24568?> 24569<#5419> 24570<?php 24571if (!$ilDB->tableExists('crs_timings_user')) { 24572 $ilDB->createTable('crs_timings_user', array( 24573 'ref_id' => array( 24574 'type' => 'integer', 24575 'length' => 4, 24576 'notnull' => true, 24577 'default' => 0 24578 ), 24579 'usr_id' => array( 24580 'type' => 'integer', 24581 'length' => 4, 24582 'notnull' => true, 24583 'default' => 0 24584 ), 24585 'sstart' => array( 24586 'type' => 'integer', 24587 'length' => 4, 24588 'notnull' => true, 24589 'default' => 0 24590 ), 24591 'ssend' => array( 24592 'type' => 'integer', 24593 'length' => 4, 24594 'notnull' => true, 24595 'default' => 0 24596 ) 24597 )); 24598 $ilDB->addPrimaryKey('crs_timings_user', array('ref_id', 'usr_id')); 24599} 24600?> 24601<#5420> 24602<?php 24603 24604include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24605$new_ops_id = ilDBUpdateNewObjectType::addCustomRBACOperation('read_results', 'Access Results', 'object', 2500); 24606$type_id = ilDBUpdateNewObjectType::getObjectTypeId('svy'); 24607if ($type_id && $new_ops_id) { 24608 ilDBUpdateNewObjectType::addRBACOperation($type_id, $new_ops_id); 24609} 24610?> 24611 24612<#5421> 24613<?php 24614include_once('./Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php'); 24615 24616$src_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('write'); 24617$tgt_ops_id = ilDBUpdateNewObjectType::getCustomRBACOperationId('read_results'); 24618ilDBUpdateNewObjectType::cloneOperation('svy', $src_ops_id, $tgt_ops_id); 24619?> 24620<#5422> 24621<?php 24622 $ilCtrlStructureReader->getStructure(); 24623?> 24624<#5423> 24625<?php 24626// Possibly missing primaries 24627$ilDB->modifyTableColumn('il_mm_translation', 'identification', array( 24628 'length' => 255 24629)); 24630 24631$ilDB->modifyTableColumn('il_gs_providers', 'provider_class', array( 24632 'length' => 255 24633)); 24634 24635$ilDB->modifyTableColumn('il_gs_providers', 'purpose', array( 24636 'length' => 255 24637)); 24638 24639$ilDB->modifyTableColumn('il_gs_identifications', 'provider_class', array( 24640 'length' => 255 24641)); 24642 24643$ilDB->modifyTableColumn('il_mm_custom_items', 'identifier', array( 24644 'length' => 255 24645)); 24646 24647$ilDB->modifyTableColumn('il_mm_actions', 'identification', array( 24648 'length' => 255 24649)); 24650 24651 24652$manager = $ilDB->loadModule('Manager'); 24653 24654$const = $manager->listTableConstraints("il_mm_translation"); 24655if (!in_array("primary", $const)) { 24656 $ilDB->addPrimaryKey('il_mm_translation', array( 'id' )); 24657} 24658$const = $manager->listTableConstraints("il_gs_providers"); 24659if (!in_array("primary", $const)) { 24660 $ilDB->addPrimaryKey('il_gs_providers', array('provider_class')); 24661} 24662$const = $manager->listTableConstraints("il_gs_identifications"); 24663if (!in_array("primary", $const)) { 24664 $ilDB->addPrimaryKey('il_gs_identifications', array('identification')); 24665} 24666$const = $manager->listTableConstraints("il_mm_custom_items"); 24667if (!in_array("primary", $const)) { 24668 $ilDB->addPrimaryKey('il_mm_custom_items', array( 'identifier' )); 24669} 24670$const = $manager->listTableConstraints("il_mm_actions"); 24671if (!in_array("primary", $const)) { 24672 $ilDB->addPrimaryKey('il_mm_actions', array( 'identification' )); 24673} 24674 24675?> 24676<#5424> 24677<?php 24678if (!$ilDB->tableExists('booking_member')) { 24679 $ilDB->createTable('booking_member', array( 24680 'participant_id' => array( 24681 'type' => 'integer', 24682 'length' => 4, 24683 'notnull' => true, 24684 'default' => 0 24685 ), 24686 'user_id' => array( 24687 'type' => 'integer', 24688 'length' => 4, 24689 'notnull' => true, 24690 'default' => 0 24691 ), 24692 'booking_pool_id' => array( 24693 'type' => 'text', 24694 'length' => 255, 24695 'notnull' => true 24696 ), 24697 'assigner_user_id' => array( 24698 'type' => 'integer', 24699 'length' => 4, 24700 'notnull' => true, 24701 'default' => 0 24702 ) 24703 )); 24704 $ilDB->addPrimaryKey('booking_member', array('participant_id', 'user_id', 'booking_pool_id')); 24705 $ilDB->createSequence('booking_member'); 24706} 24707?> 24708<#5425> 24709<?php 24710if (!$ilDB->tableColumnExists('booking_reservation', 'assigner_id')) { 24711 $ilDB->addTableColumn("booking_reservation", "assigner_id", array("type" => "integer", "length" => 4, "notnull" => true, "default" => 0)); 24712} 24713?> 24714<#5426> 24715<?php 24716$ilCtrlStructureReader->getStructure(); 24717?> 24718<#5427> 24719<?php 24720$setting = new ilSetting(); 24721$media_cont_mig = $setting->get('sty_media_cont_mig', 0); 24722if ($media_cont_mig == 0) { 24723 echo "<pre> 24724 24725 DEAR ADMINISTRATOR !! 24726 24727 Please read the following instructions CAREFULLY! 24728 24729 -> If you are using content styles (e.g. for learning modules) style settings related 24730 to media container have been lost when migrating from ILIAS 5.0/5.1 to ILIAS 5.2/5.3/5.4. 24731 24732 -> The following dbupdate step will fix this issue and set the media container properties to values 24733 before the upgrade to ILIAS 5.2/5.3/5.4. 24734 24735 -> If this issue has already been fixed manually in your content styles you may want to skip 24736 this step. If you are running ILIAS 5.2/5.3/5.4 for a longer time period you may also not want to 24737 restore old values anymore and skip this step. 24738 If you would like to skip this step you need to modify the file setup/sql/dbupdate_04.php 24739 Search for 'RUN_CONTENT_STYLE_MIGRATION' (around line 25205) and follow the instructions. 24740 24741 => To proceed the update process you now need to refresh the page (F5) 24742 24743 Mantis Bug Report: https://ilias.de/mantis/view.php?id=23299 24744 24745 </pre>"; 24746 24747 $setting->set('sty_media_cont_mig', 1); 24748 exit; 24749} 24750if ($media_cont_mig == 1) { 24751 // 24752 // RUN_CONTENT_STYLE_MIGRATION 24753 // 24754 // If you want to skip the migration of former style properties for the media container style classes 24755 // set the following value of $run_migration from 'true' to 'false'. 24756 // 24757 24758 $run_migration = true; 24759 24760 if ($run_migration) { 24761 $set = $ilDB->queryF( 24762 "SELECT * FROM style_parameter " . 24763 " WHERE type = %s AND tag = %s ", 24764 array("text", "text"), 24765 array("media_cont", "table") 24766 ); 24767 while ($rec = $ilDB->fetchAssoc($set)) { 24768 $set2 = $ilDB->queryF( 24769 "SELECT * FROM style_parameter " . 24770 " WHERE style_id = %s " . 24771 " AND tag = %s " . 24772 " AND class = %s " . 24773 " AND parameter = %s " . 24774 " AND type = %s " . 24775 " AND mq_id = %s ", 24776 array("integer", "text", "text", "text", "text", "integer"), 24777 array($rec["style_id"], "figure", $rec["class"], $rec["parameter"], "media_cont", $rec["mq_id"]) 24778 ); 24779 if (!($rec2 = $ilDB->fetchAssoc($set2))) { 24780 $id = $ilDB->nextId("style_parameter"); 24781 $ilDB->insert("style_parameter", array( 24782 "id" => array("integer", $id), 24783 "style_id" => array("integer", $rec["style_id"]), 24784 "tag" => array("text", "figure"), 24785 "class" => array("text", $rec["class"]), 24786 "parameter" => array("text", $rec["parameter"]), 24787 "value" => array("text", $rec["value"]), 24788 "type" => array("text", $rec["type"]), 24789 "mq_id" => array("integer", $rec["mq_id"]), 24790 "custom" => array("integer", $rec["custom"]), 24791 )); 24792 } 24793 } 24794 } 24795 $setting->set('sty_media_cont_mig', 2); 24796} 24797?>