diff options
author | icewind1991 <icewind1991@gmail.com> | 2013-06-02 14:29:59 -0700 |
---|---|---|
committer | icewind1991 <icewind1991@gmail.com> | 2013-06-02 14:29:59 -0700 |
commit | 2a81813e44e7530c581b44db6d58d88bd422c511 (patch) | |
tree | 7c8887d256e323278fe86fe7336b23d587243702 /apps | |
parent | 9392d2d58ebfcc9f719dd9777578ab9493ffa488 (diff) | |
parent | 24ab525669e177e37266d5b8a052e4e25990ebf0 (diff) | |
download | nextcloud-server-2a81813e44e7530c581b44db6d58d88bd422c511.tar.gz nextcloud-server-2a81813e44e7530c581b44db6d58d88bd422c511.zip |
Merge pull request #3051 from owncloud/backgroundjob
Reworked background job system.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/appinfo/app.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/appinfo/app.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/jobs.php | 19 |
3 files changed, 11 insertions, 12 deletions
diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index 05ab1722b3e..99739cb4cee 100644 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -20,4 +20,4 @@ OC_Search::registerProvider('OC_Search_Provider_File'); \OC_Hook::connect('OC_Filesystem', 'post_delete', '\OC\Files\Cache\Updater', 'deleteHook'); \OC_Hook::connect('OC_Filesystem', 'post_rename', '\OC\Files\Cache\Updater', 'renameHook'); -\OC_BackgroundJob_RegularTask::register('\OC\Files\Cache\BackgroundWatcher', 'checkNext'); +\OCP\BackgroundJob::addRegularTask('\OC\Files\Cache\BackgroundWatcher', 'checkNext'); diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 81eaa0404b7..593e846bc03 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); } |