version checking UI
authorTony Cook <tony@develop-help.com>
Mon, 8 Nov 2010 05:46:59 +0000 (05:46 +0000)
committertony <tony@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Mon, 8 Nov 2010 05:46:59 +0000 (05:46 +0000)
MANIFEST
Makefile
site/cgi-bin/bse.cfg
site/cgi-bin/modules/BSE/Cache/CHI.pm
site/cgi-bin/modules/BSE/Modules.pm [new file with mode: 0644]
site/cgi-bin/modules/BSE/UI/AdminModules.pm [new file with mode: 0644]
site/cgi-bin/modules/BSE/Util/Prereq.pm [new file with mode: 0644]
site/htdocs/css/admin.css
site/templates/admin/modules.tmpl [new file with mode: 0644]
site/util/check_versions.pl
site/util/make_versions.pl [new file with mode: 0644]

index 60a5103..000a293 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -70,7 +70,7 @@ site/cgi-bin/modules/BSE/ComposeMail.pm
 site/cgi-bin/modules/BSE/Custom.pm
 site/cgi-bin/modules/BSE/CustomBase.pm
 site/cgi-bin/modules/BSE/DB.pm
-site/cgi-bin/modules/BSE/DB/MSSQL.pm
+#site/cgi-bin/modules/BSE/DB/MSSQL.pm
 site/cgi-bin/modules/BSE/DB/Mysql.pm
 site/cgi-bin/modules/BSE/CGI.pm
 site/cgi-bin/modules/BSE/Countries.pm
@@ -97,8 +97,8 @@ site/cgi-bin/modules/BSE/Formatter/Article.pm
 site/cgi-bin/modules/BSE/Formatter/Subscription.pm
 site/cgi-bin/modules/BSE/Generate/Seminar.pm
 # site/cgi-bin/modules/BSE/FileEditor.pm
-site/cgi-bin/modules/BSE/Handler/Base.pm
-site/cgi-bin/modules/BSE/Handler/Page.pm
+#site/cgi-bin/modules/BSE/Handler/Base.pm
+#site/cgi-bin/modules/BSE/Handler/Page.pm
 site/cgi-bin/modules/BSE/ImageHandler/Base.pm
 site/cgi-bin/modules/BSE/ImageHandler/Flash.pm
 site/cgi-bin/modules/BSE/ImageHandler/Img.pm
@@ -116,6 +116,7 @@ site/cgi-bin/modules/BSE/Mail/SMTP.pm
 site/cgi-bin/modules/BSE/Mail/Sendmail.pm
 site/cgi-bin/modules/BSE/Message.pm
 site/cgi-bin/modules/BSE/MessageScanner.pm
+site/cgi-bin/modules/BSE/Modules.pm    generated list of module versions
 site/cgi-bin/modules/BSE/NLFilter/SQL.pm
 site/cgi-bin/modules/BSE/NotifyFiles.pm
 site/cgi-bin/modules/BSE/Password.pod
@@ -212,6 +213,7 @@ site/cgi-bin/modules/BSE/ThumbLow.pm
 site/cgi-bin/modules/BSE/UI/API.pm
 site/cgi-bin/modules/BSE/UI/Background.pm
 site/cgi-bin/modules/BSE/UI/AdminDispatch.pm
+site/cgi-bin/modules/BSE/UI/AdminModules.pm
 site/cgi-bin/modules/BSE/UI/AdminMessages.pm
 site/cgi-bin/modules/BSE/UI/AdminNewsletter.pm
 site/cgi-bin/modules/BSE/UI/AdminPregen.pm
@@ -243,6 +245,7 @@ site/cgi-bin/modules/BSE/Util/DynSort.pm
 site/cgi-bin/modules/BSE/Util/DynamicTags.pm
 site/cgi-bin/modules/BSE/Util/HTML.pm
 site/cgi-bin/modules/BSE/Util/Iterate.pm
+site/cgi-bin/modules/BSE/Util/Prereq.pm
 site/cgi-bin/modules/BSE/Util/SQL.pm
 site/cgi-bin/modules/BSE/Util/Secure.pm
 site/cgi-bin/modules/BSE/Util/Tags.pm
