From f89fdffb12beaf2560bd239171a5873750e4282a Mon Sep 17 00:00:00 2001 From: james Date: Wed, 27 Aug 2008 20:01:07 +0000 Subject: [PATCH] Rollover the pagetext last-update date/time Auto-create a pagetext entry in each language if they dont exist --- config/pagetexts.php | 11 +++++++---- config/rollover.php | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config/pagetexts.php b/config/pagetexts.php index f0f613e..a1bdeee 100644 --- a/config/pagetexts.php +++ b/config/pagetexts.php @@ -40,10 +40,13 @@ $q=mysql_query("SELECT * FROM pagetext WHERE year='-1' ORDER BY textname"); while($r=mysql_fetch_object($q)) { - mysql_query("INSERT INTO pagetext (textname,text,year) VALUES ( - '".mysql_escape_string($r->textname)."', - '".mysql_escape_string($r->text)."', - '".$config['FAIRYEAR']."')"); + foreach($config['languages'] AS $lang=>$langname) { + mysql_query("INSERT INTO pagetext (textname,textdescription,text,year,lang) VALUES ( + '".mysql_escape_string($r->textname)."', + '".mysql_escape_string($r->text)."', + '".$config['FAIRYEAR']."', + '".mysql_escape_string($lang)."')"); + } } diff --git a/config/rollover.php b/config/rollover.php index 94e7dfc..0292901 100644 --- a/config/rollover.php +++ b/config/rollover.php @@ -88,10 +88,11 @@ $q=mysql_query("SELECT * FROM pagetext WHERE year='$currentfairyear'"); echo mysql_error(); while($r=mysql_fetch_object($q)) - mysql_query("INSERT INTO pagetext (textname,textdescription,text,year,lang) VALUES ( + mysql_query("INSERT INTO pagetext (textname,textdescription,text,lastupdate,year,lang) VALUES ( '".mysql_escape_string($r->textname)."', '".mysql_escape_string($r->textdescription)."', '".mysql_escape_string($r->text)."', + '".mysql_escape_string($r->lastupdate)."', '".mysql_escape_string($newfairyear)."', '".mysql_escape_string($r->lang)."')");