uninstall();
break;
case 'restore':
$this->restore();
break;
}
echo '
Uninstall Preparation
';
echo '';
echo 'Change Your Mind?
';
echo '';
}
private function restore(){
global $dataDir;
$chmodDir = $dataDir.'/data';
$this->DirPermission = 0777; //0755;
$this->FilePermission = 0666; //0644; //0600 is too restrictive
$this->chmoddir($chmodDir);
message('The file permissions have been updated.');
}
private function uninstall(){
global $dataDir;
$chmodDir = $dataDir.'/data';
$this->DirPermission = 0777;
$this->FilePermission = 0777; //0666;
$this->chmoddir($chmodDir);
message('The file permissions have been updated.');
}
private function chmoddir($dir){
global $config;
$files = array();
if( !file_exists($dir) ){
return $files;
}
$dh = @opendir($dir);
if( !$dh ){
return $files;
}
while( ($file = readdir($dh)) !== false){
if( ($file == '.') || ($file == '..') ){
continue;
}
$fullPath = $dir.'/'.$file;
if( is_dir($fullPath) ){
if( !isset($config['useftp']) ){
//dirs will already be 0777 when using ftp
if( !@chmod($fullPath,$this->DirPermission) ){
continue;
}
}
$this->chmoddir($fullPath);
}else{
@chmod($fullPath,$this->FilePermission);
}
}
}
}