@@ -479,6 +482,7 @@ site/templates/admin/memberupdate/preview.tmpl
 site/templates/admin/memberupdate/request.tmpl
 site/templates/admin/menu.tmpl
 site/templates/admin/menu_adv.tmpl
+site/templates/admin/modules.tmpl
 site/templates/admin/msgs/index.tmpl
 # site/templates/admin/menu_custom.tmpl
 site/templates/admin/locations/add.tmpl
index 008fce2..3cc2b58 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,8 @@ DISTTAR=../$(DISTNAME).tar
 DISTTGZ=$(DISTTAR).gz
 WEBBASE=/home/httpd/html/bse
 
+MODULES=$(shell grep cgi-bin/.*\.pm MANIFEST | sed -e '/^\#/d' -e 's/[ \t].*//' )
+
 help:
        @echo make dist - build the tar.gz file and copy to distribution directory
        @echo make 'archive - build the tar.gz (in the parent directory)'
@@ -44,7 +46,7 @@ $(DISTTGZ): distdir
 
 # recent ExtUtils::Manifest don't copy the executable bit, fix that here
 
-distdir: docs dbinfo version
+distdir: docs dbinfo version modversion
        -perl -MExtUtils::Command -e rm_rf $(DISTBUILD)
        perl -MExtUtils::Manifest=manicopy,maniread -e "manicopy(maniread(), '$(DISTBUILD)')"
        mkdir $(DISTBUILD)/site/htdocs/shop
@@ -85,7 +87,7 @@ site/cgi-bin/modules/BSE/Version.pm: Makefile
        echo 'package BSE::Version;' >site/cgi-bin/modules/BSE/Version.pm
        echo 'use strict;' >>site/cgi-bin/modules/BSE/Version.pm
        echo  >>site/cgi-bin/modules/BSE/Version.pm
-       echo 'my $$VERSION = "$(VERSION)";' >>site/cgi-bin/modules/BSE/Version.pm
+       echo 'our $$VERSION = "$(VERSION)";' >>site/cgi-bin/modules/BSE/Version.pm
        echo  >>site/cgi-bin/modules/BSE/Version.pm
        echo 'sub version { $$VERSION }' >>site/cgi-bin/modules/BSE/Version.pm
        echo  >>site/cgi-bin/modules/BSE/Version.pm
@@ -94,6 +96,11 @@ site/cgi-bin/modules/BSE/Version.pm: Makefile
 svnversion:
        perl site/util/bse_mksvnversion.pl $(VERSION) site/cgi-bin/modules/BSE/Version.pm
 
+modversion: site/cgi-bin/modules/BSE/Modules.pm
+
+site/cgi-bin/modules/BSE/Modules.pm: $(MODULES) site/util/make_versions.pl
+       perl site/util/make_versions.pl site/cgi-bin/modules/BSE/Modules.pm
+
 # this is very rough
 testinst: distdir
        perl localinst.perl $(DISTBUILD)
@@ -106,7 +113,7 @@ testup: checkver distdir
        cd `perl -lne 'do { print $$1; exit; } if /^base_dir\s*=\s*(.*)/' test.cfg`/util ; perl upgrade_mysql.pl -b ; perl loaddata.pl ../data/db
 
 checkver:
