Skip to content

Commit

Permalink
Don't try to load module if there is none
Browse files Browse the repository at this point in the history
  • Loading branch information
Hipska authored and odain-cbd committed Oct 5, 2020
1 parent 9fddc29 commit d010937
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/collector.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,17 @@ protected function GetCharset()
protected function GetVersionFromModuleFile()
{
$aFiles = glob(APPROOT.'collectors/module.*.php');
$sModuleFile = null;
$sModuleFile = reset($aFiles);
if ($sModuleFile == null)
if (!$aFiles)
{
// No module found, use a default value...
$this->sVersion = '1.0.0';
Utils::Log(LOG_INFO, "No module file found, using default version value.");
return;
}

try
{
$sModuleFile = reset($aFiles);
$sModuleFileContents = file_get_contents($sModuleFile);
$sModuleFileContents = str_replace(array('<?php', '?>'), '', $sModuleFileContents);
$sModuleFileContents = str_replace('SetupWebPage::AddModule(', '$this->InitVersionCallback(', $sModuleFileContents);
Expand Down

0 comments on commit d010937

Please sign in to comment.