function dirReport($path) { $output = array(); $curdir = scandir($path); foreach ($curdir as $k => $v) { if (!in_array($v, array('.', '..'))) { if (is_dir($path . DIRECTORY_SEPARATOR . $v)) { $output[$v] = dirReport($path . DIRECTORY_SEPARATOR . $v); } else { $output[] = $v; } } } return $output; }
function releaseView($custom = false) { //Scan folder, compare to existing results, and process any new additions. $saveLog = $GLOBALS['cfg_save_path'] . DIRECTORY_SEPARATOR . 'metadata_dirscan.json'; if ($GLOBALS['custom']) { $scanpath = $GLOBALS['custom']; } else { $scanpath = $GLOBALS['cfg_remote_path']; } $first = false; if (!file_exists($saveLog)) { ifecho('First time running check. Building index. This may take a few minutes...'); $first = true; } //Use dirReport function to recursively scan path. scanLog("Checking for new XML files..."); $report = dirReport($scanpath); //Filter out for only XML files. $xmlreport = findXml($report); //Compare XML report with previous report to find new XML files. if (!($compare = json_decode(file_get_contents($saveLog), true))) { $compare = array(); } if ($first) { $diff = $xmlreport; } else { if (array_key_exists($scanpath, $compare) && is_array($compare) && is_array($compare[$scanpath])) { $diff = array_diff($xmlreport, $compare[$scanpath]); } else { $diff = $xmlreport; } } //Save results in changelog for future check. $compare[$scanpath] = $xmlreport; file_put_contents($saveLog, json_encode($compare, JSON_PRETTY_PRINT)); if (!count($diff)) { //No differences, append the log and exit. scanLog('No new XML files found.'); return true; } else { //There are differences. Determine what they are and act. scanLog('New XML files found, begin processing...'); //Pass the list of new XMLs and the directory report to be parsed. $total = releaseProcess($diff, $report); scanLog("Processing complete. " . $total . " XML files processed."); } }
<td align="center" style="width: 225px;"><?php echo $mbstringPresent; ?></td> </tr> <tr> <td style="width: 209px;">/application/config <?php $clang->eT("directory"); ?></td> <td align="center" style="width: 225px;"><?php $clang->eT("Found & writable"); ?></td> <td align="center" style="width: 225px;"><?php echo dirReport($configPresent,$configWritable,$clang); ?></td> </tr> <tr> <td style="width: 209px;">/upload <?php $clang->eT("directory"); ?></td> <td align="center" style="width: 225px;"><?php $clang->eT("Found & writable"); ?></td> <td align="center" style="width: 225px;"><?php echo dirReport($uploaddirPresent,$uploaddirWritable,$clang); ?></td> </tr> <tr> <td style="width: 209px;">/tmp <?php $clang->eT("directory"); ?></td> <td align="center" style="width: 225px;"><?php $clang->eT("Found & writable"); ?></td> <td align="center" style="width: 225px;"><?php echo dirReport($tmpdirPresent,$tmpdirWritable,$clang); ?></td> </tr> </table> </fieldset> <fieldset class="content-table"> <legend class="content-table-heading"><?php $clang->eT('Optional modules'); ?></legend> <table style="width: 671px; margin-top: 0px; border-top-width: 1px;" > <tr> <td style="width: 209px;"> </td> <td align="center" style="width: 225px;"><b><?php $clang->eT('Recommended'); ?></b></td> <td align="center" style="width: 225px;"><b><?php $clang->eT('Current'); ?></b></td> </tr> <tr> <td style="width: 209px;">PHP5 GD library</td> <td align="center" style="width: 225px;"><img src="<?php echo Yii::app()->baseUrl; ?>/installer/images/tick-right.png" alt="Check" /></td>
<td><?php echo dirReport($uploaddirPresent, $uploaddirWritable); ?> </td> </tr> <tr> <td>/tmp <?php eT("directory"); ?> </td> <td><?php eT("Found & writable"); ?> </td> <td><?php echo dirReport($tmpdirPresent, $tmpdirWritable); ?> </td> </tr> <tr> <td><?php eT("Session writable"); ?> </td> <td><span class='fa fa-check text-success' alt="Yes"></span></td> <td><?php echo $sessionWritableImg; if (!$sessionWritable) { echo '<br/>session.save_path: ' . session_save_path(); } ?>
<td align="center" style="width: 225px;"><?php echo dirReport($uploaddirPresent, $uploaddirWritable, $clang); ?> </td> </tr> <tr> <td style="width: 209px;">/tmp <?php $clang->eT("directory"); ?> </td> <td align="center" style="width: 225px;"><?php $clang->eT("Found & writable"); ?> </td> <td align="center" style="width: 225px;"><?php echo dirReport($tmpdirPresent, $tmpdirWritable, $clang); ?> </td> </tr> <tr> <td style="width: 209px;"><?php $clang->eT("Session writable"); ?> </td> <td align="center" style="width: 225px;"><img src="<?php echo Yii::app()->baseUrl; ?> /installer/images/tick-right.png" alt="Check" /></td> <td align="center" style="width: 225px;"><?php echo $sessionWritableImg; if (!$sessionWritable) {
<td><?php echo $bJSONPresent; ?></td> </tr> <tr> <td>/application/config <?php $clang->eT("directory"); ?></td> <td><?php $clang->eT("Found & writable"); ?></td> <td><?php echo dirReport($configPresent,$configWritable,$clang); ?></td> </tr> <tr> <td>/upload <?php $clang->eT("directory"); ?></td> <td><?php $clang->eT("Found & writable"); ?></td> <td><?php echo dirReport($uploaddirPresent,$uploaddirWritable,$clang); ?></td> </tr> <tr> <td>/tmp <?php $clang->eT("directory"); ?></td> <td><?php $clang->eT("Found & writable"); ?></td> <td><?php echo dirReport($tmpdirPresent,$tmpdirWritable,$clang); ?></td> </tr> <tr> <td><?php $clang->eT("Session writable"); ?></td> <td><img src="<?php echo Yii::app()->baseUrl; ?>/installer/images/tick-right.png" alt="Check" /></td> <td><?php echo $sessionWritableImg; if (!$sessionWritable) echo '<br/>session.save_path: ' . session_save_path(); ?></td> </tr> </tbody> </table> </fieldset> <fieldset> <legend><?php $clang->eT('Optional modules'); ?></legend> <table class='table-striped'> <thead> <tr> <th> </th>