88 $this->logger = $logger;
90 $this->
count = $this->batch->countItems();
91 $this->processed = (int) $upgrade->processed;
92 $this->offset = (
int) $upgrade->offset;
106 $this->upgrade->setStartTime();
123 if ($this->result->getFailureCount()) {
127 $this->upgrade->processed = 0;
128 $this->upgrade->offset = 0;
132 $this->upgrade->setCompleted();
133 $this->result->markComplete();
148 $this->batch->run($this->result, $this->offset);
152 $this->result->addError($e->getMessage());
153 $this->result->addFailures(1);
156 $failure_count = $this->result->getFailureCount();
157 $success_count = $this->result->getSuccessCount();
159 $total = $this->upgrade->processed + $failure_count + $success_count;
161 $progress->advance($total - $this->processed);
163 if ($this->batch->needsIncrementOffset()) {
167 $this->offset = $total;
171 $this->offset = $this->upgrade->offset + $failure_count;
174 $this->processed = $total;
183 $upgrade_name = $this->upgrade->getDisplayName();
185 if ($this->upgrade->isCompleted()) {
186 $ts = $this->upgrade->getCompletedTime();
187 $dt = new \DateTime();
188 $dt->setTimestamp((
int)
$ts);
191 if ($this->result->getFailureCount()) {
195 $this->result->getFailureCount(),
207 foreach ($this->result->getErrors() as
$error) {
238 if ($this->batch->shouldBeSkipped()) {
242 if ($this->result->wasMarkedComplete()) {
251 if (!$this->batch->needsIncrementOffset()) {
253 return ($this->batch->countItems() - $this->result->getFailureCount()) <= 0;
Exception thrown if an error which can only be found on runtime occurs.
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
__construct(\ElggUpgrade $upgrade, Result $result, Progress $progress, Logger $logger)
Constructor.
canContinue($started, $max_duration=null)
Check if the loop cand and should continue.
runBatch(ProgressBar $progress)
Run batch.
elgg_register_success_message(string|array $options)
Registers a success system message.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
isCompleted()
Check if upgrade has completed.
trait Loggable
Enables adding a logger.
getBatch()
Return instance of the class that processes the data.
const UNKNOWN_COUNT
countItems() should return this if it doesn't know how many items remain.
Represents an upgrade that runs outside of the upgrade.php script.
Result of a single BatchUpgrade run.
elgg_register_error_message(string|array $options)
Registers a error system message.
getLogger()
Returns logger.
$ts
CSRF security token view for use with secure forms.
report()
Report loop results.
loop($max_duration=null)
Run upgrade loop for a preset number of seconds.
Upgrade loop Executes upgrade batches for a given duration of time.