Exemplo n.º 1
0
 private static function core_storage_init_process()
 {
     $pso = pts_storage_object::recover_from_file(PTS_CORE_STORAGE);
     if ($pso == false) {
         $pso = new pts_storage_object(true, true);
     }
     // OpenBenchmarking.org - GSID
     $global_gsid = $pso->read_object('global_system_id');
     $global_gsid_e = $pso->read_object('global_system_id_e');
     $global_gsid_p = $pso->read_object('global_system_id_p');
     if (empty($global_gsid) || pts_openbenchmarking::is_valid_gsid_format($global_gsid) == false) {
         // Global System ID for anonymous uploads, etc
         $requested_gsid = true;
         $global_gsid = pts_openbenchmarking_client::request_gsid();
         if (is_array($global_gsid)) {
             $pso->add_object('global_system_id', $global_gsid['gsid']);
             // GSID
             $pso->add_object('global_system_id_p', $global_gsid['gsid_p']);
             // GSID_P
             $pso->add_object('global_system_id_e', $global_gsid['gsid_e']);
             // GSID_E
             pts_define('PTS_GSID', $global_gsid['gsid']);
             pts_define('PTS_GSID_E', $global_gsid['gsid_e']);
         }
     } else {
         if (pts_openbenchmarking::is_valid_gsid_e_format($global_gsid_e) == false || pts_openbenchmarking::is_valid_gsid_p_format($global_gsid_p) == false) {
             pts_define('PTS_GSID', $global_gsid);
             $requested_gsid = false;
             $global_gsid = pts_openbenchmarking_client::retrieve_gsid();
             if (is_array($global_gsid)) {
                 $pso->add_object('global_system_id_p', $global_gsid['gsid_p']);
                 // GSID_P
                 $pso->add_object('global_system_id_e', $global_gsid['gsid_e']);
                 // GSID_E
                 pts_define('PTS_GSID_E', $global_gsid['gsid_e']);
             }
         } else {
             pts_define('PTS_GSID', $global_gsid);
             pts_define('PTS_GSID_E', $global_gsid_e);
             $requested_gsid = false;
         }
     }
     $machine_self_id = $pso->read_object('machine_self_id');
     if (empty($machine_self_id)) {
         $ns = md5('phoronix-test-suite');
         $binary_ns = null;
         for ($i = 0; $i < strlen($ns); $i += 2) {
             $binary_ns .= chr(hexdec($ns[$i] . $ns[$i + 1]));
         }
         $msi_hash = sha1($binary_ns . uniqid(PTS_CORE_VERSION, true) . getenv('USERNAME') . getenv('USER') . getenv('HOSTNAME') . pts_network::get_local_ip());
         $machine_self_id = sprintf('%08s-%04s-%04x-%04x-%12s', substr($msi_hash, 0, 8), substr($msi_hash, 8, 4), hexdec(substr($msi_hash, 12, 4)) & 0xfff | 0x5000, hexdec(substr($msi_hash, 16, 4)) & 0x3fff | 0x8000, substr($msi_hash, 20, 12));
         // machine_self_id is self-generated unique name for Phoromatic/OB purposes in UUIDv5 format
         $pso->add_object('machine_self_id', $machine_self_id);
     }
     pts_define('PTS_MACHINE_SELF_ID', $machine_self_id);
     // Last Run Processing
     $last_core_version = $pso->read_object('last_core_version');
     pts_define('FIRST_RUN_ON_PTS_UPGRADE', $last_core_version != PTS_CORE_VERSION);
     if (FIRST_RUN_ON_PTS_UPGRADE || $pso->read_object('last_php_version') != PTS_PHP_VERSION) {
         // Report any missing/recommended extensions
         self::program_requirement_checks();
     }
     if (FIRST_RUN_ON_PTS_UPGRADE) {
         if ($requested_gsid == false) {
             pts_openbenchmarking_client::update_gsid();
         }
         pts_client::build_temp_cache();
     }
     $pso->add_object('last_core_version', PTS_CORE_VERSION);
     // PTS version last run
     $pso->add_object('last_php_version', PTS_PHP_VERSION);
     // PHP version last run
     //$last_pts_version = $pso->read_object('last_pts_version');
     // do something here with $last_pts_version if you want that information
     $pso->add_object('last_pts_version', PTS_VERSION);
     // PTS version last run
     // Last Run Processing
     $last_run = $pso->read_object('last_run_time');
     pts_define('IS_FIRST_RUN_TODAY', substr($last_run, 0, 10) != date('Y-m-d'));
     $pso->add_object('last_run_time', date('Y-m-d H:i:s'));
     // Time PTS was last run
     pts_define('TIME_SINCE_LAST_RUN', ceil((time() - strtotime($last_run)) / 60));
     // TIME_SINCE_LAST_RUN is in minutes
     // User Agreement Checking
     $agreement_cs = $pso->read_object('user_agreement_cs');
     $pso->add_object('user_agreement_cs', $agreement_cs);
     // User agreement check-sum
     // Phodevi Cache Handling
     $phodevi_cache = $pso->read_object('phodevi_smart_cache');
     if ($phodevi_cache instanceof phodevi_cache && pts_client::read_env('NO_PHODEVI_CACHE') == false) {
         $phodevi_cache = $phodevi_cache->restore_cache(PTS_USER_PATH, PTS_CORE_VERSION);
         phodevi::set_device_cache($phodevi_cache);
         if ($external_phodevi_cache = pts_client::read_env('EXTERNAL_PHODEVI_CACHE')) {
             if (is_dir($external_phodevi_cache) && is_file($external_phodevi_cache . '/core.pt2so')) {
                 $external_phodevi_cache .= '/core.pt2so';
             }
             if (is_file($external_phodevi_cache)) {
                 $external_phodevi_cache = pts_storage_object::force_recover_from_file($external_phodevi_cache);
                 if ($external_phodevi_cache != false) {
                     $external_phodevi_cache = $external_phodevi_cache->read_object('phodevi_smart_cache');
                     $external_phodevi_cache = $external_phodevi_cache->restore_cache(null, PTS_CORE_VERSION);
                     if ($external_phodevi_cache != false) {
                         //unset($external_phodevi_cache['system']['operating-system']);
                         //unset($external_phodevi_cache['system']['vendor-identifier']);
                         phodevi::set_device_cache($external_phodevi_cache);
                     }
                 }
             }
         }
     }
     // Archive to disk
     $pso->save_to_file(PTS_CORE_STORAGE);
 }
