* @author Thorsten Suckow-Homberg <*****@*****.**> */ /** * check if user is authorized to load script */ include './scripts/check_auth.php'; InstallLogger::getInstance($_SESSION['install_process']['INSTALL_LOGGER']); InstallLogger::stdout(InstallLogger::logMessage("Cleaning up"), true); $INSTALL = array(); $INSTALL['IMREMOVING'] = array('_configCache' => file_exists('../_configCache'), 'js' => file_exists('../js')); // delete folders from a previous installation if ($INSTALL['IMREMOVING']['js']) { InstallLogger::stdout(InstallLogger::logMessage("Removing js from previous installation")); conjoon_rmdir('../js'); } if ($INSTALL['IMREMOVING']['_configCache']) { InstallLogger::stdout(InstallLogger::logMessage("Removing _configCache from previous installation")); conjoon_rmdir('../_configCache'); } // move js folder to htdocs InstallLogger::stdout(InstallLogger::logMessage("Moving js")); rename('./files/js', '../js'); // move _configCache to htdocs InstallLogger::stdout(InstallLogger::logMessage("Moving _configCache")); rename('./files/_configCache', '../_configCache'); conjoon_copy('./htaccess.deny.txt', '../_configCache/.htaccess'); InstallLogger::stdout(InstallLogger::logMessage("Done!")); InstallLogger::stdout("Click \"Next\" to finish!"); $txt = "Done! You can find a detailed log of the update progress here: " . "<a target=\"_blank\" href=\"" . $_SESSION['install_process']['INSTALL_LOGGER'] . "\">" . $_SESSION['install_process']['INSTALL_LOGGER'] . "</a>"; echo "<script type=\"text/javascript\">parent.updateProgressNote('" . $txt . "');</script>"; echo "<script type=\"text/javascript\">parent.document.getElementById('nextButton').disabled = false;</script>";
/** * Copies a directory recursively. * * */ function conjoon_copy($source, $target) { $source = str_replace("\\", "/", $source); $target = str_replace("\\", "/", $target); if (is_dir($source)) { @mkdir($target); $d = dir($source); while (($entry = $d->read()) !== false) { if ($entry == '.' || $entry == '..') { continue; } $_entry = $source . '/' . $entry; if (is_dir($_entry)) { conjoon_copy($_entry, $target . '/' . $entry); continue; } copy($_entry, $target . '/' . $entry); } $d->close(); } else { copy($source, $target); } }
} // ... and create new dir if necessary if ($_SESSION['application']['htmlpurifier.use_cache'] && $_SESSION['application']['htmlpurifier.cache_dir']) { conjoon_mkdir($_SESSION['application']['htmlpurifier.cache_dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['application']['htmlpurifier.cache_dir'] . '/.htaccess'); } // process doctrine cache directories InstallLogger::stdout(InstallLogger::logMessage("Processing Doctrine cache directories"), true); $doctrineCacheConfigKeys = array('query_cache', 'metadata_cache'); foreach ($doctrineCacheConfigKeys as $doctrineCacheConfigKey) { // remove old doctrine cache if needed if (isset($_SESSION['installation_info']['application.doctrine.cache.' . $doctrineCacheConfigKey . '.type']) && $_SESSION['installation_info']['application.doctrine.cache.' . $doctrineCacheConfigKey . '.type'] == 'file' && isset($_SESSION['installation_info']['application.doctrine.cache.' . $doctrineCacheConfigKey . '.dir']) && file_exists($_SESSION['installation_info']['application.doctrine.cache.' . $doctrineCacheConfigKey . '.dir'])) { @conjoon_rmdir($_SESSION['installation_info']['application.doctrine.cache.' . $doctrineCacheConfigKey . '.dir']); } // ... and create new dir if necessary if ($_SESSION['application']['doctrine.cache.' . $doctrineCacheConfigKey . '.type'] == 'file' && $_SESSION['application']['doctrine.cache.' . $doctrineCacheConfigKey . '.dir']) { conjoon_mkdir($_SESSION['application']['doctrine.cache.' . $doctrineCacheConfigKey . '.dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['application']['doctrine.cache.' . $doctrineCacheConfigKey . '.dir'] . '/.htaccess'); } } // process file related directory // ... and create new dir if necessary // dont remove previous directories snce it might be needed to // re-store previous files handled by the dirs configured // for previous installations InstallLogger::stdout(InstallLogger::logMessage("Processing file system functionality"), true); if ($_SESSION['files']['storage.filesystem.enabled'] && $_SESSION['files']['storage.filesystem.dir']) { conjoon_mkdir($_SESSION['files']['storage.filesystem.dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['files']['storage.filesystem.dir'] . '/.htaccess'); } echo "<script type=\"text/javascript\">this.location.href=\"./index.php?action=install_chunk_5\"</script>";
} if ($_SESSION['cache']['email.folders_root_type.caching']) { conjoon_mkdir($_SESSION['cache']['email.folders_root_type.backend.cache_dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['email.folders_root_type.backend.cache_dir'] . '/.htaccess'); } if ($_SESSION['cache']['feed.item.caching']) { conjoon_mkdir($_SESSION['cache']['feed.item.backend.cache_dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['feed.item.backend.cache_dir'] . '/.htaccess'); } if ($_SESSION['cache']['feed.item_list.caching']) { conjoon_mkdir($_SESSION['cache']['feed.item_list.backend.cache_dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['feed.item_list.backend.cache_dir'] . '/.htaccess'); } if ($_SESSION['cache']['feed.reader.caching']) { conjoon_mkdir($_SESSION['cache']['feed.reader.backend.cache_dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['feed.reader.backend.cache_dir'] . '/.htaccess'); } if ($_SESSION['cache']['feed.account.caching']) { conjoon_mkdir($_SESSION['cache']['feed.account.backend.cache_dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['feed.account.backend.cache_dir'] . '/.htaccess'); } if ($_SESSION['cache']['feed.account_list.caching']) { conjoon_mkdir($_SESSION['cache']['feed.account_list.backend.cache_dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['feed.account_list.backend.cache_dir'] . '/.htaccess'); } if ($_SESSION['cache']['twitter.accounts.caching']) { conjoon_mkdir($_SESSION['cache']['twitter.accounts.backend.cache_dir']); conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['twitter.accounts.backend.cache_dir'] . '/.htaccess'); } } echo "<script type=\"text/javascript\">this.location.href=\"./index.php?action=install_chunk_6\"</script>";