Changeset 209
- Timestamp:
- 05/01/07 15:48:10 (16 years ago)
- Location:
- dev
- Files:
-
- 8 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/includes/class.config.php
r197 r209 150 150 if (isset($cache[$key])) 151 151 { 152 if ($cache[$key] == $value)152 if ($cache[$key] === $value) 153 153 { 154 154 return; -
dev/common/includes/class.db.php
r202 r209 38 38 } 39 39 40 function queryCount($increase = false) 41 { 42 static $count; 43 44 if ($increase) 45 { 46 $count++; 47 } 48 49 return $count; 50 } 51 40 52 function execute($sql) 41 53 { … … 65 77 file_put_contents('/tmp/profile.lst', $sql . "\nExecution time: " . $this->exectime_ . "\n", FILE_APPEND); 66 78 } 79 80 $this->queryCount(true); 67 81 68 82 return true; -
dev/common/includes/class.db_cache.php
r202 r209 227 227 { 228 228 $this->loadCache(); 229 $this->queryCachedCount(true); 229 230 return true; 230 231 } … … 265 266 } 266 267 268 $this->queryCount(true); 267 269 return true; 270 } 271 272 function queryCount($increase = false) 273 { 274 static $count; 275 276 if ($increase) 277 { 278 $count++; 279 } 280 281 return $count; 282 } 283 284 function queryCachedCount($increase = false) 285 { 286 static $count; 287 288 if ($increase) 289 { 290 $count++; 291 } 292 293 return $count; 268 294 } 269 295 -
dev/common/includes/class.killlist.php
r201 r209 484 484 } 485 485 } 486 487 class CombinedKillList extends KillList 488 { 489 function CombinedKillList() 490 { 491 // please only load killlists here 492 $this->lists = func_get_args(); 493 if (!is_array($this->lists)) 494 { 495 trigger_error('No killlists given to CombinedKillList', E_USER_ERROR); 496 } 497 $this->kills = false; 498 } 499 500 function buildKillArray() 501 { 502 $this->kills = array(); 503 foreach ($this->lists as $killlist) 504 { 505 // reset the list 506 $killlist->rewind(); 507 508 // load all kills and store them in an array 509 while ($kill = $killlist->getKill()) 510 { 511 // take sure that if there are multiple kills all are stored 512 if (isset($this->kills[$kill->timestamp_])) 513 { 514 $this->kills[$kill->timestamp_.rand()] = $kill; 515 } 516 else 517 { 518 $this->kills[$kill->timestamp_] = $kill; 519 } 520 } 521 } 522 523 // sort the kills by time 524 krsort($this->kills); 525 } 526 527 function getKill() 528 { 529 // on the first request we load up our kills 530 if ($this->kills == false) 531 { 532 $this->buildKillArray(); 533 } 534 535 // once all kills are out this will return null so we're fine 536 return array_shift($this->kills); 537 } 538 539 function rewind() 540 { 541 // intentionally left empty to overload the standard handle 542 } 543 } 486 544 ?> -
dev/common/includes/class.page.php
r205 r209 124 124 $this->processingtime_ = $this->timeend_ - $this->timestart_; 125 125 126 $qry = new DBQuery(); 127 if (method_exists($qry, 'queryCachedCount')) 128 { 129 $smarty->assign('profile_sql_cached', $qry->queryCachedCount()); 130 } 131 $smarty->assign('profile_sql', $qry->queryCount()); 126 132 $smarty->assign('profile_time', $this->processingtime_); 127 133 $smarty->assign('profile', KB_PROFILE); -
dev/common/includes/class.ship.php
r190 r209 74 74 $this->sql_ = "select * from kb3_ships shp 75 75 inner join kb3_ship_classes scl on shp.shp_class = scl.scl_id"; 76 if ( $config->getConfig('ship_values'))76 if (config::get('ship_values')) 77 77 { 78 78 $this->sql_ .= ' left join kb3_ships_values ksv on (shp.shp_id = ksv.shp_id) '; … … 86 86 $this->shiptechlevel_ = $row['shp_techlevel']; 87 87 $this->externalid_ = $row['shp_externalid']; 88 if ($config->getConfig('ship_values')) 88 89 if (config::get('ship_values')) 89 90 { 90 91 if (!$this->value_ = $row['shp_value']) -
dev/common/includes/class.toplist.php
r200 r209 213 213 $op = "or"; 214 214 } 215 else $op = "and"; 215 else 216 { 217 $this->sql_ .= ' where 1=1 '; 218 $op = "and"; 219 } 216 220 217 221 if ($this->vic_plt_) … … 277 281 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc 278 282 limit 30"); 279 if (count($this->vic_scl_id)){ 280 $this->setPodsNoobShips(false); 281 }else{ 282 $this->setPodsNoobShips(true); 283 } 283 if (count($this->vic_scl_id)) 284 { 285 $this->setPodsNoobShips(false); 286 } 287 else 288 { 289 $this->setPodsNoobShips(true); 290 } 284 291 } 285 292 } … … 309 316 $this->setSQLBottom("group by ind.ind_crp_id order by 1 desc 310 317 limit 30"); 311 if (count($this->vic_scl_id)){ 312 $this->setPodsNoobShips(false); 313 }else{ 314 $this->setPodsNoobShips(true); 315 } 316 318 if (count($this->vic_scl_id)) 319 { 320 $this->setPodsNoobShips(false); 321 } 322 else 323 { 324 $this->setPodsNoobShips(true); 325 } 317 326 } 318 327 } … … 366 375 $this->setSQLBottom("group by kll.kll_victim_id order by 1 desc 367 376 limit 30"); 368 if (!count($this->vic_scl_id_)){ 369 $this->setPodsNoobShips(false); 370 } 377 if (!count($this->vic_scl_id_)) 378 { 379 $this->setPodsNoobShips(false); 380 } 371 381 } 372 382 } … … 385 395 $this->setSQLBottom("group by kll.kll_crp_id order by 1 desc 386 396 limit 30"); 387 if (count($this->vic_scl_id)){ 388 $this->setPodsNoobShips(false); 389 }else{ 390 $this->setPodsNoobShips(true); 391 } 397 if (count($this->vic_scl_id)) 398 { 399 $this->setPodsNoobShips(false); 400 } 401 else 402 { 403 $this->setPodsNoobShips(true); 404 } 392 405 } 393 406 } … … 920 933 while ($row = $this->toplist_->getRow()) 921 934 { 922 935 $item = new Item($row['itm_id']); 923 936 if ($odd) 924 937 { -
dev/templates/index.tpl
r196 r209 46 46 {if $profile} 47 47 <table class="kb-subtable" width="99%" border="0"> 48 <tr><td height="100%" align="right" valign="bottom">{$profile_ time}s</td></tr>48 <tr><td height="100%" align="right" valign="bottom">{$profile_sql} querys{if $profile_sql_cached} (+{$profile_sql_cached} cached) {/if} {$profile_time}s</td></tr> 49 49 </table> 50 50 {else}