Rollover the pagetext last-update date/time

Auto-create a pagetext entry in each language if they dont exist
This commit is contained in:
james 2008-08-27 20:01:07 +00:00
parent 5341801ce7
commit f89fdffb12
2 changed files with 9 additions and 5 deletions

View File

@ -40,10 +40,13 @@
$q=mysql_query("SELECT * FROM pagetext WHERE year='-1' ORDER BY textname"); $q=mysql_query("SELECT * FROM pagetext WHERE year='-1' ORDER BY textname");
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
mysql_query("INSERT INTO pagetext (textname,text,year) VALUES ( foreach($config['languages'] AS $lang=>$langname) {
'".mysql_escape_string($r->textname)."', mysql_query("INSERT INTO pagetext (textname,textdescription,text,year,lang) VALUES (
'".mysql_escape_string($r->text)."', '".mysql_escape_string($r->textname)."',
'".$config['FAIRYEAR']."')"); '".mysql_escape_string($r->text)."',
'".$config['FAIRYEAR']."',
'".mysql_escape_string($lang)."')");
}
} }

View File

@ -88,10 +88,11 @@
$q=mysql_query("SELECT * FROM pagetext WHERE year='$currentfairyear'"); $q=mysql_query("SELECT * FROM pagetext WHERE year='$currentfairyear'");
echo mysql_error(); echo mysql_error();
while($r=mysql_fetch_object($q)) 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->textname)."',
'".mysql_escape_string($r->textdescription)."', '".mysql_escape_string($r->textdescription)."',
'".mysql_escape_string($r->text)."', '".mysql_escape_string($r->text)."',
'".mysql_escape_string($r->lastupdate)."',
'".mysql_escape_string($newfairyear)."', '".mysql_escape_string($newfairyear)."',
'".mysql_escape_string($r->lang)."')"); '".mysql_escape_string($r->lang)."')");