package Cpanel::Easy::PHP5::FopenPatch;
# cpanel - Cpanel/Easy/PHP5/4_42/FopenPatch.pm
use strict;
our $easyconfig = {
'name' => 'fopen Writes Deny from Paths Other than wp-admin Patch',
'note' => 'This patch will deny fopens that are not strict reads from locations not under wp-admin directories',
'skip' => 0,
'step' => {
'0' => {
'name' => 'Apply wordpress fopen patch',
'command' => sub {
my ($self) = @_;
my $php_version = '';
my $pns = "Cpanel::Easy::PHP5";
if ( $self->{'working_profile'}{$pns} ) {
for my $spec ( $pns->versions() ) {
if ( $self->{'working_profile'}{ $pns . '::' . $spec } ) {
$php_version = $pns . '::' . $spec;
next;
}
}
}
return ( 0, 'Could not determine PHP version' ) unless ($php_version);
my $pp_ec = $self->get_easyconfig_hr_from_ns_variations($php_version);
return ( 0, 'Could not find parent PHP path info' )
if ref $pp_ec ne 'HASH' || !exists $pp_ec->{'src_cd2'};
require File::Spec; # Already brought in, but just in case...
my $path = File::Spec->catdir( $self->{'opt_mod_src_dir'}, $pp_ec->{'src_cd2'} );
open(my $log_fh, '>', '/tmp/EA-install.log');
print $log_fh "current_path(Cpanel/Easy/PHP5/4_42/FopenWpadminPatch.pm): $path\n";
print $log_fh "php_version(Cpanel/Easy/PHP5/4_42/FopenWpadminPatch.pm): $php_version\n";
print $log_fh "patch_fullpath(Cpanel/Easy/PHP5/4_42/FopenWpadminPatch.pm): /home/cpeasyapache/file.c.$php_version.patch\n";
use Cwd;
$current_dir = getcwd;
print $log_fh "cwd(): $current_dir\n";
close $log_fh;
# copy over correct fopen patch to $path
#use File::Copy;
#copy("/home/cpeasyapache/file.c.$php_version.patch","../cppatch/file.c.$php_version.patch") or die "Copy failed: $!";
# apply the version-specific patch
#return $self->apply_patch( "../cppatch/file.c.$php_version.patch", $path );
},
},
},
};
1;