Example #1
0
 * @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>";
Example #2
0
/**
 * Tries to create a directory. Will try to create each directory level.
 * if the second parameter is set to true, the created directory will be removed
 * afterwards.
 * The directory has to be specified absolutely.
 *
 */
function conjoon_mkdir($dir, $remove = false)
{
    if (strpos($dir, '/') !== 0 && strpos($dir, ':') !== 1) {
        return false;
    }
    $dir = str_replace("\\", "/", $dir);
    $parts = explode('/', $dir);
    if ($parts[0] == "") {
        $parts[0] = "/";
    }
    $tmpDir = realpath($parts[0]);
    if ($tmpDir === false) {
        return false;
    }
    $existing = array();
    $removeDirs = array();
    for ($i = 1, $len = count($parts); $i < $len + 1; $i++) {
        if (!file_exists($tmpDir)) {
            $removeDirs[] = $tmpDir;
            $res = @mkdir($tmpDir);
            if ($res === false) {
                conjoon_rmdir($tmpDir);
                return false;
            }
        } else {
            $existing[$tmpDir] = true;
        }
        if (!isset($parts[$i])) {
            break;
        }
        $tmpDir .= '/' . $parts[$i];
    }
    $isCool = conjoon_validateDir($dir);
    if ($remove === true) {
        for ($i = count($removeDirs) - 1; $i >= 0; $i--) {
            rmdir($removeDirs[$i]);
        }
    }
    return $isCool;
}
Example #3
0
InstallLogger::stdout(InstallLogger::logMessage("Updating HTMLPurifier functionality"), true);
if (isset($_SESSION['installation_info']['application.htmlpurifier.use_cache']) && isset($_SESSION['installation_info']['application.htmlpurifier.cache_dir']) && file_exists($_SESSION['installation_info']['application.htmlpurifier.cache_dir'])) {
    @conjoon_rmdir($_SESSION['installation_info']['application.htmlpurifier.cache_dir']);
}
// ... 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']);
Example #4
0
        @rmdir($_SESSION['installation_info']['cache.feed.item_list.backend.cache_dir']);
    }
    if (isset($_SESSION['installation_info']['cache.feed.reader.backend.cache_dir']) && file_exists($_SESSION['installation_info']['cache.feed.reader.backend.cache_dir'])) {
        @conjoon_rmdir($_SESSION['installation_info']['cache.feed.reader.backend.cache_dir']);
        @rmdir($_SESSION['installation_info']['cache.feed.reader.backend.cache_dir']);
    }
    if (isset($_SESSION['installation_info']['cache.feed.account.backend.cache_dir']) && file_exists($_SESSION['installation_info']['cache.feed.account.backend.cache_dir'])) {
        @conjoon_rmdir($_SESSION['installation_info']['cache.feed.account.backend.cache_dir']);
        @rmdir($_SESSION['installation_info']['cache.feed.account.backend.cache_dir']);
    }
    if (isset($_SESSION['installation_info']['cache.feed.account_list.backend.cache_dir']) && file_exists($_SESSION['installation_info']['cache.feed.account_list.backend.cache_dir'])) {
        @conjoon_rmdir($_SESSION['installation_info']['cache.feed.account_list.backend.cache_dir']);
        @rmdir($_SESSION['installation_info']['cache.feed.account_list.backend.cache_dir']);
    }
    if (isset($_SESSION['installation_info']['cache.twitter.accounts.backend.cache_dir']) && file_exists($_SESSION['installation_info']['cache.twitter.accounts.backend.cache_dir'])) {
        @conjoon_rmdir($_SESSION['installation_info']['cache.twitter.accounts.backend.cache_dir']);
        @rmdir($_SESSION['installation_info']['cache.twitter.accounts.backend.cache_dir']);
    }
}
// create caching folders
if ($_SESSION['cache']['default.caching']) {
    if ($_SESSION['cache']['db.metadata.caching']) {
        conjoon_mkdir($_SESSION['cache']['db.metadata.backend.cache_dir']);
        conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['db.metadata.backend.cache_dir'] . '/.htaccess');
    }
    if ($_SESSION['cache']['email.message.caching']) {
        conjoon_mkdir($_SESSION['cache']['email.message.backend.cache_dir']);
        conjoon_copy('./htaccess.deny.txt', $_SESSION['cache']['email.message.backend.cache_dir'] . '/.htaccess');
    }
    if ($_SESSION['cache']['email.accounts.caching']) {
        conjoon_mkdir($_SESSION['cache']['email.accounts.backend.cache_dir']);