Apache-FileManager

 view release on metacpan or  search on metacpan

FileManager.pm  view on Meta::CPAN

 #9 Do the following commands:
   - production_server> chown -R nobody.nobody /usr/local/apache/nobody
   - production_server> chmod -R 700 /usr/local/apache/nobody

You also need to specify the production server in the development server's 
web conf file. So your conf file should look like this:

 <Location /FileManager>
   SetHandler           perl-script
   PerlHandler          Apache::FileManager
   PerlSetVar           RSYNC_TO   production_server:/web/xyz
 </Location>

If your ssh path is not /usr/bin/ssh or /usr/local/bin/ssh, you also need to 
specify the path in the conf file or in the contructor with the directive 
SSH_PATH.

You can also specify RSYNC_TO in the constructor:

  my $obj = Apache::FileManager->new({ 
    RSYNC_TO => "production_server:/web/xyz" 
  });

Also make sure /web/xyz and all files in the tree are readable, writeable, and 
executable by nobody on both the production server AND the development server.

=head1 USING DIFFERENT DOCUMENT ROOT

You can specify a different document root as long as the new document root 
falls inside of the orginal document root. For example if the document root 
of a web server is /web/project/htdocs, you could assign the document root to 
also be /web/project/htdocs/newroot. The directory `newroot` must exist.

 # Specify different document root in apache conf file
   <Location /FileManager>
     SetHandler           perl-script
     PerlHandler          Apache::FileManager
     PerlSetVar           DOCUMENT_ROOT /web/project/htdocs/newroot
   </Location>

 # Or specify different document root in your own mod_perl script
   use Apache::FileManager;
   my $obj = Apache::FileManager->new({ 
     DOCUMENT_ROOT => '/web/project/htdocs/newroot' 
   });
   $obj->print();

=head1 SUBCLASSING Apache::FileManager 

 # Create a new file with the following code:

 package MyProject::MyFileManager;
 use strict;
 use Apache::FileManager;
 our @ISA = ('Apache::FileManager');

 #Add your own methods here

1;

The best way to subclass the filemanager would be to copy the methods you want 
to overload from the Apache::FileManager file to your new subclass. Then change
the methods to your liking.

=head1 BUGS

There is a bug in File::NCopy that occurs when trying to paste an empty 
directory. The directory is copied but reports back as 0 directories pasted. 
The author is in the process of fixing the problem.

=head1 AUTHOR

Apache::FileManager was written by Philip Collins 
E<lt>pmc@cpan.orgE<gt>.

=cut

use strict;
#use warnings;
use IO::File;
use Apache::Request;
use Apache::Util qw(escape_html);
use Apache::File;
use File::NCopy  qw(copy);
use File::Copy   qw(move);
use File::Remove qw(remove);
use File::stat;
use Archive::Any;
use POSIX qw(strftime);
use CGI::Cookie;
use Apache::Constants ':common';
#use Data::Dumper;

require 5.005_62;

our $VERSION = '0.19';

sub r  { return Apache::Request->instance( Apache->request ); }


# ---------- Object Constructor -----------------------------------------
sub new {
  my $package = shift;
  my $attribs = shift || {};
  my $o = bless $attribs, $package;
  $o->intialize();
  $o->execute_cmds();
  return $o;
}




# ---- If this was called directly via a perl content handler by apache -------
sub handler {
  return DECLINED if defined r->param('nossi');
  my $package = __PACKAGE__;
  my $obj = $package->new();
  r->send_http_header('text/html');
  r->print("<HTML><HEAD><TITLE>".r->server->server_hostname." File Manager $VERSION</TITLE></HEAD>");
  $obj->print();



( run in 1.548 second using v1.01-cache-2.11-cpan-5837b0d9d2c )