-       perl site/util/check_versions.pl
+       if [ -d .svn ] ; then perl site/util/check_versions.pl ; fi
 
 TEST_FILES=t/*.t
 
index 97f7b27..ed6dd6f 100644 (file)
@@ -431,6 +431,7 @@ default=shop
 
 [nadmin controllers]
 shop=BSE::UI::AdminShop
+modules=BSE::UI::AdminModules
 
 [includes]
 00install=bse-install.cfg
index 3b55826..a5de326 100644 (file)
@@ -1,7 +1,7 @@
 package BSE::Cache::CHI;
 use strict;
 
-our $VERSION = "1.000";
+our $VERSION = "1.001";
 
 sub new {
   my ($class, $cfg) = @_;
@@ -11,7 +11,7 @@ sub new {
 
   require $cache_mod_file;
 
-  my $params_str = $self->cfg->entry("cache", "chi_params");
+  my $params_str = $cfg->entry("cache", "chi_params");
   my @eval_res = eval $params_str;
   if ($@) {
     print STDERR "Error evaluating cache parameters: $@\n";
diff --git a/site/cgi-bin/modules/BSE/Modules.pm b/site/cgi-bin/modules/BSE/Modules.pm
new file mode 100644 (file)
index 0000000..829f772
--- /dev/null
@@ -0,0 +1,256 @@
+package BSE::Modules;
+use strict;
+
+# automatically generated
+
+our $hash = "fdabc46aba81e80d62733c19a197fc94";
+
+our %versions =
+  (
+  "AdminUtil" => "1.000",
+  "Apache::Session::DBIreal" => "1.000",
+  "Apache::Session::Store::DBIreal" => "1.000",
+  "Article" => "1.000",
+  "Articles" => "1.000",
+  "BSE::API" => "1.000",
+  "BSE::Admin::StepParents" => "1.000",
+  "BSE::AdminLogon" => "1.000",
+  "BSE::AdminMenu" => "1.000",
+  "BSE::AdminSiteUsers" => "1.000",
+  "BSE::AdminUsers" => "1.000",
+  "BSE::Arrows" => "1.000",
+  "BSE::CGI" => "1.000",
+  "BSE::Cache" => "1.000",
+  "BSE::Cache::CHI" => "1.001",
+  "BSE::Cache::Cache" => "1.000",
+  "BSE::Cache::Memcached" => "1.000",
+  "BSE::Cfg" => "1.000",
+  "BSE::CfgInfo" => "1.000",
+  "BSE::ChangePW" => "1.000",
+  "BSE::ComposeMail" => "1.000",
+  "BSE::Countries" => "1.000",
+  "BSE::Custom" => "1.000",
+  "BSE::CustomBase" => "1.000",
+  "BSE::DB" => "1.000",
+  "BSE::DB::Mysql" => "1.000",
+  "BSE::Dynamic::Article" => "1.000",
+  "BSE::Dynamic::Catalog" => "1.000",
+  "BSE::Dynamic::Product" => "1.000",
+  "BSE::Dynamic::Seminar" => "1.000",
+  "BSE::Edit::Article" => "1.000",
+  "BSE::Edit::Base" => "1.000",
+  "BSE::Edit::Catalog" => "1.000",
+  "BSE::Edit::Product" => "1.000",
+  "BSE::Edit::Seminar" => "1.000",
+  "BSE::Edit::Site" => "1.000",
+  "BSE::EmailBlackEntry" => "1.000",
+  "BSE::EmailBlacklist" => "1.000",
+  "BSE::EmailRequest" => "1.000",
+  "BSE::EmailRequests" => "1.000",
+  "BSE::FileHandler::Base" => "1.000",
+  "BSE::FileHandler::Default" => "1.000",
+  "BSE::FileHandler::FLV" => "1.000",
+  "BSE::FileMetaMeta" => "1.000",
+  "BSE::Formatter" => "1.000",
+  "BSE::Formatter::Article" => "1.000",
+  "BSE::Formatter::Subscription" => "1.000",
+  "BSE::Generate::Seminar" => "1.000",
+  "BSE::ImageHandler::Base" => "1.000",
+  "BSE::ImageHandler::Flash" => "1.000",
+  "BSE::ImageHandler::Img" => "1.000",
+  "BSE::ImportSourceBase" => "1.000",
+  "BSE::ImportSourceXLS" => "1.000",
+  "BSE::ImportTargetArticle" => "1.000",
+  "BSE::ImportTargetBase" => "1.000",
+  "BSE::ImportTargetProduct" => "1.000",
+  "BSE::Importer" => "1.000",
+  "BSE::Index::BSE" => "1.000",
+  "BSE::Index::Base" => "1.000",
+  "BSE::Jobs::AuditClean" => "1.000",
+  "BSE::Mail" => "1.000",
+  "BSE::Mail::SMTP" => "1.000",
+  "BSE::Mail::Sendmail" => "1.000",
+  "BSE::Message" => "1.000",
+  "BSE::MessageScanner" => "1.000",
+  "BSE::NLFilter::SQL" => "1.000",
+  "BSE::NotifyFiles" => "1.000",
+  "BSE::Password::Crypt" => "1.000",
+  "BSE::Password::CryptMD5" => "1.000",
+  "BSE::Password::CryptSHA256" => "1.000",
+  "BSE::Password::Plain" => "1.000",
+  "BSE::Passwords" => "1.000",
+  "BSE::PayPal" => "1.000",
+  "BSE::Permissions" => "1.000",
+  "BSE::ProductImportXLS" => "1.000",
+  "BSE::Report" => "1.000",
+  "BSE::Request" => "1.000",
+  "BSE::Request::Base" => "1.000",
+  "BSE::Request::Test" => "1.000",
+  "BSE::Search::BSE" => "1.000",
+  "BSE::Search::Base" => "1.000",
+  "BSE::Session" => "1.000",
+  "BSE::Shipping" => "1.000",
+  "BSE::Shop::Util" => "1.000",
+  "BSE::Sort" => "1.000",
+  "BSE::Storage::AmazonS3" => "1.000",
+  "BSE::Storage::Base" => "1.000",
+  "BSE::Storage::FTP" => "1.000",
+  "BSE::Storage::LocalBase" => "1.000",
+  "BSE::Storage::LocalFiles" => "1.000",
+  "BSE::Storage::LocalImages" => "1.000",
+  "BSE::Storage::LocalThumbs" => "1.000",
+  "BSE::StorageMgr::Base" => "1.000",
+  "BSE::StorageMgr::Files" => "1.000",
+  "BSE::StorageMgr::Images" => "1.000",
+  "BSE::StorageMgr::Thumbs" => "1.000",
+  "BSE::SubscribedUser" => "1.000",
+  "BSE::SubscribedUsers" => "1.000",
+  "BSE::SubscriptionType" => "1.000",
+  "BSE::SubscriptionTypes" => "1.000",
+  "BSE::TB::AdminBase" => "1.000",
+  "BSE::TB::AdminBases" => "1.000",
+  "BSE::TB::AdminGroup" => "1.000",
+  "BSE::TB::AdminGroups" => "1.000",
+  "BSE::TB::AdminMembership" => "1.000",
+  "BSE::TB::AdminMemberships" => "1.000",
+  "BSE::TB::AdminPerm" => "1.000",
+  "BSE::TB::AdminPerms" => "1.000",
+  "BSE::TB::AdminUIState" => "1.000",
+  "BSE::TB::AdminUIStates" => "1.000",
+  "BSE::TB::AdminUser" => "1.000",
+  "BSE::TB::AdminUsers" => "1.000",
+  "BSE::TB::ArticleFile" => "1.000",
+  "BSE::TB::ArticleFileMeta" => "1.000",
+  "BSE::TB::ArticleFileMetas" => "1.000",
+  "BSE::TB::ArticleFiles" => "1.000",
+  "BSE::TB::AuditEntry" => "1.000",
+  "BSE::TB::AuditLog" => "1.000",
+  "BSE::TB::BackgroundTask" => "1.000",
+  "BSE::TB::BackgroundTasks" => "1.000",
+  "BSE::TB::FileAccessLog" => "1.000",
+  "BSE::TB::FileAccessLogEntry" => "1.000",
+  "BSE::TB::Image" => "1.000",
+  "BSE::TB::Images" => "1.000",
+  "BSE::TB::Location" => "1.000",
+  "BSE::TB::Locations" => "1.000",
+  "BSE::TB::Order" => "1.000",
+  "BSE::TB::OrderItem" => "1.000",
+  "BSE::TB::OrderItemOption" => "1.000",
+  "BSE::TB::OrderItemOptions" => "1.000",
+  "BSE::TB::OrderItems" => "1.000",
+  "BSE::TB::Orders" => "1.000",
+  "BSE::TB::OwnedFile" => "1.000",
+  "BSE::TB::OwnedFiles" => "1.000",
+  "BSE::TB::ProductOption" => "1.000",
+  "BSE::TB::ProductOptionValue" => "1.000",
+  "BSE::TB::ProductOptionValues" => "1.000",
+  "BSE::TB::ProductOptions" => "1.000",
+  "BSE::TB::Seminar" => "1.000",
+  "BSE::TB::SeminarBooking" => "1.000",
+  "BSE::TB::SeminarBookings" => "1.000",
+  "BSE::TB::SeminarSession" => "1.000",
+  "BSE::TB::SeminarSessions" => "1.000",
+  "BSE::TB::Seminars" => "1.000",
+  "BSE::TB::Site" => "1.000",
+  "BSE::TB::SiteCommon" => "1.000",
+  "BSE::TB::SiteUserGroup" => "1.000",
+  "BSE::TB::SiteUserGroups" => "1.000",
+  "BSE::TB::Subscription" => "1.000",
+  "BSE::TB::Subscription::Calc" => "1.000",
+  "BSE::TB::Subscriptions" => "1.000",
+  "BSE::TagFormats" => "1.000",
+  "BSE::Template" => "1.000",
+  "BSE::Thumb::Imager" => "1.000",
+  "BSE::Thumb::Imager::Colourize" => "1.000",
+  "BSE::Thumb::Imager::RandomCrop" => "1.000",
+  "BSE::ThumbLow" => "1.000",
+  "BSE::UI::API" => "1.000",
+  "BSE::UI::AdminDispatch" => "1.000",
+  "BSE::UI::AdminMessages" => "1.000",
+  "BSE::UI::AdminModules" => "1.000",
+  "BSE::UI::AdminNewsletter" => "1.000",
+  "BSE::UI::AdminPregen" => "1.000",
+  "BSE::UI::AdminReport" => "1.000",
+  "BSE::UI::AdminSeminar" => "1.000",
+  "BSE::UI::AdminSendEmail" => "1.000",
+  "BSE::UI::AdminShop" => "1.000",
+  "BSE::UI::Affiliate" => "1.000",
+  "BSE::UI::Background" => "1.000",
+  "BSE::UI::Dispatch" => "1.000",
+  "BSE::UI::FileProgress" => "1.000",
+  "BSE::UI::Formmail" => "1.000",
+  "BSE::UI::Image" => "1.000",
+  "BSE::UI::NAdmin" => "1.000",
+  "BSE::UI::NUser" => "1.000",
+  "BSE::UI::Page" => "1.000",
+  "BSE::UI::Redirect" => "1.000",
+  "BSE::UI::Search" => "1.000",
+  "BSE::UI::Shop" => "1.000",
+  "BSE::UI::SiteUserUpdate" => "1.000",
+  "BSE::UI::SiteuserCommon" => "1.000",
+  "BSE::UI::SubAdmin" => "1.000",
+  "BSE::UI::Tellafriend" => "1.000",
+  "BSE::UI::Thumb" => "1.000",
+  "BSE::UI::User" => "1.000",
+  "BSE::UI::UserCommon" => "1.000",
+  "BSE::UserReg" => "1.000",
+  "BSE::Util::ContentType" => "1.000",
+  "BSE::Util::DynSort" => "1.000",
+  "BSE::Util::DynamicTags" => "1.000",
+  "BSE::Util::HTML" => "1.000",
+  "BSE::Util::Iterate" => "1.000",
+  "BSE::Util::Prereq" => "1.000",
+  "BSE::Util::SQL" => "1.000",
+  "BSE::Util::Secure" => "1.000",
+  "BSE::Util::Tags" => "1.000",
+  "BSE::Util::Thumb" => "1.000",
+  "BSE::Util::Valid" => "1.000",
+  "BSE::Validate" => "1.000",
+  "BSE::Version" => "0.19",
+  "BSE::WebUtil" => "1.000",
+  "Constants" => "1.000",
+  "Courier" => "1.000",
+  "Courier::AustraliaPost" => "1.000",
+  "Courier::AustraliaPost::Air" => "1.000",
+  "Courier::AustraliaPost::Express" => "1.000",
+  "Courier::AustraliaPost::Sea" => "1.000",
+  "Courier::AustraliaPost::Standard" => "1.000",
+  "Courier::Fastway" => "1.000",
+  "Courier::Fastway::Road" => "1.000",
+  "Courier::Fastway::Satchel" => "1.000",
+  "Courier::Null" => "1.000",
+  "DevHelp::Cfg" => "1.000",
+  "DevHelp::Date" => "1.000",
+  "DevHelp::DynSort" => "1.000",
+  "DevHelp::FileUpload" => "1.000",
+  "DevHelp::Formatter" => "1.000",
+  "DevHelp::HTML" => "1.000",
+  "DevHelp::LoaderData" => "1.000",
+  "DevHelp::Payments::Inpho" => "1.000",
+  "DevHelp::Payments::SecurePayXML" => "1.000",
+  "DevHelp::Payments::Test" => "1.000",
+  "DevHelp::Report" => "1.000",
+  "DevHelp::Tags" => "1.000",
+  "DevHelp::Tags::Iterate" => "1.000",
+  "DevHelp::Validate" => "1.000",
+  "Generate" => "1.000",
+  "Generate::Article" => "1.000",
+  "Generate::Catalog" => "1.000",
+  "Generate::Product" => "1.000",
+  "Generate::Subscription" => "1.000",
+  "OtherParent" => "1.000",
+  "OtherParents" => "1.000",
+  "Product" => "1.000",
+  "Products" => "1.000",
+  "SiteUser" => "1.000",
+  "SiteUsers" => "1.000",
+  "Squirrel::GPG" => "1.000",
+  "Squirrel::PGP5" => "1.000",
+  "Squirrel::PGP6" => "1.000",
+  "Squirrel::Row" => "1.000",
+  "Squirrel::Table" => "1.000",
+  "Squirrel::Template" => "1.000",
+  "Util" => "1.000",
+  );
+
+1;
diff --git a/site/cgi-bin/modules/BSE/UI/AdminModules.pm b/site/cgi-bin/modules/BSE/UI/AdminModules.pm
new file mode 100644 (file)
index 0000000..87b6935
--- /dev/null
@@ -0,0 +1,115 @@
+package BSE::UI::AdminModules;
+use strict;
+use base "BSE::UI::AdminDispatch";
+use BSE::Modules;
+use BSE::Util::Iterate;
+use BSE::Util::Prereq;
+
+our $VERSION = "1.000";
+
+my %actions =
+  (
+   modules => "bse_modules",
+  );
+
+sub rights { \%actions }
+
+sub actions { \%actions }
+
+sub req_modules {
+  my ($self, $req) = @_;
+
+  my $versions = \%BSE::Modules::versions;
+  my $prereqs = \%BSE::Util::Prereq::prereqs;
+
+  my $base = "$FindBin::Bin/../modules";
+
+  my @modules;
+  my @bad;
+  for my $modname (sort keys %$versions) {
+    my $module =
+      {
+       name => $modname,
+       version => $versions->{$modname},
+       found => "",
+       error => "",
+       notes => "",
+      };
+    (my $filename = $modname . ".pm") =~ s(::)(/)g;
+    my $full = "$base/$filename";
+    my $error = '';
+    if (!$error && !-e $full) {
+      $error = "Module file $filename not found";
+    }
+    my $content;
+    if (!$error) {
+      if (open my $in, "<", $full) {
+       $content = do { local $/; <$in> };
+       close $in;
+      }
+      else {
+       $error = "Cannot open $full: $!";
+      }
+    }
+    my $vers;
+    if (!$error) {
+      if ($content =~ /^our \$VERSION = "([0-9.]+)"/m) {
+       $vers = $1;
+       $module->{found} = $vers;
+      }
+      else {
+       $error = "No version found in $filename";
+      }
+    }
+    if (!$error) {
+      if ($vers ne $versions->{$modname}) {
+       $error = "Version $vers in file doesn't match expected $versions->{$modname}";
+      }
+    }
+
+    if (!$error) {
+      local $SIG{__DIE__};
+      my $prereqs_good = 1;
+      if ($prereqs->{$modname}) {
+       for my $prereq (@{$prereqs->{$modname}}) {
+         if (!eval "require $prereq; 1") {
+           $module->{notes} = "Prerequisite $prereq not found";
+           $prereqs_good = 0;
+           last;
+         }
+       }
+      }
+      if ($prereqs_good) {
+       if (!eval "require $modname; 1") {
+         $error = "Cannot load $modname: $@";
+       }
+      }
+    }
+    $module->{error} = $error;
+    if ($error) {
+      push @bad, $module;
+    }
+    else {
+      push @modules, $module;
+    }
+  }
+
+  unshift @modules, @bad;
+
+  my $it = BSE::Util::Iterate->new(req => $req);
+  my %acts =
+    (
+     $req->admin_tags,
+     $it->make
+     (
+      data => \@modules,
+      single => "module",
+      plural => "modules",
+     ),
+     hash => $BSE::Modules::hash,
+    );
+
+  return $req->response("admin/modules", \%acts);
+}
+
+1;
diff --git a/site/cgi-bin/modules/BSE/Util/Prereq.pm b/site/cgi-bin/modules/BSE/Util/Prereq.pm
new file mode 100644 (file)
index 0000000..9876dc5
--- /dev/null
@@ -0,0 +1,11 @@
+package BSE::Util::Prereq;
+use strict;
+
+our $VERSION = "1.000";
+
+# pre-requisites for various modules
+
+our %prereqs =
+  (
+   "BSE::Cache::Memcached" => [ "Cache::Memcached::Fast" ],
+  );
index ccc5bc6..5cc2d3f 100644 (file)
@@ -132,6 +132,14 @@ table.editform td {
   background-color: #FFF;
 }
 
+table.editform tr.bad td {
+  background-color: #FF8080;
+}
+
+table.editform tr.odd td {
+  background-color: #E0E0FF;
+}
+
 table.editform td.help,
 table.editform td.check  {
   white-space: nowrap;
diff --git a/site/templates/admin/modules.tmpl b/site/templates/admin/modules.tmpl
new file mode 100644 (file)
index 0000000..d89976f
--- /dev/null
@@ -0,0 +1,24 @@
+<:wrap admin/xbase.tmpl title => "BSE Modules":>
+<h1>BSE Modules</h1>
+<p>
+| <a href="/cgi-bin/admin/menu.pl">Admin menu</a> 
+| </p>
+
+<p>Versions hash: <:hash:></p>
+
+<table class="editform">
+  <tr>
+    <th>Module</th>
+    <th>Expected</th>
+    <th>Found</th>
+    <th>Error</th>
+  </tr>
+<:iterator begin modules:>
+  <tr <:switch:><:case module error:>class="bad"<:case arithmetic [module_index] % 2:>class="odd"<:endswitch:>>
+    <td><:module name:></td>
+    <td><:module version:></td>
+    <td><:module found:></td>
+    <td><:switch:><:case module error:><:module error:><:case default:><:module notes:><:endswitch:></td>
+  </tr>
+<:iterator end modules:>
+</table>
\ No newline at end of file
index 29655c6..c221269 100644 (file)
@@ -6,6 +6,7 @@ my %vers;
 my @check = `svn status`;
 chomp @check;
 @check = sort grep /cgi-bin\/.*\.pm$/, @check;
+@check = grep !m(BSE/Modules\.pm), @check;
 my @errors;
 for my $check (@check) {
   $check =~ /^D/ and next;
diff --git a/site/util/make_versions.pl b/site/util/make_versions.pl
new file mode 100644 (file)
index 0000000..85522cf
--- /dev/null
@@ -0,0 +1,61 @@
+#!perl -w
+use strict;
+use ExtUtils::Manifest qw(maniread);
+use File::Slurp;
+use Digest::MD5;
+
+my $files = maniread;
+
+my $outname = shift
+  or die "Usage: $0 outfilename\n";
+
+my @files = sort grep /cgi-bin.*\.pm/, keys %$files;
+
+@files = grep !m(BSE/Modules\.pm$), @files;
+
+my %versions;
+
+my $md5 = Digest::MD5->new;
+
+for my $file (@files) {
+  my $content = read_file($file);
+
+  my $module = $file;
+  $module =~ s(^site/cgi-bin/modules/(.*)\.pm$)($1)
+    or die "Can't convert $file to module\n";
+  $module =~ s(/)(::)g;
+
+  $content =~ /^our \$VERSION = "([0-9.]+)";/m
+    or die "No version found in $file\n";
+
+  $versions{$module} = $1;
+
+  $md5->add("$module=$1\n");
+}
+
+my $hash = $md5->hexdigest;
+
+open my $out, ">", $outname
+  or die "Cannot create $outname: $!\n";
+
+print $out <<EOS;
+package BSE::Modules;
+use strict;
+
+# automatically generated
+
+our \$hash = "$hash";
+
+our %versions =
+  (
+EOS
+
+for my $module (sort keys %versions) {
+  print $out qq/  "$module" => "$versions{$module}",\n/;
+}
+
+print $out <<EOS;
+  );
+
+1;
+EOS