Exemplo n.º 2
0
 private static function set_user_context($context_script, $trigger, $schedule_id, $process)
 {
     if (!empty($context_script)) {
         $context_file = pts_client::create_temporary_file();
         file_put_contents($context_file, $context_script);
         chmod($context_file, 0755);
         pts_file_io::mkdir(pts_module::save_dir());
         $storage_path = pts_module::save_dir() . 'memory.pt2so';
         $storage_object = pts_storage_object::recover_from_file($storage_path);
         $notes_log_file = pts_module::save_dir() . sha1($trigger . $schedule_id . $process);
         // We check to see if the context was already set but the system rebooted or something in that script
         if ($storage_object == false) {
             $storage_object = new pts_storage_object(true, true);
         } else {
             if ($storage_object->read_object('last_set_context_trigger') == $trigger && $storage_object->read_object('last_set_context_schedule') == $schedule_id && $storage_object->read_object('last_set_context_process') == $process) {
                 // If the script already ran once for this trigger, don't run it again
                 self::check_user_context_log($trigger, $schedule_id, $process, $notes_log_file, null);
                 return false;
             }
         }
         $storage_object->add_object('last_set_context_trigger', $trigger);
         $storage_object->add_object('last_set_context_schedule', $schedule_id);
         $storage_object->add_object('last_set_context_process', $process);
         $storage_object->save_to_file($storage_path);
         phoromatic::update_system_status('Setting context for: ' . $schedule_id . ' - ' . $trigger . ' - ' . $process);
         // Run the set context script
         $env_vars['PHOROMATIC_TRIGGER'] = $trigger;
         $env_vars['PHOROMATIC_SCHEDULE_ID'] = $schedule_id;
         $env_vars['PHOROMATIC_SCHEDULE_PROCESS'] = $process;
         $env_vars['PHOROMATIC_LOG_FILE'] = $notes_log_file;
         $log_output = pts_client::shell_exec('./' . $context_script . ' ' . $trigger . ' 2>&1', $env_vars);
         self::check_user_context_log($trigger, $schedule_id, $process, $notes_log_file, $log_output);
         // Just simply return true for now, perhaps check exit code status and do something
         return true;
     }
     return false;
 }
 public static function prepare_database($read_only = false)
 {
     self::$json_storage = self::phoromatic_path() . 'phoromatic-settings.pt2so';
     if (!is_file(self::$json_storage)) {
         $pt2so = new pts_storage_object();
         $pt2so->save_to_file(self::$json_storage);
     }
     $db_file = self::phoromatic_path() . 'phoromatic.db';
     $db_flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE;
     if ($read_only && is_file($db_file)) {
         $db_flags = SQLITE3_OPEN_READONLY;
     }
     self::$db = new SQLite3($db_file, $db_flags);
     self::$db->busyTimeout(10000);
     if ($read_only && is_file($db_file)) {
         return true;
     }
     switch (self::read_database_version()) {
         case 0:
             // Account Database
             self::$db->exec('CREATE TABLE phoromatic_accounts (AccountID TEXT PRIMARY KEY, ValidateID TEXT NOT NULL, CreatedOn TEXT NOT NULL, Salt TEXT NOT NULL)');
             self::$db->exec('CREATE TABLE phoromatic_account_settings (AccountID TEXT PRIMARY KEY, ArchiveResultsLocally INTEGER, UploadSystemLogs INTEGER DEFAULT 1, RunInstallCommand INTEGER DEFAULT 1, ForceInstallTests INTEGER, SystemSensorMonitoring INTEGER)');
             self::$db->exec('CREATE TABLE phoromatic_users (UserID TEXT PRIMARY KEY, AccountID TEXT NOT NULL, UserName TEXT UNIQUE, Email TEXT, Password TEXT NOT NULL, CreatedOn TEXT NOT NULL, LastLogin TEXT, LastIP TEXT)');
             self::$db->exec('CREATE TABLE phoromatic_schedules (AccountID TEXT, ScheduleID INTEGER, Title TEXT, Description TEXT, State INTEGER, ActiveOn TEXT, RunAt TEXT, SetContextPreInstall TEXT, SetContextPostInstall TEXT, SetContextPreRun TEXT, SetContextPostRun TEXT, LastModifiedBy TEXT, LastModifiedOn TEXT, PublicKey TEXT, UNIQUE(AccountID, ScheduleID) ON CONFLICT IGNORE)');
             //self::$db->exec('CREATE TABLE phoromatic_schedules_systems (AccountID TEXT UNIQUE, ScheduleID INTEGER UNIQUE, SystemID TEXT UNIQUE)');
             self::$db->exec('CREATE TABLE phoromatic_schedules_tests (AccountID TEXT, ScheduleID INTEGER, TestProfile TEXT, TestArguments TEXT, TestDescription TEXT, UNIQUE(AccountID, ScheduleID, TestProfile, TestArguments) ON CONFLICT REPLACE)');
             self::$db->exec('CREATE TABLE phoromatic_schedules_triggers (AccountID TEXT, ScheduleID INTEGER, Trigger TEXT, TriggerTarget TEXT, TriggeredOn TEXT, UNIQUE(AccountID, ScheduleID, Trigger) ON CONFLICT IGNORE)');
             self::$db->exec('CREATE TABLE phoromatic_user_settings (AccountID TEXT, UserID TEXT, NotifyOnResultUploads INTEGER, NotifyOnWarnings INTEGER, NotifyOnNewSystems INTEGER, UNIQUE(AccountID, UserID) ON CONFLICT IGNORE)');
             self::$db->exec('CREATE TABLE phoromatic_systems (AccountID TEXT, SystemID TEXT, Title TEXT, Description TEXT, Groups TEXT, Hardware TEXT, Software TEXT, ClientVersion TEXT, GSID TEXT, CurrentTask TEXT, EstimatedTimeForTask TEXT, CreatedOn TEXT, LastCommunication TEXT, LastIP TEXT, State INTEGER, LocalIP TEXT, NetworkMAC TEXT, Flags TEXT, UNIQUE(AccountID, SystemID) ON CONFLICT IGNORE)');
             self::$db->exec('CREATE TABLE phoromatic_system_warnings (AccountID TEXT, SystemID TEXT, Warning TEXT, WarningTime TEXT)');
             self::$db->exec('CREATE TABLE phoromatic_results (AccountID TEXT, UploadID INTEGER, ScheduleID INTEGER, Trigger TEXT, UploadTime TEXT, Title TEXT, OpenBenchmarkingID TEXT, SystemID TEXT, UNIQUE(AccountID, UploadID) ON CONFLICT IGNORE)');
             self::$db->exec('CREATE TABLE phoromatic_groups (AccountID TEXT, GroupName TEXT, Description TEXT, UNIQUE(AccountID, GroupName) ON CONFLICT IGNORE)');
             self::$db->exec('PRAGMA user_version = 1');
         case 1:
             // phoromatic_results changes for schema mostly from OB
             // Changes made 20 September / post 5.4-M1
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN Description TEXT');
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN SystemCount INTEGER');
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN ResultCount INTEGER');
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN DisplayStatus INTEGER DEFAULT 1');
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN TimesViewed INTEGER DEFAULT 0');
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN XmlUploadHash TEXT');
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN ComparisonHash TEXT');
             // Add phoromatic_results_results as test_results_results equivalent from OB
             self::$db->exec('CREATE TABLE phoromatic_results_results (AccountID TEXT, UploadID INTEGER, AbstractID INTEGER, TestProfile TEXT, ComparisonHash TEXT, UNIQUE(AccountID, UploadID, AbstractID) ON CONFLICT IGNORE)');
             self::$db->exec('CREATE TABLE phoromatic_results_systems (AccountID TEXT, UploadID INTEGER, SystemIdentifier TEXT, Hardware TEXT, Software TEXT, UNIQUE(AccountID, UploadID, SystemIdentifier) ON CONFLICT IGNORE)');
             self::$db->exec('PRAGMA user_version = 2');
         case 2:
             // Change made 4 October to introduce machine self ID as a new identifier for local systems without Internet not having OpenBenchmarking.org GSID, etc
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN MachineSelfID TEXT');
             self::$db->exec('PRAGMA user_version = 3');
         case 3:
             // Change made 8 October for targeting the SystemID / GroupNames of systems to test in schedules
             self::$db->exec('ALTER TABLE phoromatic_schedules ADD COLUMN RunTargetSystems TEXT');
             self::$db->exec('ALTER TABLE phoromatic_schedules ADD COLUMN RunTargetGroups TEXT');
             self::$db->exec('PRAGMA user_version = 4');
         case 4:
             // Change made 11 October for administrative level
             self::$db->exec('ALTER TABLE phoromatic_users ADD COLUMN AdminLevel INTEGER DEFAULT 1');
             self::$db->exec('PRAGMA user_version = 5');
         case 5:
             self::$db->exec('CREATE TABLE phoromatic_activity_stream (AccountID TEXT, ActivityTime TEXT, ActivityCreator TEXT, ActivityCreatorType TEXT, ActivityEvent TEXT, ActivityEventID TEXT, ActivityEventType TEXT)');
             self::$db->exec('PRAGMA user_version = 6');
         case 6:
             self::$db->exec('CREATE TABLE phoromatic_system_client_errors (AccountID TEXT, SystemID TEXT, UploadTime TEXT, ScheduleID INTEGER, TriggerID TEXT, ErrorMessage TEXT, TestIdentifier TEXT, TestArguments TEXT)');
             self::$db->exec('PRAGMA user_version = 7');
         case 7:
             // Change made 11 October for administrative level
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN UploadResultsToOpenBenchmarking INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 8');
         case 8:
             // Change made 24 November 2014 Wake On LAN info for client systems
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN NetworkWakeOnLAN TEXT');
             self::$db->exec('PRAGMA user_version = 9');
         case 9:
             // Change made 24 November 2014 for new user/account settings
             self::$db->exec('ALTER TABLE phoromatic_user_settings ADD COLUMN NotifyOnHungSystems INTEGER DEFAULT 0');
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN PowerOffWhenDone INTEGER DEFAULT 0');
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN NetworkPowerUpWhenNeeded INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 10');
         case 10:
             // Change made 25 November for user context logging
             self::$db->exec('CREATE TABLE phoromatic_system_context_logs (AccountID TEXT, SystemID TEXT, UploadTime TEXT, ScheduleID INTEGER, TriggerID TEXT, UserContextStep TEXT, UserContextLog TEXT)');
             self::$db->exec('PRAGMA user_version = 11');
         case 11:
             // Change made 27 November for time elapsed during benchmarking
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN ElapsedTime INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 12');
         case 12:
             // Change made 27 November for IP/MAC address claiming to accounts
             self::$db->exec('CREATE TABLE phoromatic_system_association_claims (AccountID TEXT, IPAddress TEXT, NetworkMAC TEXT, CreationTime TEXT, UNIQUE(IPAddress, NetworkMAC) ON CONFLICT IGNORE)');
             self::$db->exec('PRAGMA user_version = 13');
         case 13:
             // Change made 30 November for percent complete
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN TaskPercentComplete INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 14');
         case 14:
             // Change made 1 December for more reporting features
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN CurrentProcessSchedule INTEGER');
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN TimeToNextCommunication INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 15');
         case 15:
             // Change made 1 December for maintenance mode
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN MaintenanceMode INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 16');
         case 16:
             // Change made 31 January for group name
             self::$db->exec('ALTER TABLE phoromatic_accounts ADD COLUMN GroupName TEXT');
             self::$db->exec('PRAGMA user_version = 17');
         case 17:
             // Change made 31 January for Phoromatic Public Result ID
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN PPRID TEXT');
             self::$db->exec('PRAGMA user_version = 18');
         case 18:
             // Change made 31 January for Phoromatic Public Result ID
             self::rebuild_pprid_entries();
             self::$db->exec('CREATE UNIQUE INDEX IF NOT EXISTS public_result_id ON phoromatic_results (PPRID)');
             self::$db->exec('PRAGMA user_version = 19');
         case 19:
             // Change made 31 January
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN LetOtherGroupsViewResults INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 20');
         case 20:
             // Change made 4 February
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN PreSeedTestInstalls INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 21');
         case 21:
             // Change made 8 February
             self::$db->exec('CREATE TABLE phoromatic_benchmark_tickets (AccountID TEXT, TicketID INTEGER, TicketIssueTime TEXT, Title TEXT, ResultIdentifier TEXT, SuiteToRun TEXT, Description TEXT, State INTEGER DEFAULT 1, LastModifiedBy TEXT, LastModifiedOn TEXT, RunTargetSystems TEXT, RunTargetGroups TEXT, UNIQUE(AccountID, TicketID) ON CONFLICT IGNORE)');
             self::$db->exec('PRAGMA user_version = 22');
         case 22:
             // Change made 8 February
             self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN BenchmarkTicketID INTEGER');
             self::$db->exec('PRAGMA user_version = 23');
         case 23:
             // Change made 24 February
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN SystemVariables TEXT');
             self::$db->exec('PRAGMA user_version = 24');
         case 24:
             // Change made 24 February
             self::$db->exec('ALTER TABLE phoromatic_benchmark_tickets ADD COLUMN EnvironmentVariables TEXT');
             self::$db->exec('PRAGMA user_version = 25');
         case 25:
             // Change made 10 March
             self::$db->exec('CREATE TABLE phoromatic_annotations (AccountID TEXT, Type TEXT, ID TEXT, SecondaryID TEXT, AnnotatedTime TEXT, AnnotatedBy TEXT, Annotation TEXT)');
             self::$db->exec('PRAGMA user_version = 26');
         case 26:
             // Change made 26 March
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN BlockPowerOffs INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 27');
         case 27:
             // Change made 27 March
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN PowerOnSystemDaily INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 28');
         case 28:
             // Change made 13 April
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN LetPublicViewResults INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 29');
         case 29:
             // Change made 12 May
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN TickThreadEvent TEXT');
             self::$db->exec('PRAGMA user_version = 30');
         case 30:
             // Change made 3 June
             self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN CoreVersion INTEGER');
             self::$db->exec('PRAGMA user_version = 31');
         case 31:
             // Change made 5 June
             self::$db->exec('CREATE TABLE phoromatic_schedules_trigger_skips (AccountID TEXT, ScheduleID INTEGER, Trigger TEXT, UNIQUE(AccountID, ScheduleID, Trigger) ON CONFLICT IGNORE)');
             self::$db->exec('PRAGMA user_version = 32');
         case 32:
             // Change made 10 June
             self::$db->exec('ALTER TABLE phoromatic_schedules_triggers ADD COLUMN SubTarget TEXT');
             self::$db->exec('PRAGMA user_version = 33');
         case 33:
             // Change made 4 October
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN AutoApproveNewSystems INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 34');
         case 34:
             // Change made 7 January 2016
             self::$db->exec('ALTER TABLE phoromatic_account_settings ADD COLUMN LimitNetworkCommunication INTEGER DEFAULT 0');
             self::$db->exec('PRAGMA user_version = 35');
     }
     chmod($db_file, 0600);
 }
