Commit 405c8602 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1631795: Only loop thru wallposts if some found



In the upgrade script for wallposts

behatnotneeded

Change-Id: I4624e827c921f09610df2487001e2ff230870436
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 4ccd5f21
......@@ -20,14 +20,15 @@ function xmldb_blocktype_wall_upgrade($oldversion=0) {
if ($oldversion < 2016101700) {
$posts = get_records_select_array('blocktype_wall_post',"text LIKE '%artefact/file/download.php%'");
require_once('embeddedimage.php');
foreach ($posts as $post) {
$newtext = EmbeddedImage::prepare_embedded_images($post->text, 'wallpost', $post->id, null, $post->from);
if ($post->text != $newtext) {
$updatedwallpost = new stdClass();
$updatedwallpost->id = $post->id;
$updatedwallpost->text = $newtext;
update_record('blocktype_wall_post', $updatedwallpost, 'id');
if ($posts) {
foreach ($posts as $post) {
$newtext = EmbeddedImage::prepare_embedded_images($post->text, 'wallpost', $post->id, null, $post->from);
if ($post->text != $newtext) {
$updatedwallpost = new stdClass();
$updatedwallpost->id = $post->id;
$updatedwallpost->text = $newtext;
update_record('blocktype_wall_post', $updatedwallpost, 'id');
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment