aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-04-20 23:27:46 +0200
committerRobin Appelman <icewind@owncloud.com>2013-04-20 23:27:46 +0200
commit7948341a86fb08d236bb53f8aece809ae10ba5f2 (patch)
tree61bf8cc11b2212953f5f87216d33a7744869385f /apps
parentd0a5fe1f4a39f21c596293232be19d70ad30652e (diff)
downloadnextcloud-server-7948341a86fb08d236bb53f8aece809ae10ba5f2.tar.gz
nextcloud-server-7948341a86fb08d236bb53f8aece809ae10ba5f2.zip
Rework background job system
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/appinfo/app.php2
-rw-r--r--apps/user_ldap/lib/jobs.php19
2 files changed, 10 insertions, 11 deletions
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index 89410b5ef07..5c8b3ddfb66 100644
--- a/apps/user_ldap/appinfo/app.php
+++ b/apps/user_ldap/appinfo/app.php
@@ -49,7 +49,7 @@ $entry = array(
'name' => 'LDAP'
);
-OCP\Backgroundjob::addRegularTask('OCA\user_ldap\lib\Jobs', 'updateGroups');
+OCP\Backgroundjob::registerJob('OCA\user_ldap\lib\Jobs');
if(OCP\App::isEnabled('user_webdavauth')) {
OCP\Util::writeLog('user_ldap',
'user_ldap and user_webdavauth are incompatible. You may experience unexpected behaviour',
diff --git a/apps/user_ldap/lib/jobs.php b/apps/user_ldap/lib/jobs.php
index 094d11db3d5..60ecc0da33d 100644
--- a/apps/user_ldap/lib/jobs.php
+++ b/apps/user_ldap/lib/jobs.php
@@ -23,20 +23,22 @@
namespace OCA\user_ldap\lib;
-class Jobs {
+class Jobs extends \OC\BackgroundJob\TimedJob {
static private $groupsFromDB;
static private $groupBE;
static private $connector;
+ public function __construct(){
+ $this->interval = self::getRefreshInterval();
+ }
+
+ public function run($argument){
+ Jobs::updateGroups();
+ }
+
static public function updateGroups() {
\OCP\Util::writeLog('user_ldap', 'Run background job "updateGroups"', \OCP\Util::DEBUG);
- $lastUpdate = \OCP\Config::getAppValue('user_ldap', 'bgjUpdateGroupsLastRun', 0);
- if((time() - $lastUpdate) < self::getRefreshInterval()) {
- \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – last run too fresh, aborting.', \OCP\Util::DEBUG);
- //komm runter Werner die Maurer geben ein aus
- return;
- }
$knownGroups = array_keys(self::getKnownGroups());
$actualGroups = self::getGroupBE()->getGroups();
@@ -45,7 +47,6 @@ class Jobs {
\OCP\Util::writeLog('user_ldap',
'bgJ "updateGroups" – groups do not seem to be configured properly, aborting.',
\OCP\Util::INFO);
- \OCP\Config::setAppValue('user_ldap', 'bgjUpdateGroupsLastRun', time());
return;
}
@@ -53,8 +54,6 @@ class Jobs {
self::handleCreatedGroups(array_diff($actualGroups, $knownGroups));
self::handleRemovedGroups(array_diff($knownGroups, $actualGroups));
- \OCP\Config::setAppValue('user_ldap', 'bgjUpdateGroupsLastRun', time());
-
\OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – Finished.', \OCP\Util::DEBUG);
}