Skip to content

Commit

Permalink
Fix for incorrect value comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxudo committed May 22, 2024
1 parent 8600866 commit 8d1e41e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions supported_os_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function index()
{
echo "You've loaded the supported_os module!";
}

public function admin()
{
$obj = new View();
Expand Down Expand Up @@ -89,11 +89,11 @@ public function update_cached_data()

// Get the current time
$current_time = time();

// Save new cache data to the cache table
munkireport\models\Cache::updateOrCreate(
[
'module' => 'supported_os',
'module' => 'supported_os',
'property' => 'yaml',
],[
'value' => $yaml_result,
Expand All @@ -102,7 +102,7 @@ public function update_cached_data()
);
munkireport\models\Cache::updateOrCreate(
[
'module' => 'supported_os',
'module' => 'supported_os',
'property' => 'source',
],[
'value' => $cache_source,
Expand All @@ -111,7 +111,7 @@ public function update_cached_data()
);
munkireport\models\Cache::updateOrCreate(
[
'module' => 'supported_os',
'module' => 'supported_os',
'property' => 'current_os',
],[
'value' => $current_os,
Expand All @@ -120,7 +120,7 @@ public function update_cached_data()
);
munkireport\models\Cache::updateOrCreate(
[
'module' => 'supported_os',
'module' => 'supported_os',
'property' => 'last_update ',
],[
'value' => $current_time,
Expand Down Expand Up @@ -250,7 +250,7 @@ public function get_admin_data()
**/
public function get_data($serial_number = '')
{
$os = new Supported_os_model($serial_number);
$os = new Supported_os_model($serial_number);
jsonView($os->rs);
}
} // End class Supported_os_controller
16 changes: 8 additions & 8 deletions supported_os_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function process($data)
// Save new cache data to the cache table
munkireport\models\Cache::updateOrCreate(
[
'module' => 'supported_os',
'module' => 'supported_os',
'property' => 'yaml',
],[
'value' => $yaml_result,
Expand All @@ -91,7 +91,7 @@ public function process($data)
);
munkireport\models\Cache::updateOrCreate(
[
'module' => 'supported_os',
'module' => 'supported_os',
'property' => 'source',
],[
'value' => $cache_source,
Expand All @@ -100,7 +100,7 @@ public function process($data)
);
munkireport\models\Cache::updateOrCreate(
[
'module' => 'supported_os',
'module' => 'supported_os',
'property' => 'current_os',
],[
'value' => $current_os,
Expand All @@ -109,7 +109,7 @@ public function process($data)
);
munkireport\models\Cache::updateOrCreate(
[
'module' => 'supported_os',
'module' => 'supported_os',
'property' => 'last_update ',
],[
'value' => $current_time,
Expand Down Expand Up @@ -148,7 +148,7 @@ public function process($data)
$this->rs['machine_id'] = $plist['machine_id'];
$this->rs['current_os'] = $plist['current_os'];
$this->rs['last_touch'] = $plist['last_touch'];

} else if($data['reprocess']){
$this->retrieve_record($data['serial_number']);
$this->rs['serial_number'] = $data['serial_number'];
Expand Down Expand Up @@ -205,10 +205,10 @@ public function process($data)
if (array_key_exists($model_family, $shipping_os)) {
// Sort the model ID numbers
krsort($shipping_os[$model_family]);

// Process each model ID number in the model ID family
foreach($shipping_os[$model_family] as $model_check=>$model_os){

// Compare model ID number to shipping OS array, highest first
if ($model_num >= $model_check){
$this->rs['shipping_os'] = $model_os;
Expand Down Expand Up @@ -259,7 +259,7 @@ public function process($data)
// Trigger updated macOS event if not nulls and 'supported_os_show_macos_updated' config is set to true
if(conf('supported_os_show_macos_updated') && ! is_null($stored_current_os) && ! is_null($this->rs['current_os'])){
// and previous version of macOS is different than new version of macOS
if ( $stored_current_os !== $this->rs['current_os']){
if (intval($stored_current_os) !== intval($this->rs['current_os'])){
$this->_storeEvents($stored_current_os, $this->rs['current_os']);
}
}
Expand Down

0 comments on commit 8d1e41e

Please sign in to comment.