Example #1
0
SystemPref::DeleteSystemPrefsFromCache();
// replace $campsite by $gimme
require_once $g_documentRoot . '/classes/TemplateConverterNewscoop.php';
$template_files = camp_read_files($g_documentRoot . '/templates');
$converter = new TemplateConverterNewscoop();
if (!empty($template_files)) {
    foreach ($template_files as $template_file) {
        $converter->read($template_file);
        $converter->parse();
        $converter->write();
    }
}
// update plugins
CampPlugin::OnUpgrade();
CampRequest::SetVar('step', 'finish');
$install = new CampInstallation();
$install->initSession();
$step = $install->execute();
// update plugins environment
CampPlugin::OnAfterUpgrade();
CampTemplate::singleton()->clearCache();
// replace javascript by js in .htaccess file
$htaccesspath = $g_documentRoot . '/.htaccess';
if (upgrade_htaccess($htaccesspath) == false) {
    display_upgrade_error('Could not write .htaccess file.<br />Please read the ' . 'UPGRADE.txt file in this same directory to see what changes need to ' . 'be apply for this specific version of Newscoop.', FALSE);
}
if (file_exists($upgrade_trigger_path)) {
    @unlink($upgrade_trigger_path);
}
function display_upgrade_error($p_errorMessage, $exit = TRUE)
{
Example #2
0
$GLOBALS['g_campsiteDir'] = dirname(dirname(__FILE__));
require_once $GLOBALS['g_campsiteDir'] . '/include/campsite_constants.php';
require_once $GLOBALS['g_campsiteDir'] . '/install/classes/CampInstallation.php';
require_once CS_PATH_CONFIG . DIR_SEP . 'install_conf.php';
if (file_exists(CS_PATH_CONFIG . DIR_SEP . 'configuration.php') && file_exists(CS_PATH_CONFIG . DIR_SEP . 'database_conf.php')) {
    header("Location: " . CS_PATH_BASE_URL . str_replace('/install', '', $Campsite['SUBDIR']));
}
// check if template cache dir is writable
$templates_cache = dirname(dirname(__FILE__)) . DIR_SEP . 'cache';
if (!is_writable($templates_cache)) {
    echo '<!DOCTYPE html>';
    echo '<html><head><meta charset="utf-8" />';
    echo '<title>Install requirement</title>';
    echo '<link rel="shortcut icon" href="' . $GLOBALS['g_campsiteDir'] . '/admin-style/images/7773658c3ccbf03954b4dacb029b2229.ico" />';
    echo '</head><body>';
    echo '<h1>Install requirement</h1>';
    echo "<p>Directory '{$templates_cache}' is not writable.</p>";
    echo "<p>Please make it writable in order to continue. (i.e. <code>\$ sudo chmod o+w {$templates_cache}</code> on linux)</p>";
    echo '</body></html>';
    exit;
}
unset($templates_cache);
$install = new CampInstallation();
$install->initSession();
$step = $install->execute();
$install->dispatch($step);
$install->render();
if ($step == 'finish') {
    $template = CampTemplate::singleton();
    $template->clear_compiled_tpl();
}
    private function sysCheck()
    {
        $success = true;

        $to_check = array(
            CS_PATH_SITE => 'Document Root Writable',
            CS_INSTALL_DIR.DIR_SEP.'cron_jobs' => 'Cron Jobs Writable',
            CS_PATH_CONFIG => 'Configuration Files Writable',
            CS_PATH_TEMPLATES => 'Templates Folder Writable',
            CS_PATH_SITE.DIR_SEP.'templates_cache' => 'Templates Cache Writable',
            CS_PATH_SITE.DIR_SEP.'plugins' => 'Plugins Folder Writable',
            CS_PATH_SITE.DIR_SEP.'backup' => 'Backup Folder Writable',
            );

        foreach ($to_check as $path => $tag) {
            $isWritable = CampInstallationViewHelper::CheckDirWritable($path);
            $success = ($isWritable == 'Yes') ? $success : false;
            $sysRequirements[] = array(
                                   'tag' => $tag,
                                   'exists' => $isWritable,
                                   'path' => $path
                                   );
        }

        if (CampInstallation::GetHostOS() == 'windows') {
            $sysRequirements[] = array(
                                       'tag' => 'Apache mod_rewrite enabled',
                                       'exists' => '<a href="#" onmouseover="domTT_activate(this, event, \'caption\', \'What is this?\', \'content\', \''.wordwrap('As you are installing Newscoop on a Windows server you will need to have the Apache mod_rewrite module enabled in order to be able to use friendly short names URLs.<br /><br />This, however, is not mandatory, as you still will can run Newscoop by using template path URLs.', 60, '<br />', true).'\', \'trail\', true, \'delay\', 0);">?</a>'
                                       );
        }
        $this->m_lists['sysRequirements'] = $sysRequirements;

        return $success;
    } // fn sysCheck