diff --git a/e107_admin/fileinspector.php b/e107_admin/fileinspector.php
index c200bf0db..bdb3290e0 100755
--- a/e107_admin/fileinspector.php
+++ b/e107_admin/fileinspector.php
@@ -112,7 +112,8 @@ class file_inspector {
private $coreImageVersion;
var $root_dir;
- var $files = array();
+ private $files = array();
+ private $fileSizes = array();
var $parent;
var $count = array();
var $results = 0;
@@ -130,7 +131,7 @@ class file_inspector {
private $options = array(
'core' => '',
- 'type' =>'list',
+ 'type' => 'tree',
'missing' => 0,
'noncore' => 9,
'oldcore' => 0,
@@ -516,13 +517,11 @@ class file_inspector {
/**
* @param $baseDir string Absolute path to the directory to inspect
- * @return string HTML output of the validated directory structure
*/
protected function inspect($baseDir)
{
$this->inspect_existing($baseDir);
$this->inspect_missing(array_keys($this->files));
- return $this->generateScanResultsHtml();
}
private function inspect_existing($baseDir)
@@ -543,6 +542,7 @@ class file_inspector {
if (empty($relativePath) || $relativePath == $absolutePath) continue;
$this->files[$relativePath] = $this->coreImage->validate($relativePath);
+ $this->fileSizes[$relativePath] = filesize($absolutePath);
$this->updateFileSizeCounter($absolutePath, $this->files[$relativePath]);
}
}
@@ -592,6 +592,9 @@ class file_inspector {
return $category;
}
+ /**
+ * @return string HTML output of the validated directory structure
+ */
private function generateScanResultsHtml()
{
$nestedFiles = [];
@@ -611,8 +614,9 @@ class file_inspector {
$hide = $level;
foreach ($tree as $fileName => $validationCode)
{
- $relativePath = "$parentPath/$fileName";
- $rowId = base64_encode($relativePath);
+ $relativePath = ltrim("$parentPath/$fileName", '/');
+ if ($level === 0) $relativePath = '';
+ $rowId = str_replace(" ", "%20", $relativePath);
list($icon, $title) = $this->getGlyphForValidationCode($validationCode);
$html .= "
";
$html .= "";
@@ -626,6 +630,12 @@ class file_inspector {
$html .= $this->generateDirectoryHtml($validationCode, $level + 1, $relativePath);
$html .= "
";
}
+ else
+ {
+ $html .= '';
+ $html .= isset($this->fileSizes[$relativePath]) ? $this->parsesize($this->fileSizes[$relativePath]) : '';
+ $html .= '';
+ }
$html .= "";
}
@@ -846,7 +856,7 @@ class file_inspector {
'size' => 0,
]
];
- $scan_text = $this->inspect($this->root_dir);
+ $this->inspect($this->root_dir);
array_walk_recursive($this->files, function ($validationCode)
{
@@ -876,7 +886,7 @@ class file_inspector {
$text .= "
- ".$scan_text."
+ ".$this->generateScanResultsHtml()."
|
";
@@ -989,55 +999,19 @@ class file_inspector {
$text .= " ".FR_LAN_23." | ";
}
-
- // print_a($this->files);
- }
-
-
-
-
- foreach ($this->files as $dir_id => $fid)
- {
- ksort($fid);
- $text .= ($this->opt('type') == 'tree') ? " " : "";
- $initial = FALSE;
- foreach ($fid as $key => $stext)
- {
-
- // print_a($stext);
-
- $iconKey = $stext['icon'];
-
- if(!$initial)
- {
- if($this->opt('type') == 'tree')
- {
-
- $rootIconKey = ($stext['level'] ? "folder_up" : "folder_root");
-
- $text .= "getDiz($iconKey)."\" style='padding-left: 4px' ".($stext['level'] ? "onclick=\"sh('f_".$stext['parent']."')\"" : "").">";
- $text .= $this->iconTag[$rootIconKey];
- $text .= ($stext['level'] ? " .." : "")." |
- ";
- $text .= $this->iconTag['folder_close'];
- $text .= " | ";
- }
- }
- else
- {
- if($this->opt('type') != 'tree')
- {
- $stext['file'] = str_replace($this->root_dir."/", "", $stext['file']);
- }
-
- $text .= $this->renderRow($stext);
-
-
- }
- $initial = TRUE;
- }
- $text .= ($this->opt('type') == 'tree') ? " " : "";
- }
+ ksort($this->files);
+ foreach ($this->files as $relativePath => $validation)
+ {
+ list($icon, $title) = $this->getGlyphForValidationCode($validation);
+ $text .= ' ';
+ $text .= "$icon ";
+ $text .= htmlspecialchars($relativePath);
+ $text .= ' | ';
+ $text .= isset($this->fileSizes[$relativePath]) ? $this->parsesize($this->fileSizes[$relativePath]) : '';
+ $text .= ' | ';
+ $text .= ' ';
+ }
+ }
if($this->opt('type') != 'tree') {
$text .= " |
@@ -1057,68 +1031,6 @@ class file_inspector {
}
-
- function renderRow($stext)
- {
-
- $mode = $this->opt('core');
-
- $iconKey = $stext['icon'];
-
- // return "
".$mode." ( ".$iconKey.") |
";
-
-
- if($mode == 'full' && $iconKey == 'file_check' )
- {
- return '';
- }
-
- if($mode == 'none')
- {
- // return '';
- }
-
-
- $text = '';
- $text .= "
-
- getDiz($iconKey)."\">".$this->iconTag[$iconKey]." ".$stext['file']." ";
-
- if($this->opt('regex'))
- {
- if($this->opt('num') || $this->opt('line'))
- {
- $text .= " ";
- }
-
- foreach ($stext['lines'] as $rkey => $rvalue)
- {
- if($this->opt('num'))
- {
- $text .= "[".($rkey + 1)."] ";
- }
-
- if($this->opt('line'))
- {
- $text .= htmlspecialchars($rvalue)." ";
- }
- }
-
- $text .= " ";
- }
- else
- {
- $text .= " |
- ".$this->parsesize($stext['size']);
- }
-
- $text .= " |
";
-
- return $text;
- }
-
-
-
function create_image($dir)
{
global $core_image, $deprecated_image,$coredir;