'') $sql .= ','.$upd_special; mysql_qry($sql); /* get rid of column time */ $sql = "ALTER TABLE $tbl " . "drop ".$column; mysql_qry($sql); /* move time_tmp to time */ $sql = "ALTER TABLE $tbl " . "CHANGE ".$column."_tmp ".$column." $new_def"; mysql_qry($sql); } /* load the updated pphlogger_domains table */ $sql = "DROP TABLE IF EXISTS ".$tbl_domains; mysql_qry($sql); exec_sql_lines(SQL_DOMAINS, 'pphl_domains', $tbl_domains); /* convert timestamps to GMT UNIX-timestamp */ convert_to_GMT($tbl_users,'last_access',$server_GMT); convert_to_GMT($tbl_users,'date_start',0); convert_to_GMT($tbl_userlog,'t_reload',$server_GMT,'t_since=t_since'); convert_to_GMT($tbl_userlog,'t_since',$server_GMT); /* changed language codes: ge->de, sp->es */ $sql = "UPDATE ".$tbl_users." SET lang = 'de' WHERE lang = 'ge'"; mysql_qry($sql); $sql = "UPDATE ".$tbl_users." SET lang = 'es' WHERE lang = 'sp'"; mysql_qry($sql); /* css styles no longer refer to files, so we don't use the file-extensions anymore... */ $sql = "UPDATE ".$tbl_users." SET css = TRIM(TRAILING '.css' FROM css)"; mysql_qry($sql); $sql = "UPDATE ".$tbl_users." SET css='iceage' WHERE css NOT IN ('cartesia','lila','phloggstyle','phpeestyle','pink','sahara','metal','iceage')"; mysql_qry($sql); $sql = "ALTER TABLE $tbl_users " . "ADD limh_p int(6) unsigned DEFAULT '500' NOT NULL AFTER limh," . "ADD limd_p int(3) unsigned DEFAULT '0' NOT NULL AFTER limd," . "ADD index_files text AFTER ipblock," . "ADD qstr text AFTER ipblock," . "ADD access_diff int(5) unsigned NOT NULL AFTER last_access," . "ADD flags enum('Y','N') DEFAULT 'Y' NOT NULL AFTER demo," . "ADD stats_cache int(7) unsigned DEFAULT '900' NOT NULL AFTER loglim," . "ADD tblsize int(11) unsigned DEFAULT '0' NOT NULL," . "CHANGE css css varchar(30) DEFAULT 'metal' NOT NULL"; mysql_qry($sql); /* convert the pphlogger_cache table to the new format */ convert_to_GMT($tbl_cache,'time',$server_GMT); $sql = "ALTER TABLE $tbl_cache " . "ADD yyyymm int(6) unsigned DEFAULT '0' NOT NULL AFTER type," . "CHANGE id id int(5) unsigned DEFAULT '0' NOT NULL"; mysql_qry($sql); /* load the new pphlogger_css table */ $sql = "DROP TABLE IF EXISTS ".$tbl_css; mysql_qry($sql); exec_sql_lines(SQL_CSS, 'pphl_css', $tbl_css); /* update the userlog table */ $sql = "ALTER TABLE ".$tbl_userlog." ADD hostname varchar(150) NOT NULL AFTER ip"; mysql_qry($sql); /* update logs table */ $sql = "SELECT id,username,gmt,your_url FROM ".$tbl_users; $res = mysql_query($sql); while ($row = mysql_fetch_array($res)) { $id = $row['id']; echo "upgrading $id - ".$row['username']." ...".$br; flush(); $this_tbl_logs = $tbl_prefix.$id.$tbl_logs; $this_tbl_ipcheck = $tbl_prefix.$id.$tbl_ipcheck; $this_tbl_mpdl = $tbl_prefix.$id.$tbl_mpdl; /* we need some more columns for additional data... */ $sql = "ALTER TABLE $this_tbl_logs " . "ADD path blob AFTER entrypoint," . "ADD proxy varchar(255) NOT NULL," . "ADD proxy_ip varchar(15) NOT NULL," . "ADD proxy_hostname varchar(150) NOT NULL," . "DROP ok"; mysql_qry($sql); $this_gmt = $row['gmt']; convert_to_GMT($this_tbl_logs,'time',$this_gmt); convert_to_GMT($this_tbl_mpdl,'since',$this_gmt); convert_to_GMT($this_tbl_ipcheck,'t_reload',$this_gmt); convert_to_GMT($this_tbl_ipcheck,'t_since',$this_gmt); /* change mpdl table for new title string - [2.2.0-rc2 > 2.2.0] * fix: PRIMARY KEY now spans over type & url !!! */ $sql = "ALTER TABLE $this_tbl_mpdl " . "ADD title varchar(255)," . "DROP PRIMARY KEY," . "ADD PRIMARY KEY (type,url)"; mysql_qry($sql); /* extend all URLs in the usersettings by a 'http://' */ $urls = explode("\n",trim($row['your_url'])); for ($i = 0; $i < count($urls); $i++) { $urls[$i] = addHTTP(trim($urls[$i])); } $sql = "UPDATE ".$tbl_users." SET your_url='".implode("\n",$urls)."' WHERE id=$id"; mysql_qry($sql); /* import the old cache-data for the calendar */ $sql = "SELECT type,cache,time FROM ".$tbl_cache." WHERE id=$id AND yyyymm=0"; $res_cache = mysql_query($sql); while ($row_cache = mysql_fetch_array($res_cache)) { $cache_arr = explode("\n",$row_cache['cache']); for ($i=0; $i < count($cache_arr); $i++) { $yyyymm = substr($cache_arr[$i],0,6); $cache = substr($cache_arr[$i],7); $sql_n = "INSERT INTO $tbl_cache (id,type,yyyymm,cache,time) " . "VALUES ($id,'".$row_cache['type']."',$yyyymm,'$cache',".$row_cache['time'].")"; mysql_query($sql_n); } } /* remove the user's old cache-data */ $sql = "DELETE FROM $tbl_cache WHERE yyyymm=0 AND id=$id"; mysql_query($sql); } /* remove all old cache-data or messed up data in the cache table */ $sql = "DELETE FROM $tbl_cache WHERE yyyymm=0"; mysql_qry($sql); $sql = "ALTER TABLE $tbl_cache ADD PRIMARY KEY (id,type,yyyymm)"; mysql_qry($sql); echo $br."Your upgrade to v.2.2.0 was successful!"; echo $br."Now, please run the next upgrade script: upd_2.2.0-2.2.1.".CFG_PHPEXT.""; ?>