.

SystemupdateController Class Reference
[SystemUpdate]

Controller for system update calls. More...

Inheritance diagram for SystemupdateController:
ControllerBase IController IEventSink

List of all members.

Public Member Functions

  action_systemupdate_update (PageData $page_data)
  Update System.
  get_routes ()
  Returns array of IRoute this controller takes responsibility.

Protected Member Functions

  do_update_console ($page_data)
  Actually do the updates, invoked from commandline.
  do_update_form (FormHandler $formhandler, PageData $page_data)
  Actually do the updates.
  execute_updates ()
  Execute updates.

Detailed Description

Controller for system update calls.

This controller defines only one route: systemupdate. It an be invokes through the command line using the Console module or through the web browser. In later case you need to define SYSTEMUPDATE_PWD, a password the user has to provide to execute the update

Author:
Gerd Riesselmann

Definition at line 13 of file systemupdate.controller.php.


Member Function Documentation

SystemupdateController::action_systemupdate_update ( PageData page_data  ) 

Update System.

Parameters:
PageData  $page_data

Definition at line 28 of file systemupdate.controller.php.

00028                                                                         {
00029                 if (class_exists('Console') && Console::is_console_request()) {
00030                         $this->do_update_console($page_data);   
00031                 }
00032                 else if (defined('SYSTEMUPDATE_PWD')) {
00033                         Load::tools('formhandler');
00034                         $formhandler = new FormHandler('frmsystemupdate');
00035                         if ($page_data->has_post_data()) {
00036                                 // Execute Update
00037                                 $this->do_update_form($formhandler, $page_data);          
00038                         }
00039                         else {
00040                                 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'core::systemupdate/auth', $page_data);
00041                                 $formhandler->prepare_view($view);
00042                                 $view->render();
00043                         }
00044                 }
00045                 else {
00046                         return CONTROLLER_NOT_FOUND;
00047                 }
00048         }
SystemupdateController::do_update_console ( page_data  )  [protected]

Actually do the updates, invoked from commandline.

Definition at line 77 of file systemupdate.controller.php.

00077                                                          {
00078                 $logs = $this->execute_updates();
00079                 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'systemupdate/log_console', $page_data);
00080                 $view->assign('logs', $logs);
00081                 $view->render();
00082         }
SystemupdateController::do_update_form ( FormHandler formhandler,
PageData page_data  
) [protected]

Actually do the updates.

Parameters:
FormHandler  $formhandler
PageData  $pagedata

Definition at line 56 of file systemupdate.controller.php.

00056                                                                                          {
00057                 $err = $formhandler->validate();
00058                 if ($err->is_ok()) {
00059                         if ($page_data->get_post()->get_item('a') == SYSTEMUPDATE_PWD) {
00060                                 $logs = $this->execute_updates();
00061                 
00062                                 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'systemupdate/log', $page_data);
00063                                 $view->assign('logs', $logs);
00064                                 $view->render();
00065                                 return; 
00066                         }
00067                         else {
00068                                 $err->append(tr('Sorry, try again', 'systemupdate'));
00069                         }                       
00070                 }
00071                 $formhandler->finish($err);
00072         }
SystemupdateController::execute_updates (  )  [protected]

Execute updates.

Returns:
array Array of log entries

Definition at line 89 of file systemupdate.controller.php.

00089                                              {
00090                 Load::components('systemupdateexecutor');
00091                 $executor = new SystemUpdateExecutor();
00092                 return $executor->execute_updates();
00093         }
SystemupdateController::get_routes (  ) 

Returns array of IRoute this controller takes responsibility.

Reimplemented from ControllerBase.

Definition at line 17 of file systemupdate.controller.php.

00017                                      {
00018                 return array(
00019                         new ExactMatchRoute('https://systemupdate', $this, 'systemupdate_update', new NoCacheCacheManager()),
00020                 );
00021         }

The documentation for this class was generated from the following file: