Project

General

Profile

« Previous | Next » 

Revision 2090

Added by darkviper almost 11 years ago

! UpgradeHelper: added method delTree()
- templates/argos_theme
- templates/allcss
- templates/wb_theme
+ templates/WbTheme
! all upgrade/install and all other files needed to change defaults
  1. modules/MultiLingual/update_keys.php inactive lines of code removed

View differences:

upgrade-script.php
79 79
if (is_readable($config_file) && !defined('WB_URL')) {
80 80
	require_once($config_file);
81 81
}
82
$oReg = WbAdaptor::getInstance();
82 83
UpgradeHelper::checkSetupFiles(dirname(__FILE__).'/');
83 84

  
84 85
if (!class_exists('admin', false)) {
......
120 121

  
121 122
$OK            = ' <span class="ok">OK</span> ';
122 123
$FAIL          = ' <span class="error">FAILED</span> ';
123
$DEFAULT_THEME = 'wb_theme';
124
$DEFAULT_THEME = 'WbTheme';
124 125

  
125 126
$stepID = 1;
126 127
$dirRemove = array(
127
/*
128
			'[TEMPLATE]/allcss/',
129
			'[TEMPLATE]/blank/',
130
			'[TEMPLATE]/round/',
131
			'[TEMPLATE]/simple/',
132
*/
133
			'[ADMIN]/themes/',
128
//			'[TEMPLATE]allcss/',
129
//			'[TEMPLATE]blank/',
130
//			'[TEMPLATE]round/',
131
//			'[TEMPLATE]simple/',
132
            '[TEMPLATE]wb_theme/',
133
			'[ADMIN]themes/'
134 134
		 );
135
//
135

  
136 136
$aRemoveSingleFiles = array(
137
			'[ADMIN]/preferences/details.php',
138
			'[ADMIN]/preferences/email.php',
139
			'[ADMIN]/preferences/password.php',
140
			'[ADMIN]/pages/settings2.php',
141
			'[ADMIN]/users/users.php',
142
			'[ADMIN]/groups/add.php',
143
			'[ADMIN]/groups/groups.php',
144
			'[ADMIN]/groups/save.php',
145
			'[ADMIN]/skel/themes/htt/groups.htt',
137
			'[ADMIN]preferences/details.php',
138
			'[ADMIN]preferences/email.php',
139
			'[ADMIN]preferences/password.php',
140
			'[ADMIN]pages/settings2.php',
141
			'[ADMIN]users/users.php',
142
			'[ADMIN]groups/add.php',
143
			'[ADMIN]groups/groups.php',
144
			'[ADMIN]groups/save.php',
145
			'[ADMIN]skel/themes/htt/groups.htt',
146 146

  
147
			'[FRAMEWORK]/class.msg_queue.php',
148
			'[FRAMEWORK]/class.logfile.php',
149
			'[FRAMEWORK]/PasswordHash.php',
150
			'[MODULES]/droplets/js/mdcr.js',
151

  
147
			'[FRAMEWORK]class.msg_queue.php',
148
			'[FRAMEWORK]class.logfile.php',
149
			'[FRAMEWORK]PasswordHash.php',
150
			'[MODULES]droplets/js/mdcr.js'
152 151
);
153

  
154 152
// deleting files below only from less 2.8.4 stable
155 153
if(version_compare(WB_VERSION, '2.8.4', '<'))
156 154
{
157 155
	$aRemoveOldTemplates = array(
158

  
159
			'[TEMPLATE]/argos_theme/templates/access.htt',
160
			'[TEMPLATE]/argos_theme/templates/addons.htt',
161
			'[TEMPLATE]/argos_theme/templates/admintools.htt',
162
			'[TEMPLATE]/argos_theme/templates/error.htt',
163
			'[TEMPLATE]/argos_theme/templates/groups.htt',
164
			'[TEMPLATE]/argos_theme/templates/groups_form.htt',
165
			'[TEMPLATE]/argos_theme/templates/languages.htt',
166
			'[TEMPLATE]/argos_theme/templates/languages_details.htt',
167
			'[TEMPLATE]/argos_theme/templates/login.htt',
168
			'[TEMPLATE]/argos_theme/templates/login_forgot.htt',
169
			'[TEMPLATE]/argos_theme/templates/media.htt',
170
			'[TEMPLATE]/argos_theme/templates/media_browse.htt',
171
			'[TEMPLATE]/argos_theme/templates/media_rename.htt',
172
			'[TEMPLATE]/argos_theme/templates/modules.htt',
173
			'[TEMPLATE]/argos_theme/templates/modules_details.htt',
174
			'[TEMPLATE]/argos_theme/templates/pages.htt',
175
			'[TEMPLATE]/argos_theme/templates/pages_modify.htt',
176
			'[TEMPLATE]/argos_theme/templates/pages_sections.htt',
177
			'[TEMPLATE]/argos_theme/templates/pages_settings.htt',
178
			'[TEMPLATE]/argos_theme/templates/preferences.htt',
179
			'[TEMPLATE]/argos_theme/templates/setparameter.htt',
180
			'[TEMPLATE]/argos_theme/templates/settings.htt',
181
			'[TEMPLATE]/argos_theme/templates/start.htt',
182
			'[TEMPLATE]/argos_theme/templates/success.htt',
183
			'[TEMPLATE]/argos_theme/templates/templates.htt',
184
			'[TEMPLATE]/argos_theme/templates/templates_details.htt',
185
			'[TEMPLATE]/argos_theme/templates/users.htt',
186
			'[TEMPLATE]/argos_theme/templates/users_form.htt',
187

  
188
			'[TEMPLATE]/wb_theme/templates/access.htt',
189
			'[TEMPLATE]/wb_theme/templates/addons.htt',
190
			'[TEMPLATE]/wb_theme/templates/admintools.htt',
191
			'[TEMPLATE]/wb_theme/templates/error.htt',
192
			'[TEMPLATE]/wb_theme/templates/groups.htt',
193
			'[TEMPLATE]/wb_theme/templates/groups_form.htt',
194
			'[TEMPLATE]/wb_theme/templates/languages.htt',
195
			'[TEMPLATE]/wb_theme/templates/languages_details.htt',
196
			'[TEMPLATE]/wb_theme/templates/login.htt',
197
			'[TEMPLATE]/wb_theme/templates/login_forgot.htt',
198
			'[TEMPLATE]/wb_theme/templates/media.htt',
199
			'[TEMPLATE]/wb_theme/templates/media_browse.htt',
200
			'[TEMPLATE]/wb_theme/templates/media_rename.htt',
201
			'[TEMPLATE]/wb_theme/templates/modules.htt',
202
			'[TEMPLATE]/wb_theme/templates/modules_details.htt',
203
			'[TEMPLATE]/wb_theme/templates/pages.htt',
204
			'[TEMPLATE]/wb_theme/templates/pages_modify.htt',
205
			'[TEMPLATE]/wb_theme/templates/pages_sections.htt',
206
			'[TEMPLATE]/wb_theme/templates/pages_settings.htt',
207
			'[TEMPLATE]/wb_theme/templates/preferences.htt',
208
			'[TEMPLATE]/wb_theme/templates/setparameter.htt',
209
			'[TEMPLATE]/wb_theme/templates/settings.htt',
210
			'[TEMPLATE]/wb_theme/templates/start.htt',
211
			'[TEMPLATE]/wb_theme/templates/success.htt',
212
			'[TEMPLATE]/wb_theme/templates/templates.htt',
213
			'[TEMPLATE]/wb_theme/templates/templates_details.htt',
214
			'[TEMPLATE]/wb_theme/templates/users.htt',
215
			'[TEMPLATE]/wb_theme/templates/users_form.htt'
156
			'[TEMPLATE]argos_theme/templates/access.htt',
157
			'[TEMPLATE]argos_theme/templates/addons.htt',
158
			'[TEMPLATE]argos_theme/templates/admintools.htt',
159
			'[TEMPLATE]argos_theme/templates/error.htt',
160
			'[TEMPLATE]argos_theme/templates/groups.htt',
161
			'[TEMPLATE]argos_theme/templates/groups_form.htt',
162
			'[TEMPLATE]argos_theme/templates/languages.htt',
163
			'[TEMPLATE]argos_theme/templates/languages_details.htt',
164
			'[TEMPLATE]argos_theme/templates/login.htt',
165
			'[TEMPLATE]argos_theme/templates/login_forgot.htt',
166
			'[TEMPLATE]argos_theme/templates/media.htt',
167
			'[TEMPLATE]argos_theme/templates/media_browse.htt',
168
			'[TEMPLATE]argos_theme/templates/media_rename.htt',
169
			'[TEMPLATE]argos_theme/templates/modules.htt',
170
			'[TEMPLATE]argos_theme/templates/modules_details.htt',
171
			'[TEMPLATE]argos_theme/templates/pages.htt',
172
			'[TEMPLATE]argos_theme/templates/pages_modify.htt',
173
			'[TEMPLATE]argos_theme/templates/pages_sections.htt',
174
			'[TEMPLATE]argos_theme/templates/pages_settings.htt',
175
			'[TEMPLATE]argos_theme/templates/preferences.htt',
176
			'[TEMPLATE]argos_theme/templates/setparameter.htt',
177
			'[TEMPLATE]argos_theme/templates/settings.htt',
178
			'[TEMPLATE]argos_theme/templates/start.htt',
179
			'[TEMPLATE]argos_theme/templates/success.htt',
180
			'[TEMPLATE]argos_theme/templates/templates.htt',
181
			'[TEMPLATE]argos_theme/templates/templates_details.htt',
182
			'[TEMPLATE]argos_theme/templates/users.htt',
183
			'[TEMPLATE]argos_theme/templates/users_form.htt'
216 184
	);
217 185
}else {
218 186
	$aRemoveOldTemplates = array();
......
282 250
#container {
283 251
	min-width:48em;
284 252
    width: 70%;
285
	background: #A8BCCB url(<?php echo WB_URL; ?>/templates/wb_theme/images/background.png) repeat-x;
253
	background: #A8BCCB url(<?php echo WB_URL; ?>/templates/<?php echo $DEFAULT_THEME; ?>/images/background.png) repeat-x;
286 254
	border:1px solid #000;
287 255
	color:#000;
288 256
	margin:2em auto;
......
355 323
<body>
356 324
<div id="container">
357 325
<div class="page">
358
<img src="<?php echo WB_URL; ?>/templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" />
326
<img src="<?php echo WB_URL; ?>/templates/<?php echo $DEFAULT_THEME; ?>/images/logo.png" alt="WebsiteBaker Project" />
359 327
<div class="content">
360 328
<h1>WebsiteBaker Upgrade</h1>
361 329
<?php
......
794 762
	}
795 763
	echo '</div>';
796 764
}
797

  
798 765
if(version_compare(WB_REVISION, REVISION, '<='))
799 766
{
800 767
	$aDebugMessage = array();
......
954 921
			'[TEMPLATE]'
955 922
		);
