Fix tool to generate filecheck
This commit is contained in:
parent
7c030a114d
commit
4eedec0274
@ -39,12 +39,14 @@ parse_str($argv[1]);
|
|||||||
$outputfile=dirname(__FILE__).'/../htdocs/install/filelist.xml';
|
$outputfile=dirname(__FILE__).'/../htdocs/install/filelist.xml';
|
||||||
$fp = fopen($outputfile,'w');
|
$fp = fopen($outputfile,'w');
|
||||||
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
|
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
|
||||||
fputs($fp, '<checksum_list>'."\n");
|
fputs($fp, '<checksum_list version="'.$release.'">'."\n");
|
||||||
fputs($fp, '<dolibarr_root_dir version="'.$release.'">'."\n");
|
|
||||||
$dir_iterator = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/');
|
fputs($fp, '<dolibarr_htdocs_dir>'."\n");
|
||||||
$iterator = new RecursiveIteratorIterator($dir_iterator);
|
|
||||||
|
$dir_iterator1 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/');
|
||||||
|
$iterator1 = new RecursiveIteratorIterator($dir_iterator1);
|
||||||
// need to ignore document custom etc
|
// need to ignore document custom etc
|
||||||
$files = new RegexIterator($iterator, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install|nltechno))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install|nltechno))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||||
$dir='';
|
$dir='';
|
||||||
$needtoclose=0;
|
$needtoclose=0;
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
@ -61,7 +63,34 @@ foreach ($files as $file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputs($fp, '</dir>'."\n");
|
fputs($fp, '</dir>'."\n");
|
||||||
fputs($fp, '</dolibarr_root_dir>'."\n");
|
fputs($fp, '</dolibarr_htdocs_dir>'."\n");
|
||||||
|
|
||||||
|
|
||||||
|
fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n");
|
||||||
|
|
||||||
|
$dir_iterator2 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../scripts/');
|
||||||
|
$iterator2 = new RecursiveIteratorIterator($dir_iterator2);
|
||||||
|
// need to ignore document custom etc
|
||||||
|
$files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install|nltechno))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||||
|
$dir='';
|
||||||
|
$needtoclose=0;
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
|
||||||
|
if ($newdir!=$dir) {
|
||||||
|
if ($needtoclose)
|
||||||
|
fputs($fp, '</dir>'."\n");
|
||||||
|
fputs($fp, '<dir name="'.$newdir.'" >'."\n");
|
||||||
|
$dir = $newdir;
|
||||||
|
$needtoclose=1;
|
||||||
|
}
|
||||||
|
if (filetype($file)=="file") {
|
||||||
|
fputs($fp, '<md5file name="'.basename($file).'">'.md5_file($file).'</md5file>'."\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fputs($fp, '</dir>'."\n");
|
||||||
|
fputs($fp, '</dolibarr_script_dir>'."\n");
|
||||||
|
|
||||||
|
|
||||||
fputs($fp, '</checksum_list>'."\n");
|
fputs($fp, '</checksum_list>'."\n");
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,8 @@ $langs->load("admin");
|
|||||||
if (!$user->admin)
|
if (!$user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -76,9 +78,11 @@ if (file_exists($xmlfile))
|
|||||||
{
|
{
|
||||||
$xml = simplexml_load_file($xmlfile);
|
$xml = simplexml_load_file($xmlfile);
|
||||||
if ($xml)
|
if ($xml)
|
||||||
|
{
|
||||||
|
if (is_object($xml->dolibarr_htdocs_dir[0]))
|
||||||
{
|
{
|
||||||
$file_list = array();
|
$file_list = array();
|
||||||
$ret = getFilesUpdated($file_list, $xml->dolibarr_root_dir[0]); // Fill array $file_list
|
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0]); // Fill array $file_list
|
||||||
|
|
||||||
print '<table class="noborder">';
|
print '<table class="noborder">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -87,7 +91,7 @@ if (file_exists($xmlfile))
|
|||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
$var = true;
|
$var = true;
|
||||||
$tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
|
$tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
|
||||||
if (is_array($tmpfilelist))
|
if (is_array($tmpfilelist) && count($tmpfilelist))
|
||||||
{
|
{
|
||||||
foreach ($tmpfilelist as $file)
|
foreach ($tmpfilelist as $file)
|
||||||
{
|
{
|
||||||
@ -98,6 +102,10 @@ if (file_exists($xmlfile))
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr ' . $bc[false] . '><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
||||||
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -112,7 +120,7 @@ if (file_exists($xmlfile))
|
|||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
$var = true;
|
$var = true;
|
||||||
$tmpfilelist = dol_sort_array($file_list['updated'], 'filename');
|
$tmpfilelist = dol_sort_array($file_list['updated'], 'filename');
|
||||||
if (is_array($tmpfilelist))
|
if (is_array($tmpfilelist) && count($tmpfilelist))
|
||||||
{
|
{
|
||||||
foreach ($tmpfilelist as $file)
|
foreach ($tmpfilelist as $file)
|
||||||
{
|
{
|
||||||
@ -126,18 +134,36 @@ if (file_exists($xmlfile))
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr ' . $bc[false] . '><td colspan="5">'.$langs->trans("None").'</td></tr>';
|
||||||
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print 'Error: Failed to parse XML for input file '.$xmlfile;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans('XmlNotFound') . ': ' . $xmlfile;
|
print $langs->trans('XmlNotFound') . ': ' . $xmlfile;
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
exit($error);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to get list of updated or modified files.
|
* Function to get list of updated or modified files.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user