WP File Manager
Current Path:
/
home
/
translil
/
www
/
amitram
/
multimedia
/
tools
/
Name
Action
..
fill_history.pl
Edit
index.php
Edit
language
metadata.php
Edit
missing_keys.pl
Edit
piwigo_remote.pl
Edit
piwigo_upload.pl
Edit
pwg_rel_create.sh
Edit
replace_version.pl
Edit
translation_analysis.php
Edit
triggers_list.php
Edit
ws.htm
Edit
Editing: replace_version.pl
#!/usr/bin/perl #### # Usage # # perl replace_version.pl --file=/path/to/file.php --version=2.8.0 use strict; use warnings; use Getopt::Long; use File::Basename; my %opt = (); GetOptions( \%opt, qw/ file=s version=s / ); if (not -e $opt{file}) { die "file missing ".$opt{file}; } my $new_content = ''; open(my $ifh, '<'.$opt{file}) or die 'Houston, problem with "'.$opt{file}.'" for reading'; while (<$ifh>) { if (/^Version:/) { $_ = 'Version: '.$opt{version}.''."\n"; } $new_content.= $_; } close($ifh); open(my $ofh, '>'.$opt{file}) or die 'Houston, problem with "'.$opt{file}.'" for writing'; print {$ofh} $new_content; close($ofh);