Revision 2069
Added by darkviper almost 11 years ago
upgrade.php | ||
---|---|---|
188 | 188 |
. 'WHERE `published_when`=0 OR `published_when`>`posted_when`'; |
189 | 189 |
$oDb->query($sql); |
190 | 190 |
} |
191 |
/* --- insert SYSVAR placeholders and repair already existing ------------------------- */ |
|
192 |
$sql = 'SELECT `post_id`, `content_long`, `content_short` ' |
|
193 |
. 'FROM `'.$oDb->TablePrefix.'mod_news_posts` '; |
|
194 |
if (($oEntrySet = $oDb->doQuery($sql))) { |
|
195 |
$iRecords = 0; |
|
196 |
$iReplaced = 0; |
|
197 |
$aSearch = array( '/\{SYSVAR\:MEDIA_REL\}[\/\\\\]?/sU', |
|
198 |
'/\{SYSVAR\:WB_URL\}[\/\\\\]?/sU', |
|
199 |
'/(\{SYSVAR\:AppUrl\.MediaDir\})[\/\\\\]?/sU', |
|
200 |
'/(\{SYSVAR\:AppUrl\})[\/\\\\]?/sU' |
|
201 |
); |
|
202 |
$aReplace = array( '{SYSVAR:AppUrl.MediaDir}', '{SYSVAR:AppUrl}', '\1', '\1' ); |
|
203 |
while (($aEntry = $oEntrySet->fetchRow(MYSQL_ASSOC))) { |
|
204 |
$iCount = 0; |
|
205 |
$aSubject = array($aEntry['content_long'], $aEntry['content_short']); |
|
206 |
$aNewContents = preg_replace($aSearch, $aReplace, $aSubject, -1, $iCount); |
|
207 |
if ($iCount > 0) { |
|
208 |
$iReplaced += $iCount; |
|
209 |
$sql = 'UPDATE `'.$oDb->TablePrefix.'mod_news_posts` ' |
|
210 |
. 'SET `content_long`=\''.$oDb->escapeString($aNewContents[0]).'\', ' |
|
211 |
. '`content_short`=\''.$oDb->escapeString($aNewContents[1]).'\' ' |
|
212 |
. 'WHERE `post_id`='.$aEntry['post_id']; |
|
213 |
$oDb->doQuery($sql); |
|
214 |
$iRecords++; |
|
215 |
} |
|
216 |
} |
|
217 |
$msg[] = '['.$iRecords.'] records with ['.$iReplaced.'] SYSVAR placeholder(s) repaired'." $OK"; |
|
218 |
} |
|
219 |
try { |
|
220 |
$sql = 'UPDATE `'.$oDb->TablePrefix.'mod_news_posts` '; |
|
221 |
$sql .= 'SET `content` = REPLACE(`content`, \'"'.$oReg->AppPath.$oReg->MediaDir.'\', \'"{SYSVAR:AppPath.MediaDir}\')'; |
|
222 |
$oDb->doQuery($sql); |
|
223 |
$msg[] = 'Change internal absolute Media links into SYSVAR placeholders'." $OK"; |
|
224 |
} catch(WbDatabaseException $e) { |
|
225 |
$msg[] = ''.$oDb->get_error(); |
|
226 |
} |
|
227 |
try { |
|
228 |
$sql = 'UPDATE `'.$oDb->TablePrefix.'mod_news_posts` '; |
|
229 |
$sql .= 'SET `content` = REPLACE(`content`, \'"'.$oReg->AppPath.'\', \'"{SYSVAR:AppPath}\')'; |
|
230 |
$oDb->doQuery($sql); |
|
231 |
$msg[] = 'Change internal absolute links into SYSVAR placeholders'." $OK"; |
|
232 |
} catch(WbDatabaseException $e) { |
|
233 |
$msg[] = ''.$oDb->get_error(); |
|
234 |
} |
|
191 | 235 |
/* --- rebuild all access files ------------------------------------------------------- */ |
192 | 236 |
$aReport = array('FilesDeleted'=>0,'FilesCreated'=>0,); |
193 | 237 |
$oReorg = new m_news_Reorg(ModuleReorgAbstract::LOG_EXTENDED); |
Also available in: Unified diff
! module News: some little fixes, implementation of AccessFile completed.