rblog

My latest book – Andy Dougan “Kamp til døden”

Latest book I read when traveling by train from Mosjøen to Trondheim Sunday afternoon. Very interesting book about Dynamo Kiev before and during WW2. Also interesting to read the story about Babij Jar and the Siretz death camp. Read more about the actual match, in English stateofthegame.co.uk//the-greatest-teams-fc-start-the-death-match/ and in Norwegian fotball.aftenposten.no/… (the article which made me search for the book).

Tog – Delillos

…Selvfølgelig kan det være kjedelig
Å sitte stille i timevis
Men nå som jeg har blitt en voksen mann
Føles lenger ikke turen så lang…

…wonder why 🙂

Heading north together with Sigurd and Sverre

Kite running in late November

Quite sure that the weather today must have been at least 20 degrees warmer today than exactly one year ago. Picture taken at Bjørkelangen earlier today, my son Anders together with two friends running out on the field trying to chase down the kite. Weather was really nice, 13 celsius. Pretty strong wind, but good for kiting.

Blog upgraded to latest version 4.1.2

Have spent some hours upgrading from 4.0.5 to 4.1.2. But note that the actual process of upgrading did not take more than an hour or so, most of the time spent uploading new files using FTP-client Filezilla. Since it had to check each file “if newer” it takes some extra time. But the actual work of upgrading took only five minutes or so.

But, yesterday I spent some hours creating a script that helped me change from the Youtube-plugin which is no longer being developed to the “out-of-the-box” video plugin.

As usual I found a script helping me almost all the way, thanks to Stackoverflow.com, but I had to fine-tune it to my needs.

First, I had to create a SQL-statement that selected all blog posts containing the tag [youtube], but also the post_render column since the video-render plugin was changed.

$sql = "SELECT post_ID, post_content,post_renderers FROM evo_items__item WHERE LOCATE('[youtube]',post_content) != 0";

Then later in the script when doing the actual work, removing the old tag replacing it with the new

$post_content = preg_replace('#\[youtube\](.*?)\[/youtube\]#', '[video:youtube:$1]', $post_content);

The regex is searching for the [youtube][/youtube]-tag, crabbing the content of it (.*?) and backreferencing it to create the new tag.

And then at last adding the post_render for the new plugin, check that it does not exist already.

$pos = strpos($post_renderers,'.evo_videoplug');

	if($pos === false) {
	 	$post_renderers = $post_renderers . ".evo_videoplug";
	}