public function setup()
    {
        parent::setup();
        Environment::increaseTimeLimitTo();

        $restart = $this->currentStep == 0;
        if (!$this->tempFile || !file_exists($this->tempFile)) {
            $tmpfile = tempnam(TempFolder::getTempFolder(BASE_PATH), 'sitemap');
            if (file_exists($tmpfile)) {
                $this->tempFile = $tmpfile;
            }
            $restart = true;
        }

        if ($restart) {
            $this->pagesToProcess = DB::query('SELECT ID FROM SiteTree_Live WHERE ShowInSearch=1')->column();
        }
    }