Revision 2083
Added by darkviper almost 11 years ago
- modules/news/upgrade manipulation of {SYSVAR:}-Tags fixed
- modules/wysiwyg/upgrade manipulation of {SYSVAR:}-Tags fixed
- modules/news/add default template fixed
upgrade.php | ||
---|---|---|
91 | 91 |
if (($oEntrySet = $oDb->doQuery($sql))) { |
92 | 92 |
$iRecords = 0; |
93 | 93 |
$iReplaced = 0; |
94 |
$aSearch = array( '/\{SYSVAR\:MEDIA_REL\}[\/\\\\]?/sU', |
|
95 |
'/\{SYSVAR\:WB_URL\}[\/\\\\]?/sU', |
|
96 |
'/(\{SYSVAR\:AppUrl\.MediaDir\})[\/\\\\]?/sU', |
|
97 |
'/(\{SYSVAR\:AppUrl\})[\/\\\\]?/sU' |
|
94 |
$aSearch = array( '/\{SYSVAR\:MEDIA_REL\}\/*/s', |
|
95 |
'/\{SYSVAR\:WB_URL\}\/*/s', |
|
96 |
'/'.preg_quote('"'.$oReg->AppUrl.$oReg->MediaDir, '/').'*/s', |
|
97 |
'/'.preg_quote('"'.$oReg->AppUrl, '/').'*/s', |
|
98 |
'/(\{SYSVAR\:AppUrl\.MediaDir\})\/+/s', |
|
99 |
'/(\{SYSVAR\:AppUrl\})\/+/s' |
|
98 | 100 |
); |
99 |
$aReplace = array( '{SYSVAR:AppUrl.MediaDir}', '{SYSVAR:AppUrl}', '\1', '\1' );
|
|
101 |
$aReplace = array( '{SYSVAR:AppUrl.MediaDir}', '{SYSVAR:AppUrl}', '{SYSVAR:AppUrl.MediaDir}', '{SYSVAR:AppUrl}', '\1', '\1');
|
|
100 | 102 |
while (($aEntry = $oEntrySet->fetchRow(MYSQL_ASSOC))) { |
101 | 103 |
$iCount = 0; |
102 |
$aEntry['content'] = preg_replace($aSearch, $aReplace, $aEntry['content'], -1, $iCount); |
|
104 |
$aSubject = array($aEntry['content_long'], $aEntry['content_short']); |
|
105 |
$aNewContents = preg_replace($aSearch, $aReplace, $aSubject, -1, $iCount); |
|
103 | 106 |
if ($iCount > 0) { |
104 | 107 |
$iReplaced += $iCount; |
105 |
$sql = 'UPDATE `'.$oDb->TablePrefix.'mod_wysiwyg` ' |
|
106 |
. 'SET `content`=\''.$oDb->escapeString($aEntry['content']).'\' ' |
|
107 |
. 'WHERE `section_id`='.$aEntry['section_id']; |
|
108 |
$sql = 'UPDATE `'.$oDb->TablePrefix.'mod_news_posts` ' |
|
109 |
. 'SET `content_long`=\''.$oDb->escapeString($aNewContents[0]).'\', ' |
|
110 |
. '`content_short`=\''.$oDb->escapeString($aNewContents[1]).'\' ' |
|
111 |
. 'WHERE `post_id`='.$aEntry['post_id']; |
|
108 | 112 |
$oDb->doQuery($sql); |
109 | 113 |
$iRecords++; |
110 | 114 |
} |
111 | 115 |
} |
112 |
$msg[] = '['.$iRecords.'] records with ['.$iReplaced.'] SYSVAR placeholder(s) repaired'." $OK"; |
|
116 |
$msg[] = '['.$iRecords.'] records with ['.$iReplaced.'] SYSVAR placeholder(s) repaired/inserted'." $OK"; |
|
117 |
// only for $callingScript upgrade-script.php |
|
118 |
if($globalStarted && $bDebug) { |
|
119 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />'; |
|
120 |
} |
|
113 | 121 |
} |
114 |
try { |
|
115 |
$sql = 'UPDATE `'.$sTable.'` '; |
|
116 |
$sql .= 'SET `content` = REPLACE(`content`, \'"'.$oReg->AppPath.$oReg->MediaDir.'\', \'"{SYSVAR:AppPath.MediaDir}\')'; |
|
117 |
$oDb->doQuery($sql); |
|
118 |
$msg[] = 'Change internal absolute Media links into SYSVAR placeholders'." $OK"; |
|
119 |
} catch(WbDatabaseException $e) { |
|
120 |
$msg[] = ''.$oDb->get_error(); |
|
121 |
} |
|
122 |
try { |
|
123 |
$sql = 'UPDATE `'.$sTable.'` '; |
|
124 |
$sql .= 'SET `content` = REPLACE(`content`, \'"'.$oReg->AppPath.'\', \'"{SYSVAR:AppPath}\')'; |
|
125 |
$oDb->doQuery($sql); |
|
126 |
$msg[] = 'Change internal absolute links into SYSVAR placeholders'." $OK"; |
|
127 |
} catch(WbDatabaseException $e) { |
|
128 |
$msg[] = ''.$oDb->get_error(); |
|
129 |
} |
|
130 |
// only for $callingScript upgrade-script.php |
|
131 |
if($globalStarted) { |
|
132 |
if($bDebug) { |
|
133 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />'; |
|
134 |
} |
|
135 |
} |
|
136 |
} |
|
122 |
} |
|
137 | 123 |
$msg[] = 'WYSIWYG upgrade successfull finished'." $OK"; |
138 | 124 |
if($globalStarted) { |
139 | 125 |
echo "<strong>WYSIWYG upgrade successfull finished $OK</strong><br />"; |
Also available in: Unified diff