Gets the next stage for the backup.

We override this function to implement the one click backup.
When the user performs a one click backup we jump straight to the final stage.

@return int
772940
public function get_next_stage() {
        if ($this->oneclickbackup) {
            // Its a one click backup.
            // The default filename is backup.mbz, this normally gets set to something useful in the confirmation stage.
            // because we skipped that stage we must manually set this to a useful value.
            $tasks = $this->ui->get_tasks();
            foreach ($tasks as $task) {
                if ($task instanceof backup_root_task) {
                    // Find the filename setting.
                    $setting = $task->get_setting('filename');
                    if ($setting) {
                        // Use the helper objects to get a useful name.
                        $filename = backup_plan_dbops::get_default_backup_filename(
                            $this->ui->get_format(),
                            $this->ui->get_type(),
                            $this->ui->get_controller_id(),
                            $this->ui->get_setting_value('users'),
                            $this->ui->get_setting_value('anonymize')
                        );
                        $setting->set_value($filename);
                    }
                }
            }
            return backup_ui::STAGE_FINAL;
        }
        return parent::get_next_stage();
    }
668487
public function getLastSequenceNumber()
    {
        if (count($this->events) === 0) {
            return $this->lastCommittedSequenceNumber;
        }
        if ($this->lastSequenceNumber === null) {
            $event = end($this->events);
            $this->lastSequenceNumber = $event->getSequenceNumber();
        }
        return $this->lastSequenceNumber;
    }
540995
public function getNextPage()
    {
        $lastPage = $this->getLastPage();

        return $this->page < $lastPage ? $this->page + 1 : $lastPage;
    }
547476
private function getTotalSteps()
    {
        $total = 0;

        if (null != $this->configuration) {
            foreach ($this->configuration['steps']['groups'] as &$group) {
                $total += count($group['steps']);
            }
        }

        return $total;
    }
424033
public function getLast()
    {
        if ($this->isEmpty()) {
            return null;
        }

        $this->seek(count($this->positions) - 1);

        return $this->current();
    }
104894
public function last()
    {
        $lastIndex = $this->count() - 1;
        if ($this->offsetExists($lastIndex)) {
            return $this->offsetGet($lastIndex);
        }
    }
609004
public function getNextUrl() {
        $lastChunk = ceil($this->_max / $this->_options['pageSize']);
        if ($this->_chunk == $lastChunk) {
            return $this->_options['cycle'] ? $this->createStateUrl(1) : false;
        }
        return $this->createStateUrl($this->_chunk+1);
    }
174980
public function nextId()
    {
        $timestamp = time() - static::BASE_TIME;

        if ($this->lastTimestamp >= $timestamp) {
            $timestamp = $this->lastTimestamp;

            $sequence = ++ $this->sequence;

            if ($sequence > 0x7ff) {
                $this->lastTimestamp = ++ $timestamp;

                $sequence = $this->sequence = 0;
            }
        } else {
            $this->lastTimestamp = $timestamp;

            $sequence = $this->sequence = 0;
        }

        return ($timestamp << 32) | $this->mask | ($sequence & 0x7ff);
    }
1310531
public function getNextStepFromDatabase()
    {
        if ($this->SessionID && is_numeric($this->SessionID)) {
            $nextSteps = $this->config()->get('next_steps');

            if (is_string($nextSteps)) {
                return DataObject::get_one($nextSteps, "\"SessionID\" = {$this->SessionID}");
            } elseif (is_array($nextSteps)) {
                return DataObject::get_one($nextSteps[0], "\"SessionID\" = {$this->SessionID}");
            } else {
                return false;
            }
        }
    }
4724
public function next() {
		if ($this->_buffer) {
			list($this->_key, $this->_current) = array_shift($this->_buffer);
			return $this->_current;
		}

		if (!$next = $this->_fetch()) {
			$this->_key = null;
			$this->_current = null;
			$this->_valid = false;

			return null;
		} else {
			list($this->_key, $this->_current) = $next;
			$this->_valid = true;
		}
		return $this->_current;
	}
1254360
public function next()
    {
        $this->queryHasBegun = true;
        $this->currentRecord = $this->nextRecord();
        $this->rowNum++;
        return $this->currentRecord;
    }
1329978
public function next()
    {
        if ((int) $this->current()->query->getValue('o') >= $this->nbPages) {
            return null;
        }

        return $this->getIndexUrl(+1);
    }
649903
public function get_next_id()
    {
        return (int) $this->_database->select('AUTO_INCREMENT')
            ->from('information_schema.TABLES')
            ->where('TABLE_NAME', $this->_table)
            ->where('TABLE_SCHEMA', $this->_database->database)->get()->row()->AUTO_INCREMENT;
    }
123212
public function next()
    {
        if (!isset($this->states[++$this->index])) {
            $this->index = 0;
        }

        $state = $this->fab->paint(
            $this->states[$this->index]
        );

        foreach ($this->trajectories as &$trajectory) {
            if (count($trajectory) >= $this->maxWidth) {
                array_shift($trajectory);
            }

            $trajectory[] = $state;
        }

        return $this->trajectories;
    }
229974
protected function NextItem()
	{
		while (true)
		{
			if ( ! $this->accept )
			{
				if ( ! $this->MoveNextIter() )
				{
					return null;
				}
				$this->first = true;
				if ( $this->matchSelf && $this->TestItem() )
				{
					$this->sequentialPosition++;
					return $this->curr;
				}
			}
			if ( $this->first)
			{
				$this->accept = $this->MoveToFirst( $this->curr );
				$this->first = false;
			}
			else
			{
				$this->accept = $this->MoveToNext( $this->curr );
			}
			if ( $this->accept )
			{
				if ( $this->TestItem() )
				{
					$this->sequentialPosition++;
					return $this->curr;
				}
			}
		}
	}
450559
public function next() {
        global $DB;
        $result = new stdClass();

        while ($record = $this->csvreader->next()) {
            $idstr = $record[$this->idindex];
            // Strip the integer from the end of the participant string.
            $id = substr($idstr, strlen(get_string('hiddenuser', 'assign')));
            if ($userid = $this->assignment->get_user_id_for_uniqueid($id)) {
                if (array_key_exists($userid, $this->validusers)) {
                    $result->grade = $record[$this->gradeindex];
                    $result->modified = strtotime($record[$this->modifiedindex]);
                    $result->user = $this->validusers[$userid];
                    $result->feedback = array();
                    foreach ($this->feedbackcolumnindexes as $description => $details) {
                        if (!empty($details['index'])) {
                            $details['value'] = $record[$details['index']];
                            $result->feedback[] = $details;
                        }
                    }

                    return $result;
                }
            }
        }

        // If we got here the csvreader had no more rows.
        return false;
    }
416965
public function getNextRunTimestamp()
  {
    if(is_file($this->storage_dir.$this->nextruntime_filename)){
      return (int)file_get_contents($this->storage_dir.$this->nextruntime_filename);
    }else{
      return time();
    }
  }