"Fossies" - the Fresh Open Source Software Archive

Member "4.6.1/db/migrations/102_remove_guestbook_migration.php" (8 Apr 2021, 1546 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 
    3 class RemoveGuestbookMigration extends Migration
    4 {
    5 
    6     function description()
    7     {
    8         return 'puts all data from active guestbooks into blubber';
    9     }
   10 
   11     function up()
   12     {
   13         $db = DBManager::get();
   14         $guestbook_text = _("Gästebuch");
   15         $db->exec("
   16             INSERT IGNORE INTO blubber (topic_id, parent_id, root_id, context_type, name, description, mkdate, chdate, Seminar_id, user_id, external_contact)
   17                 SELECT MD5(CONCAT('guestbook_', user_info.user_id)), '0', MD5(CONCAT('guestbook_', user_info.user_id)), 'public', ".$db->quote($guestbook_text).", ".$db->quote($guestbook_text).", user_info.mkdate, user_info.mkdate, user_info.user_id, user_info.user_id, '0'
   18                 FROM user_info
   19                 WHERE user_info.guestbook = '1'
   20         ");
   21         $db->exec("
   22             INSERT IGNORE INTO blubber (topic_id, parent_id, root_id, context_type, name, description, mkdate, chdate, Seminar_id, user_id, external_contact)
   23                 SELECT guestbook.post_id, MD5(CONCAT('guestbook_', guestbook.range_id)), MD5(CONCAT('guestbook_', guestbook.range_id)), 'public', ".$db->quote($guestbook_text).", guestbook.content, guestbook.mkdate, guestbook.mkdate, guestbook.range_id, guestbook.user_id, '0'
   24                 FROM guestbook
   25                     INNER JOIN user_info ON (guestbook.range_id = user_info.user_id)
   26                 WHERE user_info.guestbook = '1'
   27         ");
   28         $db->exec("
   29             DROP TABLE guestbook
   30         ");
   31     }
   32 
   33     function down()
   34     {
   35     }
   36 }