#!/usr/bin/php '."\n"; # return 1; #} $connection_ok = mysql_connect(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD); if(!$connection_ok) { print 'Could not connect to the OpenSim database. Please edit the script and make sure the credentials are correct.'."\n"; return 1; } $db_selected = mysql_select_db(MYSQL_DATABASE); if(!$db_selected) { print 'Could not select the opensim database. Please edit this script and make sure the credentials are correct.'."\n"; return 1; } $query = 'SELECT Concat(FirstName, " ", LastName) FROM UserAccounts'; $result = mysql_query($query); $users = array(); while($row = mysql_fetch_array($result)) { array_push($users, $row[0]); } // Now we can get rid of the script name. array_shift($argv); // Create the request $req = new wasRemoteAdmin('http://localhost:10000', 'opensim'); // ..and dump foreach($users as $user) { $_user = preg_replace('/\s/','_',$user); $USER_FOLDER='/var/lib/iar/'.$_user; if(!is_dir($USER_FOLDER)) mkdir($USER_FOLDER); chown($USER_FOLDER, 'opensim'); $req->admin_console_command('save iar '.$user.' / '.$USER_FOLDER.'/'.$_user.'.iar'); }