Beispiel #1
0
 public static function getObject($record)
 {
     global $DEFAULT_LANG;
     # Converts a user record in DB into a User object
     if ($record == null) {
         return null;
     }
     $user = new User();
     $user->userId = $record['user_id'];
     $user->username = $record['username'];
     $user->password = $record['password'];
     $user->actualName = $record['actualname'];
     $user->level = $record['level'];
     $user->email = $record['email'];
     $user->phone = $record['phone'];
     $user->createdBy = $record['created_by'];
     $user->labConfigId = $record['lab_config_id'];
     if (isset($record['lang_id'])) {
         $user->langId = $record['lang_id'];
     } else {
         $user->langId = $DEFAULT_LANG;
     }
     /*if( $user->labConfigId == 128 || $user->labConfigId == 129 || $user->labConfig == 131 ) */
     $user->country = LabConfig::getUserCountry($user->labConfigId);
     return $user;
 }
Beispiel #2
0
function updateDatabase()
{
    global $labConfigId, $DB_HOST, $DB_USER, $DB_PASS;
    $country = strtolower(LabConfig::getUserCountry($labConfigId));
    $saved_db = DbUtil::switchToCountry($country);
    $currentDir = getcwd();
    $mainBlisDir = substr($currentDir, $length, strpos($currentDir, "htdocs"));
    //$blisLabBackupFilePath = "\"".$mainBlisDir.$backup_folder."\blis_".$lab_config_id."\blis_".$lab_config_id."_backup.sql\"";
    $sqlFilePath = "\"" . $mainBlisDir . "htdocs\\export\\temp.sql\"";
    $mysqlExePath = "\"" . $mainBlisDir . "server\\mysql\\bin\\mysql.exe\"";
    $dbname = "blis_" . $country;
    $command = $mysqlExePath . " -h {$DB_HOST} -P 7188 -u {$DB_USER} -p{$DB_PASS} {$dbname} < {$sqlFilePath}";
    $command = "C: &" . $command;
    //the C: is a useless command to prevent the original command from failing because of having more than 2 double quotes
    echo $command;
    system($command, $return_var);
    if ($return_var == 0) {
        echo "true";
    } else {
        echo "false";
    }
    DbUtil::switchRestore($saved_db);
}