Project

General

Profile

« Previous | Next » 

Revision 1870

Added by Dietmar over 11 years ago

  1. solved installation issues
    ! upgrade-script sanitize pages_directory before creating access files

View differences:

branches/2.8.x/CHANGELOG
12 12
===============================================================================
13 13

  
14 14

  
15
21 Feb-2013 Build 1870 Dietmar Woellbrink (Luisehahne)
16
# solved installation issues
17
! upgrade-script sanitize pages_directory before creating access files
15 18
20 Feb-2013 Build 1869 Dietmar Woellbrink (Luisehahne)
16 19
# solved renaming access files by page settings if php as apachehandler
17 20
19 Feb-2013 Build 1868 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/upgrade-script.php
39 39
if(file_exists($config_file) && !defined('WB_URL'))
40 40
{
41 41
	require($config_file);
42

  
42 43
}
43

  
44
// solved wrong pages_directory value before creating access files
45
$sql  = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` ';
46
$sql .= 'WHERE `name`=\'pages_directory\' ';
47
$sTmpDir = WbDatabase::getInstance()->get_one($sql);
48
$sTmpDir = ( (strpos($sTmpDir,'/',0)===false) && (strlen($sTmpDir)>1)  ? '/'.$sTmpDir : rtrim($sTmpDir,'/') );
49
$sPagesDir = defined('PAGES_DIRECTORY') ? PAGES_DIRECTORY : '';
50
if(($sTmpDir != $sPagesDir)) {
51
	$sql = 'UPDATE `'.TABLE_PREFIX.'settings` SET '
52
		.  '`value` = \''.$sTmpDir.'\' '
53
		.  'WHERE `name`=\'pages_directory\' ';
54
	if(!WbDatabase::getInstance()->query($sql) ) {}
55
}
44 56
//require_once(WB_PATH.'/framework/class.admin.php');
45 57
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
46 58
require_once(WB_PATH.'/framework/functions.php');
......
59 71
// set addition settings if not exists, otherwise upgrade will be breaks
60 72
if(!defined('WB_SP')) { define('WB_SP',''); }
61 73
if(!defined('WB_REVISION')) { define('WB_REVISION',''); }
62

  
63 74
// database tables including in WB package
64 75
$aPackage = array (
65 76
    'settings','groups','addons','pages','sections','search','users',
......
358 369
<p class="info">This script upgrades an existing WebsiteBaker <strong> <?php echo $oldRevision; ?></strong> installation to the <strong> <?php echo $newRevision ?> </strong>.<br />The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p>
359 370

  
360 371
<?php
372

  
361 373
/**
362 374
 * Check if disclaimer was accepted
363 375
 */
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1869');
54
if(!defined('REVISION')) define('REVISION', '1870');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/initialize.php
188 188
									 ? false 
189 189
									 : $aSetting['value'])
190 190
								 );
191
			$aSetting['name'] = strtoupper($aSetting['name']);
192
			if($aSetting['name'] == 'STRING_FILE_MODE') {
193
				$iTmp = ((intval(octdec($aSetting['value'])) & ~0111)|0600);
194
				define('OCTAL_FILE_MODE', $iTmp);
195
				define('STRING_FILE_MODE', sprintf('0%03o', $iTmp));
196
			}elseif($aSetting['name'] == 'STRING_DIR_MODE') {
197
				$iTmp = (intval(octdec($aSetting['value'])) |0711);
198
				define('OCTAL_DIR_MODE', $iTmp);
199
				define('STRING_DIR_MODE', sprintf('0%03o', $iTmp));
200
			}else {
191 201
			// make global const from setting
192
			@define(strtoupper($aSetting['name']), $aSetting['value']);
202
				@define($aSetting['name'], $aSetting['value']);
203
			}
193 204
		}
194 205
	}else { throw new AppException($database->get_error()); }
195 206
// get/set users timezone ---
......
203 214
// extended wb editor settings
204 215
	define('EDIT_ONE_SECTION', false);
205 216
	define('EDITOR_WIDTH', 0);
206
// define numeric, octal values for chmod operations ---	
207
	$string_file_mode = STRING_FILE_MODE; // STRING_FILE_MODE is set deprecated
208
	define('OCTAL_FILE_MODE',(int) octdec($string_file_mode));
209
	$string_dir_mode = STRING_DIR_MODE; // STRING_DIR_MODE is set deprecated
210
	define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
211 217
// define form security class and preload it ---
212 218
	$sSecMod = (defined('SECURE_FORM_MODULE') && SECURE_FORM_MODULE != '') ? '.'.SECURE_FORM_MODULE : '';
213 219
	$sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php';
branches/2.8.x/wb/framework/WbAutoloader.php
14 14
 * Register WB - CoreAutoloader as SPL autoloader
15 15
 * @param array $aDirectories list of 'directory'=>'shortKey'
16 16
 */
17
    static public function doRegister(array $aDirectories)
18
    {
19
		if(sizeof($aDirectories > 0)) {
20
			self::$_aSearchpatterns[] = '/(^.[^_].*$)/i';
21
			self::$_aReplacements[] = basename(dirname(__FILE__)).'_$1';
22
			foreach($aDirectories as $value => $shortKey) {
23
				self::$_aSearchpatterns[] = '/^'.$shortKey.'_/i';
24
				self::$_aReplacements[] = $value.'_';
17
	static public function doRegister(array $aDirectories)
18
	{
19
		if(!sizeof(self::$_aSearchpatterns)) {
20
			if(sizeof($aDirectories > 0)) {
21
				self::$_aSearchpatterns[] = '/(^.[^_].*$)/i';
22
				self::$_aReplacements[] = basename(dirname(__FILE__)).'_$1';
23
				foreach($aDirectories as $value => $shortKey) {
24
					self::$_aSearchpatterns[] = '/^'.$shortKey.'_/i';
25
					self::$_aReplacements[] = $value.'_';
26
				}
25 27
			}
26 28
		}
27
        spl_autoload_register(array(new self, 'CoreAutoloader'));
28
    }
29
		spl_autoload_register(array(new self, 'CoreAutoloader'));
30
	}
29 31
/**
30 32
 * tries autoloading the given class
31 33
 * @param  string $sClassName
branches/2.8.x/wb/install/save.php
17 17

  
18 18
$debug = true;
19 19

  
20
include(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php'); 
21
include(dirname(dirname(__FILE__)).'/framework/WbAutoloader.php');
22
WbAutoloader::doRegister(array('admin'=>'a', 'modules'=>'m'));
23

  
20 24
if (true === $debug) {
21 25
	ini_set('display_errors', 1);
22 26
	error_reporting(E_ALL);
......
31 35
list($usec,$sec) = explode(' ',microtime());
32 36
srand((float)$sec+((float)$usec*100000));
33 37
$session_rand = rand(1000,9999);
34
if(!class_exists('WbAutoloader', false)) {
35
	include(dirname(dirname(__FILE__)).'/framework/WbAutoloader.php');
36
}
37
WbAutoloader::doRegister(array('admin'=>'a', 'modules'=>'m'));
38 38

  
39 39
// Function to set error
40 40
function set_error($message, $field_name = '') {
......
98 98
		$default_file_mode = '0'.substr(sprintf('%o', fileperms($filename)), -3);
99 99
		unlink($filename);
100 100
	} else {
101
		$default_file_mode = '0777';
101
		$default_file_mode = '0666';
102 102
	}
103 103
	return $default_file_mode;
104 104
}
......
328 328
define('ADMIN_URL', $wb_url.'/'.ADMIN_DIRECTORY);
329 329

  
330 330
// Check if the user has entered a correct path
331
    if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
332
    	set_error('It appears the Absolute path that you entered is incorrect');
333
    }
331
	if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
332
		set_error('It appears the Absolute path that you entered is incorrect');
333
	}
334 334
	$sSqlUrl = DB_TYPE.'://'.DB_USERNAME.':'.DB_PASSWORD.'@'.DB_HOST.'/'.DB_NAME;
335 335
	$database = WbDatabase::getInstance();
336 336
	$database->doConnect($sSqlUrl);
......
351 351
	}
352 352

  
353 353
//  core tables only structure
354
    $sSqlFileName = dirname(__FILE__).'/sql/websitebaker.sql';
355
    if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
354
	$sSqlFileName = dirname(__FILE__).'/sql/websitebaker.sql';
355
	if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
356 356

  
357 357
	require(ADMIN_PATH.'/interface/version.php');
358 358

  
......
430 430
	if(!$database->query($insert_admin_group)) { set_error($database->get_error()); }
431 431

  
432 432
// Admin user
433
    $insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` VALUES (1, 1, '1', 1, '$admin_username', '".md5($admin_password)."', '', 0, '', 0, 'Administrator', '$admin_email', $default_timezone, '', '', '$default_language', '', 0, '');";
