Location: PHPKode > scripts > Admidio > admidio-2.2.9/adm_install/db_scripts/upd_2_2_5_conv.php
<?php
/******************************************************************************
 * Datenkonvertierung fuer die Version 2.2.5
 *
 * Copyright    : (c) 2004 - 2011 The Admidio Team
 * Homepage     : http://www.admidio.org
 * License      : GNU Public License 2 http://www.gnu.org/licenses/gpl-2.0.html
 *
 *****************************************************************************/

// eine Orga-ID einlesen
$sql = 'SELECT MIN(org_id) as org_id FROM '. TBL_ORGANIZATIONS. ' ORDER BY org_id DESC';
$result_orga = $g_db->query($sql);
$row_orga = $g_db->fetch_array($result_orga);

// Webmaster-ID ermitteln
$sql = 'SELECT usr_id as webmaster_id, usr_timestamp_create as timestamp
          FROM '.TBL_USERS.'
         WHERE usr_id IN (SELECT min(mem_usr_id)
                            FROM '. TBL_MEMBERS. ', '. TBL_ROLES. ', '. TBL_CATEGORIES. '
                           WHERE cat_org_id = '. $row_orga['org_id']. '
                             AND rol_cat_id = cat_id
                             AND rol_name   = "Webmaster"
                             AND mem_rol_id = rol_id )';
$result = $g_db->query($sql);
$row_webmaster = $g_db->fetch_array($result);

// Rollenpflichtfelder fuellen, falls dies noch nicht passiert ist
$sql = 'UPDATE '. TBL_ROLES. ' SET rol_timestamp_create = "'. $row_webmaster['timestamp'].'"
                                 , rol_usr_id_create    = '. $row_webmaster['webmaster_id'].'
     WHERE rol_usr_id_create IS NULL ';
$g_db->query($sql);

?>
Return current item: Admidio