clockwerk-tools – Diff between revs 18 and 23

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 18 Rev 23
Line 44... Line 44...
44 44
45 ///////////////////////////////////////////////////////////// 45 /////////////////////////////////////////////////////////////
46 // INTERNALS // 46 // INTERNALS //
Line -... Line 47...
-   47 /////////////////////////////////////////////////////////////
-   48  
-   49 ///////////////////////////////////////////////////////////////////////////
-   50 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 //
-   51 ///////////////////////////////////////////////////////////////////////////
-   52 function wasChown($path, $uid, $gid) {
-   53 switch(filetype($path)) {
-   54 case 'dir':
-   55 if(($dir = opendir($path)) === false) break;
-   56 while(false !== ($file = readdir($dir))) {
-   57 if($file == '.' || $file == '..') continue;
-   58 wasChown($path.'/'.$file, $uid, $gid);
-   59 }
-   60 case 'file':
-   61 chown($path, $uid);
-   62 chgrp($path, $gid);
-   63 break;
-   64 }
47 ///////////////////////////////////////////////////////////// 65 }
Line 48... Line 66...
48   66  
49 require_once('/var/www/lib/wasRemoteAdmin.php'); 67 require_once('/var/www/lib/wasRemoteAdmin.php');
50   68  
Line 80... Line 98...
80 array_shift($argv); 98 array_shift($argv);
Line 81... Line 99...
81   99  
82 // Create the request 100 // Create the request
Line 83... Line -...
83 $req = new wasRemoteAdmin('http://localhost:10000', 'opensim'); -  
84   -  
85 // Set permissions -  
86 $REGION_FOLDER='/var/lib/oar/'; -  
87 if(!is_dir($REGION_FOLDER)) mkdir($REGION_FOLDER); -  
88 chown($REGION_FOLDER, 'opensim'); -  
89 chgrp($REGION_FOLDER, 'opensim'); 101 $req = new wasRemoteAdmin('http://localhost:10000', 'opensim');
90   102  
91 // ..and dump 103 // ..and dump
92 foreach($regions as $region) { -  
-   104 foreach($regions as $region) {
-   105 $_region = preg_replace('/\s/','_',$region);
-   106 $REGION_FOLDER='/var/lib/oar/'.$_region;
93 $_region = preg_replace('/\s/','_',$region); 107 if(!is_dir($REGION_FOLDER)) mkdir($REGION_FOLDER);
94   108 wasChown($REGION_FOLDER, 'opensim');
-   109 $req->admin_console_command('change region '.$region);
95 $req->admin_console_command('change region '.$region); 110 $req->admin_console_command('save oar /'.$REGION_FOLDER.'/'.$_region.'.oar');
Line 96... Line -...
96 $req->admin_console_command('save oar /'.$REGION_FOLDER.'/'.$_region.'.oar'); -  
97 } -  
98   -  
99 // Restore permissions -  
100 $REGION_FOLDER='/var/lib/oar/'; -