/**
* Version 3.0.0 update
*/
protected function update300()
{
// Step 1: database structure
if (!$this->Database->tableExists('tl_files')) {
$this->enableMaintenanceMode();
if (\Input::post('FORM_SUBMIT') == 'tl_30update') {
$this->import('Database\\Updater', 'Updater');
$this->Updater->run300Update();
$this->reload();
}
// Disable the tasks extension (see #4907)
if (is_dir(TL_ROOT . '/system/modules/tasks')) {
\System::disableModule('tasks');
}
// Reset the upload path if it has been changed already (see #5560 and #5870)
if (\Config::get('uploadPath') == 'files' && is_dir(TL_ROOT . '/tl_files')) {
\Config::set('uploadPath', 'tl_files');
\Config::persist('uploadPath', 'tl_files');
}
// Show a warning if the upload folder does not exist (see #4626)
if (!is_dir(TL_ROOT . '/' . \Config::get('uploadPath'))) {
$this->Template->filesWarning = sprintf($GLOBALS['TL_LANG']['tl_install']['filesWarning'], '<a href="https://gist.github.com/3304014" target="_blank">https://gist.github.com/3304014</a>');
}
$this->Template->step = 1;
$this->Template->is30Update = true;
$this->outputAndExit();
}
$objRow = $this->Database->query("SELECT COUNT(*) AS count FROM tl_files");
// Step 2: scan the upload folder if it is not empty (see #6061)
if ($objRow->count < 1 && count(scan(TL_ROOT . '/' . \Config::get('uploadPath'))) > 0) {
$this->enableMaintenanceMode();
if (\Input::post('FORM_SUBMIT') == 'tl_30update') {
$this->import('Database\\Updater', 'Updater');
$this->Updater->scanUploadFolder();
\Config::persist('checkFileTree', true);
$this->reload();
}
$this->Template->step = 2;
$this->Template->is30Update = true;
$this->outputAndExit();
} elseif (\Config::get('checkFileTree')) {
$this->enableMaintenanceMode();
if (\Input::post('FORM_SUBMIT') == 'tl_30update') {
$this->import('Database\\Updater', 'Updater');
$this->Updater->updateFileTreeFields();
\Config::persist('checkFileTree', false);
$this->reload();
}
$this->Template->step = 3;
$this->Template->is30Update = true;
$this->outputAndExit();
}
}