PHP Upgrade 5.4 => 7.2

This commit is contained in:
2020-07-31 04:58:02 -04:00
parent d4271e9e90
commit 88819877ac
278 changed files with 40520 additions and 126229 deletions
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/env ruby
require 'iconv'
########################################################################
# convert ChangeLog to google code wiki
# muquit@muquit.com Mar-17-2013
########################################################################
class ChangeLogToWiki
ME = $0
ME_SHORT = File.basename(ME)
def initialize
$stdout.sync = true
@url = "https://mailsend.googlecode.com/svn/trunk/changelog2wiki.rb"
end
def kprint(line)
Kernel.print line
end
def escape_html(line)
line = line.gsub(/</,"`<")
line = line.gsub(/>/,">`")
return line
end
def doit
file = ''
file = Dir.pwd + "/ChangeLog" if File.exists?(Dir.pwd + "/ChangeLog")
file = Dir.pwd + "/ChangeLog.txt" if File.exists?(Dir.pwd + "/ChangeLog.txt")
f = File.open(file)
list_found = false
project=File.basename(Dir.pwd)
puts <<EOD
#summary ChangeLog of #{project}
#sidebar Toc
#labels Featured
<wiki:toc />
EOD
while ((line = f.gets))
line.chomp! if line
line.strip! if line
line = Iconv.conv('UTF-8', 'iso8859-1',line)
if line =~ /^=/
puts line
next
end
if line =~ /^[0-9]+\..*$/
puts "=#{line}="
next
end
if line =~ /^-/
line.gsub!(/^-/,"")
line = line.gsub("/\n","")
line = escape_html(line)
if list_found
kprint "\n *#{line}"
else
kprint " *#{line}"
end
list_found = true
else
if line =~ /^\([a-zA-Z]+-[0-9]+-[0-9]+\)$/
puts "\n_#{line}_"
list_found = false
else
next if line.length == 0
line = line.gsub("/\n","")
line = escape_html(line)
if list_found
kprint " #{line}"
else
puts " #{line}"
end
end
end
end
t = Time.new
puts <<EOD
----
This wiki is auto generated by [#{@url} #{ME_SHORT}] on #{t}.
EOD
end
end
if __FILE__ == $0
ChangeLogToWiki.new.doit
end
@@ -0,0 +1,46 @@
#!/usr/bin/env ruby
########################################################################
# make array of pointer to char from copyright file
# muquit@muquit.com Oct-12-2013
########################################################################
class CopyrightTwoArrayOfPointerToChar
ME = File.basename($0)
COPYRIGHT_FILE = Dir.pwd + "/COPYRIGHT"
def initialize
end
def doit
lines = File.readlines(COPYRIGHT_FILE)
if !lines
puts "Error: could not read #{COPYRIGHT_FILE}"
exit
end
t = Time.new
puts <<-EOF
#ifndef COPYRIGHT_H
#define COPYRIGHT_H
/*
** Automatically generated by #{ME}.
** #{t}
*/
static char
*mailsend_copyright[] =
{
EOF
lines.each do |line|
line.chomp!
line = line.gsub(/\"/,"\\\"")
puts "\"#{line}\","
end
puts <<-EOF
(char *) NULL
};
#endif /* COPYRIGHT_H */
EOF
end
end
if __FILE__ == $0
CopyrightTwoArrayOfPointerToChar.new.doit
end
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env ruby
# copy to mailsned_binary and add to svn
# muquit@muquit.com Mar-16-2013
require 'fileutils'
begin
version = nil
prog = Dir.pwd + "/mailsend"
l = `#{prog} -V 2>&1`
lines = l.split("\n")
lines.each do |line|
line = line.chomp
line = line.strip
if line =~ /.*mailsend v(.*)$/
version = $1
end
end
if version
to_dir = "../mailsend_bins/#{version}"
if !File.exists?(to_dir)
puts "Creating dir: #{to_dir}"
FileUtils.mkdir_p(to_dir)
end
files = []
files << "mailsend-#{version}.tar.gz"
files << "mailsend#{version}.exe.zip"
files << "mailsend_#{version}-ubuntu_i386.deb"
files.each do |file|
if !File.exists?(file)
puts "Error: File #{file} does not exist"
exit 1
end
puts "File: #{file} -> #{to_dir}"
FileUtils.cp(file,to_dir)
end
else
puts "Could not determine version"
end
rescue => e
puts "Error: #{e}"
end
+135
View File
@@ -0,0 +1,135 @@
#!/usr/bin/env ruby
########################################################################
# Generate google code wiki from mailsend -ex output
# Mar-17-2013
########################################################################
class GenerateMailsendExample
ME = $0
ME_SHORT = File.basename(ME)
PROG = Dir.pwd + "/mailsend"
def initialize
$stdout.sync = true
@url = "https://mailsend.googlecode.com/svn/trunk/ex2wiki.rb"
end
def error(msg)
puts "Error: #{msg}"
exit 1
end
def doit
if !File.exists?(PROG)
error "Program mailsend does not exist"
end
mhash = {}
a = []
last_header = nil
block_found = false
mailsend_found = false
header = nil
headers = []
o = `#{PROG} -ex`
new_lines = []
last_h = ''
lines = o.split("\n")
lines.each_index do |i|
line = lines[i]
line.chomp!
line.strip!
if line =~ /^Example .*$/
next
end
line1 = line
line1.chomp! if line1
line1.strip! if line1
line2 = lines[i + 1]
line2.chomp! if line2
line2.strip! if line2
if line2 =~ /^==.*$/
last_h = line1
if last_header && a
headers << last_header
mhash[last_header] = a
a = []
end
block_found = true
last_header = line1
header = line1
next
end
x = lines[i]
x.chomp! if x
x.strip! if x
if x !~ /^==.*$/
a << x;
end
end
# handle last one
headers << last_h
mhash[last_h] = a
puts <<EOD
#summary Examples of mailasend
#sidebar Toc
#labels Featured
<wiki:toc />
EOD
# print version info first
v = `mailsend -V 2>&1`.chomp
v = v.gsub('^\s+','')
puts <<-EOS
=VERSION=
These examples are generated using
{{{
$ mailsend -V
#{v}
}}}
EOS
headers.each do |h|
puts "=#{h}="
a = mhash[h]
a.each do |line|
next if line =~ /^==.*$/
if line =~ /^mailsend .*$/
puts "}}}" if mailsend_found
mailsend_found = true
puts "{{{"
puts " $ #{line}"
next
end
if line =~ /^-.*$/
puts " #{line}"
else
if mailsend_found && line.length == 0
puts "}}}"
mailsend_found = false
elsif mailsend_found && line !~ /^-.*$/
puts "}}}"
mailsend_found = false
else
puts " #{line}"
end
end
end
end
t = Time.new
puts <<EOD
}}}
----
This wiki is auto generated by [#{@url} #{ME_SHORT}] on #{t}.
EOD
end
end
if __FILE__ == $0
GenerateMailsendExample.new.doit
end
+193
View File
@@ -0,0 +1,193 @@
#!/usr/bin/env ruby
##################################################
# make a debian binary package for ubuntu
# muquit@muquit.com Mar-28-2012
##################################################
#
require 'fileutils'
class MakeDebianPackage
def initialize
@dirs = []
@dirs << Dir.pwd + "/debian/DEBIAN"
@dirs << Dir.pwd + "/debian/usr/bin"
@dirs << Dir.pwd + "/debian/usr/share/doc/mailsend"
@dirs << Dir.pwd + "/debian/usr/share/man/man1"
@depends = "libc6 (>= 2.4)" # XXX CHANGE if needed
@mailsend_ver = ''
@package_name = ''
@control_file = Dir.pwd + "/debian/DEBIAN/control"
end
def log(msg)
t = Time.new
puts "#{t}: #{msg}"
end
def check
file = Dir.pwd + "/mailsend"
if !File.exists?(file)
log "#{file} does not exist, compile first"
exit(1)
end
file = Dir.pwd + "/changelog.debian"
if !File.exists?(file)
log "#{file} does not exist, compile first"
exit(1)
end
end
def gen_control_file
mailsend_version
begin
f = File.open(@control_file, "w")
f.puts <<EOD
Package: mailsend
Section: utils
Version: #{@mailsend_ver}-ubuntu
Maintainer: Muhammad Muquit <muquit@muquit.com>
Installed-Size: 104
Homepage: http://muquit.com/muquit/software/mailsend/mailsend.html
Priority: optional
Architecture: i386
Depends: #{@depends}
Description: Send mail via SMTP protocol
mailsend is a simple command line program to send mail via SMTP protocol.
Among other things it supports ESMTP authentication and MIME attachments.
STARTTLS and SMTP over SSL is also supported. It was originally written
for Microsoft Windows but later on ported to Linux/Unix. The Homepage of
mailsend is at: http://muquit.com/muquit/software/mailsend/mailsend.html
License is BSD.
EOD
f.close
rescue => ex
log "Could not create '#{@control_file}' (#{ex})"
end
end
def gen_copyright
f = File.open("./debian/usr/share/doc/mailsend/COPYRIGHT", "w")
year = Time.new.year
f.puts <<EOD
mailsend
Copyright #{year} Muhammad Muquit <muquit@muquit.com>
License: BSD
On Debian systems, the full text of the BSD can be found at
/usr/share/common-licenses/BSD
EOD
f.close
end
def compress(file)
cmd = "gzip --force --best #{file}"
system(cmd)
end
def strip_binary(file)
cmd = "strip #{file}"
system(cmd)
end
def copy_files
FileUtils.copy("./mailsend", "./debian/usr/bin")
strip_binary("./debian/usr/bin/mailsend")
FileUtils.copy("./doc/mailsend.1.gz", "./debian/usr/share/man/man1")
file = "./debian/usr/share/doc/mailsend/changelog"
FileUtils.copy("./changelog.debian", file)
compress(file)
file = "./debian/usr/share/doc/mailsend/changelog.Debian"
FileUtils.copy("./changelog.debian", file)
compress(file)
end
def make_dirs
@dirs.each do |dir|
log "Make directory: #{dir}"
FileUtils.mkdir_p(dir)
end
end
def lintian
package_name = get_package_name
log "Running lintian on #{package_name}"
cmd = "lintian #{package_name}"
system(cmd)
end
def mailsend_version
ver = `./mailsend -V 2>&1`
a = ver.split("\n")
l = a[0].to_s.chomp
if l =~ /.*v(.*)$/
@mailsend_ver = $1
log "mailsend version: '#{@mailsend_ver}'"
else
log "Could not determine mailsend version"
exit(1)
end
end
def get_package_name
pname = "mailsend_#{@mailsend_ver}-ubuntu_i386.deb"
@package_name = pname
return pname
end
def make_package
package_name = get_package_name
FileUtils.remove("./debian.deb") if File.exists?("./debian.deb")
cmd = "fakeroot dpkg-deb --build debian"
log "Running: #{cmd}"
system(cmd)
FileUtils.mv("debian.deb", package_name)
log "Package: #{package_name}"
end
def print_install_inst
puts <<EOD
##########################################
To install the package, type:
sudo dpkg -i #{@package_name}
To remove the package, type:
sudo dpkg -r mailsend
##########################################
EOD
end
def doit
check
make_dirs
gen_control_file
gen_copyright
copy_files
make_package
lintian
print_install_inst
end
end
if __FILE__ == $0
deb = MakeDebianPackage.new
deb.doit
end
+108
View File
@@ -0,0 +1,108 @@
#!/usr/bin/env ruby
# make the minimal pod doc and then generate man page from it
# muquit@muquit.com Mar-27-2012
class MakeMailsendPod
PROG = Dir.pwd + "/mailsend"
def initialize
@mailsend_ver = ''
@copyright
end
def log(msg)
t = Time.new
puts "#{t}: #{msg}"
end
def mailsend_version
ver = `#{PROG} -V 2>&1`
a = ver.split("\n")
l = a[0].to_s.chomp
if l =~ /.*v(.*)$/
@mailsend_ver = $1
log "mailsend version: '#{@mailsend_ver}'"
else
log "Could not determine mailsend version"
exit(1)
end
end
def check_binary
if !File.exists?("#{PROG}")
log "#{PROG} does not exist. exiting"
exit
end
end
def gen_pod
synopsis = `#{PROG} -h`
ex = `#{PROG} -ex`
f = File.open(Dir.pwd + "/doc/mailsend.pod", "w")
f.puts <<EOD
=head1 NAME
mailsend - A command line program to send mail via SMTP protocol
=head1 SYNOPSYS
#{synopsis}
=head1 DESCRIPTION
mailsend is a simple command line program to send mail via SMTP protocol
for Windows, Linux/Unix.
For deatils, please look at the web page:
L<http://muquit.com/muquit/software/mailsend/mailsend.html>
=head1 EXAMPLES
#{ex}
=head1 SEE ALSO
Please look at the web page for latest version and documentation:
L<http://muquit.com/muquit/software/mailsend/mailsend.html>
=head1 LICENSE
#{@copyright}
=head1 AUTHOR
mailsend is written by Muhammad Muquit E<lt>muquit@muquit.comE<gt>.
Homepage: L<http://www.muquit.com/>.
EOD
;
f.close
end
def read_copyright
@copyright = File.read("./COPYRIGHT")
end
def gen_man
cmd = "pod2man --release \"mailsend #{@mailsend_ver}\" -c \"User Commands\" doc/mailsend.pod > doc/mailsend.1"
system(cmd)
# compress
cmd = "gzip --best -c doc/mailsend.1 > doc/mailsend.1.gz"
system(cmd)
end
def doit
check_binary
mailsend_version
read_copyright
gen_pod
gen_man
end
end
if __FILE__ == $0
MakeMailsendPod.new.doit
end
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env ruby
##################################################
# make examples.c file from misc/examples.
# muquit@muquit.com Dec-14-2013
##################################################
#
require 'fileutils'
class MakeExamples
ME = __FILE__
EXAMPLE_FILE = Dir.pwd + "/misc/examples.txt"
PROG = Dir.pwd + "/mailsend"
def initialize
end
def log(msg)
t = Time.new
puts "#{t}: #{msg}"
end
def make_examples
v = `#{PROG} -V 2>&1`
va = v.split("\n")
puts <<-EOF
#include "mailsend.h"
void show_examples(void)
{
(void) fprintf(stdout, "Examples of #{va[0]}\\n\\n");
(void) fprintf(stdout,
EOF
lines = File.read(EXAMPLE_FILE)
lines.each do |line|
line = line.chomp
line = line.gsub(/\"/,'\"')
if line.length == 0
puts " \"\\n\""
else
puts " \" #{line}\\n\""
end
end
puts <<-EOF
);
}
EOF
end
def doit
make_examples
end
end
if __FILE__ == $0
MakeExamples.new.doit
end
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env ruby
##################################################
# make mime_types.h file from mime.types file
# muquit@muquit.com Dec-14-2013
##################################################
#
require 'fileutils'
class MakeMimeTypesH
ME = __FILE__
MIME_TYPES_FILE = Dir.pwd + "/mime.types"
def initialize
end
def log(msg)
t = Time.new
puts "#{t}: #{msg}"
end
def make_mime_types_h
lines = File.read(MIME_TYPES_FILE) if File.exists?(MIME_TYPES_FILE)
t = Time.new
puts <<-EOF
/*
** WARNING: This file is auto generated. DO NOT MODIFY
** Generated by #{ME} from #{MIME_TYPES_FILE}
** #{t}
*/
EOF
linesa = lines.split("\n")
linesa.each do |line|
line.chomp if line
next if line =~ /^#/ || line.length == 0
if line =~ /(.+)\t+(.+)$/
type = $1
exts = $2
type = type.gsub(/\t+/,'')
extsa = exts.split("\s")
extsa.each do |e|
puts "{ \"#{e}\",\"#{type}\"},"
end
end
end
end
def doit
make_mime_types_h
end
end
if __FILE__ == $0
MakeMimeTypesH.new.doit
end
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env ruby
# print the date in debian changelog format
# Example: Wed, 28 Mar 2012 20:45:31 -0400
# muquit@muquit.com Mar-28-2012
require 'date'
offset = DateTime.now.zone.to_s
offset = offset.sub(/:/,'')
t = Time.new
d = t.strftime("%a, %d %b %Y %H:%M:%S #{offset}")
puts " -- Muhammad Muquit <muquit@muquit.com> #{d}"
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env ruby
# If config.log exists, try to determine how the configure was run last time
# and generate Makefiles.
# muquit@muquit.com Apr-18-2012
class RunConfigure
def doit
cmd = "sh ./configure"
file = "./config.log"
if File.exists?(file)
f = File.open(file, "r")
while (line = f.gets)
line = line.chomp
# $ ./configure --with-openssl=/usr
if line =~ /^\s+\$ (.*configure.*)$/
cmd = $1
puts "line: #{line}\n";
break
end
end
f.close
end
puts cmd
system(cmd)
end
end
if __FILE__ == $0
r = RunConfigure.new
r.doit
end
+1
View File
@@ -0,0 +1 @@
$ ./configure --target=mipsel-linux --host=mipsel-linux --build=i686-pc-linux-gnu
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# test
to="muquit@gmail.com"
from="muquit@muquit.com"
mailsend="./mailsend"
date=`date`
#$mailsend -v -d localhost -t $to +cc +bc -sub test \
# -from $from -a nf.jpg,image/jpeg,a -sub test
$mailsend -d localhost -t $to +cc +bc \
-from $from -sub "test-$date" ${1+"$@"}
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env ruby
########################################################
# update the debian changelog file with dch.
# To udpdate the changelog file:
# ./update_deb_changelog.rb
# To increment the version:
# ./update_deb_changelog.rb blah
# muquit@muquit.com May-11-2012
########################################################
class UpdateDebianChangelog
def initialize
ENV['CHANGELOG'] = Dir.pwd + '/changelog.debian'
ENV['DEBFULLNAME'] = 'Muhammad Muquit'
ENV['DEBEMAIL'] = 'muquit@muquit.com'
ENV['VISUAL'] = 'vi'
end
def doit
if ARGV.length > 0
system("dch -i")
else
system("dch")
end
end
end
if __FILE__ == $0
dcl = UpdateDebianChangelog.new.doit
end
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env ruby
# muquit@muquit.com May-05-2013
# a helper script to upload files
begin
ME = $0
if ARGV.length != 2
puts <<EOD
#{ME} "<comment>" "<file">
EOD
exit
end
if !ENV['GOOGLECODE_PASS']
puts "Set GOOGLECODE_PASS"
exit 1
end
comment = ARGV[0]
file = ARGV[1]
cmd = "googlecode_upload.pl"
cmd << " "
cmd << "-s="
cmd << '"'
cmd << comment
cmd << '"'
cmd << " "
cmd << "-project="
cmd << '"mailsend"'
cmd << " "
cmd << '-user="muquit"'
cmd << " "
cmd << '-labels="Featured"'
cmd << " "
cmd << "--file="
cmd << file
puts cmd
system(cmd)
rescue => e
puts "Error: #{e}"
end