diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2024-02-10 09:41:15 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2024-02-10 09:41:15 +0000 |
commit | b0b8c6b6f0fc0c4fe86c4c4bbaf094d0a15d60df (patch) | |
tree | d58db0dc2785f025e6c9b8afcafcfffb55ff5557 /scripts/diag.php | |
parent | 9c250cd88d0629fe7ac16239f5d88290ff2c1a31 (diff) | |
download | pmwiki.svn-b0b8c6b6f0fc0c4fe86c4c4bbaf094d0a15d60df.tar.bz2 |
Update RecipeCheck to also list skins.
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4623 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'scripts/diag.php')
-rw-r--r-- | scripts/diag.php | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/scripts/diag.php b/scripts/diag.php index db9e2a78..0eece6ca 100644 --- a/scripts/diag.php +++ b/scripts/diag.php @@ -1,5 +1,5 @@ <?php if (!defined('PmWiki')) exit(); -/* Copyright 2003-2023 Patrick R. Michaud (pmichaud@pobox.com) +/* Copyright 2003-2024 Patrick R. Michaud (pmichaud@pobox.com) This file is part of PmWiki; 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 @@ -112,10 +112,18 @@ function HandleRecipeCheckCore($pagename, $auth = 'admin') { Abort($msg); } $rinfo['PmWiki:Upgrades'] = $Version; - ScanRecipeInfoCore('cookbook', $cvinfo); + ScanRecipeInfoCore('cookbook', $cvinfo, 'Cookbook:'); + $skindirs = glob("pub/skins/*"); + if($skindirs) foreach($skindirs as $skindir) { + if($skindir[0] == '.') continue; + if(is_dir($skindir)) ScanRecipeInfoCore($skindir, $cvinfo, 'Skins:'); + } foreach((array)$RecipeInfo as $r => $v) { if (!@$v['Version']) continue; - $r = preg_replace('/^(?!PmWiki:)(Cookbook[.:])?/', 'Cookbook:', $r); + if (!preg_match('/:/', $r)) { + $imap = isset($v['InterMap']) ? $v['InterMap'] : 'Cookbook:'; + $r = $imap.$r; + } $rinfo[$r] = $v['Version']; } $markup = "!!Recipe status for {\$PageUrl}\n".RecipeTableCore($rinfo, $cvinfo); @@ -139,21 +147,26 @@ function GetRecipeListCore($list) { } -function ScanRecipeInfoCore($dlistfmt, $cvinfo = NULL) { +function ScanRecipeInfoCore($dlistfmt, $cvinfo = NULL, $imap = 'Cookbook:') { global $RecipeInfo; foreach((array)$dlistfmt as $dir) { $dfp = @opendir($dir); if (!$dfp) continue; while ( ($name = readdir($dfp)) !== false) { if ($name[0] == '.') continue; if (!preg_match('/\\.php/i', $name)) continue; - $text = implode('', @file("$dir/$name")); - if (preg_match("/^\\s*\\\$RecipeInfo\\['(.*?)'\\]\\['Version'\\]\\s*=\\s*'(.*?)'\\s*;/m", $text, $match)) + $text = implode('', (array)@file("$dir/$name")); + if (preg_match("/^\\s*\\\$RecipeInfo\\['(.*?)'\\]\\['Version'\\]\\s*=\\s*'(.*?)'\\s*;/m", $text, $match)) { SDV($RecipeInfo[$match[1]]['Version'], $match[2]); - if (preg_match("/^\\s*SDV\\(\\s*\\\$RecipeInfo\\['(.*?)'\\]\\['Version'\\]\\s*,\\s*'(.*?)'\\s*\\)\\s*\\;/m", $text, $match)) + SDV($RecipeInfo[$match[1]]['InterMap'], $imap); + } + if (preg_match("/^\\s*SDV\\(\\s*\\\$RecipeInfo\\['(.*?)'\\]\\['Version'\\]\\s*,\\s*'(.*?)'\\s*\\)\\s*\\;/m", $text, $match)) { SDV($RecipeInfo[$match[1]]['Version'], $match[2]); + SDV($RecipeInfo[$match[1]]['InterMap'], $imap); + } if (@$cvinfo[$name]) { $r = preg_replace('/^.*:/', '', $cvinfo[$name]); SDV($RecipeInfo[$r]['Version'], "unknown ($name)"); + SDV($RecipeInfo[$r]['InterMap'], $imap); } } closedir($dfp); @@ -163,7 +176,8 @@ function ScanRecipeInfoCore($dlistfmt, $cvinfo = NULL) { function RecipeTableCore($rinfo, $cvinfo) { $fmt = "||%-40s ||%-20s ||%-20s ||\n"; - $out = "||class=recipecheck cellpadding=0 cellspacing=0 width=600\n"; + $out = "||class='recipecheck sortable filterable' " + . "cellpadding=0 cellspacing=0 width=600\n"; $out .= sprintf($fmt, '!Recipe', '!local', '!pmwiki.org'); foreach($rinfo as $r => $lv) { $cv = @$cvinfo[$r]; |