ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilDBGenerator.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13class ilDBGenerator
14{
15 protected $target_encoding = 'UTF-8';
16
17 var $whitelist = array();
18 var $blacklist = array();
19 var $tables = array();
20
24 function __construct()
25 {
26 global $ilDB;
27
28 $this->manager = $ilDB->db->loadModule('Manager');
29 $this->reverse = $ilDB->db->loadModule('Reverse');
30 $this->il_db = $ilDB;
31 include_once("./Services/Database/classes/class.ilDBAnalyzer.php");
32 $this->analyzer = new ilDBAnalyzer();
33
34 $this->allowed_attributes = $ilDB->getAllowedAttributes();
35 }
36
37 public static function lookupAbstractedTables()
38 {
39 global $ilDB;
40
41 $query = "SELECT DISTINCT(table_name) FROM abstraction_progress ";
42 $res = $ilDB->query($query);
43 $names = array();
44 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
45 {
46 $names[] = $row->table_name;
47 }
48
49 // tables that have been already created in an abstracted
50 // way or tables that have been renamed after being abstracted
51 // (see db_update script)
52 $abs_tables = array_merge($names, array(
53 'acc_access_key',
54 'acc_user_access_key',
55 'ldap_rg_mapping',
56 'page_anchor',
57 'qpl_question_orderinghorizontal',
58 'qpl_question_fileupload',
59 'payment_vats',
60 'chat_smilies',
61 'style_color',
62 'style_template_class',
63 'style_template',
64 'page_style_usage',
65 'style_setting',
66 'page_editor_settings',
67 'mep_data',
68 'license_data',
69 'loginname_history',
70 'mep_item',
71 'qpl_a_cloze',
72 'qpl_a_imagemap',
73 'qpl_a_matching',
74 'qpl_num_range',
75 'qpl_qst_cloze',
76 'qpl_qst_essay',
77 'qpl_qst_fileupload',
78 'qpl_qst_flash',
79 'qpl_qst_horder',
80 'qpl_qst_imagemap',
81 'qpl_qst_javaapplet',
82 'qpl_qst_matching',
83 'qpl_qst_mc',
84 'qpl_qst_numeric',
85 'qpl_qst_ordering',
86 'qpl_qst_sc',
87 'qpl_qst_textsubset',
88 'qpl_qst_type',
89 'qpl_sol_sug',
90 'udf_text',
91 'udf_clob',
92 'xmlnestedsettmp',
93 'cache_text',
94 'cache_clob',
95 'qpl_a_errortext',
96 'qpl_qst_errortext',
97 'tst_rnd_cpy',
98 'tst_rnd_qpl_title',
99 'qpl_a_mdef'
100 ));
101
102 return $abs_tables;
103 }
104
125 public function setTargetEncoding($a_encoding)
126 {
127 $this->target_encoding = $a_encoding;
128 }
129
134 public function getTargetEncoding()
135 {
136 return $this->target_encoding;
137 }
138
145 function setBlackList($a_blacklist)
146 {
147 $this->blacklist = $a_blacklist;
148 }
149
155 function getBlackList()
156 {
157 return $this->blacklist;
158 }
159
167 function setWhiteList($a_whitelist)
168 {
169 $this->whitelist = $a_whitelist;
170 }
171
177 function getWhiteList()
178 {
179 return $this->whitelist;
180 }
181
185 function setFilter($a_filter, $a_value)
186 {
187 $this->filter[$a_filter] = $a_value;
188 }
189
193 function getTables()
194 {
195 $r = $this->manager->listTables();
196 if (!MDB2::isError($r))
197 {
198 $this->tables = $r;
199 }
200
201 // fix for 12570
202 if (!in_array("sahs_sc13_seq_seq", $r))
203 {
204 $this->tables[] = "sahs_sc13_seq_seq";
205 }
206
207 return $this->tables;
208 }
209
213 function checkProcessing($a_table)
214 {
215 // check black list
216 if (in_array($a_table, $this->blacklist))
217 {
218 return false;
219 }
220
221 // check white list
222 if (count($this->whitelist) > 0 && !in_array($a_table, $this->whitelist))
223 {
224 return false;
225 }
226
227 return true;
228 }
229
230 protected function openFile($a_path)
231 {
232 if(1)
233 {
234 $file = fopen($a_path, "w");
235 $start.= "\t".'global $ilDB;'."\n\n";
236 fwrite($file, $start);
237 return $file;
238 }
239
240 $file = fopen($a_path, "w");
241 $start = '<?php'."\n".'function setupILIASDatabase()'."\n{\n";
242 $start.= "\t".'global $ilDB;'."\n\n";
243 fwrite($file, $start);
244 return $file;
245 }
246
247
248 protected function closeFile($fp)
249 {
250 if(1)
251 {
252 #fwrite ($fp, $end);
253 fclose ($fp);
254 return;
255 }
256
257 $end = "\n}\n?>\n";
258 fwrite ($fp, $end);
259 fclose ($fp);
260 }
261
262
268 function buildDBGenerationScript($a_filename = "")
269 {
270//echo "<br>3"; flush();
271 $isDirectory = false;
272 if(@is_dir($a_filename))
273 {
274 $isDirectory = true;
275 $path = $a_filename;
276 }
277 else
278 {
279 $isDirectory = false;
280 $path = '';
281 }
282
283 $file = "";
284 if ($a_filename != "" and !$isDirectory)
285 {
286 $file = fopen($a_filename, "w");
287
288 $start = '<?php'."\n".'function setupILIASDatabase()'."\n{\n";
289 $start.= "\t".'global $ilDB;'."\n\n";
290 fwrite($file, $start);
291 }
292 elseif($isDirectory)
293 {
294 ;
295 }
296
297 else
298 {
299 echo "<pre>";
300 }
301//echo "<br>4"; flush();
302 $this->getTables();
303 foreach ($this->tables as $table)
304 {
305 if ($this->checkProcessing($table))
306 {
307 if ($a_filename != "")
308 {
309 echo "<br>$table"; flush();
310 }
311
312 if($isDirectory)
313 {
314 $file = $this->openFile($path.'/'.$table);
315 }
316
317 // create table statement
318 $this->buildCreateTableStatement($table, $file);
319
320 // primary key
321 $this->buildAddPrimaryKeyStatement($table, $file);
322
323 // indices
324 $this->buildAddIndexStatements($table, $file);
325
326 // constraints (currently unique keys)
327 $this->buildAddUniqueConstraintStatements($table, $file);
328
329 // auto increment sequence
330 $this->buildCreateSequenceStatement($table, $file);
331
332 // inserts
333 if($isDirectory)
334 {
335 $this->buildInsertStatement($table, $path);
336 #$this->buildInsertStatementsXML($table,$path);
337 }
338 else
339 {
340 $this->buildInsertStatements($table, $file);
341 }
342
343 if($isDirectory)
344 {
345 $this->closeFile($file);
346 }
347
348 }
349 else
350 {
351 if ($a_filename != "")
352 {
353 echo "<br><b>missing: ".$table."</b>"; flush();
354 }
355 }
356 }
357
358 // sequence(s) without table (of same name)
359 $this->buildSingularSequenceStatement($file);
360
361 if ($a_filename == "")
362 {
363 echo "</pre>";
364 }
365 elseif(!$isDirectory)
366 {
367 $end = "\n}\n?>\n";
368 fwrite ($file, $end);
369 fclose ($file);
370 }
371 }
372
379 function buildCreateTableStatement($a_table, $a_file = "")
380 {
381 $fields = $this->analyzer->getFieldInformation($a_table, true);
382 $this->fields = $fields;
383 $create_st = "\n\n//\n// ".$a_table."\n//\n";
384 $create_st.= '$fields = array ('."\n";
385 $f_sep = "";
386 foreach ($fields as $f => $def)
387 {
388
389 $create_st.= "\t".$f_sep.'"'.$f.'" => array ('."\n";
390 $f_sep = ",";
391 $a_sep = "";
392 foreach ($def as $k => $v)
393 {
394 if ($k != "nativetype" && $k != "alt_types" && $k != "autoincrement" && !is_null($v))
395 {
396 switch ($k)
397 {
398 case "notnull":
399 case "unsigned":
400 case "fixed":
401 $v = $v ? "true" : "false";
402 break;
403
404 case "default":
405 case "type":
406 $v = '"'.$v.'"';
407 brak;
408
409 default:
410 break;
411 }
412 $create_st.= "\t\t".$a_sep.'"'.$k.'" => '.$v."\n";
413 $a_sep = ",";
414 }
415 }
416 $create_st.= "\t".')'."\n";
417 }
418 $create_st.= ');'."\n";
419 $create_st.= '$ilDB->createTable("'.$a_table.'", $fields);'."\n";
420
421 if ($a_file == "")
422 {
423 echo $create_st;
424 }
425 else
426 {
427 fwrite($a_file, $create_st);
428 }
429 }
430
437 function buildAddPrimaryKeyStatement($a_table, $a_file = "")
438 {
439 $pk = $this->analyzer->getPrimaryKeyInformation($a_table);
440
441 if (is_array($pk["fields"]) && count($pk["fields"]) > 0)
442 {
443 $pk_st = "\n".'$pk_fields = array(';
444 $sep = "";
445 foreach ($pk["fields"] as $f => $pos)
446 {
447 $pk_st.= $sep.'"'.$f.'"';
448 $sep = ",";
449 }
450 $pk_st.= ");\n";
451 $pk_st.= '$ilDB->addPrimaryKey("'.$a_table.'", $pk_fields);'."\n";
452
453 if ($a_file == "")
454 {
455 echo $pk_st;
456 }
457 else
458 {
459 fwrite($a_file, $pk_st);
460 }
461 }
462 }
463
470 function buildAddIndexStatements($a_table, $a_file = "")
471 {
472 $ind = $this->analyzer->getIndicesInformation($a_table, true);
473
474 if (is_array($ind))
475 {
476 foreach ($ind as $i)
477 {
478 if ($i["fulltext"])
479 {
480 $ft = ", true";
481 }
482 else
483 {
484 $ft = ", false";
485 }
486 $in_st = "\n".'$in_fields = array(';
487 $sep = "";
488 foreach ($i["fields"] as $f => $pos)
489 {
490 $in_st.= $sep.'"'.$f.'"';
491 $sep = ",";
492 }
493 $in_st.= ");\n";
494 $in_st.= '$ilDB->addIndex("'.$a_table.'", $in_fields, "'.$i["name"].'"'.$ft.');'."\n";
495
496 if ($a_file == "")
497 {
498 echo $in_st;
499 }
500 else
501 {
502 fwrite($a_file, $in_st);
503 }
504 }
505 }
506 }
507
514 function buildAddUniqueConstraintStatements($a_table, $a_file = "")
515 {
516 $con = $this->analyzer->getConstraintsInformation($a_table, true);
517
518 if (is_array($con))
519 {
520 foreach ($con as $i)
521 {
522 $in_st = "\n".'$in_fields = array(';
523 $sep = "";
524 foreach ($i["fields"] as $f => $pos)
525 {
526 $in_st.= $sep.'"'.$f.'"';
527 $sep = ",";
528 }
529 $in_st.= ");\n";
530 $in_st.= '$ilDB->addUniqueConstraint("'.$a_table.'", $in_fields, "'.$i["name"].'");'."\n";
531
532 if ($a_file == "")
533 {
534 echo $in_st;
535 }
536 else
537 {
538 fwrite($a_file, $in_st);
539 }
540 }
541 }
542 }
543
550 function buildCreateSequenceStatement($a_table, $a_file = "")
551 {
552 $seq = $this->analyzer->hasSequence($a_table);
553 if ($seq !== false)
554 {
555 $seq_st = "\n".'$ilDB->createSequence("'.$a_table.'", '.(int) $seq.');'."\n";
556
557 if ($a_file == "")
558 {
559 echo $seq_st;
560 }
561 else
562 {
563 fwrite($a_file, $seq_st);
564 }
565 }
566 }
567
573 function buildSingularSequenceStatement($a_file = "")
574 {
575 $r = $this->manager->listSequences();
576 if (!MDB2::isError($r))
577 {
578 foreach ($r as $seq)
579 {
580 if (!in_array($seq, $this->tables))
581 {
582 // 12570
583 if ($seq == "sahs_sc13_seq")
584 {
585 continue;
586 }
587
588 $create_st = "\n".'$ilDB->createSequence("'.$seq.'");'."\n";
589
590 if ($a_file == "")
591 {
592 echo $create_st;
593 }
594 else
595 {
596 fwrite($a_file, $create_st);
597 }
598 }
599 }
600 }
601 }
602
609 public function buildInsertStatement($a_table,$a_basedir)
610 {
611 global $ilLog;
612
613 $ilLog->write('Starting export of:'.$a_table);
614
615 $set = $this->il_db->query("SELECT * FROM `".$a_table."`");
616 $row = 0;
617
618 umask(0000);
619 mkdir($a_basedir.'/'.$a_table.'_inserts',fileperms($a_basedir));
620
621 $filenum = 1;
622 while ($rec = $this->il_db->fetchAssoc($set))
623 {
624 $values = array();
625 foreach($rec as $f => $v)
626 {
627 if($this->fields[$f]['type'] == 'text' and $this->fields[$f]['length'] >= 1000)
628 {
629 $v = $this->shortenText($a_table, $f, $v, $this->fields[$f]['length']);
630 }
631
632 $values[$f] = array(
633 $this->fields[$f]['type'],
634 $v
635 );
636 }
637
638 $rows[$a_table][$row++] = $values;
639
640 if($row >= 1000)
641 {
642 $ilLog->write('Writing insert statements after 1000 lines...');
643 $fp = fopen($a_basedir.'/'.$a_table.'_inserts/'.$filenum++.'.data','w');
644 fwrite($fp,serialize((array) $rows));
645 fclose($fp);
646
647 $row = 0;
648 unset($rows);
649 }
650
651 }
652 if($rows)
653 {
654 $fp = fopen($a_basedir.'/'.$a_table.'_inserts/'.$filenum++.'.data','w');
655 fwrite($fp,serialize((array) $rows)."\n");
656 fclose($fp);
657 }
658
659 $ilLog->write('Finished export of: '.$a_table);
660 if(function_exists('memory_get_usage'))
661 {
662 $ilLog->write('Memory usage: '.memory_get_usage(true));
663 }
664 return true;
665 }
666
673 function buildInsertStatementsXML($a_table,$a_basedir)
674 {
675 global $ilLog;
676
677 include_once './Services/Xml/classes/class.ilXmlWriter.php';
678 $w = new ilXmlWriter();
679 $w->xmlStartTag('Table',array('name' => $a_table));
680
681 $set = $this->il_db->query("SELECT * FROM `".$a_table."`");
682 $ins_st = "";
683 $first = true;
684 while ($rec = $this->il_db->fetchAssoc($set))
685 {
686 #$ilLog->write('Num: '.$num++);
687 $w->xmlStartTag('Row');
688
689 $fields = array();
690 $types = array();
691 $values = array();
692 foreach($rec as $f => $v)
693 {
694 if($this->fields[$f]['type'] == 'text' and $this->fields[$f]['length'] >= 1000)
695 {
696 $v = $this->shortenText($a_table, $f, $v, $this->fields[$f]['length']);
697 }
698
699 $w->xmlElement(
700 'Value',
701 array(
702 'name' => $f,
703 'type' => $this->fields[$f]['type']
704 ),
705 $v
706 );
707 }
708
709 $w->xmlEndTag('Row');
710 }
711 $w->xmlEndTag('Table');
712
713 $w->xmlDumpFile($a_basedir.'/'.$a_table.'.xml',FALSE);
714 }
715
722 function buildInsertStatements($a_table, $a_file = "")
723 {
724 if ($a_table == "lng_data")
725 {
726 return;
727 }
728
729 $set = $this->il_db->query("SELECT * FROM `".$a_table."`");
730 $ins_st = "";
731 $first = true;
732 while ($rec = $this->il_db->fetchAssoc($set))
733 {
734 $fields = array();
735 $types = array();
736 $values = array();
737 $i_str = array();
738 foreach ($rec as $f => $v)
739 {
740 $fields[] = $f;
741 $types[] = '"'.$this->fields[$f]["type"].'"';
742 $v = str_replace('\\', '\\\\', $v);
743 $values[] = "'".str_replace("'", "\'", $v)."'";
744 $i_str[] = "'".$f."' => array('".$this->fields[$f]["type"].
745 "', '".str_replace("'", "\'", $v)."')";
746 }
747 $fields_str = "(".implode($fields, ",").")";
748 $types_str = "array(".implode($types, ",").")";
749 $values_str = "array(".implode($values, ",").")";
750 $ins_st = "\n".'$ilDB->insert("'.$a_table.'", array('."\n";
751 $ins_st.= implode($i_str, ", ")."));\n";
752 //$ins_st.= "\t".$fields_str."\n";
753 //$ins_st.= "\t".'VALUES '."(%s".str_repeat(",%s", count($fields) - 1).')"'.",\n";
754 //$ins_st.= "\t".$types_str.','.$values_str.');'."\n";
755
756 if ($a_file == "")
757 {
758 echo $ins_st;
759 }
760 else
761 {
762 fwrite($a_file, $ins_st);
763 }
764 $ins_st = "";
765 }
766 }
767
773 function getHTMLOverview($a_filename = "")
774 {
775 $tpl = new ilTemplate("tpl.db_overview.html", true, true, "Services/Database");
776
777 $this->getTables();
778 $cnt = 1;
779 foreach ($this->tables as $table)
780 {
781 if ($this->checkProcessing($table))
782 {
783 // create table statement
784 if ($this->addTableToOverview($table, $tpl, $cnt))
785 {
786 $cnt++;
787 }
788 }
789 }
790
791 $tpl->setVariable("TXT_TITLE", "ILIAS Abstract DB Tables (".ILIAS_VERSION.")");
792
793 if ($a_filename == "")
794 {
795 echo $tpl->get();
796 }
797 }
798
802 function addTableToOverview($a_table, $a_tpl, $a_cnt)
803 {
804 $fields = $this->analyzer->getFieldInformation($a_table);
805 $indices = $this->analyzer->getIndicesInformation($a_table);
806 $constraints = $this->analyzer->getConstraintsInformation($a_table);
807 $pk = $this->analyzer->getPrimaryKeyInformation($a_table);
808 $auto = $this->analyzer->getAutoIncrementField($a_table);
809 $has_sequence = $this->analyzer->hasSequence($a_table);
810
811 // table filter
812 if (isset($this->filter["has_sequence"]))
813 {
814 if ((!$has_sequence && $auto == "" && $this->filter["has_sequence"]) ||
815 (($has_sequence || $auto != "") && !$this->filter["has_sequence"]))
816 {
817 return false;
818 }
819 }
820
821 // indices
822 $indices_output = false;
823 if (is_array($indices) && count($indices) > 0 && !$this->filter["skip_indices"])
824 {
825 foreach ($indices as $index => $def)
826 {
827 $f2 = array();
828 foreach ($def["fields"] as $f => $pos)
829 {
830 $f2[] = $f;
831 }
832 $a_tpl->setCurrentBlock("index");
833 $a_tpl->setVariable("VAL_INDEX", $def["name"]);
834 $a_tpl->setVariable("VAL_FIELDS", implode($f2, ", "));
835 $a_tpl->parseCurrentBlock();
836 $indices_output = true;
837 }
838 $a_tpl->setCurrentBlock("index_table");
839 $a_tpl->parseCurrentBlock();
840 }
841
842 // constraints
843 $constraints_output = false;
844 if (is_array($constraints) && count($constraints) > 0 && !$this->filter["skip_constraints"])
845 {
846 foreach ($constraints as $index => $def)
847 {
848 $f2 = array();
849 foreach ($def["fields"] as $f => $pos)
850 {
851 $f2[] = $f;
852 }
853 $a_tpl->setCurrentBlock("constraint");
854 $a_tpl->setVariable("VAL_CONSTRAINT", $def["name"]);
855 $a_tpl->setVariable("VAL_CTYPE", $def["type"]);
856 $a_tpl->setVariable("VAL_CFIELDS", implode($f2, ", "));
857 $a_tpl->parseCurrentBlock();
858 $constraints_output = true;
859 }
860 $a_tpl->setCurrentBlock("constraint_table");
861 $a_tpl->parseCurrentBlock();
862 }
863
864 // fields
865 $fields_output = false;
866 foreach ($fields as $field => $def)
867 {
868 // field filter
869 if (isset($this->filter["alt_types"]))
870 {
871 if (($def["alt_types"] == "" && $this->filter["alt_types"]) ||
872 ($def["alt_types"] != "" && !$this->filter["alt_types"]))
873 {
874 continue;
875 }
876 }
877 if (isset($this->filter["type"]))
878 {
879 if ($def["type"] != $this->filter["type"])
880 {
881 continue;
882 }
883 }
884 if (isset($this->filter["nativetype"]))
885 {
886 if ($def["nativetype"] != $this->filter["nativetype"])
887 {
888 continue;
889 }
890 }
891 if (isset($this->filter["unsigned"]))
892 {
893 if ($def["unsigned"] != $this->filter["unsigned"])
894 {
895 continue;
896 }
897 }
898
899 $a_tpl->setCurrentBlock("field");
900 if (empty($pk["fields"][$field]))
901 {
902 $a_tpl->setVariable("VAL_FIELD", strtolower($field));
903 }
904 else
905 {
906 $a_tpl->setVariable("VAL_FIELD", "<u>".strtolower($field)."</u>");
907 }
908 $a_tpl->setVariable("VAL_TYPE", $def["type"]);
909 $a_tpl->setVariable("VAL_LENGTH", (!is_null($def["length"])) ? $def["length"] : "&nbsp;");
910
911 if (strtolower($def["default"]) == "current_timestamp")
912 {
913 //$def["default"] = "0000-00-00 00:00:00";
914 unset($def["default"]);
915 }
916
917 $a_tpl->setVariable("VAL_DEFAULT", (!is_null($def["default"])) ? $def["default"] : "&nbsp;");
918 $a_tpl->setVariable("VAL_NOT_NULL", (!is_null($def["notnull"]))
919 ? (($def["notnull"]) ? "true" : "false")
920 : "&nbsp;");
921 $a_tpl->setVariable("VAL_FIXED", (!is_null($def["fixed"]))
922 ? (($def["fixed"]) ? "true" : "false")
923 : "&nbsp;");
924 $a_tpl->setVariable("VAL_UNSIGNED", (!is_null($def["unsigned"]))
925 ? (($def["unsigned"]) ? "true" : "false")
926 : "&nbsp;");
927 $a_tpl->setVariable("VAL_ALTERNATIVE_TYPES", ($def["alt_types"] != "") ? $def["alt_types"] : "&nbsp;");
928 $a_tpl->setVariable("VAL_NATIVETYPE", ($def["nativetype"] != "") ? $def["nativetype"] : "&nbsp;");
929 $a_tpl->parseCurrentBlock();
930 $fields_output = true;
931 }
932
933 if ($fields_output)
934 {
935 $a_tpl->setCurrentBlock("field_table");
936 $a_tpl->parseCurrentBlock();
937 }
938
939 // table information
940 if ($indices_output || $fields_output || $constraints_output)
941 {
942 $a_tpl->setCurrentBlock("table");
943 $a_tpl->setVariable("TXT_TABLE_NAME", strtolower($a_table));
944 if ($has_sequence || $auto != "")
945 {
946 $a_tpl->setVariable("TXT_SEQUENCE", "Has Sequence");
947 }
948 else
949 {
950 $a_tpl->setVariable("TXT_SEQUENCE", "No Sequence");
951 }
952 $a_tpl->setVariable("VAL_CNT", (int) $a_cnt);
953 $a_tpl->parseCurrentBlock();
954
955 return true;
956 }
957
958 return false;
959 }
960
969 protected function shortenText($table,$field,$a_value,$a_size)
970 {
971 global $ilLog;
972
973 if($this->getTargetEncoding() == 'UTF-8')
974 {
975 return $a_value;
976 }
977 // Convert to target encoding
978 $shortened = mb_convert_encoding($a_value, $this->getTargetEncoding(), 'UTF-8');
979 // Shorten
980 include_once './Services/Utilities/classes/class.ilStr.php';
981 $shortened = ilStr::shortenText($shortened, 0, $a_size,$this->getTargetEncoding());
982 // Convert back to UTF-8
983 $shortened = mb_convert_encoding($shortened, 'UTF-8',$this->getTargetEncoding());
984
985 if(strlen($a_value) != strlen($shortened))
986 {
987 $ilLog->write('Table : '.$table);
988 $ilLog->write('Field : '.$field );
989 $ilLog->write('Type : '.$this->fields[$field]['type']);
990 $ilLog->write('Length : '.$this->fields[$field]['length']);
991 $ilLog->write('Before : '.$a_value);
992 $ilLog->write('Shortened : '.$shortened);
993 $ilLog->write('Strlen Before: '.strlen($a_value));
994 $ilLog->write('Strlen After : '.strlen($shortened));
995 }
996 return $shortened;
997 }
998
999}
1000?>
print $file
global $tpl
Definition: ilias.php:8
isError($data, $code=null)
Tell whether a value is a MDB2 error.
Definition: MDB2.php:594
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
This class gives all kind of DB information using the MDB2 manager and reverse module.
static shortenText($a_string, $a_start_pos, $a_num_bytes, $a_encoding='UTF-8')
Shorten text to the given number of bytes.
special template class to simplify handling of ITX/PEAR
XML writer class.
if(!file_exists(getcwd().'/ilias.ini.php')) if(isset( $_GET["client_id"]))
registration confirmation script for ilias
Definition: confirmReg.php:20
$w
$r
Definition: example_031.php:79
const ILIAS_VERSION
$path
Definition: index.php:22
global $ilDB
$errors fields
Definition: imgupload.php:48