reset owner

mdbbe

Verified User
Joined
Jul 30, 2008
Messages
7
I want to execute the 'reset owner' command from the file manager, because the files I make are owned by apache, this is giving my a lot of trouble.

I have this (with php da class):
PHP:
function directadmin_chown($sock, $path){
  $sock->set_method('POST');
  
  $sock->query('/CMD_API_FILE_MANAGER',
                array(
                  'action' => 'resetowner',
                  'button=resetowner',
                  'path='.$path,
                ));

  $result = $sock->fetch_body();

  return $result;
}

I get the error : error=1&text=An error occured while resetting the file ownership&details=You must enter a valid path. eg: /public_html

I treid to change the path so it would start with /public_html/... but no luck.

Any suggestions?
 
Hello,

There are 2 ways this is called.

1) Via "GET" on just one file or directory, in which case, you'd use:
PHP:
  $sock->set_method('GET');    
  $sock->query("/CMD_API_FILE_MANAGER$path", 
                array( 
                  'action' => 'resetowner', 
                  'method' => 'recursive'
                ));
where the method=recursive bit is optional.. used on directories.

OR

2) if you want to hit multiple selections at once (the checkbox method in the filemanager), then you'd use a POST like this
PHP:
  $sock->set_method('POST');   
  $sock->query('/CMD_API_FILE_MANAGER', 
                array( 
                  'action' => 'multiple', 
                  'resetowner=whateveryouwant', 
                  'path='.$path, 
                  'select1='.'/file/numerone.txt',
                  'select2='.'/file/numertwo.txt',
                ));
Hope this helps!

John
 
Who is help me ?

Hello,

There are 2 ways this is called.

1) Via "GET" on just one file or directory, in which case, you'd use:
PHP:
  $sock->set_method('GET');    
  $sock->query("/CMD_API_FILE_MANAGER$path", 
                array( 
                  'action' => 'resetowner', 
                  'method' => 'recursive'
                ));
where the method=recursive bit is optional.. used on directories.


Put this code where ? My site have same error, when member of site upload image it allway are: UID: apache - GID: apache

Who is help me -> How to fix it ?
 
Back
Top