mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 04:10:38 +02:00
Install routine fix - problem related mainly with our old enemy - global vars;
Everything should work fine now, notices also cleared.
This commit is contained in:
@@ -179,13 +179,15 @@ class e_admin_log
|
||||
*/
|
||||
public function e_log_event($importance, $source_call, $eventcode = "GEN", $event_title = "Untitled", $explain = "", $finished = FALSE, $target_logs = LOG_TO_AUDIT )
|
||||
{
|
||||
global $pref,$e107,$tp;
|
||||
$e107 = e107::getInstance();
|
||||
$pref = e107::getPref();
|
||||
$tp = e107::getParser();
|
||||
|
||||
list($time_usec, $time_sec) = explode(" ", microtime(FALSE)); // Log event time immediately to minimise uncertainty
|
||||
$time_usec = $time_usec * 1000000;
|
||||
|
||||
if ($this->rldb == NULL)
|
||||
$this->rldb = new db; // Better use our own db - don't know what else is going on
|
||||
$this->rldb = e107::getDb('adminlog'); // Better use our own db - don't know what else is going on
|
||||
|
||||
if (is_bool($target_logs))
|
||||
{ // Handle the legacy stuff for now - some old code used a boolean to select admin or rolling logs
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
@@ -34,11 +34,10 @@ class ecache {
|
||||
|
||||
const CACHE_PREFIX = '<?php exit;';
|
||||
|
||||
function ecache()
|
||||
function __construct()
|
||||
{
|
||||
global $pref;
|
||||
$this->UserCacheActive = varsettrue($pref['cachestatus']);
|
||||
$this->SystemCacheActive = varsettrue($pref['syscachestatus']);
|
||||
$this->UserCacheActive = e107::getPref('cachestatus');
|
||||
$this->SystemCacheActive = e107::getPref('syscachestatus');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,8 +103,7 @@ class ecache {
|
||||
*/
|
||||
function retrieve($CacheTag, $MaximumAge = false, $ForcedCheck = false, $syscache = false)
|
||||
{
|
||||
global $pref, $tp;
|
||||
if(($ForcedCheck != false ) || ($syscache == false && varsettrue($pref['cachestatus'])) || ($syscache == true && varsettrue($pref['syscachestatus'])) && !$tp->checkHighlighting())
|
||||
if(($ForcedCheck != false ) || ($syscache == false && $this->UserCacheActive) || ($syscache == true && $this->SystemCacheActive) && !e107::getParser()->checkHighlighting())
|
||||
{
|
||||
$cache_file = (isset($this) && $this instanceof ecache ? $this->cache_fname($CacheTag, $syscache) : ecache::cache_fname($CacheTag, $syscache));
|
||||
if (file_exists($cache_file))
|
||||
@@ -165,8 +163,7 @@ class ecache {
|
||||
*/
|
||||
public function set($CacheTag, $Data, $ForceCache = false, $bRaw=0, $syscache = false)
|
||||
{
|
||||
global $pref, $FILES_DIRECTORY, $tp;
|
||||
if(($ForceCache != false ) || ($syscache == false && varsettrue($pref['cachestatus'])) || ($syscache == true && varsettrue($pref['syscachestatus'])) && !$tp->checkHighlighting())
|
||||
if(($ForceCache != false ) || ($syscache == false && $this->UserCacheActive) || ($syscache == true && $this->SystemCacheActive) && !e107::getParser()->checkHighlighting())
|
||||
{
|
||||
$cache_file = (isset($this) && $this instanceof ecache ? $this->cache_fname($CacheTag, $syscache) : ecache::cache_fname($CacheTag, $syscache));
|
||||
file_put_contents($cache_file, ($bRaw? $Data : self::CACHE_PREFIX.$Data) );
|
||||
@@ -268,5 +265,3 @@ class ecache {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -504,6 +504,7 @@ class e_pref extends e_front_model
|
||||
}
|
||||
|
||||
$admin_log = e107::getAdminLog();
|
||||
$disallow_logs = $this->getParam('nologs', false);
|
||||
|
||||
//Save to DB
|
||||
if(!$this->hasError())
|
||||
@@ -534,7 +535,7 @@ class e_pref extends e_front_model
|
||||
}
|
||||
|
||||
// auto admin log
|
||||
if(is_array($old)) // fix install problems - no old prefs available
|
||||
if(is_array($old) && !$disallow_logs) // fix install problems - no old prefs available
|
||||
{
|
||||
$new = $this->getPref();
|
||||
$admin_log->logArrayDiffs($new, $old, 'PREFS_02', false);
|
||||
@@ -542,13 +543,13 @@ class e_pref extends e_front_model
|
||||
}
|
||||
if(e107::getDb()->db_Select_gen("REPLACE INTO `#core` (e107_name,e107_value) values ('".$this->prefid."_Backup', '".addslashes($dbdata)."') "))
|
||||
{
|
||||
$admin_log->logMessage('Backup of <strong>'.$this->alias.' ('.$this->prefid.')</strong> successfully created.', E_MESSAGE_DEBUG, E_MESSAGE_SUCCESS, $session_messages);
|
||||
if(!$disallow_logs) $admin_log->logMessage('Backup of <strong>'.$this->alias.' ('.$this->prefid.')</strong> successfully created.', E_MESSAGE_DEBUG, E_MESSAGE_SUCCESS, $session_messages);
|
||||
ecache::clear_sys('Config_'.$this->alias.'_backup');
|
||||
}
|
||||
}
|
||||
$this->setPrefCache($this->toString(false), true); //reset pref cache - runtime & file
|
||||
|
||||
$admin_log->logSuccess('Settings successfully saved.', true, $session_messages)->flushMessages('PREFS_01');
|
||||
if(!$disallow_logs) $admin_log->logSuccess('Settings successfully saved.', true, $session_messages)->flushMessages('PREFS_01');
|
||||
//BC
|
||||
if($this->alias === 'core')
|
||||
{
|
||||
@@ -558,7 +559,8 @@ class e_pref extends e_front_model
|
||||
}
|
||||
elseif(e107::getDb()->getLastErrorNumber())
|
||||
{
|
||||
$admin_log->logError('mySQL error #'.e107::getDb()->getLastErrorNumber().': '.e107::getDb()->getLastErrorText(), true, $session_messages)
|
||||
if(!$disallow_logs)
|
||||
$admin_log->logError('mySQL error #'.e107::getDb()->getLastErrorNumber().': '.e107::getDb()->getLastErrorText(), true, $session_messages)
|
||||
->logError('Settings not saved.', true, $session_messages)
|
||||
->flushMessages('PREFS_03');
|
||||
return false;
|
||||
@@ -569,14 +571,15 @@ class e_pref extends e_front_model
|
||||
{
|
||||
//add errors to the eMessage stack
|
||||
//$this->setErrors(true, $session_messages); old - doesn't needed anymore
|
||||
$admin_log->logError('Settings not saved.', true, $session_messages)
|
||||
if(!$disallow_logs)
|
||||
$admin_log->logError('Settings not saved.', true, $session_messages)
|
||||
->flushMessages('LAN_FIXME');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
e107::getMessage()->add('Settings not saved as no changes were made.', E_MESSAGE_INFO, $session_messages);
|
||||
$admin_log->flushMessages('LAN_FIXME');
|
||||
if(!$disallow_logs) $admin_log->flushMessages('LAN_FIXME');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@@ -2,16 +2,14 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Simple XML Parser
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $URL $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@@ -828,10 +826,11 @@ class xmlClass
|
||||
*
|
||||
* @param path $file - e107 XML file path
|
||||
* @param string $mode[optional] - add|replace
|
||||
* @param boolean $noLogs [optional] tells pref handler to disable admin logs when true (install issues)
|
||||
* @param boolean $debug [optional]
|
||||
* @return array with keys 'success' and 'failed' - DB table entry status.
|
||||
*/
|
||||
public function e107Import($file,$mode='replace',$debug=FALSE)
|
||||
public function e107Import($file, $mode='replace', $noLogs = false, $debug=FALSE)
|
||||
{
|
||||
|
||||
$xmlArray = $this->loadXMLfile($file, 'advanced');
|
||||
@@ -866,7 +865,9 @@ class xmlClass
|
||||
|
||||
if($debug == FALSE)
|
||||
{
|
||||
e107::getConfig($type)->save(FALSE,TRUE);
|
||||
e107::getConfig($type)
|
||||
->setParam('nologs', $noLogs)
|
||||
->save(FALSE,TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
28
install_.php
28
install_.php
@@ -204,6 +204,11 @@ class e_install
|
||||
// public function __construct()
|
||||
function e_install()
|
||||
{
|
||||
// notice removal, required from various core routines
|
||||
define('USERID', 1);
|
||||
define('USER', true);
|
||||
define('ADMIN', true);
|
||||
|
||||
$this->logFile = '';
|
||||
if (MAKE_INSTALL_LOG)
|
||||
{
|
||||
@@ -791,6 +796,10 @@ class e_install
|
||||
return $this->stage_5();
|
||||
}
|
||||
|
||||
// required for various core routines
|
||||
define('USERNAME', $this->previous_steps['admin']['user']);
|
||||
define('USEREMAIL', $this->previous_steps['admin']['email']);
|
||||
|
||||
|
||||
// ------------- Step 6 Form --------------------------------
|
||||
|
||||
@@ -873,6 +882,10 @@ class e_install
|
||||
$this->stage = 7;
|
||||
$this->logLine('Stage 7 started');
|
||||
|
||||
// required for various core routines
|
||||
define('USERNAME', $this->previous_steps['admin']['user']);
|
||||
define('USEREMAIL', $this->previous_steps['admin']['email']);
|
||||
|
||||
if(varset($_POST['sitename']))
|
||||
{
|
||||
$this->previous_steps['prefs']['sitename'] = $_POST['sitename'];
|
||||
@@ -940,6 +953,11 @@ class e_install
|
||||
{
|
||||
|
||||
global $e_forms;
|
||||
|
||||
// required for various core routines
|
||||
define('USERNAME', $this->previous_steps['admin']['user']);
|
||||
define('USEREMAIL', $this->previous_steps['admin']['email']);
|
||||
|
||||
$this->stage = 8;
|
||||
$this->logLine('Stage 8 started');
|
||||
|
||||
@@ -1029,6 +1047,7 @@ class e_install
|
||||
{
|
||||
$this->logLine('Starting configuration import');
|
||||
|
||||
|
||||
// Basic stuff to get the handlers/classes to work.
|
||||
|
||||
|
||||
@@ -1066,7 +1085,6 @@ class e_install
|
||||
$tp = e107::getParser();
|
||||
|
||||
define('PREVIEWTHEMENAME',""); // Notice Removal.
|
||||
define('USERID', 1); // notice removal, required from media import routine
|
||||
|
||||
include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$this->previous_steps['language']."/lan_prefs.php");
|
||||
include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$this->previous_steps['language']."/admin/lan_theme.php");
|
||||
@@ -1077,8 +1095,8 @@ class e_install
|
||||
$this->logLine('Plugins table updated');
|
||||
|
||||
//should be 'add' not 'replace' - but 'add' doesn't insert arrays correctly.
|
||||
// [SecretR] should work now
|
||||
e107::getXml()->e107Import($XMLImportfile, 'add'); // Add missing core pref values
|
||||
// [SecretR] should work now - fixed log errors (argument noLogs = true) change to false to enable log
|
||||
e107::getXml()->e107Import($XMLImportfile, 'add', true); // Add missing core pref values
|
||||
$this->logLine('Core prefs written');
|
||||
|
||||
// Install Theme-required plugins
|
||||
@@ -1110,9 +1128,11 @@ class e_install
|
||||
$this->logLine('Addon prefs saved');
|
||||
|
||||
$tm = e107::getSingleton('themeHandler');
|
||||
$tm->noLog = TRUE;
|
||||
$tm->noLog = true; // false to enable log
|
||||
$tm->setTheme($this->previous_steps['prefs']['sitetheme']);
|
||||
|
||||
// Admin log fix - don't allow logs to be called inside pref handler
|
||||
e107::getConfig('core')->setParam('nologs', false); // change to true to enable log
|
||||
$pref = e107::getConfig('core')->getPref();
|
||||
|
||||
// Set Preferences defined during install - overwriting those that may exist in the XML.
|
||||
|
Reference in New Issue
Block a user