433
	$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` VALUES (1, 1, '1', 1, '$admin_username', '".md5($admin_password)."', '', 0, '', 0, 'Administrator', '$admin_email', $default_timezone, '', '', '$default_language', '', 0, '');";
434 434
	if(!$database->query($insert_admin_user)) { set_error($database->get_error()); }
435 435

  
436 436
// Search layout default data
437
    $sSqlFileName = dirname(__FILE__).'/sql/wb_search_data.sql';
438
    if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
437
	$sSqlFileName = dirname(__FILE__).'/sql/wb_search_data.sql';
438
	if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
439 439

  
440
	require_once(WB_PATH.'/framework/initialize.php');
440 441
// Include WB functions file
441 442
	require_once(WB_PATH.'/framework/functions.php');
442 443
// Re-connect to the database, this time using in-build database class
443 444
	require_once(WB_PATH.'/framework/class.login.php');
444

  
445
	require_once(WB_PATH.'/framework/initialize.php');
446 445
	// Include the PclZip class file (thanks to
447 446
	require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');
448 447
	// Install add-ons
......
490 489
		set_error($database->get_error());
491 490
	}
492 491

  
493
    if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY )) ) {  }
494
    if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY.'/home' )) ) {  }
495
    if ( sizeof(createFolderProtectFile( WB_PATH.PAGES_DIRECTORY )) ) {  }
492
	if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY )) ) {  }
493
	if ( sizeof(createFolderProtectFile( WB_PATH.MEDIA_DIRECTORY.'/home' )) ) {  }
494
	if ( sizeof(createFolderProtectFile( WB_PATH.PAGES_DIRECTORY )) ) {  }
496 495

  
497 496
// end of if install_tables
498 497

  

Also available in: Unified diff