Example #1
0
 /**
  * Unlock sync and view sync log for project
  *
  * @return  void
  */
 public function fixsyncTask()
 {
     $id = Request::getVar('id', 0);
     $service = 'google';
     // Initiate extended database class
     $obj = new Tables\Project($this->database);
     if (!$id or !$obj->loadProject($id)) {
         App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_PROJECTS_NOTICE_ID_NOT_FOUND'), 'error');
         return;
     }
     // Unlock sync
     $obj->saveParam($id, $service . '_sync_lock', '');
     // Get log file
     $repodir = Helpers\Html::getProjectRepoPath($obj->alias, 'logs');
     $sfile = $repodir . DS . 'sync.' . Date::format('Y-m') . '.log';
     if (file_exists($sfile)) {
         // Serve up file
         $server = new \Hubzero\Content\Server();
         $server->filename($sfile);
         $server->disposition('attachment');
         $server->acceptranges(false);
         $server->saveas('sync.' . Date::format('Y-m') . '.txt');
         $result = $server->serve_attachment($sfile, 'sync.' . Date::format('Y-m') . '.txt', false);
         exit;
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&task=edit&id=' . $id, false), Lang::txt('Sync log unavailable'));
 }