1
0
mirror of https://github.com/EGroupware/egroupware.git synced 2024-12-26 16:49:10 +01:00
egroupware_official/setup/tools/versions.pl.txt
2001-07-30 15:59:25 +00:00

107 lines
2.4 KiB
Plaintext

#!/usr/bin/perl
#**************************************************************************#
# phpGroupWare #
# http://www.phpgroupware.org #
# -------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the #
# Free Software Foundation; either version 2 of the License, or (at your #
# option) any later version. #
#**************************************************************************#
# $Id$ #
# versions.pl (c) 2001 Miles Lott
# Extract and print all app versions, and create a versions.inc.php file.
# This would be run at each release to generate a tab-delimited listing
# of appnames and current versions.
$installdir = '/usr/local/apache/htdocs/phpgroupware/';
$count = $nover = $ver = $i = 0;
@info = @versions = ();
sub get_versions()
{
$d = opendir(DIR,$installdir);
while($entry = readdir(DIR))
{
$found = 0;
$_ = $entry;
if (/\A.\Z/)
{
next;
}
if (!(/setup/ || /tmp/))
{
$setupdir = $installdir . $entry . '/setup/';
my $f = $setupdir . 'setup.inc.php';
if (stat($f))
{
open(FILE,$f);
while(<FILE>)
{
$_ =~ s/"/'/g;
if (/((.*?)version')(.*?)=(.*?)'(.*?)';/)
{
$info[$i] = $entry . "\t" . $5 . "\n";
$found = 1;
$ver++;
$count++;
}
}
close FILE;
}
if (!$found && stat($setupdir))
{
$info[$i] = $entry . "\t0.0.0\n";
$nover++;
$count++;
}
}
$i++;
}
close DIR;
}
get_versions();
if(@info)
{
@versions = sort @info;
reset(@versions);
open(OUT,'>' . $installdir. '/setup/versions.inc.php');
for $i (0..$#versions)
{
print $versions[$i];
print OUT $versions[$i];
}
close OUT;
printf('Found %s applications',$count);
print "\n";
}
if ($ver)
{
if ($ver != $count)
{
printf('%s of these had a valid version string.',$ver);
}
else
{
print 'All had a valid version string.';
}
print "\n";
}
if ($nover)
{
if ($nover != $count)
{
printf('%s of these had no version string.',$nover);
}
else
{
print 'None had a valid version string.';
}
print "\n";
}