1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
converter.php
См. документацию.
1<?
2
3
4if($updater->CanUpdateDatabase())
5{
6 class CLearnInstall201203ConvertDBTimeOut extends Exception
7 {
8 }
9
10
11 class CLearnInstall201203ConvertDBException extends Exception
12 {
13 }
14
15
17 {
18 const MODULE_ID = 'learning';
19 const OPTION_ID = '~LearnInstall201203ConvertDB::_IsAlreadyConverted'; // don't change this constant, NEVER!
20 const STATUS_INSTALL_COMPLETE = '1';
22 const STATUS_INSTALL_INCOMPLETE = '3';
23
28
29
30 public static function run()
31 {
32 global $DB;
33 $msg = $step = false;
34 $errorMessage = '';
35
36 // If data tables are not installed - nothing to do
37 if ( ! $DB->TableExists('b_learn_lesson') )
38 return ($errorMessage);
39
40 try
41 {
42 if ( ! self::IsNewRightsModelInitialized($step, $msg) )
43 {
45 $step = false;
46 if ( ! self::IsNewRightsModelInitialized($step, $msg) )
47 {
48 $errorMessage .= 'FAILED on step ' . $step . '; msg = ' . $msg . '.';
49 return ($errorMessage); // FATAL
50 }
51 }
52
56
60 }
61 catch (CLearnInstall201203ConvertDBException $e)
62 {
64 $errorMessage .= "Cautch exception at line: " . $e->getLine()
65 . "; with message: " . $e->getMessage();
66 }
67 catch (CLearnInstall201203ConvertDBTimeOut $e)
68 {
70 /*
71 $errorMessage .= "Timeout occured at line: " . $e->getLine()
72 . ". Convertation is incomplete and should be executed another time.";
73 */
74 $errorMessage .= '';
75 }
76 catch (Exception $e)
77 {
79 $errorMessage .= "Cautch general exception at line: " . $e->getLine()
80 . "; with message: " . $e->getMessage();
81 }
82
83 return ($errorMessage);
84 }
85
86
87 protected static function StartTransaction()
88 {
89 global $DB;
90
91 $DB->StartTransaction();
92 }
93
94
95 protected static function Rollback()
96 {
97 global $DB;
98
99 $DB->Rollback();
100 }
101
102
103 protected static function Commit()
104 {
105 global $DB;
106
107 $DB->Commit();
108 }
109
110
111 protected static function ReCreateTriggersForMSSQL()
112 {
113 }
114
115
116 protected static function _RightsModelGetTasksWithOperations()
117 {
118 $arTasksOperations = array(
119 'learning_lesson_access_denied' => array(),
120 'learning_lesson_access_read' => array(
121 'lesson_read'
122 ),
123 'learning_lesson_access_manage_basic' => array(
124 'lesson_read',
125 'lesson_create',
126 'lesson_write',
127 'lesson_remove'
128 ),
129 'learning_lesson_access_linkage_as_child' => array(
130 'lesson_read',
131 'lesson_link_to_parents',
132 'lesson_unlink_from_parents'
133 ),
134 'learning_lesson_access_linkage_as_parent' => array(
135 'lesson_read',
136 'lesson_link_descendants',
137 'lesson_unlink_descendants'
138 ),
139 'learning_lesson_access_linkage_any' => array(
140 'lesson_read',
141 'lesson_link_to_parents',
142 'lesson_unlink_from_parents',
143 'lesson_link_descendants',
144 'lesson_unlink_descendants'
145 ),
146 'learning_lesson_access_manage_as_child' => array(
147 'lesson_read',
148 'lesson_create',
149 'lesson_write',
150 'lesson_remove',
151 'lesson_link_to_parents',
152 'lesson_unlink_from_parents'
153 ),
154 'learning_lesson_access_manage_as_parent' => array(
155 'lesson_read',
156 'lesson_create',
157 'lesson_write',
158 'lesson_remove',
159 'lesson_link_descendants',
160 'lesson_unlink_descendants'
161 ),
162 'learning_lesson_access_manage_dual' => array(
163 'lesson_read',
164 'lesson_create',
165 'lesson_write',
166 'lesson_remove',
167 'lesson_link_to_parents',
168 'lesson_unlink_from_parents',
169 'lesson_link_descendants',
170 'lesson_unlink_descendants'
171 ),
172 'learning_lesson_access_manage_full' => array(
173 'lesson_read',
174 'lesson_create',
175 'lesson_write',
176 'lesson_remove',
177 'lesson_link_to_parents',
178 'lesson_unlink_from_parents',
179 'lesson_link_descendants',
180 'lesson_unlink_descendants',
181 'lesson_manage_rights'
182 )
183 );
184
185 return ($arTasksOperations);
186 }
187
188
189 protected static function _RightsModelGetAllOperations()
190 {
191 $arAllOperations = array(
192 'lesson_read',
193 'lesson_create',
194 'lesson_write',
195 'lesson_remove',
196 'lesson_link_to_parents',
197 'lesson_unlink_from_parents',
198 'lesson_link_descendants',
199 'lesson_unlink_descendants',
200 'lesson_manage_rights'
201 );
202
203 return ($arAllOperations);
204 }
205
206
210 protected static function _CheckOperationsInDB()
211 {
212 global $DB;
213
214 $arAllOperations = self::_RightsModelGetAllOperations();
215
216 $rc = $DB->Query ("SELECT ID, NAME, BINDING FROM b_operation WHERE MODULE_ID = 'learning'", true);
217
218 if ($rc === false)
219 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
220
221 $arOperationsInDB = array();
222 while ($arOperation = $rc->Fetch())
223 {
224 if (mb_substr($arOperation['NAME'], 0, 7) === 'lesson_')
225 $binding = 'lesson';
226 else
227 $binding = 'module';
228
229 if ($arOperation['BINDING'] !== $binding)
230 throw new Exception();
231
232 $arOperationsInDB[$arOperation['NAME']] = $arOperation['ID'];
233 }
234
235 if (count($arOperationsInDB) !== count($arAllOperations))
236 throw new Exception(); // not all operations in DB
237
238 foreach ($arAllOperations as $operationName)
239 {
240 if ( ! isset($arOperationsInDB[$operationName]) )
241 throw new Exception(); // not all operations in DB
242 }
243
244 return ($arOperationsInDB);
245 }
246
247
248 protected static function _CheckTasksInDB($arTasksOperations)
249 {
250 global $DB;
251
252 $rc = $DB->Query ("SELECT ID, NAME, BINDING FROM b_task WHERE MODULE_ID = 'learning'", true);
253
254 if ($rc === false)
255 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
256
257 $arTasksInDB = array();
258 while ($arTask = $rc->Fetch())
259 {
260 if (mb_substr($arTask['NAME'], 0, 16) === 'learning_lesson_')
261 $binding = 'lesson';
262 else
263 $binding = 'module';
264
265 if ($arTask['BINDING'] !== $binding)
266 throw new Exception();
267
268 $arTasksInDB[$arTask['NAME']] = $arTask['ID'];
269 }
270
271 if (count($arTasksInDB) !== count($arTasksOperations))
272 {
273 throw new Exception('count($arTasksInDB) = '
274 . count($arTasksInDB)
275 . '; count($arTasksOperations) = '
276 . count($arTasksOperations)); // not all tasks in DB
277 }
278
279 foreach (array_keys($arTasksOperations) as $taskName)
280 {
281 if ( ! isset($arTasksInDB[$taskName]) )
282 throw new Exception(); // not all tasks in DB
283 }
284
285 return ($arTasksInDB);
286 }
287
288
289 protected static function _CheckTasksOperationsRelations($arOperationsInDB, $arTasksInDB, $arTasksOperations)
290 {
291 global $DB;
292
293 foreach ($arTasksInDB as $taskName => $taskId)
294 {
295 if ( ! isset($arTasksOperations[$taskName]) )
296 throw new Exception();
297
298 $arCurTaskOperations = $arTasksOperations[$taskName];
299 $arCurTaskOperationsIDs = array();
300 foreach ($arCurTaskOperations as $operationName)
301 {
302 if ( ! isset($arOperationsInDB[$operationName]) )
303 throw new Exception();
304
305 $operationId = $arOperationsInDB[$operationName];
306
307 $arCurTaskOperationsIDs[$operationId] = 'operation';
308 }
309
310 // Get list of task's operations reltaions
311 $rc = $DB->Query ("SELECT OPERATION_ID FROM b_task_operation WHERE TASK_ID = " . ($taskId + 0), true);
312
313 if ($rc === false)
314 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
315
316
317
318 while ($arRelation = $rc->Fetch())
319 {
320 if ( ! isset($arCurTaskOperationsIDs[$arRelation['OPERATION_ID']]) )
321 throw new Exception();
322
323 unset ($arCurTaskOperationsIDs[$arRelation['OPERATION_ID']]);
324 }
325
326 if (count($arCurTaskOperationsIDs) > 0)
327 throw new Exception();
328 }
329 }
330
331
332 protected static function IsNewRightsModelInitialized(&$step, &$msg)
333 {
334 try
335 {
336 $arTasksOperations = self::_RightsModelGetTasksWithOperations();
337 // Compare list of operations in DB
338 $arOperationsInDB = self::_CheckOperationsInDB();
339
340 // Compare list of tasks in DB
341 $arTasksInDB = self::_CheckTasksInDB($arTasksOperations);
342
343 // Compare relations between tasks and operations
344 self::_CheckTasksOperationsRelations($arOperationsInDB, $arTasksInDB, $arTasksOperations);
345
346 return (true); // new rights model correctly initialized
347 }
348 catch (Exception $e)
349 {
350 $step = $e->getLine();
351 $msg = $e->getMessage();
352 return (false); // new rights model not initialized
353 }
354 }
355
356
357 protected static function _RightsModelCreateOperations()
358 {
359 global $DB;
360
361 $arAllOperations = self::_RightsModelGetAllOperations();
362
363 $arOperationsInDB = array();
364
365 foreach ($arAllOperations as $operationName)
366 {
367 if (mb_substr($operationName, 0, 7) === 'lesson_')
368 $binding = 'lesson';
369 else
370 $binding = 'module';
371
373 'NAME' => "'" . $DB->ForSql($operationName) . "'",
374 'MODULE_ID' => "'learning'",
375 'DESCRIPTION' => 'NULL',
376 'BINDING' => "'" . $binding . "'"
377 );
378
379 $id = $DB->Insert(
380 'b_operation',
381 $arFields,
382 "", // $error_position
383 false, // $debug
384 "", // $exist_id
385 false // don't ignore errors, due to the bug in Database::Insert (it don't checks Query return status)
386 );
387
388 if ($id === false)
389 throw new Exception();
390
391 $arOperationsInDB[$operationName] = $id;
392 }
393
394 return ($arOperationsInDB);
395 }
396
397
398 protected static function _RightsModelCreateTasksAndRelation($arOperationsInDB)
399 {
400 global $DB, $APPLICATION;
401
402 $arOld2NewRightsMatrix = array(
403 'D' => 'learning_lesson_access_read',
404 'W' => 'learning_lesson_access_manage_full'
405 );
406
407 $module_id = 'learning';
408
409 $arDefaultRights = array (
410 'learning_lesson_access_read' => array(),
411 'learning_lesson_access_manage_dual' => array('CR'), // Author
412 'learning_lesson_access_manage_full' => array('G1') // Admins
413 );
414
415 $rc = CGroup::GetList('sort', 'asc', array('ACTIVE' => 'Y'));
416 while($zr = $rc->Fetch())
417 {
418 $group_id = $zr['ID'];
419 $oldSymbol = $APPLICATION->GetGroupRight(
420 $module_id,
421 array($group_id),
422 $use_default_level = "N",
423 $max_right_for_super_admin = "N",
424 $site_id = false);
425
426 if (isset($arOld2NewRightsMatrix[$oldSymbol]))
427 {
428 $newSymbol = $arOld2NewRightsMatrix[$oldSymbol];
429 if (isset($arDefaultRights[$newSymbol]))
430 $arDefaultRights[$newSymbol][] = 'G' . $group_id;
431 }
432 }
433
434 $arTasksOperations = self::_RightsModelGetTasksWithOperations();
435
436 foreach ($arTasksOperations as $taskName => $arOperationsForTask)
437 {
438 if (mb_substr($taskName, 0, 16) === 'learning_lesson_')
439 $binding = 'lesson';
440 else
441 $binding = 'module';
442
444 'NAME' => "'" . $DB->ForSql($taskName) . "'",
445 'LETTER' => 'NULL',
446 'MODULE_ID' => "'learning'",
447 'SYS' => "'Y'",
448 'DESCRIPTION' => 'NULL',
449 'BINDING' => "'" . $binding . "'"
450 );
451
452 $taskId = $DB->Insert(
453 'b_task',
454 $arFields,
455 "", // $error_position
456 false, // $debug
457 "", // $exist_id
458 false // don't ignore errors, due to the bug in Database::Insert (it don't checks Query return status)
459 );
460
461 if ($taskId === false)
462 throw new Exception();
463
464 // Create relation for every operation per task
465 foreach ($arOperationsForTask as $operationName)
466 {
467 if ( ! isset($arOperationsInDB[$operationName]) )
468 throw new Exception();
469
470 $operationId = (int) $arOperationsInDB[$operationName];
471
472 $rc = $DB->Query(
473 "INSERT INTO b_task_operation (TASK_ID, OPERATION_ID)
474 VALUES (" . (int) $taskId . ", " . (int) $operationId . ")", true);
475
476 if ($rc === false)
477 throw new Exception();
478 }
479
480 // Add default rights for this task, if it exists
481 if ( array_key_exists($taskName, $arDefaultRights) )
482 {
483 $arDefaultRights[$taskName] = array_unique($arDefaultRights[$taskName]);
484 foreach ($arDefaultRights[$taskName] as $subject_id)
485 {
486 $rc = $DB->Query (
487 "INSERT INTO b_learn_rights_all (SUBJECT_ID, TASK_ID)
488 VALUES ('" . $DB->ForSQL($subject_id) . "', " . (int) $taskId . ")",
489 true);
490
491 if ($rc === false)
492 throw new Exception();
493 }
494 }
495 }
496 }
497
498
499 protected static function _RightsModelPurge()
500 {
501 global $DB;
502
503 $arQueries = array(
504 "DELETE FROM b_task_operation
505 WHERE TASK_ID IN (SELECT ID FROM b_task WHERE MODULE_ID = 'learning')
506 OR OPERATION_ID IN (SELECT ID FROM b_operation WHERE MODULE_ID = 'learning')",
507
508 "DELETE FROM b_operation
509 WHERE MODULE_ID = 'learning'",
510
511 "DELETE FROM b_task
512 WHERE MODULE_ID = 'learning'"
513 );
514
515 foreach ($arQueries as $key => $query)
516 {
517 $rc = $DB->Query($query, true); // ignore_errors = true
518 if ($rc === false)
519 throw new Exception ('EA_SQLERROR in query #' . $key);
520 }
521 }
522
523
524 protected static function InitializeNewRightsModel()
525 {
526 global $DB;
527
528 // Clean up learning module operations and tasks (if exists)
530
531 if ( ! $DB->TableExists('b_learn_rights_all') )
533
534 $arOperationsInDB = self::_RightsModelCreateOperations();
535
537 }
538
539
540 protected static function _CreateTblRightsAll ()
541 {
542 global $DB;
543
544 if ( ! $DB->TableExists('b_learn_rights_all') )
545 {
546 // Prepare sql code for adding fields
547 $sql_tbl_b_learn_rights_all = "
548 CREATE TABLE b_learn_rights_all (
549 SUBJECT_ID VARCHAR( 100 ) NOT NULL ,
550 TASK_ID INT NOT NULL ,
551 PRIMARY KEY ( SUBJECT_ID )
552 )";
553
554 $rc = $DB->Query($sql_tbl_b_learn_rights_all);
555 if ($rc === false)
556 throw new CLearnInstall201203ConvertDBException(__LINE__ . '/tbl: sql_tbl_b_learn_rights_all');
557 }
558 }
559
560
564 public static function ConvertDB(&$errorMessage)
565 {
566 global $DB;
567
568 // Check, was DB already converted?
569 if (self::_IsAlreadyConverted() === true)
570 return (true);
571
572 // Mark that db convert process started
573 $rc = COption::SetOptionString(self::MODULE_ID, self::OPTION_ID, self::STATUS_INSTALL_INCOMPLETE);
574 if ($rc === false)
575 throw new CLearnInstall201203ConvertDBException('SetOptionString() failed!');
576
577 // Create fields `CODE`, `WAS_CHAPTER_ID` in `b_learn_lesson` (if they doesn't exists yet)
578 // and `JOURNAL_STATUS` in `b_learn_chapter`
579 // and `LINKED_LESSON_ID` in `b_learn_course`
581
594
596
597 // Process courses
599
600 // Process chapters
602
603 // Creates table for edges, if it doesn't exists yet.
605
606 // Build edges for lessons and chapters (`WAS_COURSE_ID` === NULL)
608
609 // Convert old permissions to new
611
612 // Add new path: COURSE_ID=#COURSE_ID#
613 // ?LESSON_PATH=#LESSON_PATH#
615
616 // Remove b_learn_course_permission, if exists
618
619 // Mark that db convert process complete
620 $rc = COption::SetOptionString(self::MODULE_ID, self::OPTION_ID, self::STATUS_INSTALL_COMPLETE);
621 if ($rc === false)
622 throw new CLearnInstall201203ConvertDBException('SetOptionString() failed!');
623 }
624
625
626 protected static function ConvertPermissions()
627 {
628 global $DB;
629
630 $arTaskIdByOldSymbol = array();
631 $arTasks = array(
632 'R' => 'learning_lesson_access_read',
633 'W' => 'learning_lesson_access_manage_basic',
634 'X' => 'learning_lesson_access_manage_full');
635
636 foreach ($arTasks as $oldSymbol => $taskName)
637 {
638 $rc = $DB->Query (
639 "SELECT ID
640 FROM b_task
641 WHERE NAME = '" . $taskName . "'",
642 true);
643
644 if ($rc === false)
645 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
646
647 $row = $rc->Fetch();
648
649 if ( ! isset($row['ID']) )
650 throw new CLearnInstall201203ConvertDBException('EA_LOGIC');
651
652 $arTaskIdByOldSymbol[$oldSymbol] = (int) $row['ID'];
653 }
654
655
656
657 $sql =
658 "SELECT TLL.ID, TLCP.PERMISSION, TLCP.USER_GROUP_ID
659 FROM b_learn_lesson TLL
660 INNER JOIN b_learn_course_permission TLCP
661 ON TLL.COURSE_ID = TLCP.COURSE_ID
662 WHERE TLL.COURSE_ID > 0
663 AND TLCP.PERMISSION != 'D'
664
665 UNION
666
667 SELECT TLL.ID, TLCP.PERMISSION, TLCP.USER_GROUP_ID
668 FROM b_learn_lesson TLL
669 INNER JOIN b_learn_course_permission TLCP
670 ON TLL.WAS_COURSE_ID = TLCP.COURSE_ID
671 WHERE TLL.COURSE_ID = 0
672 AND TLL.WAS_COURSE_ID > 0
673 AND TLCP.PERMISSION != 'D'
674 ";
675
676 $res = $DB->Query($sql, true);
677
678 if ($res === false)
679 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
680
681 while ($row = $res->Fetch())
682 {
683 $lessonId = $row['ID'];
684 $permission = $row['PERMISSION'];
685 $user_group_id = $row['USER_GROUP_ID'];
686
687 $group = 'G' . $user_group_id;
688
689 // Determine task id
690 if ( ! in_array($permission, array('R', 'W', 'X'), true) )
691 continue; // skip elements with D
692
693 $task_id = $arTaskIdByOldSymbol[$permission];
694
695 $rc = $DB->Query (
696 "DELETE FROM b_learn_rights
697 WHERE LESSON_ID = " . (int) $lessonId . "
698 AND SUBJECT_ID = '" . $DB->ForSql($group) . "'",
699 true);
700 if ($rc === false)
701 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
702
703
704 $rc = $DB->Query (
705 "INSERT INTO b_learn_rights (LESSON_ID, SUBJECT_ID, TASK_ID)
706 VALUES (" . (int) $lessonId . ", '" . $DB->ForSql($group) . "', '" . $task_id . "')", true);
707
708 if ($rc === false)
709 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
710 }
711
712 }
713
714
715 protected static function AddPath()
716 {
717 global $DB;
718
719 $res = $DB->Query(
720 "SELECT DISTINCT SITE_ID
721 FROM b_learn_site_path
722 WHERE 1=1", true);
723
724 if ($res === false)
725 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
726
727 $arSitesIds = array();
728 while ($row = $res->Fetch())
729 $arSitesIds[] = $row['SITE_ID'];
730
731 foreach ($arSitesIds as $k => $siteId)
732 {
733 $res = $DB->Query (
734 "DELETE FROM b_learn_site_path
735 WHERE SITE_ID = '" . $DB->ForSql($siteId) . "'
736 AND TYPE = 'U'", true);
737
738 if ($res === false)
739 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
740
741 $res = $DB->Query (
742 "SELECT TSP.PATH
743 FROM b_learn_site_path TSP
744 WHERE TYPE = 'C' AND SITE_ID = '" . $DB->ForSql($siteId) . "'",
745 true);
746
747 if ($res === false)
748 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
749
750 $row = $res->Fetch();
751 if (isset($row['PATH']))
752 {
753 $path = str_replace('COURSE_ID=#COURSE_ID#', 'LESSON_PATH=#LESSON_PATH#', $row['PATH']);
754 $path = str_replace('&INDEX=Y', '', $path);
755 }
756 else
757 $path = '/services/learning/course.php?LESSON_PATH=#LESSON_PATH#';
758
759 $DB->Insert(
760 'b_learn_site_path',
761 array(
762 'SITE_ID' => "'" . $DB->ForSql($siteId) . "'",
763 'PATH' => "'" . $DB->ForSql($path) . "'",
764 'TYPE' => "'U'"
765 )
766 );
767 }
768 }
769
773 public static function _buildEdges(&$errorMessage)
774 {
775 global $DB;
776
778
779 // For lessons, on which b_learn_course.LINKED_LESSON_ID linked we don't need edges, because they are tops nodes now.
780 $res = $DB->Query (
781 "SELECT ID, COURSE_ID, CHAPTER_ID, ACTIVE, SORT, WAS_CHAPTER_ID,
782 WAS_PARENT_CHAPTER_ID, WAS_PARENT_COURSE_ID
783 FROM b_learn_lesson
784 WHERE JOURNAL_STATUS != " . self::JOURNAL_STATUS_LESSON_EDGES_CREATED . "
785 AND WAS_COURSE_ID IS NULL",
786 $ignore_errors = true);
787
788 if ($res === false)
789 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
790
791 while ($arLesson = $res->Fetch())
792 {
793 $sort = $arLesson['SORT'];
794
795 $childNodeId = $arLesson['ID'];
796
797 // Determine, who is immediate parent of lesson - chapter or course
798 if ($arLesson['WAS_CHAPTER_ID'] === NULL) // current node wasn't a chapter
799 {
800 if ($arLesson['CHAPTER_ID'] !== NULL)
801 {
802 // intermediate parent is chapter, get it id in new data model
803 $parentNodeId = self::_GetChapterIdInNewDataModel ($arLesson['CHAPTER_ID']);
804 }
805 elseif ($arLesson['COURSE_ID'] !== NULL)
806 {
807 // intermediate parent is course, get it id in new data model
808 $parentNodeId = self::_GetCourseIdInNewDataModel ($arLesson['COURSE_ID']);
809 }
810 else
811 {
812 // No parent? It's very strange for old data model, but it's OK for new data model.
813 // So, nothing to do here.
814 $parentNodeId = NULL;
815 }
816 }
817 else // current node was a chapter
818 {
819 if ($arLesson['WAS_PARENT_CHAPTER_ID'] !== NULL)
820 {
821 // intermediate parent is chapter, get it id in new data model
822 $parentNodeId = self::_GetChapterIdInNewDataModel ($arLesson['WAS_PARENT_CHAPTER_ID']);
823 }
824 elseif ($arLesson['WAS_PARENT_COURSE_ID'] !== NULL)
825 {
826 // intermediate parent is course, get it id in new data model
827 $parentNodeId = self::_GetCourseIdInNewDataModel ($arLesson['WAS_PARENT_COURSE_ID']);
828 }
829 else
830 {
831 // No parent? It's very strange for old data model, but it's OK for new data model.
832 // So, nothing to do here.
833 $parentNodeId = NULL;
834 }
835 }
836
837 if ($parentNodeId === NULL)
838 ; // nothing to do
839 elseif ($parentNodeId === -1)
840 {
854 $errorMessage .= "Problem occured with CHAPTER_ID = " . $arLesson['CHAPTER_ID']
855 . "; COURSE_ID = " . $arLesson['COURSE_ID'] . "<br>\n";
856 }
857 elseif ($parentNodeId <= 0)
858 {
859 // This is invalid value
860 throw new CLearnInstall201203ConvertDBException('EA_OTHER: invalid parentNodeId for lesson_id = ' . $arLesson['ID']);
861 }
862 else
863 {
864 // All is OK, so create edge for nodes
865 self::_CreateEdgeForNodes ($parentNodeId, $childNodeId, $sort);
866 }
867
868 // Mark lesson as processed
869 self::_MarkLessonAsProcessed ($arLesson['ID']);
870
872
873 // This function throws exception CLearnInstall201203ConvertDBTimeOut, if it's low time left.
875 }
876
877 return ($items_processed);
878 }
879
880 public static function _MarkLessonAsProcessed ($lessonId)
881 {
882 global $DB;
883
884 // Mark this course as processed
885 $rc = $DB->Update('b_learn_lesson',
886 array ('JOURNAL_STATUS' => self::JOURNAL_STATUS_LESSON_EDGES_CREATED),
887 "WHERE ID = '" . ($lessonId + 0) . "'",
888 $error_position = "",
889 $debug = false,
890 $ignore_errors = true
891 );
892
893 if ($rc === false)
894 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
895
896 }
897
898 public static function _CreateEdgeForNodes ($parentNodeId, $childNodeId, $sort)
899 {
900 global $DB;
901
902 $parentNodeId += 0;
903 $childNodeId += 0;
904
905 // Firstly, remove such edge, if exists
906 $rc = $DB->Query (
907 "DELETE FROM b_learn_lesson_edges
908 WHERE SOURCE_NODE = '" . $parentNodeId . "'
909 AND TARGET_NODE = '" . $childNodeId . "'",
910 $ignore_errors = true);
911
912 if ($rc === false)
913 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
914
915 // Now, create edge
916 $rc = $DB->Query (
917 "INSERT INTO b_learn_lesson_edges (SOURCE_NODE, TARGET_NODE, SORT)
918 VALUES ('" . $parentNodeId . "', '" . $childNodeId . "', '" . $sort . "')",
919 $ignore_errors = true);
920
921 if ($rc === false)
922 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
923 }
924
929 public static function _GetChapterIdInNewDataModel ($b_learn_chapter_ID)
930 {
931 global $DB;
932
933 $res = $DB->Query (
934 "SELECT ID FROM b_learn_lesson
935 WHERE WAS_CHAPTER_ID = '" . ($b_learn_chapter_ID + 0) . "'",
936 $ignore_errors = true);
937
938 if ($res === false)
939 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
940
941 if ($arLesson = $res->Fetch())
942 return ($arLesson['ID'] + 0);
943 else
944 return (-1);
945 }
946
951 public static function _GetCourseIdInNewDataModel ($b_learn_course_ID)
952 {
953 global $DB;
954
955 $res = $DB->Query (
956 "SELECT ID FROM b_learn_lesson
957 WHERE WAS_COURSE_ID = '" . ($b_learn_course_ID + 0) . "'",
958 $ignore_errors = true);
959
960 if ($res === false)
961 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
962
963 if ($arLesson = $res->Fetch())
964 return ($arLesson['ID'] + 0);
965 else
966 return (-1);
967 }
968
972 public static function _processCourses()
973 {
974 global $DB;
975
977
978 $res = $DB->Query ("SELECT * FROM b_learn_course WHERE JOURNAL_STATUS != " . self::JOURNAL_STATUS_COURSE_LINKED,
979 $ignore_errors = true);
980
981 if ($res === false)
982 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
983
984 while ($arCourses = $res->Fetch())
985 {
987 'ACTIVE' => $arCourses['ACTIVE'],
988 'NAME' => ($arCourses['NAME'] === NULL) ? false : $arCourses['NAME'],
989 'CODE' => ($arCourses['CODE'] === NULL) ? false : $arCourses['CODE'],
990 'SORT' => $arCourses['SORT'],
991 'PREVIEW_PICTURE' => ($arCourses['PREVIEW_PICTURE'] === NULL) ? false : $arCourses['PREVIEW_PICTURE'],
992 'DETAIL_PICTURE' => ($arCourses['PREVIEW_PICTURE'] === NULL) ? false : $arCourses['PREVIEW_PICTURE'],
993 'PREVIEW_TEXT_TYPE' => $arCourses['PREVIEW_TEXT_TYPE'],
994 'DETAIL_TEXT_TYPE' => $arCourses['DESCRIPTION_TYPE'],
995 'LAUNCH' => '',
996 'JOURNAL_STATUS' => self::JOURNAL_STATUS_UNPROCESSED,
997 'WAS_CHAPTER_ID' => false,
998 'WAS_PARENT_CHAPTER_ID' => false,
999 'WAS_PARENT_COURSE_ID' => false,
1000 'WAS_COURSE_ID' => $arCourses['ID'],
1001 'PREVIEW_TEXT' => $arCourses['PREVIEW_TEXT'],
1002 'DETAIL_TEXT' => $arCourses['DESCRIPTION']
1003 );
1004
1005 // Creates new lesson (unprocessed duplicates will be removed first)
1006 $id_of_new_lesson = self::_UnrepeatableCreateLesson ($arFields);
1007
1008 // Link course to this lesson
1009 $rc = $DB->Update ('b_learn_course',
1010 array ('LINKED_LESSON_ID' => $id_of_new_lesson),
1011 "WHERE ID = '" . ($arCourses['ID'] + 0) . "'",
1012 $error_position = "",
1013 $debug = false,
1014 $ignore_errors = true
1015 );
1016
1017 if ($rc === false)
1018 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
1019
1020 // Mark this course as processed
1021 $rc = $DB->Update('b_learn_course',
1022 array ('JOURNAL_STATUS' => self::JOURNAL_STATUS_COURSE_LINKED),
1023 "WHERE ID = '" . ($arCourses['ID'] + 0) . "'",
1024 $error_position = "",
1025 $debug = false,
1026 $ignore_errors = true
1027 );
1028
1029 if ($rc === false)
1030 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
1031
1033
1034 // This function throws exception CLearnInstall201203ConvertDBTimeOut, if it's low time left.
1036 }
1037
1038 return ($items_processed);
1039 }
1040
1044 public static function avoidTimeout()
1045 {
1046 static $started_at = false;
1047 static $time_limit = false;
1048
1049 if ($started_at === false)
1050 {
1051 $started_at = microtime (true);
1052
1053 $rc = ini_get('max_execution_time');
1054 if (($rc === false) || ($rc === '') || ($rc < 0))
1055 {
1056 // We fail to determine max_execution_time, try to set it
1057 set_time_limit (28);
1058
1059 // Ensure, that max_execution_time was set
1060 $rc = ini_get('max_execution_time');
1061 }
1062
1063 if (($rc === false) || ($rc === '') || ($rc < 0))
1064 {
1071 $time_limit = 25;
1072 }
1073 elseif ($rc == 0)
1074 {
1079 $time_limit = 20;
1080 }
1081 else
1082 {
1083 $time_limit = ($rc + 0);
1084 }
1085 }
1086
1087 $time_executed = microtime(true) - $started_at;
1088 $time_left = $time_limit - $time_executed;
1089
1090 if ($time_left < 4)
1091 throw new CLearnInstall201203ConvertDBTimeOut();
1092 }
1093
1094
1095 public static function _processChapters()
1096 {
1097 global $DB;
1098
1099 $items_processed = 0;
1100
1101 $res = $DB->Query ("SELECT * FROM b_learn_chapter WHERE JOURNAL_STATUS != " . self::JOURNAL_STATUS_CHAPTER_COPIED,
1102 $ignore_errors = true);
1103
1104 if ($res === false)
1105 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
1106
1107 while ($arChapter = $res->Fetch())
1108 {
1109 $arFields = array (
1110 'ACTIVE' => $arChapter['ACTIVE'],
1111 'NAME' => ($arChapter['NAME'] === NULL) ? false : $arChapter['NAME'],
1112 'CODE' => ($arChapter['CODE'] === NULL) ? false : $arChapter['CODE'],
1113 'SORT' => (string) (1000000 + (int) $arChapter['SORT']),
1114 'PREVIEW_PICTURE' => ($arChapter['PREVIEW_PICTURE'] === NULL) ? false : $arChapter['PREVIEW_PICTURE'],
1115 'PREVIEW_TEXT' => $arChapter['PREVIEW_TEXT'],
1116 'PREVIEW_TEXT_TYPE' => $arChapter['PREVIEW_TEXT_TYPE'],
1117 'DETAIL_PICTURE' => ($arChapter['DETAIL_PICTURE'] === NULL) ? false : $arChapter['DETAIL_PICTURE'],
1118 'DETAIL_TEXT' => $arChapter['DETAIL_TEXT'],
1119 'DETAIL_TEXT_TYPE' => $arChapter['DETAIL_TEXT_TYPE'],
1120 'LAUNCH' => '',
1121 'JOURNAL_STATUS' => self::JOURNAL_STATUS_UNPROCESSED,
1122 'WAS_CHAPTER_ID' => ($arChapter['ID']),
1123 'WAS_PARENT_CHAPTER_ID' => ($arChapter['CHAPTER_ID'] === NULL) ? false : $arChapter['CHAPTER_ID'],
1124 'WAS_PARENT_COURSE_ID' => ($arChapter['COURSE_ID'] === NULL) ? false : $arChapter['COURSE_ID'],
1125 'WAS_COURSE_ID' => false
1126 );
1127
1128 // Creates new lesson (unprocessed duplicates will be removed first)
1129 $id_of_new_lesson = self::_UnrepeatableCreateLesson ($arFields);
1130
1131 // Now we must replace QUESTIONS_FROM_ID (where now is $arChapter['ID'])
1132 // in b_learn_test for QUESTIONS_FROM=='H'. Replace them to QUESTIONS_FROM=''
1133
1134 // UPDATE b_learn_test SET QUESTIONS_FROM = 'R', QUESTIONS_FROM_ID = 150 WHERE QUESTIONS_FROM = 'H' AND QUESTIONS_FROM_ID = '1'
1135 $rc = $DB->Query(
1136 "UPDATE b_learn_test
1137 SET TIMESTAMP_X = " . $DB->GetNowFunction()
1138 . ", QUESTIONS_FROM = 'R',
1139 QUESTIONS_FROM_ID = " . ($id_of_new_lesson + 0)
1140 . " WHERE QUESTIONS_FROM = 'H'
1141 AND QUESTIONS_FROM_ID = '" . ($arChapter['ID'] + 0) . "'",
1142 $ignore_errors = true
1143 );
1144
1145 if ($rc === false)
1146 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
1147
1148 // Mark this chapter as processed
1149 $rc = $DB->Update('b_learn_chapter',
1150 array ('JOURNAL_STATUS' => self::JOURNAL_STATUS_CHAPTER_COPIED),
1151 "WHERE ID = '" . ($arChapter['ID'] + 0) . "'",
1152 $error_position = "",
1153 $debug = false,
1154 $ignore_errors = true
1155 );
1156
1157 if ($rc === false)
1158 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
1159
1161
1162 // This function throws exception CLearnInstall201203ConvertDBTimeOut, if it's low time left.
1164 }
1165
1166 return ($items_processed);
1167 }
1168
1174 public static function _UnrepeatableCreateLesson ($arFields)
1175 {
1176 global $DB;
1177
1178 if ( ! is_array($arFields) )
1179 throw new CLearnInstall201203ConvertDBException('EA_PARAMS');
1180
1181 if ( ! isset($arFields['COURSE_ID']) )
1182 $arFields['COURSE_ID'] = 0;
1183
1184 // Determine, from what source import doing (Chapter or Course)
1185 if (array_key_exists('WAS_CHAPTER_ID', $arFields)
1186 && ($arFields['WAS_CHAPTER_ID'] !== false)
1187 )
1188 {
1189 // new lesson will be created from chapter
1190 $sqlWhere = "WAS_CHAPTER_ID = '" . ($arFields['WAS_CHAPTER_ID'] + 0) . "'";
1191 }
1192 elseif (array_key_exists('WAS_COURSE_ID', $arFields)
1193 && ($arFields['WAS_COURSE_ID'] !== false)
1194 )
1195 {
1196 // new lesson will be created from chapter
1197 $sqlWhere = "WAS_COURSE_ID = '" . ($arFields['WAS_COURSE_ID'] + 0) . "'";
1198 }
1199 else
1200 {
1201 throw new CLearnInstall201203ConvertDBException('EA_PARAMS');
1202 }
1203
1204 // Firstly, remove such imported lesson, if exists
1205 $rc = $DB->Query ("DELETE FROM b_learn_lesson WHERE " . $sqlWhere, $ignore_errors = true);
1206 if ($rc === false)
1207 throw new CLearnInstall201203ConvertDBException('EA_SQLERROR');
1208
1209 $arFields['~TIMESTAMP_X'] = $DB->GetNowFunction();
1210 $arFields['~DATE_CREATE'] = $DB->GetNowFunction();
1211 $arFields['~CREATED_BY'] = '1';
1212
1213 $newLessonId = $DB->Add('b_learn_lesson', $arFields);
1214
1215 return ($newLessonId);
1216 }
1217
1229 public static function _IsAlreadyConverted()
1230 {
1231 $rc = COption::GetOptionString(self::MODULE_ID, self::OPTION_ID, self::STATUS_INSTALL_NEVER_START, $site = '');
1232
1233 if ($rc === self::STATUS_INSTALL_NEVER_START)
1234 {
1235 global $DB;
1236
1237 if ($DB->TableExists('b_learn_lesson_edges')
1238 && $DB->TableExists('b_learn_rights_all')
1239 && ( ! $DB->TableExists('b_learn_course_permission') )
1240 )
1241 {
1242 return (true);
1243 }
1244 else
1245 return (false);
1246 }
1247 elseif ($rc === self::STATUS_INSTALL_COMPLETE)
1248 return (true);
1249 elseif ($rc === self::STATUS_INSTALL_INCOMPLETE)
1250 return (false);
1251 else
1252 self::_GiveUp(__LINE__);
1253 }
1254
1255
1256 protected static function _RemoveOrphanedTables()
1257 {
1258 global $DB;
1259
1260 if ( ! $DB->TableExists('b_learn_course_permission') )
1261 return;
1262
1263 $rc = $DB->Query ("DROP TABLE b_learn_course_permission", true);
1264 if ($rc === false)
1265 throw new CLearnInstall201203ConvertDBException('Can\'t DROP `b_learn_course_permission` under database engine: mysql');
1266 }
1267
1268 public static function _CreateEdgesTbl()
1269 {
1270 global $DB;
1271
1272 if ($DB->TableExists('b_learn_lesson_edges'))
1273 return;
1274
1275 $sql
1276 = "CREATE TABLE b_learn_lesson_edges (
1277 SOURCE_NODE INT NOT NULL ,
1278 TARGET_NODE INT NOT NULL ,
1279 SORT INT NOT NULL DEFAULT '500',
1280 PRIMARY KEY ( SOURCE_NODE , TARGET_NODE )
1281 )";
1282
1283 $rc = $DB->Query ($sql, $ignore_errors = true);
1284 if ($rc === false)
1285 throw new CLearnInstall201203ConvertDBException('Can\'t create `b_learn_lesson_edges` under database engine: mysql');
1286 }
1287
1288 public static function _CreateFieldsInTbls()
1289 {
1290 global $DB;
1291
1292 $arTableFields = array(
1293 'b_learn_lesson' => $DB->GetTableFieldsList ('b_learn_lesson'),
1294 'b_learn_chapter' => $DB->GetTableFieldsList ('b_learn_chapter'),
1295 'b_learn_course' => $DB->GetTableFieldsList ('b_learn_course')
1296 );
1297
1298 $sql_add = array();
1299 $other_sql_skip_errors = array();
1300 $other_sql = array();
1301
1302 // Prepare sql code for adding fields
1303 $sql_add['b_learn_lesson'] = array (
1304 'KEYWORDS' => "ALTER TABLE b_learn_lesson ADD KEYWORDS TEXT NOT NULL DEFAULT ''",
1305 'CODE' => "ALTER TABLE b_learn_lesson ADD CODE VARCHAR( 50 ) NULL DEFAULT NULL",
1306 'WAS_CHAPTER_ID' => "ALTER TABLE b_learn_lesson ADD WAS_CHAPTER_ID INT NULL DEFAULT NULL",
1307 'WAS_PARENT_CHAPTER_ID' => "ALTER TABLE b_learn_lesson ADD WAS_PARENT_CHAPTER_ID INT NULL DEFAULT NULL",
1308 'WAS_PARENT_COURSE_ID' => "ALTER TABLE b_learn_lesson ADD WAS_PARENT_COURSE_ID INT NULL DEFAULT NULL",
1309 'WAS_COURSE_ID' => "ALTER TABLE b_learn_lesson ADD WAS_COURSE_ID INT NULL DEFAULT NULL",
1310 'JOURNAL_STATUS' => "ALTER TABLE b_learn_lesson ADD JOURNAL_STATUS INT NOT NULL DEFAULT '0'"
1311 );
1312
1313 $sql_add['b_learn_chapter'] = array (
1314 'JOURNAL_STATUS' => "ALTER TABLE b_learn_chapter ADD JOURNAL_STATUS INT NOT NULL DEFAULT '0'"
1315 );
1316
1317 $sql_add['b_learn_course'] = array (
1318 'LINKED_LESSON_ID' => "ALTER TABLE b_learn_course ADD LINKED_LESSON_ID INT NULL DEFAULT NULL",
1319 'JOURNAL_STATUS' => "ALTER TABLE b_learn_course ADD JOURNAL_STATUS INT NOT NULL DEFAULT '0'"
1320 );
1321
1322 $sql_tbl_b_learn_rights = "
1323 CREATE TABLE b_learn_rights (
1324 LESSON_ID INT UNSIGNED NOT NULL ,
1325 SUBJECT_ID VARCHAR( 100 ) NOT NULL ,
1326 TASK_ID INT NOT NULL ,
1327 PRIMARY KEY ( LESSON_ID , SUBJECT_ID )
1328 )";
1329
1330 $other_sql_skip_errors[] = "ALTER TABLE b_learn_course ALTER COLUMN NAME SET DEFAULT 'name'";
1331 $other_sql_skip_errors[] = "ALTER TABLE b_learn_lesson ALTER COLUMN NAME SET DEFAULT 'name'";
1332 $other_sql_skip_errors[] = "ALTER TABLE b_learn_lesson ALTER COLUMN COURSE_ID SET DEFAULT '0'";
1333
1334 $other_sql_skip_errors[] = "
1335 CREATE TABLE b_learn_publish_prohibition
1336 (
1337 COURSE_LESSON_ID INT UNSIGNED NOT NULL ,
1338 PROHIBITED_LESSON_ID INT UNSIGNED NOT NULL ,
1339 PRIMARY KEY ( COURSE_LESSON_ID , PROHIBITED_LESSON_ID )
1340 )";
1341
1342 $other_sql_skip_errors[] = "
1343 CREATE TABLE b_learn_exceptions_log (
1344 DATE_REGISTERED datetime NOT NULL,
1345 CODE int(11) NOT NULL,
1346 MESSAGE text NOT NULL,
1347 FFILE text NOT NULL,
1348 LINE int(11) NOT NULL,
1349 BACKTRACE text NOT NULL
1350 )";
1351
1352 if ( ! $DB->TableExists('b_learn_rights'))
1353 {
1354 $rc = $DB->Query($sql_tbl_b_learn_rights);
1355 if ($rc === false)
1356 throw new CLearnInstall201203ConvertDBException(__LINE__ . '/tbl: sql_tbl_b_learn_rights');
1357 }
1358
1359 foreach ($sql_add as $tableName => $sql_for_table)
1360 {
1361 // Add every field (if not exists yet) to table $tableName
1362 foreach ($sql_for_table as $fieldName => $sql)
1363 {
1364 if ( ! in_array($fieldName, $arTableFields[$tableName], true) )
1365 {
1366 $rc = $DB->Query($sql, $ignore_erros = true);
1367
1368 if ($rc === false)
1369 throw new CLearnInstall201203ConvertDBException(__LINE__.'/tbl:'.mb_strlen($fieldName));
1370 }
1371 }
1372 /*
1373
1374 !!! This does not work correctly (table's fields cache in Database class issue?)
1375 // Now, ensure, that fields was added really
1376 $arTableFields_after = $DB->GetTableFieldsList ($tableName);
1377 foreach ($sql_for_table as $fieldName => $sql)
1378 {
1379 if ( ! in_array($fieldName, $arTableFields_after, true) )
1380 self::_GiveUp(__LINE__ . '/tbl:' . strlen($fieldName));
1381 }
1382 */
1383 }
1384
1385 foreach ($other_sql_skip_errors as $sql)
1386 $rc = $DB->Query($sql, $ignore_erros = true);
1387
1388 foreach ($other_sql as $sql)
1389 {
1390 $rc = $DB->Query($sql, $ignore_erros = true);
1391 if ($rc === false)
1392 throw new CLearnInstall201203ConvertDBException(__LINE__ . '/sql:' . htmlspecialcharsbx($sql));
1393 }
1394
1395 // Drop cache
1396 $rc = $DB->DDL("SELECT * FROM b_learn_lesson WHERE 1=1", true);
1397 if ($rc === false)
1398 throw new CLearnInstall201203ConvertDBException(__LINE__ . ', on DDL\'s cache drop');
1399 }
1400
1401 /*
1402 public static function _RemoveFieldsFromLesson()
1403 {
1404 // ORACLE:
1405 // ALTER TABLE `b_learn_lesson` DROP COLUMN `JOURNAL_ID` ???
1406
1407 global $DB, $DBType;
1408
1409 $arTableFields = $DB->GetTableFieldsList (`b_learn_lesson`);
1410
1411 // Prepare sql code for removing fields
1412 $sql_add = array();
1413 if ($DBType === 'mysql')
1414 {
1415 $sql_add['JOURNAL_ID'] = "ALTER TABLE `b_learn_lesson` DROP `JOURNAL_ID`";
1416 }
1417 else
1418 {
1419 // TODO: do sql code for MSSQL and Oracle
1420
1421 self::_GiveUp ('SQL code not ready for: ' . $DBType);
1422 }
1423
1424 // Remove every field (if exists) from table b_learn_lesson
1425 foreach ($sql_add as $fieldName => $sql)
1426 {
1427 if ( in_array($fieldName, $arTableFields, true) )
1428 {
1429 $rc = $DB->Query($sql, $ignore_erros = true);
1430
1431 if ($rc === false)
1432 self::_GiveUp(__LINE__);
1433 }
1434 }
1435
1436 // Don't ensure, that fields was really removed, because it's not critical for us
1437 }
1438 */
1439
1440 public static function _GiveUp($msg = false)
1441 {
1442 if ($msg !== false)
1443 throw new Exception ('FATAL: ' . $msg);
1444 else
1445 throw new Exception ('Shit happens.');
1446 }
1447 }
1448
1449
1451 if ($rc <> '')
1452 $errorMessage = $rc;
1453}
$path
Определения access_edit.php:21
global $APPLICATION
Определения include.php:80
$module_id
Определения options.php:6
static GetList($by='c_sort', $order='asc', $arFilter=[], $SHOW_USERS_AMOUNT="N")
Определения group.php:136
static GetOptionString($module_id, $name, $def="", $site=false, $bExactSite=false)
Определения option.php:8
static SetOptionString($module_id, $name, $value="", $desc=false, $site="")
Определения option.php:29
const STATUS_INSTALL_COMPLETE
Определения converter_to_11.5.0.php:16
const STATUS_INSTALL_NEVER_START
Определения converter_to_11.5.0.php:17
static _GiveUp($msg=false)
Определения converter_to_11.5.0.php:1439
static _MarkLessonAsProcessed($lessonId)
Определения converter_to_11.5.0.php:877
static InitializeNewRightsModel()
Определения converter_to_11.5.0.php:525
const JOURNAL_STATUS_UNPROCESSED
Определения converter_to_11.5.0.php:20
static _CreateEdgeForNodes($parentNodeId, $childNodeId, $sort)
Определения converter_to_11.5.0.php:895
static StartTransaction()
Определения converter_to_11.5.0.php:85
static _RemoveOrphanedTables()
Определения converter_to_11.5.0.php:1250
static ConvertPermissions()
Определения converter_to_11.5.0.php:627
const JOURNAL_STATUS_CHAPTER_COPIED
Определения converter_to_11.5.0.php:22
const JOURNAL_STATUS_LESSON_EDGES_CREATED
Определения converter_to_11.5.0.php:23
static _RightsModelGetAllOperations()
Определения converter_to_11.5.0.php:187
const STATUS_INSTALL_INCOMPLETE
Определения converter_to_11.5.0.php:18
static _RightsModelCreateOperations()
Определения converter_to_11.5.0.php:355
static _CheckTasksInDB($arTasksOperations)
Определения converter_to_11.5.0.php:246
const JOURNAL_STATUS_COURSE_LINKED
Определения converter_to_11.5.0.php:21
static _GetChapterIdInNewDataModel($b_learn_chapter_ID)
Определения converter_to_11.5.0.php:926
static ReCreateTriggersForMSSQL()
Определения converter_to_11.5.0.php:109
static _UnrepeatableCreateLesson($arFields)
Определения converter_to_11.5.0.php:1163
static _CheckOperationsInDB()
Определения converter_to_11.5.0.php:208
static _GetCourseIdInNewDataModel($b_learn_course_ID)
Определения converter_to_11.5.0.php:948
static _buildEdges(&$errorMessage)
Определения converter_to_11.5.0.php:774
static ConvertDB(&$errorMessage)
Определения converter_to_11.5.0.php:565
static _RightsModelCreateTasksAndRelation($arOperationsInDB)
Определения converter_to_11.5.0.php:396
static _CreateTblRightsAll()
Определения converter_to_11.5.0.php:541
static _RightsModelPurge()
Определения converter_to_11.5.0.php:500
static IsNewRightsModelInitialized(&$step, &$msg)
Определения converter_to_11.5.0.php:330
static _CreateFieldsInTbls()
Определения converter_to_11.5.0.php:1282
static _RightsModelGetTasksWithOperations()
Определения converter_to_11.5.0.php:114
static _CheckTasksOperationsRelations($arOperationsInDB, $arTasksInDB, $arTasksOperations)
Определения converter_to_11.5.0.php:287
static _IsAlreadyConverted()
Определения converter_to_11.5.0.php:1218
$arFields
Определения dblapprove.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$zr
Определения options.php:5
$query
Определения get_search.php:11
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage
global $DB
Определения cron_frame.php:29
$arTasks
Определения options.php:777
$siteId
Определения ajax.php:8
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$site_id
Определения sonet_set_content_view.php:9
$k
Определения template_pdf.php:567
$site
Определения yandex_run.php:614