예제 #1
0
파일: Manager.php 프로젝트: bolt/bolt
 /**
  * Clear a log.
  *
  * @param string $log
  *
  * @throws \UnexpectedValueException
  */
 public function clear($log)
 {
     if ($log === 'change') {
         $this->changeRepository->clearLog();
     } elseif ($log === 'system') {
         $this->systemRepository->clearLog();
     } else {
         throw new \UnexpectedValueException("Invalid log type requested: {$log}");
     }
     $this->app['logger.system']->info(ucfirst($log) . ' log cleared.', ['event' => 'security']);
 }
예제 #2
0
파일: Manager.php 프로젝트: Twiebie/bolt
 /**
  * Get a specific activity log.
  *
  * @param string  $log     The log to query.  Either 'change' or 'system'
  * @param integer $page
  * @param integer $amount  Number of results to return
  * @param array   $options
  *
  * @throws \UnexpectedValueException
  *
  * @return array
  */
 public function getActivity($log, $page = 1, $amount = 10, $options = [])
 {
     if ($log == 'change') {
         $rows = $this->changeRepository->getActivity($page, $amount, $options);
         $rowcount = $this->changeRepository->getActivityCount($options);
     } elseif ($log == 'system') {
         $rows = $this->systemRepository->getActivity($page, $amount, $options);
         $rowcount = $this->systemRepository->getActivityCount($options);
     } else {
         throw new \UnexpectedValueException("Invalid log type requested: {$log}");
     }
     // Set up the pager
     $pager = ['for' => 'activity', 'count' => $rowcount, 'totalpages' => ceil($rowcount / $amount), 'current' => $page, 'showing_from' => ($page - 1) * $amount + 1, 'showing_to' => ($page - 1) * $amount + count($rows)];
     $this->app['storage']->setPager('activity', $pager);
     return $rows;
 }