This repository was archived by the owner on Sep 19, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 * Hook to run a cron job.
1010 *
1111 * @param array $croninfo Output
12- * @author Dominik Baranek <baranek@ics.muni.cz>
1312 */
1413function perun_hook_cron (&$ croninfo )
1514{
@@ -19,9 +18,15 @@ function perun_hook_cron(&$croninfo)
1918 }
2019 Logger::info ('cron [perun]: Running cron in cron tag [ ' . $ croninfo ['tag ' ] . '] ' );
2120
22- $ challengesDbCmd = new ChallengesDbCmd ();
21+ try {
22+ $ challengesDbCmd = new ChallengesDbCmd ();
2323
24- if (! $ challengesDbCmd ->deleteOldChallenges ()) {
25- Logger::error ('cron [perun]: Error while deleting old challenges from the database. ' );
24+ if (! $ challengesDbCmd ->deleteOldChallenges ()) {
25+ Logger::error ('cron [perun]: Error while deleting old challenges from the database. ' );
26+ }
27+ } catch (\Exception $ e ) {
28+ Logger::info (
29+ 'cron [perun]: Not deleting old challenges from the database because no database is configured or an error occured: ' . $ e ->getMessage ()
30+ );
2631 }
2732}
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ private function __construct()
3232 {
3333 $ configuration = Configuration::getConfig (self ::CONFIG_FILE_NAME );
3434
35- $ this ->config = $ configuration ->getConfigItem (self ::DATABASE , null );
35+ $ this ->config = $ configuration ->getConfigItem (self ::DATABASE );
3636 $ this ->store = $ this ->config ->getConfigItem (self ::STORE , null );
3737
3838 $ this ->whitelistTableName = $ this ->config ->getString (self ::WHITELIST_TABLE_NAME , null );
You can’t perform that action at this time.
0 commit comments