Only record database activity, if we got a version

This commit is contained in:
Deon George 2023-03-03 12:15:20 +11:00
parent 2c0bef1050
commit c8398cb0cb

View File

@ -24,16 +24,16 @@ class VersionController extends Controller
// v1.2.3-xxx-abcdef01 // v1.2.3-xxx-abcdef01
Log::info(sprintf('Connection from [%s] reporting version [%s]',$this->getUserIpAddr(),$version)); Log::info(sprintf('Connection from [%s] reporting version [%s]',$this->getUserIpAddr(),$version));
$so = Site::firstOrCreate([
'ip_address'=>$this->getUserIpAddr()
]);
$vo = new SiteVersion;
$vo->version = $version;
$so->versions()->save($vo);
$matches = []; $matches = [];
if (preg_match(self::VERSION_REGEX,$version,$matches)) { if (preg_match(self::VERSION_REGEX,$version,$matches)) {
$so = Site::firstOrCreate([
'ip_address'=>$this->getUserIpAddr()
]);
$vo = new SiteVersion;
$vo->version = $version;
$so->versions()->save($vo);
// If xxx is "dev" we are a development version // If xxx is "dev" we are a development version
switch($matches[3]) { switch($matches[3]) {
case 'dev': case 'dev':