956 923
		$replacements = array(
957
			'/'.substr(ADMIN_PATH, strlen(WB_PATH)+1),
958
			MEDIA_DIRECTORY,
959
			PAGES_DIRECTORY,
960
			'/framework',
961
			'/modules',
962
			'/templates'
924
            $oReg->AcpDir,
925
            $oReg->MediaDir,
926
            $oReg->PagesDir,
927
			'framework/',
928
			'modules/',
929
			'templates/'
963 930
		);
964 931

  
965 932
		$msg = '';
......
968 935
		foreach( $aFilesToRemove as $file )
969 936
		{
970 937
			$file = str_replace($searches, $replacements, $file);
971
			if( is_writable(WB_PATH.'/'.$file) ) {
938
			if( is_writable($oReg->AppDir.$file) ) {
972 939
				$iFound++;
973 940
				// try to unlink file
974
				if(!unlink(WB_PATH.$file)) {
941
				if(!unlink($oReg->AppDir.$file)) {
975 942
					$iFailed++;
976 943
				}
977 944
			}
978
			if( is_readable(WB_PATH.'/'.$file) ) {
945
			if( is_readable($oReg->AppDir.$file) ) {
979 946
				// save in err-list, if failed
980 947
				$msg .= $file.'<br />';
981 948
			}
......
1007 974

  
1008 975

  
1009 976
	/**********************************************************
1010
	 * - check for deprecated / never needed files
977
	 * - check for deprecated / never needed folders
1011 978
	 */
1012 979
	$iLoaded = sizeof($dirRemove);
1013 980
	if($iLoaded) {
......
1018 985
			'[ADMIN]',
1019 986
			'[MEDIA]',
1020 987
			'[PAGES]',
988
			'[FRAMEWORK]',
989
			'[MODULES]',
1021 990
			'[TEMPLATE]'
1022 991
		);
1023 992
		$replacements = array(
1024
			substr(ADMIN_PATH, strlen(WB_PATH)+1),
1025
			MEDIA_DIRECTORY,
1026
			PAGES_DIRECTORY,
1027
			'/templates',
993
            $oReg->AcpDir,
994
            $oReg->MediaDir,
995
            $oReg->PagesDir,
996
			'framework/',
997
			'modules/',
998
			'templates/'
1028 999
		);
1029 1000
		$msg = '';
1030 1001
		echo '<div style="margin-left:2em;">';
1031 1002
		echo '<h4>Search '.$iLoaded.' deprecated and outdated folders</h4>';
1032
		foreach( $dirRemove as $dir ) {
1033
			$dir = str_replace($searches, $replacements, $dir);
1034
			$dir = WB_PATH.'/'.$dir;
1035
			if( is_dir( $dir )) {
1036
				$iFound++;
1037
			// try to delete dir
1038
				if(!is_writable( $dir ) || !rm_full_dir($dir)) {
1039
				// save in err-list, if failed
1040
					$iFailed++;
1041
				}
1042
			}
1043
			if( is_readable(WB_PATH.'/'.$dir) ) {
1044
				$msg .= str_replace(WB_PATH,'',$dir).'<br />';
1045
			}
1046
		}
1047
		
1048
		$iRemove = $iFound-$iFailed;
1049
		echo '<strong>Remove '.$iRemove.' from '.$iFound.' founded</strong> ';
1003
		foreach( $dirRemove as $sRootDir ) {
1004
			$sRootDir = str_replace($searches, $replacements, $sRootDir);
1005
            if (file_exists($oReg->AppPath.$sRootDir)) {
1006
                if (!UpgradeHelper::delTree($oReg->AppPath.$sRootDir, UpgradeHelper::DEL_ROOT_DELETE)) {
1007
                    $iFailed = sizeof(($msg = UpgradeHelper::getDelTreeLog()));
1008
                    $msg = implode('<br />', $msg);
1009
                }
1010
            }
1011
        }
1050 1012
		echo ($iFailed == 0) ? $OK : $FAIL;
1051 1013
		echo '</div>';
1052

  
1053 1014
		if($msg != '') {
1054 1015
			$msg = '<br /><br />Following directories are deprecated, outdated or a security risk and
1055 1016
					can not be removed automatically.<br /><br />Please delete them
......
1066 1027
			</html>";
1067 1028
			exit;
1068 1029
		}
1069

  
1070

  
1071 1030
	}
1072 1031

  
1073 1032
	/**********************************************************

Also available in: Unified diff