Project

General

Profile

« Previous | Next » 

Revision 1883

Added by Dietmar over 11 years ago

! groups change languages class to translate class
! prepare upgrade-script for WB Version 2.8.4 (versioncompare)
! update Form modul to version 2.9.1

View differences:

upgrade-script.php
85 85
$DEFAULT_THEME = 'wb_theme';
86 86

  
87 87
$stepID = 0;
88
$filesRemove = array();
88 89
$aFilesToRemove = array();
89 90
$dirRemove = array(
90 91
/*
......
103 104
			'[ADMIN]/preferences/password.php',
104 105
			'[ADMIN]/pages/settings2.php',
105 106
			'[ADMIN]/users/users.php',
107
			'[ADMIN]/groups/add.php',
108
			'[ADMIN]/groups/groups.php',
109
			'[ADMIN]/groups/save.php',
106 110
			'[ADMIN]/skel/themes/htt/groups.htt',
107 111

  
108 112
			'[FRAMEWORK]/class.msg_queue.php',
......
113 117
	$aFilesToRemove = array_merge($filesRemove['0']);
114 118

  
115 119
// deleting files below only from less 2.8.4 stable
116
if(version_compare(WB_REVISION, REVISION, '<='))
120
if(version_compare(WB_VERSION, '2.8.4', '<'))
117 121
{
118 122
	$filesRemove['1'] = array(
119 123

  
......
898 902
	echo '<strong>'.implode ('<br />',$msg).'</strong>';
899 903
    echo '</div>';
900 904

  
901
    /* *****************************************************************************
902
     * - check for deprecated / never needed files
903
     */
904
    if(sizeof($aFilesToRemove)) {
905
    	echo '<h3>Step '.(++$stepID).': Remove deprecated and old files</h3>';
906
    	$searches = array(
907
    		'[ADMIN]',
908
    		'[MEDIA]',
909
    		'[PAGES]',
910
    		'[FRAMEWORK]',
911
    		'[MODULES]',
912
    		'[TEMPLATE]'
913
    	);
914
    	$replacements = array(
915
    		'/'.substr(ADMIN_PATH, strlen(WB_PATH)+1),
916
    		MEDIA_DIRECTORY,
917
    		PAGES_DIRECTORY,
918
    		'/framework',
919
    		'/modules',
920
    		'/templates'
921
    	);
905
	/* *****************************************************************************
906
	 * - check for deprecated / never needed files
907
	 */
908
	$iLoaded = sizeof($aFilesToRemove);
909
	if($iLoaded) {
910
		echo '<h3>Step '.(++$stepID).': Remove deprecated and outdated files</h3>';
911
		$iFailed = 0;
912
		$iFound = 0;
913
		$searches = array(
914
			'[ADMIN]',
915
			'[MEDIA]',
916
			'[PAGES]',
917
			'[FRAMEWORK]',
918
			'[MODULES]',
919
			'[TEMPLATE]'
920
		);
921
		$replacements = array(
922
			'/'.substr(ADMIN_PATH, strlen(WB_PATH)+1),
923
			MEDIA_DIRECTORY,
924
			PAGES_DIRECTORY,
925
			'/framework',
926
			'/modules',
927
			'/templates'
928
		);
922 929

  
923 930
		$msg = '';
924
    	foreach( $aFilesToRemove as $file )
925
    	{
931
		echo '<div style="margin-left:2em;">';
932
		echo '<h4>Search '.$iLoaded.' deprecated and outdated files</h4>';
933
		foreach( $aFilesToRemove as $file )
934
		{
926 935
			$file = str_replace($searches, $replacements, $file);
927 936
			if( is_writable(WB_PATH.'/'.$file) ) {
937
				$iFound++;
928 938
				// try to unlink file
929 939
				if(!unlink(WB_PATH.$file)) {
930
					// save in err-list, if failed
940
					$iFailed++;
931 941
				}
932 942
			}
933
            if( is_readable(WB_PATH.'/'.$file) ) {
934
                $msg .= $file.'<br />';
935
            }
936
    	}
943
			if( is_readable(WB_PATH.'/'.$file) ) {
944
				// save in err-list, if failed
945
				$msg .= $file.'<br />';
946
			}
947
		}
948
		$iRemove = $iFound-$iFailed;
949
		echo '<strong>Remove '.$iRemove.' from '.$iFound.' founded</strong> ';
950
		echo ($iFailed == 0) ? $OK : $FAIL;
951
		echo '</div>';
937 952

  
938 953
		if($msg != '')
939 954
		{
......
956 971
    }
957 972

  
958 973

  
959
/**********************************************************
960
 * - check for deprecated / never needed files
961
 */
962
	if(sizeof($dirRemove)) {
963
		echo '<h3>Step  '.(++$stepID).': Remove deprecated and old folders</h3>';
974
	/**********************************************************
975
	 * - check for deprecated / never needed files
976
	 */
977
	$iLoaded = sizeof($dirRemove);
978
	if($iLoaded) {
979
		echo '<h3>Step  '.(++$stepID).': Remove deprecated and outdated folders</h3>';
980
		$iFailed = 0;
981
		$iFound = 0;
964 982
		$searches = array(
965 983
			'[ADMIN]',
966 984
			'[MEDIA]',
......
974 992
			'/templates',
975 993
		);
976 994
		$msg = '';
995
		echo '<div style="margin-left:2em;">';
996
		echo '<h4>Search '.$iLoaded.' deprecated and outdated folders</h4>';
977 997
		foreach( $dirRemove as $dir ) {
978 998
			$dir = str_replace($searches, $replacements, $dir);
979 999
			$dir = WB_PATH.'/'.$dir;
980 1000
			if( is_dir( $dir )) {
1001
				$iFound++;
981 1002
			// try to delete dir
982 1003
				if(!is_writable( $dir ) || !rm_full_dir($dir)) {
983 1004
				// save in err-list, if failed
984
                    if( is_readable(WB_PATH.'/'.$file) ) {
985
                    	$msg .= str_replace(WB_PATH,'',$dir).'<br />';
986
                    }
1005
					$iFailed++;
987 1006
				}
988 1007
			}
1008
			if( is_readable(WB_PATH.'/'.$dir) ) {
1009
				$msg .= str_replace(WB_PATH,'',$dir).'<br />';
1010
			}
989 1011
		}
1012
		
1013
		$iRemove = $iFound-$iFailed;
1014
		echo '<strong>Remove '.$iRemove.' from '.$iFound.' founded</strong> ';
1015
		echo ($iFailed == 0) ? $OK : $FAIL;
1016
		echo '</div>';
990 1017

  
991 1018
		if($msg != '') {
992 1019
			$msg = '<br /><br />Following directories are deprecated, outdated or a security risk and
......
1004 1031
			</html>";
1005 1032
			exit;
1006 1033
		}
1034

  
1035

  
1007 1036
	}
1008 1037

  
1009
    /**********************************************************
1010
     * upgrade modules if newer version is available
1011
     * $aModuleList list of proofed modules
1012
     */
1013
    $aModuleList = array('news','wysiwyg','form');
1038
	/**********************************************************
1039
	 * upgrade modules if newer version is available
1040
	 * $aModuleList list of proofed modules
1041
	 */
1042
	$aModuleList = array('news','wysiwyg','form');
1014 1043
	if(sizeof($aModuleList)) 
1015 1044
	{
1016 1045
	    echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>';
......
1019 1048
				$currModulVersion = get_modul_version ($sModul, false);
1020 1049
				$newModulVersion =  get_modul_version ($sModul, true);
1021 1050
				if((version_compare($currModulVersion, $newModulVersion) <= 0)) {
1022
	                echo '<div style="margin-left:2em;">';
1051
					echo '<div style="margin-left:2em;">';
1023 1052
					echo '<h4>'.'Upgrade module \''.$sModul.'\' version '.$newModulVersion.'</h4>';
1024 1053
					require(WB_PATH.'/modules/'.$sModul.'/upgrade.php');
1025
	                echo '</div>';
1054
					echo '</div>';
1026 1055
				}
1027 1056
			}
1028 1057
		}
1029 1058
	}
1030 1059

  
1031
    /**********************************************************
1032
     * Reformat/rebuild all existing moules access files
1033
     * $aModuleList list of modules
1034
     */
1035
    $aModuleList = array('bakery','topics','news');
1060
	/**********************************************************
1061
	 * Reformat/rebuild all existing moules access files
1062
	 * $aModuleList list of modules
1063
	 */
1064
	$aModuleList = array('bakery','topics','news');
1036 1065
	if(sizeof($aModuleList)) 
1037 1066
	{
1038 1067
		echo '<h3>Step '.(++$stepID).': Create/Reorg Accessfiles from modules</h3>';
......
1059 1088
 */
1060 1089

  
1061 1090
	echo '<h3>Step '.(++$stepID).' : Reload all addons database entry (no upgrade)</h3><br />';
1062
    echo '<div style="margin-left:2em;">';
1063
    $iFound = 0;
1064
    $iLoaded = 0;
1091
	echo '<div style="margin-left:2em;">';
1092
	$iFound = 0;
1093
	$iLoaded = 0;
1065 1094
	////delete modules
1066 1095
	//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
1067 1096
	// Load all modules
......
1136 1165
	'wb_revision' => REVISION,
1137 1166
	'wb_sp' => SP
1138 1167
);
1139
echo '<br /><span><strong>Set database version number to '.VERSION.' '.SP.' '.' Revision ['.REVISION.'] : </strong></span>';
1168
echo '<br /><span><strong>Set WebsiteBaker version number to '.VERSION.' '.SP.' '.' Revision ['.REVISION.'] : </strong></span>';
1140 1169
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
1141 1170
echo '</div>';
1142 1171

  

Also available in: Unified diff