/lib/fs/etc/cron.daily/iardumper |
@@ -46,6 +46,24 @@ |
// INTERNALS // |
///////////////////////////////////////////////////////////// |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
function wasChown($path, $uid, $gid) { |
switch(filetype($path)) { |
case 'dir': |
if(($dir = opendir($path)) === false) break; |
while(false !== ($file = readdir($dir))) { |
if($file == '.' || $file == '..') continue; |
wasChown($path.'/'.$file, $uid, $gid); |
} |
case 'file': |
chown($path, $uid); |
chgrp($path, $gid); |
break; |
} |
} |
|
require_once('/var/www/lib/wasRemoteAdmin.php'); |
|
if(!defined('STDIN')) { |
@@ -87,9 +105,7 @@ |
$_user = preg_replace('/\s/','_',$user); |
$USER_FOLDER='/var/lib/iar/'.$_user; |
if(!is_dir($USER_FOLDER)) mkdir($USER_FOLDER); |
chown($USER_FOLDER, 'opensim'); |
chgrp($USER_FOLDER, 'opensim'); |
$req->admin_console_command('save iar '.$user.' / '.$USER_FOLDER.'/'.$_user.'.iar'); |
chown($USER_FOLDER, 'www-data'); |
chgrp($USER_FOLDER, 'www-data'); |
wasChown($USER_FOLDER, 'opensim'); |
$req->admin_console_command('save iar '.$user.' /'.$USER_FOLDER.'/'.$_user.'.iar'); |
wasChown($USER_FOLDER, 'www-data'); |
} |
/lib/fs/etc/cron.daily/oardumper |
@@ -46,6 +46,24 @@ |
// INTERNALS // |
///////////////////////////////////////////////////////////// |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
function wasChown($path, $uid, $gid) { |
switch(filetype($path)) { |
case 'dir': |
if(($dir = opendir($path)) === false) break; |
while(false !== ($file = readdir($dir))) { |
if($file == '.' || $file == '..') continue; |
wasChown($path.'/'.$file, $uid, $gid); |
} |
case 'file': |
chown($path, $uid); |
chgrp($path, $gid); |
break; |
} |
} |
|
require_once('/var/www/lib/wasRemoteAdmin.php'); |
|
if(!defined('STDIN')) { |
@@ -82,22 +100,14 @@ |
// Create the request |
$req = new wasRemoteAdmin('http://localhost:10000', 'opensim'); |
|
// Set permissions |
$REGION_FOLDER='/var/lib/oar/'; |
if(!is_dir($REGION_FOLDER)) mkdir($REGION_FOLDER); |
chown($REGION_FOLDER, 'opensim'); |
chgrp($REGION_FOLDER, 'opensim'); |
|
// ..and dump |
foreach($regions as $region) { |
$_region = preg_replace('/\s/','_',$region); |
|
$REGION_FOLDER='/var/lib/oar/'.$_region; |
if(!is_dir($REGION_FOLDER)) mkdir($REGION_FOLDER); |
wasChown($REGION_FOLDER, 'opensim'); |
$req->admin_console_command('change region '.$region); |
$req->admin_console_command('save oar /'.$REGION_FOLDER.'/'.$_region.'.oar'); |
wasChown($REGION_FOLDER, 'www-data'); |
} |
|
// Restore permissions |
$REGION_FOLDER='/var/lib/oar/'; |
if(!is_dir($REGION_FOLDER)) mkdir($REGION_FOLDER); |
chown($REGION_FOLDER, 'www-data'); |
chgrp($REGION_FOLDER, 'www-data'); |