From 9cf9d41e51252ae321f264b497b741599c88613d Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Fri, 26 Oct 2012 23:13:19 +0200 Subject: [PATCH] Add a new backgroundjob class to access the type of background jobs easily --- lib/backgroundjob.php | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 lib/backgroundjob.php diff --git a/lib/backgroundjob.php b/lib/backgroundjob.php new file mode 100644 index 00000000000..992a2484ea5 --- /dev/null +++ b/lib/backgroundjob.php @@ -0,0 +1,52 @@ +. +* +*/ + +/** + * This class does the dirty work. + */ +class OC_BackgroundJob{ + /** + * @brief get the type of background jobs + * @return string + * + * This method returns the type how background jobs are executed. If the user + * did not select something, the type is ajax. + */ + public static function getType() { + return OC_Appconfig::getValue( 'core', 'backgroundjobs_mode', 'ajax' ); + } + + /** + * @brief sets the background jobs type + * @param $type type of background jobs + * @return boolean + * + * This method sets the type of the background jobs. Possible types are + * "none", "ajax", "webcron", "cron" + */ + public static function setType( $type ) { + if( !in_array( $type, array('none', 'ajax', 'webcron', 'cron'))){ + return false; + } + return OC_Appconfig::setValue( 'core', 'backgroundjobs_mode', $type ); + } +} -- 2.39.5