if (file_exists($autosetup_file)) { OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', OC_Log::INFO); include $autosetup_file; $_POST['install'] = 'true'; $_POST = array_merge($_POST, $AUTOCONFIG); unlink($autosetup_file); } OC_Util::addScript('setup'); $hasSQLite = (is_callable('sqlite_open') or class_exists('SQLite3')); $hasMySQL = is_callable('mysql_connect'); $hasPostgreSQL = is_callable('pg_connect'); $hasOracle = is_callable('oci_connect'); $datadir = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data'); // Protect data directory here, so we can test if the protection is working OC_Setup::protectDataDirectory(); $opts = array('hasSQLite' => $hasSQLite, 'hasMySQL' => $hasMySQL, 'hasPostgreSQL' => $hasPostgreSQL, 'hasOracle' => $hasOracle, 'directory' => $datadir, 'secureRNG' => OC_Util::secureRNG_available(), 'htaccessWorking' => OC_Util::ishtaccessworking(), 'errors' => array()); if (isset($_POST['install']) and $_POST['install'] == 'true') { // We have to launch the installation process : $e = OC_Setup::install($_POST); $errors = array('errors' => $e); if (count($e) > 0) { //OC_Template::printGuestPage("", "error", array("errors" => $errors)); $options = array_merge($_POST, $opts, $errors); OC_Template::printGuestPage("", "installation", $options); } else { header("Location: " . OC::$WEBROOT . '/'); exit; } } else { OC_Template::printGuestPage("", "installation", $opts); }
<?php /** * Copyright (c) 2011, Robin Appelman <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ require_once '../lib/base.php'; OC_Util::checkAdminUser(); OC_Util::addStyle("settings", "settings"); OC_Util::addScript("settings", "admin"); OC_Util::addScript("settings", "log"); OC_App::setActiveNavigationEntry("admin"); $tmpl = new OC_Template('settings', 'admin', 'user'); $forms = OC_App::getForms('admin'); $htaccessworking = OC_Util::ishtaccessworking(); $entries = OC_Log_Owncloud::getEntries(3); $entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3 ? true : false; function compareEntries($a, $b) { return $b->time - $a->time; } usort($entries, 'compareEntries'); $tmpl->assign('loglevel', OC_Config::getValue("loglevel", 2)); $tmpl->assign('entries', OC_Util::sanitizeHTML($entries)); $tmpl->assign('entriesremain', $entriesremain); $tmpl->assign('htaccessworking', $htaccessworking); $tmpl->assign('forms', array()); foreach ($forms as $form) { $tmpl->append('forms', $form); }
public static function checkUpgrade() { if (OC_Config::getValue('installed', false)) { $installedVersion = OC_Config::getValue('version', '0.0.0'); $currentVersion = implode('.', OC_Util::getVersion()); if (version_compare($currentVersion, $installedVersion, '>')) { // Check if the .htaccess is existing - this is needed for upgrades from really old ownCloud versions if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) { if (!OC_Util::ishtaccessworking()) { if (!file_exists(OC::$SERVERROOT . '/data/.htaccess')) { OC_Setup::protectDataDirectory(); } } } OC_Log::write('core', 'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::DEBUG); $result = OC_DB::updateDbFromStructure(OC::$SERVERROOT . '/db_structure.xml'); if (!$result) { echo 'Error while upgrading the database'; die; } if (file_exists(OC::$SERVERROOT . "/config/config.php") and !is_writable(OC::$SERVERROOT . "/config/config.php")) { $tmpl = new OC_Template('', 'error', 'guest'); $tmpl->assign('errors', array(1 => array('error' => "Can't write into config directory 'config'", 'hint' => "You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); $tmpl->printPage(); exit; } $minimizerCSS = new OC_Minimizer_CSS(); $minimizerCSS->clearCache(); $minimizerJS = new OC_Minimizer_JS(); $minimizerJS->clearCache(); OC_Config::setValue('version', implode('.', OC_Util::getVersion())); OC_App::checkAppsRequirements(); // load all apps to also upgrade enabled apps OC_App::loadApps(); } } }