1<?php 2 3/** 4 * This file is part of the Froxlor project. 5 * Copyright (c) 2003-2009 the SysCP Team (see authors). 6 * Copyright (c) 2010 the Froxlor Team (see authors). 7 * 8 * For the full copyright and license information, please view the COPYING 9 * file that was distributed with this source code. You can also view the 10 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt 11 * 12 * @copyright (c) the authors 13 * @author Florian Lippert <flo@syscp.org> (2003-2009) 14 * @author Froxlor team <team@froxlor.org> (2010-) 15 * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt 16 * @package Install 17 * 18 */ 19 20if (!defined('AREA') 21 || (defined('AREA') && AREA != 'admin') 22 || !isset($userinfo['loginname']) 23 || (isset($userinfo['loginname']) && $userinfo['loginname'] == '') 24) { 25 header('Location: ../index.php'); 26 exit; 27} 28 29$updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater')); 30 31$updatelogfile = validateUpdateLogFile(makeCorrectFile(dirname(__FILE__).'/update.log')); 32$filelog = FileLogger::getInstanceOf(array('loginname' => 'updater')); 33$filelog->setLogFile($updatelogfile); 34 35// if first writing does not work we'll stop, tell the user to fix it 36// and then let him try again. 37try { 38 $filelog->logAction(ADM_ACTION, LOG_WARNING, '-------------- START LOG --------------'); 39} catch(Exception $e) { 40 standard_error('exception', $e->getMessage()); 41} 42 43/* 44 * since froxlor, we have to check if there's still someone 45 * out there using syscp and needs to upgrade 46 */ 47if(!isFroxlor()) { 48 /** 49 * Upgrading SysCP to Froxlor-0.9 50 */ 51 include_once (makeCorrectFile(dirname(__FILE__).'/updates/froxlor/upgrade_syscp.inc.php')); 52} 53 54if (isFroxlor()) { 55 include_once (makeCorrectFile(dirname(__FILE__).'/updates/froxlor/0.9/update_0.9.inc.php')); 56 57 // Check Froxlor - database integrity (only happens after all updates are done, so we know the db-layout is okay) 58 showUpdateStep("Checking database integrity"); 59 60 $integrity = new IntegrityCheck(); 61 if (!$integrity->checkAll()) { 62 lastStepStatus(1, 'Monkeys ate the integrity'); 63 showUpdateStep("Trying to remove monkeys, feeding bananas"); 64 if(!$integrity->fixAll()) { 65 lastStepStatus(2, 'Some monkeys just would not move, you should contact team@froxlor.org'); 66 } else { 67 lastStepStatus(0, 'Integrity restored'); 68 } 69 } else { 70 lastStepStatus(0); 71 } 72 73 $filelog->logAction(ADM_ACTION, LOG_WARNING, '--------------- END LOG ---------------'); 74 unset($filelog); 75} 76