예제 #1
0
 protected function actionSync()
 {
     $this->render("externalHeader");
     echo "<h1>" . GO::t('syncing', 'dropbox') . "</h1>";
     $sync = new Sync();
     $sync->start();
     echo "<p>" . GO::t('done', 'dropbox') . "</p>";
     $this->render("externalFooter");
 }
예제 #2
0
파일: Sync.php 프로젝트: ajaboa/crmpuan
 /**
  * The code that needs to be called when the cron is running
  * 
  * If $this->enableUserAndGroupSupport() returns TRUE then the run function 
  * will be called for each $user. (The $user parameter will be given)
  * 
  * If $this->enableUserAndGroupSupport() returns FALSE then the 
  * $user parameter is null and the run function will be called only once.
  * 
  * @param CronJob $cronJob
  * @param User $user [OPTIONAL]
  */
 public function run(CronJob $cronJob, User $user = null)
 {
     $stmt = \GO\Dropbox\Model\User::model()->find(FindParams::newInstance()->select());
     $sync = new Model\Sync();
     foreach ($stmt as $dbxUser) {
         try {
             if (!empty($dbxUser->access_token)) {
                 $sync->start($dbxUser->user);
             } else {
                 $sync::log("Skipped user " . $dbxUser->user->username . " because there's no access token");
             }
         } catch (DropboxException $e) {
             $sync::log($e->getMessage());
             $this->_sendMessage($dbxUser, $e, GO::t('syncFailedBody', 'dropbox'));
             //Remove user that does not work anymore so he can reconnect
             //$dbxUser->delete();
         } catch (\Exception $e) {
             $sync::log($e->getMessage());
             //				$this->_sendMessage($dbxUser, $e,"");
         }
     }
 }