Example #1
0
 public function usherControl($request, $match)
 {
     $title = __('Usher control');
     $action = $match[1];
     if (!empty($action)) {
         if (!in_array($action, array('reload', 'shutdown', 'startup'))) {
             throw new Pluf_HTTP_Error404();
         }
         $msg = null;
         if ($action == 'reload') {
             IDF_Scm_Monotone_Usher::reload();
             $msg = __('Usher configuration has been reloaded');
         } else {
             if ($action == 'shutdown') {
                 IDF_Scm_Monotone_Usher::shutDown();
                 $msg = __('Usher has been shut down');
             } else {
                 IDF_Scm_Monotone_Usher::startUp();
                 $msg = __('Usher has been started up');
             }
         }
         $request->user->setMessage($msg);
         $url = Pluf_HTTP_URL_urlForView('IDF_Views_Admin::usherControl', array(''));
         return new Pluf_HTTP_Response_Redirect($url);
     }
     return Pluf_Shortcuts_RenderToResponse('idf/gadmin/usher/control.html', array('page_title' => $title, 'status' => IDF_Scm_Monotone_Usher::getStatus()), $request);
 }