Exemplo n.º 4
0
 private static function set_user_context($context_script, $trigger, $schedule_id, $process)
 {
     if (!empty($context_script)) {
         if (!is_executable($context_script)) {
             if (($context_script = pts_client::executable_in_path($context_script)) == false || !is_executable($context_script)) {
                 return false;
             }
         }
         $storage_path = pts_module::save_dir() . 'memory.pt2so';
         $storage_object = pts_storage_object::recover_from_file($storage_path);
         // We check to see if the context was already set but the system rebooted or something in that script
         if ($storage_object == false) {
             $storage_object = new pts_storage_object(true, true);
         } else {
             if ($storage_object->read_object('last_set_context_trigger') == $trigger && $storage_object->read_object('last_set_context_schedule') == $schedule_id && $storage_object->read_object('last_set_context_process') == $process) {
                 // If the script already ran once for this trigger, don't run it again
                 return false;
             }
         }
         $storage_object->add_object('last_set_context_trigger', $trigger);
         $storage_object->add_object('last_set_context_schedule', $schedule_id);
         $storage_object->add_object('last_set_context_process', $process);
         $storage_object->save_to_file($storage_path);
         // Run the set context script
         exec($context_script . ' ' . $trigger);
         // Just simply return true for now, perhaps check exit code status and do something
         return true;
     }
     return false;
 }