Пример #1
0
/**
 * Patch notes view
 *
 * @author Thorsten Suckow-Homberg <*****@*****.**>
 */
function patch_0_1_5RC2()
{
    $dbAdapter = $_SESSION['db_adapter'];
    $prefix = $_SESSION['db_table_prefix'];
    $dbHost = $_SESSION['db_host'];
    $db = $_SESSION['db'];
    $dbPort = $_SESSION['db_port'];
    $dbUser = $_SESSION['db_user'];
    $dbPassword = $_SESSION['db_password'];
    $dbType = strtolower(str_replace("pdo_", "", $dbAdapter));
    $patchData = $_SESSION['patchdata']['0.1.5RC2'];
    switch ($dbType) {
        case 'mysql':
            $db = new PDO($dbType . ":" . "host=" . $dbHost . ";" . "dbname=" . $_SESSION['db'] . ";" . "port=" . $dbPort, $dbUser, $dbPassword, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8', PDO::ATTR_PERSISTENT => false));
            break;
        default:
            die("No support for adapter \"{$dbType}\"");
            break;
    }
    $file = $patchData['dataFilePath'];
    if (!@file_exists($file)) {
        InstallLogger::logMessage("Cannot apply patch 0.1.5RC2 - {$file} not found");
        return;
    }
    $contents = trim(@file_get_contents($file));
    if (!$contents) {
        InstallLogger::logMessage("Cannot apply patch 0.1.5RC2 - {$file} " . "was empty or I could not access it");
        return;
    }
    InstallLogger::logMessage("Deleting from groupware_feeds_items_flags for Patch 0.1.5RC2");
    $feedsItemsFlagsTbl = $prefix . "groupware_feeds_items_flags";
    $lines = explode("\n", $contents);
    for ($i = 0, $len = count($lines); $i < $len; $i++) {
        $line = $lines[$i];
        $values = explode(',', $line);
        $groupware_feeds_accounts_id = trim(array_shift($values));
        $guid = trim(implode($values, ','));
        $sql = "INSERT INTO {$feedsItemsFlagsTbl} " . "(`groupware_feeds_accounts_id`,`guid`) " . "VALUES" . "(?, ?)";
        $sth = $db->prepare($sql);
        $updValues = array($groupware_feeds_accounts_id, md5($guid));
        InstallLogger::logMessage("Executing {$sql} with values " . implode(", ", $updValues));
        if (!$sth->execute($updValues)) {
            $rt = $sth->errorInfo();
            InstallLogger::logMessage("Could not insert into {$feedsItemsFlagsTbl}: " . $rt[2]);
        }
    }
    InstallLogger::logMessage("Applying patch 0.1.5RC2 - End");
}
Пример #2
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>";
Пример #3
0
/**
 * Patch notes view
 *
 * @author Thorsten Suckow-Homberg <*****@*****.**>
 */
function patch_0_1_4RC5()
{
    $dbAdapter = $_SESSION['db_adapter'];
    $prefix = $_SESSION['db_table_prefix'];
    $dbHost = $_SESSION['db_host'];
    $db = $_SESSION['db'];
    $dbPort = $_SESSION['db_port'];
    $dbUser = $_SESSION['db_user'];
    $dbPassword = $_SESSION['db_password'];
    $patchData = $_SESSION['patchdata']['0.1.4RC5'];
    $inCharset = strtolower($patchData['in_charset']);
    $dbType = strtolower(str_replace("pdo_", "", $dbAdapter));
    InstallLogger::logMessage("Applying patch 0.1.4RC5 - Start");
    if ($inCharset == "utf8") {
        InstallLogger::logMessage("in charset is already utf8... exiting.");
        InstallLogger::logMessage("Applying patch 0.1.4RC5 - End");
        return;
    }
    switch ($dbType) {
        case 'mysql':
            $db = new PDO($dbType . ":" . "host=" . $dbHost . ";" . "dbname=" . $db . ";" . "port=" . $dbPort, $dbUser, $dbPassword, array(PDO::ATTR_PERSISTENT => false));
            $dbNew = new PDO($dbType . ":" . "host=" . $dbHost . ";" . "dbname=" . $_SESSION['db'] . ";" . "port=" . $dbPort, $dbUser, $dbPassword, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8', PDO::ATTR_PERSISTENT => false));
            break;
        default:
            die("No support for adapter \"{$dbType}\"");
            break;
    }
    // EMAIL ITEMS
    InstallLogger::logMessage("--- Applying patch 0.1.4RC5 to email items ---");
    $emailItemsTbl = $prefix . "groupware_email_items";
    $sql = "SELECT * FROM {$emailItemsTbl}";
    $emailItems = $db->query($sql);
    if (!$emailItems) {
        InstallLogger::logMessage("Could not update email items table with patch 0.1.4RC5");
    } else {
        foreach ($emailItems as $row) {
            $id = $row['id'];
            $convert = array('subject' => $row['subject'], 'from' => $row['from'], 'reply_to' => $row['reply_to'], 'to' => $row['to'], 'cc' => $row['cc'], 'bcc' => $row['bcc'], 'in_reply_to' => $row['in_reply_to'], 'content_text_plain' => $row['content_text_plain'], 'content_text_html' => $row['content_text_html'], 'recipients' => $row['recipients'], 'sender' => $row['sender']);
            $updStr = array();
            foreach ($convert as $key => $value) {
                $convert[$key] = iconv('UTF-8', 'UTF-8//TRANSLIT//IGNORE', $value);
                $updStr[] = '`' . $key . '` = ?';
            }
            $sql = "UPDATE " . $emailItemsTbl . " " . "SET " . implode(',', $updStr) . " WHERE `id`=?";
            $sth = $dbNew->prepare($sql);
            $updValues = array_values($convert);
            array_push($updValues, $id);
            InstallLogger::logMessage("Executing {$sql} with values " . implode(", ", $updValues));
            if (!$sth->execute($updValues)) {
                $rt = $sth->errorInfo();
                InstallLogger::logMessage("Could not update {$emailItemsTbl}: " . $rt[2]);
            }
        }
    }
    // FEED ITEMS
    InstallLogger::logMessage("--- Applying patch 0.1.4RC5 to feeds items ---");
    $feedItemsTbl = $prefix . "groupware_feeds_items";
    $sql = "SELECT * FROM {$feedItemsTbl}";
    $feedItems = $db->query($sql);
    if (!$feedItems) {
        InstallLogger::logMessage("Could not update {$feedItemsTbl} table with patch 0.1.4RC5");
    } else {
        foreach ($feedItems as $row) {
            $id = $row['id'];
            $convert = array('title' => $row['title'], 'description' => $row['description'], 'content' => $row['content']);
            $updStr = array();
            foreach ($convert as $key => $value) {
                $convert[$key] = iconv('UTF-8', 'UTF-8//TRANSLIT//IGNORE', $value);
                $updStr[] = '`' . $key . '` = ?';
            }
            $sql = "UPDATE " . $feedItemsTbl . " " . "SET " . implode(',', $updStr) . " WHERE `id`=?";
            $sth = $dbNew->prepare($sql);
            $updValues = array_values($convert);
            array_push($updValues, $id);
            InstallLogger::logMessage("Executing {$sql} with values " . implode(", ", $updValues));
            if (!$sth->execute($updValues)) {
                $rt = $sth->errorInfo();
                InstallLogger::logMessage("Could not update {$feedItemsTbl}: " . $rt[2]);
            }
        }
    }
    // FEED ACCOUNTS
    InstallLogger::logMessage("--- Applying patch 0.1.4RC5 to feeds accounts ---");
    $feedAccountsTbl = $prefix . "groupware_feeds_accounts";
    $sql = "SELECT * FROM {$feedAccountsTbl}";
    $feedAccounts = $db->query($sql);
    if (!$feedAccounts) {
        InstallLogger::logMessage("Could not update {$feedAccountsTbl} table with patch 0.1.4RC5");
    } else {
        foreach ($feedAccounts as $row) {
            $id = $row['id'];
            $convert = array('title' => $row['title'], 'description' => $row['description'], 'name' => $row['name']);
            $updStr = array();
            foreach ($convert as $key => $value) {
                $convert[$key] = iconv('UTF-8', 'UTF-8//TRANSLIT//IGNORE', $value);
                $updStr[] = '`' . $key . '` = ?';
            }
            $sql = "UPDATE " . $feedAccountsTbl . " " . "SET " . implode(',', $updStr) . " WHERE `id`=?";
            $sth = $dbNew->prepare($sql);
            $updValues = array_values($convert);
            array_push($updValues, $id);
            InstallLogger::logMessage("Executing {$sql} with values " . implode(", ", $updValues));
            if (!$sth->execute($updValues)) {
                $rt = $sth->errorInfo();
                InstallLogger::logMessage("Could not update {$feedAccountsTbl}: " . $rt[2]);
            }
        }
    }
    // USERS
    InstallLogger::logMessage("--- Applying patch 0.1.4RC5 to users ---");
    $usersTbl = $prefix . "users";
    $sql = "SELECT * FROM {$usersTbl}";
    $userItems = $db->query($sql);
    if (!$userItems) {
        InstallLogger::logMessage("Could not update {$usersTbl} table with patch 0.1.4RC5");
    } else {
        foreach ($userItems as $row) {
            $id = $row['id'];
            $convert = array('firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'user_name' => $row['user_name']);
            $updStr = array();
            foreach ($convert as $key => $value) {
                $convert[$key] = iconv('UTF-8', 'UTF-8//TRANSLIT//IGNORE', $value);
                $updStr[] = '`' . $key . '` = ?';
            }
            $sql = "UPDATE " . $usersTbl . " " . "SET " . implode(',', $updStr) . " WHERE `id`=?";
            $sth = $dbNew->prepare($sql);
            $updValues = array_values($convert);
            array_push($updValues, $id);
            InstallLogger::logMessage("Executing {$sql} with values " . implode(", ", $updValues));
            if (!$sth->execute($updValues)) {
                $rt = $sth->errorInfo();
                InstallLogger::logMessage("Could not update {$usersTbl}: " . $rt[2]);
            }
        }
    }
    InstallLogger::logMessage("Applying patch 0.1.4RC5 - End");
}
Пример #4
0
/**
 *
 * @author Thorsten Suckow-Homberg <*****@*****.**>
 */
function patch_prepare_0_1_5RC2()
{
    $dbAdapter = $_SESSION['db_adapter'];
    $prefix = $_SESSION['db_table_prefix'];
    $dbHost = $_SESSION['db_host'];
    $db = $_SESSION['db'];
    $dbPort = $_SESSION['db_port'];
    $dbUser = $_SESSION['db_user'];
    $dbPassword = $_SESSION['db_password'];
    $dbType = strtolower(str_replace("pdo_", "", $dbAdapter));
    if (!isset($_SESSION['patchdata']['0.1.5RC2'])) {
        $_SESSION['patchdata']['0.1.5RC2'] = array();
    }
    $_SESSION['patchdata']['0.1.5RC2']['dataFilePath'] = realpath(dirname(__FILE__) . '/../../') . '/patch.0.1.5RC2.data.txt';
    InstallLogger::logMessage("Preparing patch 0.1.5RC2 - collecting data");
    switch ($dbType) {
        case 'mysql':
            $db = new PDO($dbType . ":" . "host=" . $dbHost . ";" . "dbname=" . $_SESSION['db'] . ";" . "port=" . $dbPort, $dbUser, $dbPassword, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8', PDO::ATTR_PERSISTENT => false));
            break;
        default:
            die("No support for adapter \"{$dbType}\"");
            break;
    }
    // groupware_feeds_items_flags
    $feedsItemsFlagsTbl = $prefix . "groupware_feeds_items_flags";
    $sql = "SELECT * FROM {$feedsItemsFlagsTbl}";
    $feedsItemsFlags = $db->query($sql);
    if (!$feedsItemsFlags) {
        InstallLogger::logMessage("Could not read out data for patch 0.1.5RC2");
    } else {
        $strs = array();
        foreach ($feedsItemsFlags as $row) {
            $strs[] = $row['groupware_feeds_accounts_id'] . ", " . $row['guid'];
            InstallLogger::logMessage("Collecting: " . $strs[count($strs) - 1]);
        }
        // write data into file
        InstallLogger::logMessage("Writing " . count($strs) . " lines into " . $_SESSION['patchdata']['0.1.5RC2']['dataFilePath']);
        $res = @file_put_contents($_SESSION['patchdata']['0.1.5RC2']['dataFilePath'], implode($strs, "\n"));
        if ($res === false) {
            InstallLogger::logMessage("Could not write patch data into " . $_SESSION['patchdata']['0.1.5RC2']['dataFilePath']);
        } else {
            $sql = "DELETE FROM {$feedsItemsFlagsTbl}";
            InstallLogger::logMessage("Executing {$sql}");
            $deleted = $db->exec($sql);
            if ($deleted === false) {
                $rt = $db->errorInfo();
                InstallLogger::logMessage("Could not delete from {$feedsItemsFlagsTbl}: " . $rt[2]);
            }
        }
    }
    InstallLogger::logMessage("Collecting patch data 0.1.5RC2 - End");
}
Пример #5
0
/**
 * Patch notes view
 *
 * @author Thorsten Suckow-Homberg <*****@*****.**>
 */
function patch_0_1_4RC3()
{
    $dbAdapter = $_SESSION['db_adapter'];
    $prefix = $_SESSION['db_table_prefix'];
    $dbHost = $_SESSION['db_host'];
    $db = $_SESSION['db'];
    $dbPort = $_SESSION['db_port'];
    $dbUser = $_SESSION['db_user'];
    $dbPassword = $_SESSION['db_password'];
    $patchData = $_SESSION['patchdata']['0.1.4RC3'];
    $timezone = $patchData['timezone'];
    $dbType = strtolower(str_replace("pdo_", "", $dbAdapter));
    switch ($dbType) {
        case 'mysql':
            $db = new PDO($dbType . ":" . "host=" . $dbHost . ";" . "dbname=" . $db . ";" . "port=" . $dbPort, $dbUser, $dbPassword);
            break;
        default:
            die("No support for adapter \"{$dbType}\"");
            break;
    }
    InstallLogger::logMessage("Applying patch 0.1.4RC3 - Start");
    InstallLogger::logMessage("Using timezone {$timezone} to convert to UTC");
    $oldTimezone = date_default_timezone_get();
    date_default_timezone_set($timezone);
    // EMAIL ITEMS
    InstallLogger::logMessage("--- Applying patch 0.1.4RC3 to email items ---");
    $sql = "SELECT `id`,`date` FROM " . $prefix . "groupware_email_items";
    $datetimes = $db->query($sql);
    if (!$datetimes) {
        InstallLogger::logMessage("Could not update email items table with patch 0.1.4RC3");
    } else {
        foreach ($datetimes as $row) {
            $time = $row['date'];
            $id = $row['id'];
            $new = strtotime($time);
            $new = gmdate("Y-m-d H:i:s", $new);
            InstallLogger::logMessage("Changing date in email items for id {$id} from {$time} to {$new}");
            $sql = "UPDATE " . $prefix . "groupware_email_items " . "SET `date`='" . $new . "' WHERE `id`=" . $id;
            $db->query($sql);
        }
    }
    // FEED ITEMS
    InstallLogger::logMessage("--- Applying patch 0.1.4RC3 to feeds items ---");
    $sql = "SELECT `id`,`pub_date` FROM " . $prefix . "groupware_feeds_items";
    $datetimes = $db->query($sql);
    if (!$datetimes) {
        InstallLogger::logMessage("Could not update feed items table with patch 0.1.4RC3");
    } else {
        foreach ($datetimes as $row) {
            $time = $row['pub_date'];
            $id = $row['id'];
            $new = strtotime($time);
            $new = gmdate("Y-m-d H:i:s", $new);
            InstallLogger::logMessage("Changing date in feed items for id {$id} from {$time} to {$new}");
            $sql = "UPDATE " . $prefix . "groupware_feeds_items " . "SET `pub_date`='" . $new . "' WHERE `id`=" . $id;
            $db->query($sql);
        }
    }
    date_default_timezone_set($oldTimezone);
    InstallLogger::logMessage("Applying patch 0.1.4RC3 - End");
}
Пример #6
0
// conjoon settings
// file related settings
InstallLogger::stdout(InstallLogger::logMessage("Adding file related information to config.ini.php"), true);
$configini = str_replace('{FILES.UPLOAD.MAX_SIZE}', $_SESSION['files']['upload.max_size'], $configini);
$configini = str_replace('{FILES.STORAGE.FILESYSTEM.ENABLED}', $_SESSION['files']['storage.filesystem.enabled'] ? '1' : '0', $configini);
$configini = str_replace('{FILES.STORAGE.FILESYSTEM.DIR}', $_SESSION['files']['storage.filesystem.enabled'] && $_SESSION['files']['storage.filesystem.dir'] ? $_SESSION['files']['storage.filesystem.dir'] : "", $configini);
// Doctrine settings
InstallLogger::stdout(InstallLogger::logMessage("Adding doctrine information to config.ini.php"), true);
$configini = str_replace('{DOCTRINE.CACHE.ENABLED}', $_SESSION['application']['doctrine.cache.enabled'] ? '1' : '0', $configini);
$doctrineCacheConfigKeys = array('QUERY_CACHE', 'METADATA_CACHE');
foreach ($doctrineCacheConfigKeys as $doctrineCacheConfigKey) {
    $configini = str_replace('{DOCTRINE.CACHE.' . $doctrineCacheConfigKey . '.ENABLED}', $_SESSION['application']['doctrine.cache.enabled'] && $_SESSION['application']['doctrine.cache.' . strtolower($doctrineCacheConfigKey) . '.enabled'] ? '1' : '0', $configini);
    $configini = str_replace('{DOCTRINE.CACHE.' . $doctrineCacheConfigKey . '.TYPE}', $_SESSION['application']['doctrine.cache.' . strtolower($doctrineCacheConfigKey) . '.enabled'] && $_SESSION['application']['doctrine.cache.enabled'] ? $_SESSION['application']['doctrine.cache.' . strtolower($doctrineCacheConfigKey) . '.type'] : '', $configini);
    $configini = str_replace('{DOCTRINE.CACHE.' . $doctrineCacheConfigKey . '.DIR}', $_SESSION['application']['doctrine.cache.' . strtolower($doctrineCacheConfigKey) . '.enabled'] && $_SESSION['application']['doctrine.cache.enabled'] && $_SESSION['application']['doctrine.cache.' . strtolower($doctrineCacheConfigKey) . '.type'] == 'file' ? $_SESSION['application']['doctrine.cache.' . strtolower($doctrineCacheConfigKey) . '.dir'] : '', $configini);
}
// overwrite the file completely, even if it still exists from a previous
// installation!
InstallLogger::stdout(InstallLogger::logMessage("Writing config.ini"), true);
file_put_contents('../config.ini.php', $configini);
$configini = "";
// generate and update install.info.php
InstallLogger::stdout(InstallLogger::logMessage("Writing installation.info.php"), true);
if (!file_exists('../installation.info.php')) {
    $installationinfo = file_get_contents('./installation.info.php.template');
} else {
    $installationinfo = file_get_contents('../installation.info.php');
}
$installationinfo .= "\n\r\n        // generated by conjoon V" . $_SESSION['current_version'] . "\r\n        // on " . date("m-d-Y H:i:s", time()) . "\r\n        \$INSTALLATION_INFO[] = array(\r\n            'locale_timezone_default'  => '" . $_SESSION['locale_timezone_default'] . "',\r\n            'locale_timezone_fallback' => '" . $_SESSION['locale_timezone_fallback'] . "',\r\n            'support_key'        => '" . $_SESSION['support_key'] . "',\r\n            'version'            => '" . $_SESSION['current_version'] . "',\r\n            'date'               => '" . time() . "',\r\n            'db_host'            => '" . $_SESSION['db_host'] . "',\r\n            'db_adapter'         => '" . $_SESSION['db_adapter'] . "',\r\n            'db'                 => '" . $_SESSION['db'] . "',\r\n            'db_port'            => '" . $_SESSION['db_port'] . "',\r\n            'db_user'            => '" . $_SESSION['db_user'] . "',\r\n            'db_table_prefix'    => '" . $_SESSION['db_table_prefix'] . "',\r\n            'edition'            => '" . $_SESSION['edition'] . "',\r\n            'max_allowed_packet' => '" . $_SESSION['max_allowed_packet'] . "',\r\n            'app_path'           => '" . $_SESSION['app_path'] . "',\r\n            'lib_path'           => '" . $_SESSION['lib_path'] . "',\r\n            'add_include_path'   => '" . $_SESSION['add_include_path'] . "',\r\n            'doc_path'           => '" . $_SESSION['doc_path'] . "',\r\n            'applied_patches'    => array(" . (empty($_SESSION['applied_patches']) ? "" : "'") . implode("','", isset($_SESSION['applied_patches']) && is_array($_SESSION['applied_patches']) ? array_values($_SESSION['applied_patches']) : array()) . (empty($_SESSION['applied_patches']) ? "" : "'") . "),\r\n            'ignored_patches'    => array(" . (empty($_SESSION['ignored_patches']) ? "" : "'") . implode("','", isset($_SESSION['ignored_patches']) && is_array($_SESSION['ignored_patches']) ? array_values($_SESSION['ignored_patches']) : array()) . (empty($_SESSION['ignored_patches']) ? "" : "'") . "),\r\n\r\n\r\n            " . ($_SESSION['cache']['default.caching'] ? "\r\n\r\n              'cache.default.caching' => 1,\r\n\r\n              'cache.db.metadata.caching' => " . ($_SESSION['cache']['db.metadata.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['db.metadata.caching'] ? "'cache.db.metadata.backend.cache_dir' => '" . $_SESSION['cache']['db.metadata.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.email.message.caching' => " . ($_SESSION['cache']['email.message.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['email.message.caching'] ? "'cache.email.message.backend.cache_dir' => '" . $_SESSION['cache']['email.message.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.email.accounts.caching' => " . ($_SESSION['cache']['email.accounts.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['email.accounts.caching'] ? "'cache.email.accounts.backend.cache_dir' => '" . $_SESSION['cache']['email.accounts.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.email.folders_root_type.caching' => " . ($_SESSION['cache']['email.folders_root_type.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['email.folders_root_type.caching'] ? "'cache.email.folders_root_type.backend.cache_dir' => '" . $_SESSION['cache']['email.folders_root_type.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.feed.item.caching' => " . ($_SESSION['cache']['feed.item.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['feed.item.caching'] ? "'cache.feed.item.backend.cache_dir' => '" . $_SESSION['cache']['feed.item.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.feed.item_list.caching' => " . ($_SESSION['cache']['feed.item_list.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['feed.item_list.caching'] ? "'cache.feed.item_list.backend.cache_dir' => '" . $_SESSION['cache']['feed.item_list.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.feed.reader.caching' => " . ($_SESSION['cache']['feed.reader.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['feed.reader.caching'] ? "'cache.feed.reader.backend.cache_dir' => '" . $_SESSION['cache']['feed.reader.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.feed.account.caching' => " . ($_SESSION['cache']['feed.account.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['feed.account.caching'] ? "'cache.feed.account.backend.cache_dir' => '" . $_SESSION['cache']['feed.account.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.feed.account_list.caching' => " . ($_SESSION['cache']['feed.account_list.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['feed.account_list.caching'] ? "'cache.feed.account_list.backend.cache_dir' => '" . $_SESSION['cache']['feed.account_list.backend.cache_dir'] . "'," : "") . "\r\n\r\n              'cache.twitter.accounts.caching' => " . ($_SESSION['cache']['twitter.accounts.caching'] ? "1" : "0") . ",\r\n              " . ($_SESSION['cache']['twitter.accounts.caching'] ? "'cache.twitter.accounts.backend.cache_dir' => '" . $_SESSION['cache']['twitter.accounts.backend.cache_dir'] . "'," : "") . "\r\n\r\n\r\n              " : "'cache.default.caching' => 0,") . "'application.htmlpurifier.preload_all' => " . ($_SESSION['application']['htmlpurifier.preload_all'] ? '1' : '0') . ",\r\n            'application.htmlpurifier.use_cache' => " . ($_SESSION['application']['htmlpurifier.use_cache'] ? '1' : '0') . ",\r\n            'application.htmlpurifier.cache_dir' => " . ($_SESSION['application']['htmlpurifier.use_cache'] ? "'" . $_SESSION['application']['htmlpurifier.cache_dir'] . "'" : "''") . ",\r\n\r\n            'application.doctrine.cache.enabled' => " . ($_SESSION['application']['doctrine.cache.enabled'] ? '1' : '0') . ",\r\n            'application.doctrine.cache.query_cache.enabled' => " . ($_SESSION['application']['doctrine.cache.enabled'] && $_SESSION['application']['doctrine.cache.query_cache.enabled'] ? '1' : '0') . ",\r\n            'application.doctrine.cache.query_cache.type' => '" . ($_SESSION['application']['doctrine.cache.enabled'] && $_SESSION['application']['doctrine.cache.query_cache.enabled'] ? $_SESSION['application']['doctrine.cache.query_cache.type'] : '') . "',\r\n            'application.doctrine.cache.query_cache.dir' => " . ($_SESSION['application']['doctrine.cache.enabled'] && $_SESSION['application']['doctrine.cache.query_cache.enabled'] && $_SESSION['application']['doctrine.cache.query_cache.type'] == 'file' ? "'" . $_SESSION['application']['doctrine.cache.query_cache.dir'] . "'" : "''") . ",\r\n\r\n            'application.doctrine.cache.metadata_cache.enabled' => " . ($_SESSION['application']['doctrine.cache.enabled'] && $_SESSION['application']['doctrine.cache.metadata_cache.enabled'] ? '1' : '0') . ",\r\n            'application.doctrine.cache.metadata_cache.type' => '" . ($_SESSION['application']['doctrine.cache.enabled'] && $_SESSION['application']['doctrine.cache.metadata_cache.enabled'] ? $_SESSION['application']['doctrine.cache.metadata_cache.type'] : '') . "',\r\n            'application.doctrine.cache.metadata_cache.dir' => " . ($_SESSION['application']['doctrine.cache.enabled'] && $_SESSION['application']['doctrine.cache.metadata_cache.enabled'] && $_SESSION['application']['doctrine.cache.metadata_cache.type'] == 'file' ? "'" . $_SESSION['application']['doctrine.cache.metadata_cache.dir'] . "'" : "''") . ",\r\n\r\n            'files.upload.max_size' => " . $_SESSION['files']['upload.max_size'] . ",\r\n            'files.storage.filesystem.enabled' => " . ($_SESSION['files']['storage.filesystem.enabled'] ? '1' : '0') . ",\r\n            'files.storage.filesystem.dir' => " . ($_SESSION['files']['storage.filesystem.enabled'] && $_SESSION['files']['storage.filesystem.dir'] ? "'" . $_SESSION['files']['storage.filesystem.dir'] . "'" : "''") . ",\r\n\r\n            'app_credentials'    => array('user' => '" . $_SESSION['app_credentials']['user'] . "')\r\n        );\r\n    ";
file_put_contents('../installation.info.php', $installationinfo);
$installationinfo = "";
echo "<script type=\"text/javascript\">this.location.href=\"./index.php?action=install_chunk_2\"</script>";
Пример #7
0
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* $Author: T. Suckow $
* $Id: cache.php 1985 2014-07-05 13:00:08Z T. Suckow $
* $Date: 2014-07-05 15:00:08 +0200 (Sa, 05 Jul 2014) $
* $Revision: 1985 $
* $LastChangedDate: 2014-07-05 15:00:08 +0200 (Sa, 05 Jul 2014) $
* $LastChangedBy: T. Suckow $
* $URL: http://svn.conjoon.org/trunk/src/www/htdocs/install/cache.php $
*/
/**
 * Processes installation.
 *
 * @author Thorsten Suckow-Homberg <*****@*****.**>
 */
/**
 * check if user is authorized to load script
 */
include './scripts/check_auth.php';
// generate logging file
$_SESSION['install_process'] = array('INSTALL_LOGGER' => './INSTALL_LOG-' . date("Y.m.d-H.i.s", time()) . '.log');
InstallLogger::getInstance($_SESSION['install_process']['INSTALL_LOGGER']);
include_once './view/install_process.tpl';
Пример #8
0
}
// ... 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>";
Пример #9
0
 * Install chunk_6
 *
 * Takes care of patching - final run
 *
 * @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("Applying patches"), true);
InstallLogger::stdout(InstallLogger::logMessage("Final run!"));
// PREPARE PATCHES, IF ANY!
if (isset($_SESSION['patches'])) {
    // apply patches, if any
    foreach ($_SESSION['patches'] as $patch => $doApply) {
        InstallLogger::stdout(InstallLogger::logMessage("Applying patch {$patch}"), true);
        if ($doApply) {
            if (file_exists('./patches/' . $patch . '/run.php')) {
                InstallLogger::stdout(InstallLogger::logMessage("Running {$patch}..."));
                include_once './patches/' . $patch . '/run.php';
            } else {
                InstallLogger::stdout(InstallLogger::logMessage("{$patch} did not exist!"));
            }
        }
    }
} else {
    InstallLogger::stdout(InstallLogger::logMessage("Nothing to do here..."), true);
}
echo "<script type=\"text/javascript\">this.location.href=\"./index.php?action=install_chunk_7\"</script>";
Пример #10
0
 public static function getInstance($fileName = null)
 {
     if (!self::$_instance) {
         self::$_instance = new InstallLogger();
         self::$_logFile = $fileName;
         if (!file_exists($fileName)) {
             file_put_contents($fileName, "INSTALL LOG\n==========\n\n");
         }
     }
     return self::$_instance;
 }
Пример #11
0
*/
/**
 * Install chunk_5
 *
 * Takes care of file operations
 *
 * @author Thorsten Suckow-Homberg <*****@*****.**>
 */
/**
 * check if user is authorized to load script
 */
include './scripts/check_auth.php';
$libFolder = $_SESSION['setup_ini']['lib_path']['folder'];
$appFolder = $_SESSION['setup_ini']['app_path']['folder'];
InstallLogger::getInstance($_SESSION['install_process']['INSTALL_LOGGER']);
InstallLogger::stdout(InstallLogger::logMessage("Updating cache system..."), true);
// remove old cache folders
if (isset($_SESSION['installation_info']['cache.default.caching']) && $_SESSION['installation_info']['cache.default.caching']) {
    if (isset($_SESSION['installation_info']['cache.db.metadata.backend.cache_dir']) && file_exists($_SESSION['installation_info']['cache.db.metadata.backend.cache_dir'])) {
        @conjoon_rmdir($_SESSION['installation_info']['cache.db.metadata.backend.cache_dir']);
        @rmdir($_SESSION['installation_info']['cache.db.metadata.backend.cache_dir']);
    }
    if (isset($_SESSION['installation_info']['cache.email.message.backend.cache_dir']) && file_exists($_SESSION['installation_info']['cache.email.message.backend.cache_dir'])) {
        @conjoon_rmdir($_SESSION['installation_info']['cache.email.message.backend.cache_dir']);
        @rmdir($_SESSION['installation_info']['cache.email.message.backend.cache_dir']);
    }
    if (isset($_SESSION['installation_info']['cache.email.accounts.backend.cache_dir']) && file_exists($_SESSION['installation_info']['cache.email.accounts.backend.cache_dir'])) {
        @conjoon_rmdir($_SESSION['installation_info']['cache.email.accounts.backend.cache_dir']);
        @rmdir($_SESSION['installation_info']['cache.email.accounts.backend.cache_dir']);
    }
    if (isset($_SESSION['installation_info']['cache.email.folders_root_type.backend.cache_dir']) && file_exists($_SESSION['installation_info']['cache.email.folders_root_type.backend.cache_dir'])) {
Пример #12
0
/**
 * Install chunk_3
 *
 * Takes care of db updates
 *
 * @author Thorsten Suckow-Homberg <*****@*****.**>
 */
/**
 * check if user is authorized to load script
 */
include './scripts/check_auth.php';
$libFolder = $_SESSION['setup_ini']['lib_path']['folder'];
$text = "Updating database. Depending on your database size, this can take a while. " . "Please note that progress marked with \"failure\" " . "is not an indication for a failed update attempt... " . "Don\\'t worry, we got this.";
InstallLogger::getInstance($_SESSION['install_process']['INSTALL_LOGGER']);
InstallLogger::stdout(InstallLogger::logMessage($text), true);
InstallLogger::stdout(InstallLogger::logMessage("Updating database"));
$dbConnInfo = array('host' => $_SESSION['db_host'], 'port' => $_SESSION['db_port'], 'database' => $_SESSION['db'], 'user' => $_SESSION['db_user'], 'password' => $_SESSION['db_password'], 'prefix' => $_SESSION['db_table_prefix']);
// import the sql file for the selected database
$path = realpath('./files/datastore/mysql/conjoon.sql');
conjoon_createTables($path, $_SESSION['db_adapter'], $dbConnInfo);
$table = "";
sleep(1);
// create root user if needed
if (!isset($_SESSION['installation_info']['app_credentials'])) {
    conjoon_createAdmin($_SESSION['db_adapter'], array('user' => $_SESSION['app_credentials']['user'], 'password' => $_SESSION['app_credentials']['password'], 'firstname' => $_SESSION['app_credentials']['firstname'], 'lastname' => $_SESSION['app_credentials']['lastname'], 'email_address' => $_SESSION['app_credentials']['email_address']), $dbConnInfo);
}
sleep(1);
// add fixtures
$path = realpath('./files/datastore/mysql/fixtures.sql');
conjoon_insertFixtures($path, $_SESSION['db_adapter'], $dbConnInfo);
echo "<script type=\"text/javascript\">this.location.href=\"./index.php?action=install_chunk_4\"</script>";