"Fossies" - the Fresh Open Source Software Archive

Member "4.6.1/db/migrations/05_step_25_raumzeit_migrations.php" (8 Apr 2021, 9401 Bytes) of package /linux/www/studip-4.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 class Step25RaumzeitMigrations extends Migration
    3 {
    4     function description ()
    5     {
    6         return 'modify db schema for StEP00025; see logfile in $TMP_PATH';
    7     }
    8 
    9     function up ()
   10     {
   11         // StEP202 causes this migration to fail, see #1551
   12         throw new Exception(_('Die Ausgangsversion der Datenbank ist zu alt. Die Migration kann nicht durchgeführt werden.'));
   13 
   14         // open log file
   15         $logfile_handle = fopen( $GLOBALS["TMP_PATH"] ."/Stud.IP_date_conversion.log", "ab");
   16         if(!$logfile_handle) {
   17             throw new Exception ("Can't open logfile ".$GLOBALS["TMP_PATH"]."/Stud.IP_date_conversion.log");
   18         }
   19 
   20         $this->write( get_class($this)." - Creating db schema...");
   21 
   22         DBManager::get()->exec("
   23             CREATE TABLE IF NOT EXISTS `themen` (
   24               `issue_id` varchar(32) NOT NULL default '',
   25               `seminar_id` varchar(32) NOT NULL default '',
   26               `author_id` varchar(32) NOT NULL default '',
   27               `title` varchar(255) NOT NULL default '',
   28               `description` text NOT NULL,
   29               `priority` smallint(5) unsigned NOT NULL default '0',
   30               `mkdate` int(10) unsigned NOT NULL default '0',
   31               `chdate` int(10) unsigned NOT NULL default '0',
   32               PRIMARY KEY  (`issue_id`),
   33               KEY `seminar_id` (`seminar_id`,`priority`)
   34             ) ENGINE=MyISAM;
   35         ");
   36 
   37         DBManager::get()->exec("
   38             CREATE TABLE IF NOT EXISTS `ex_termine` (
   39               `termin_id` varchar(32) NOT NULL default '',
   40               `range_id` varchar(32) NOT NULL default '',
   41               `autor_id` varchar(32) NOT NULL default '',
   42               `content` varchar(255) NOT NULL default '',
   43               `description` text,
   44               `date` int(20) NOT NULL default '0',
   45               `end_time` int(20) NOT NULL default '0',
   46               `mkdate` int(20) NOT NULL default '0',
   47               `chdate` int(20) NOT NULL default '0',
   48               `date_typ` tinyint(4) NOT NULL default '0',
   49               `topic_id` varchar(32) default NULL,
   50               `expire` int(20) default NULL,
   51               `repeat` varchar(128) default NULL,
   52               `color` varchar(20) default NULL,
   53               `priority` tinyint(4) default NULL,
   54               `raum` varchar(255) default NULL,
   55               `metadate_id` varchar(32) default NULL,
   56               `resource_id` varchar(32) NOT NULL default '',
   57               PRIMARY KEY  (`termin_id`),
   58               KEY `range_id` (`range_id`,`date`),
   59               KEY `metadate_id` (`metadate_id`,`date`)
   60             ) ENGINE=MyISAM PACK_KEYS=1;
   61         ");
   62 
   63         DBManager::get()->exec("
   64             CREATE TABLE IF NOT EXISTS `themen_termine` (
   65               `issue_id` varchar(32) NOT NULL default '',
   66               `termin_id` varchar(32) NOT NULL default '',
   67               PRIMARY KEY  (`issue_id`,`termin_id`),
   68                 KEY `termin_id` (`termin_id`,`issue_id`)
   69             ) ENGINE=MyISAM;
   70         ");
   71         DBManager::get()->exec("
   72             ALTER TABLE `termine` DROP INDEX `autor_id`
   73         ");
   74         DBManager::get()->exec("
   75             ALTER TABLE `termine` DROP INDEX `range_id`
   76         ");
   77         DBManager::get()->exec("
   78             ALTER TABLE `termine` ADD `metadate_id` VARCHAR( 32 );
   79         ");
   80 
   81         DBManager::get()->exec("
   82             ALTER TABLE `termine` ADD INDEX ( `metadate_id` , `date` )
   83         ");
   84 
   85         DBManager::get()->exec("
   86             ALTER TABLE `termine` ADD INDEX ( `range_id` , `date` );
   87         ");
   88 
   89         DBManager::get()->exec("
   90             ALTER TABLE `resources_requests` ADD `reply_comment` TEXT AFTER `comment`;
   91         ");
   92 
   93                 DBManager::get()->exec("
   94                     INSERT INTO `log_actions` VALUES (MD5('SEM_UNDELETE_SINGLEDATE'), 'SEM_UNDELETE_SINGLEDATE', 'Einzeltermin wiederherstellen', '%user stellt Einzeltermin %singledate(%affected) in %sem(%coaffected) wieder her.', 1, NULL);
   95         ");
   96 
   97                 DBManager::get()->exec("
   98                     INSERT INTO `log_actions` VALUES (MD5('SEM_DELETE_SINGLEDATE'), 'SEM_DELETE_SINGLEDATE', 'Einzeltermin löschen', '%user löscht Einzeltermin %singledate(%affected) in %sem(%coaffected).', 1, NULL);
   99         ");
  100 
  101                 DBManager::get()->exec("
  102                     INSERT INTO `log_actions` VALUES (MD5('SEM_SET_STARTSEMESTER'), 'SEM_SET_STARTSEMESTER', 'Startsemester ändern', '%user hat in %sem(%affected) das Startsemester auf %semester(%coaffected) geändert.', 1, NULL);
  103         ");
  104 
  105                 DBManager::get()->exec("
  106                     INSERT INTO `log_actions` VALUES (MD5('SEM_SET_ENDSEMESTER'), 'SEM_SET_ENDSEMESTER', 'Semesterlaufzeit ändern', '%user hat in %sem(%affected) die Laufzeit auf %semester(%coaffected) geändert', 1, NULL);
  107         ");
  108 
  109                 DBManager::get()->exec("
  110                     INSERT INTO `log_actions` VALUES (MD5('SEM_ADD_CYCLE'), 'SEM_ADD_CYCLE', 'Regelmäßige Zeit hinzugefügt', '%user hat in %sem(%affected) die regelmäßige Zeit <em>%coaffected</em> hinzugefügt.', 1, NULL);
  111         ");
  112 
  113                 DBManager::get()->exec("
  114                     INSERT INTO `log_actions` VALUES (MD5('SEM_DELETE_CYCLE'), 'SEM_DELETE_CYCLE', 'Regelmäßige Zeit gelöscht', '%user hat in %sem(%affected) die regelmäßige Zeit <em>%coaffected</em> gelöscht.', 1, NULL);
  115         ");
  116 
  117                 DBManager::get()->exec("
  118                     INSERT INTO `log_actions` VALUES (MD5('SEM_ADD_SINGLEDATE'), 'SEM_ADD_SINGLEDATE', 'Einzeltermin hinzufügen', '%user hat in %sem(%affected) den Einzeltermin <em>%coaffected</em> hinzugefügt', 1, NULL);
  119         ");
  120 
  121                 DBManager::get()->exec("
  122                     INSERT INTO `log_actions` VALUES (MD5('SEM_DELETE_REQUEST'), 'SEM_DELETE_REQUEST', 'Raumanfrage gelöscht', '%user hat in %sem(%affected) die Raumanfrage für die gesamte Veranstaltung gelöscht.', 1, NULL);
  123         ");
  124 
  125                 DBManager::get()->exec("
  126                     INSERT INTO `log_actions` VALUES (MD5('SEM_DELETE_SINGLEDATE_REQUEST'), 'SEM_DELETE_SINGLEDATE_REQUEST', 'Einzeltermin, Raumanfrage gelöscht', '%user hat in %sem(%affected) die Raumanfrage für den Termin <em>%coaffected</em> gelöscht.', 1, NULL);
  127         ");
  128 
  129                 DBManager::get()->exec("
  130                     INSERT INTO `log_actions` VALUES (MD5('SINGLEDATE_CHANGE_TIME'), 'SINGLEDATE_CHANGE_TIME', 'Einzeltermin bearbeiten', '%user hat in %sem(%affected) den Einzeltermin %coaffected geändert.', 1, NULL);
  131         ");
  132 
  133         // move "RESOURCES_ENABLE" from config_local.inc.php to config table:
  134         if( $GLOBALS["RESOURCES_ENABLE"] ){
  135             // if "true", insert this as a local customization
  136             DBManager::get()->exec("
  137                 INSERT INTO `config` ( `config_id` , `parent_id` , `field` , `value` , `is_default` , `type` , `range` , `section` , `position` , `mkdate` , `chdate` , `description` , `comment` , `message_template` )
  138                 VALUES ( 'dade8ea9ac4ec346e796ab9449d35b0e' , '', 'RESOURCES_ENABLE', '1', '0', 'boolean', 'global', '', '0', '0', '0', 'Enable the Stud.IP resource management module', '', '');
  139             ");
  140         }
  141 
  142         // RESOURCES_ENABLE default value (=false)
  143         DBManager::get()->exec("
  144             INSERT INTO `config` ( `config_id` , `parent_id` , `field` , `value` , `is_default` , `type` , `range` , `section` , `position` , `mkdate` , `chdate` , `description` , `comment` , `message_template` )
  145             VALUES ( '06cdb765fb8f0853e3ebe08f51c3596e' , '', 'RESOURCES_ENABLE', '0', '1', 'boolean', 'global', '', '0', '0', '0', 'Enable the Stud.IP resource management module', '', '');
  146         ");
  147 
  148         DBManager::get()->exec("
  149             INSERT INTO `config` ( `config_id` , `parent_id` , `field` , `value` , `is_default` , `type` , `range` , `section` , `position` , `mkdate` , `chdate` , `description` , `comment` , `message_template` )
  150             VALUES ( '93da66ca9e2d17df5bc61bd56406add7' , '', 'RESOURCES_ROOM_REQUEST_DEFAULT_ACTION', 'NO_ROOM_INFO_ACTION', '1', 'string', 'global', '', '0', '0', '0', 'Designates the pre-selected action for the room request dialog', 'Valid values are: NO_ROOM_INFO_ACTION, ROOM_REQUEST_ACTION, BOOKING_OF_ROOM_ACTION, FREETEXT_ROOM_ACTION', '');
  151         ");
  152 
  153         DBManager::get()->exec("
  154             INSERT INTO `config` (`config_id`, `parent_id`, `field`, `value`, `is_default`, `type`, `range`, `section`, `position`, `mkdate`, `chdate`, `description`, `comment`, `message_template`)
  155             VALUES ('0d3f84ed4dd6b7147b504ffb5b6fbc2c', '', 'RESOURCES_ENABLE_EXPERT_SCHEDULE_VIEW', '0', 1, 'boolean', 'global', '', 0, 12, 12, 'Enables the expert view of the course schedules', '', '');
  156         ");
  157 
  158         DBManager::get()->exec("
  159             INSERT INTO `config` ( `config_id` , `parent_id` , `field` , `value` , `is_default` , `type` , `range` , `section` , `position` , `mkdate` , `chdate` , `description` , `comment` , `message_template` )
  160             VALUES ( 'bc3004618b17b29dc65e10e89be9a7a0', '', 'RESOURCES_ENABLE_BOOKINGSTATUS_COLORING', '1', '1', 'boolean', 'global', '', '0', '0', '0', 'Enable the colored presentation of the room booking status of a date', '', '');
  161         ");
  162 
  163         $this->write( get_class($this).": Finished with creating db schema.");
  164 
  165         // close logfile
  166         fclose($logfile_handle);
  167     }
  168 }
  169