Пример #1
0
        $ilDB->query($q);
    }
}
?>
<#1387>
<?php 
$setting = new ilSetting();
$se_db = (int) $setting->get("se_db");
if ($se_db <= 38) {
    // force rewriting of page container style
    $q = "DELETE FROM `style_char` WHERE type = 'page_cont'";
    $ilDB->query($q);
    $q = "DELETE FROM `style_parameter` WHERE type = 'page_cont'";
    $ilDB->query($q);
    include_once "./Services/Migration/DBUpdate_1385/classes/class.ilStyleMigration.php";
    ilStyleMigration::_addMissingStyleClassesToAllStyles();
}
?>
<#1388>
UPDATE `style_data` SET `uptodate` = 0;
<#1389>
<?php 
$setting = new ilSetting();
$unirstep = (int) $setting->get('unir_db');
if ($unirstep <= 8) {
    $setting = new ilSetting();
    $se_db = (int) $setting->get("se_db");
    if ($se_db <= 39) {
        $q = "UPDATE `style_char` SET characteristic = 'TextInput' WHERE type = 'qinput'";
        $ilDB->query($q);
        $q = "UPDATE `style_parameter` SET class = 'TextInput' WHERE type = 'qinput'";
Пример #2
0
 /**
  * Add missing style classes to all styles
  */
 static function _addMissingStyleClassesToAllStyles()
 {
     global $ilDB;
     $core_styles = ilStyleMigration::_getCoreStyles();
     $bdom = ilStyleMigration::_getBasicStyleDom();
     // get all core image files
     $core_images = array();
     $core_dir = self::$basic_style_image_dir;
     if (is_dir($core_dir)) {
         $dir = opendir($core_dir);
         while ($file = readdir($dir)) {
             if (substr($file, 0, 1) != "." && is_file($core_dir . "/" . $file)) {
                 $core_images[] = $file;
             }
         }
     }
     // check, whether core style class exists
     $sets = $ilDB->query("SELECT * FROM object_data WHERE type = 'sty'");
     while ($recs = $ilDB->fetchAssoc($sets)) {
         $id = $recs["obj_id"];
         foreach ($core_styles as $cs) {
             // check, whether core style class exists
             $set = $ilDB->queryF("SELECT * FROM style_char WHERE style_id = %s " . "AND type = %s AND characteristic = %s", array("integer", "text", "text"), array($id, $cs["type"], $cs["class"]));
             // if not, add core style class
             if (!($rec = $ilDB->fetchAssoc($set))) {
                 $ilDB->manipulateF("INSERT INTO style_char (style_id, type, characteristic) " . " VALUES (%s,%s,%s) ", array("integer", "text", "text"), array($id, $cs["type"], $cs["class"]));
                 $xpath = new DOMXPath($bdom);
                 $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '" . $cs["tag"] . "' and @Type='" . $cs["type"] . "' and @Class='" . $cs["class"] . "']/StyleParameter");
                 foreach ($par_nodes as $par_node) {
                     // check whether style parameter exists
                     $set = $ilDB->queryF("SELECT * FROM style_parameter WHERE style_id = %s " . "AND type = %s AND class = %s AND tag = %s AND parameter = %s", array("integer", "text", "text", "text", "text"), array($id, $cs["type"], $cs["class"], $cs["tag"], $par_node->getAttribute("Name")));
                     // if not, create style parameter
                     if (!($rec = $ilDB->fetchAssoc($set))) {
                         $ilDB->manipulateF("INSERT INTO style_parameter (style_id, type, class, tag, parameter, value) " . " VALUES (%s,%s,%s,%s,%s,%s)", array("integer", "text", "text", "text", "text", "text"), array($id, $cs["type"], $cs["class"], $cs["tag"], $par_node->getAttribute("Name"), $par_node->getAttribute("Value")));
                     }
                 }
             }
         }
         // now check, whether some core image files are missing
         ilStyleMigration::_createImagesDirectory($id);
         $imdir = ilStyleMigration::_getImagesDirectory($id);
         reset($core_images);
         foreach ($core_images as $cim) {
             if (!is_file($imdir . "/" . $cim)) {
                 copy($core_dir . "/" . $cim, $imdir . "/" . $cim);
             }
         }
     }
 }