From: Jakob Sack Date: Fri, 26 Oct 2012 21:13:19 +0000 (+0200) Subject: Add a new backgroundjob class to access the type of background jobs easily X-Git-Tag: v5.0.0alpha1~610 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9cf9d41e51252ae321f264b497b741599c88613d;p=nextcloud-server.git Add a new backgroundjob class to access the type of background jobs easily --- 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 ); + } +}