Elgg  Version 6.2
Result.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Upgrade;
4 
10 final class Result {
11 
12  private $errors = [];
13 
14  private $failure_count = 0;
15 
16  private $success_count = 0;
17 
18  private $is_complete = false;
19 
27  public function addError($message): void {
28  if (is_array($message)) {
29  $this->errors = $this->errors + $message;
30  } else {
31  $this->errors[] = $message;
32  }
33  }
34 
40  public function getErrors(): array {
41  return $this->errors;
42  }
43 
53  public function addFailures(int $num = 1): void {
54  $this->failure_count += $num;
55  }
56 
62  public function getFailureCount(): int {
63  return $this->failure_count;
64  }
65 
73  public function addSuccesses(int $num = 1): void {
74  $this->success_count += $num;
75  }
76 
82  public function getSuccessCount(): int {
83  return $this->success_count;
84  }
85 
91  public function markComplete(): void {
92  $this->is_complete = true;
93  }
94 
100  public function wasMarkedComplete(): bool {
101  return $this->is_complete === true;
102  }
103 
109  public function toArray(): array {
110  return [
111  'errors' => $this->getErrors(),
112  'numErrors' => $this->getFailureCount(),
113  'numSuccess' => $this->getSuccessCount(),
114  'isComplete' => $this->wasMarkedComplete(),
115  ];
116  }
117 }
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
Definition: actions.php:73
Result of a single BatchUpgrade run.
Definition: Result.php:10
addFailures(int $num=1)
Increment failure count.
Definition: Result.php:53
getErrors()
Get error messages.
Definition: Result.php:40
addSuccesses(int $num=1)
Set an item (or items) as successfully upgraded.
Definition: Result.php:73
markComplete()
Mark the upgrade as complete (not necessarily successful)
Definition: Result.php:91
toArray()
Export to reports array.
Definition: Result.php:109
getSuccessCount()
Get count of successfully upgraded items within the current batch.
Definition: Result.php:82
addError($message)
Add new error message to the batch.
Definition: Result.php:27
wasMarkedComplete()
Has the upgrade been marked complete?
Definition: Result.php:100
getFailureCount()
Get count of failures within the current batch.
Definition: Result.php:62
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
Definition: robots.php:10