@@ -324,17 +324,17 @@ |
||
| 324 | 324 | if(array_key_exists("F", $options) || |
| 325 | 325 | array_key_exists("fetch-backfill", $options)){ |
| 326 | 326 | $days = array_key_exists("F", $options)?$options["F"]:$options["fetch-backfill"]; |
| 327 | - try{ |
|
| 328 | - $days = abs(intval($days)); |
|
| 329 | - }catch(Exception $e){ |
|
| 327 | + try{ |
|
| 328 | + $days = abs(intval($days)); |
|
| 329 | + }catch(Exception $e){ |
|
| 330 | 330 | $days = -1; |
| 331 | - } |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - if($days <= 0){ |
|
| 334 | - echo "Error: A SpotNab fetch backfill requires you specify the number of days to look back.\n"; |
|
| 335 | - echo "Syntax: php spontnab.php -F=<days>\n"; |
|
| 336 | - exit(1); |
|
| 337 | - } |
|
| 333 | + if($days <= 0){ |
|
| 334 | + echo "Error: A SpotNab fetch backfill requires you specify the number of days to look back.\n"; |
|
| 335 | + echo "Syntax: php spontnab.php -F=<days>\n"; |
|
| 336 | + exit(1); |
|
| 337 | + } |
|
| 338 | 338 | echo "Fetching $days day(s) back ... "; |
| 339 | 339 | $spotnab = new SpotNab(); |
| 340 | 340 | $spotnab->fetch(time()-($days*86400)); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $options = getopt($shortopts, $longopts); |
| 214 | 214 | |
| 215 | -function display_help(){ |
|
| 215 | +function display_help() { |
|
| 216 | 216 | echo "\n"; |
| 217 | 217 | echo "SpotNab v0.97.4, Author: l2g\n"; |
| 218 | 218 | echo "Syntax: spotnab.php <action>\n"; |
@@ -265,28 +265,28 @@ discard block |
||
| 265 | 265 | echo "\n"; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | -if(!$options){ display_help(); exit(1);} |
|
| 269 | -if(!count($options)){ display_help(); exit(1);} |
|
| 268 | +if (!$options) { display_help(); exit(1); } |
|
| 269 | +if (!count($options)) { display_help(); exit(1); } |
|
| 270 | 270 | |
| 271 | 271 | $delete_broken_releases = false; |
| 272 | -if(array_key_exists("G", $options) || |
|
| 273 | - array_key_exists("populate-fix-gid", $options)){ |
|
| 272 | +if (array_key_exists("G", $options) || |
|
| 273 | + array_key_exists("populate-fix-gid", $options)) { |
|
| 274 | 274 | echo "Updating GID in releases table + fix ..."; |
| 275 | 275 | $spotnab = new SpotNab(); |
| 276 | - $spotnab->processGID(0,5000,true); |
|
| 276 | + $spotnab->processGID(0, 5000, true); |
|
| 277 | 277 | echo "Done\n"; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | -if(array_key_exists("g", $options) || |
|
| 281 | - array_key_exists("populate-gid", $options)){ |
|
| 280 | +if (array_key_exists("g", $options) || |
|
| 281 | + array_key_exists("populate-gid", $options)) { |
|
| 282 | 282 | echo "Updating GID in releases table ..."; |
| 283 | 283 | $spotnab = new SpotNab(); |
| 284 | 284 | $spotnab->processGID(); |
| 285 | 285 | echo "Done\n"; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | -if(array_key_exists("r", $options) || |
|
| 289 | - array_key_exists("soft-reset", $options)){ |
|
| 288 | +if (array_key_exists("r", $options) || |
|
| 289 | + array_key_exists("soft-reset", $options)) { |
|
| 290 | 290 | echo "Soft Reseting Spotnab... "; |
| 291 | 291 | $spotnab = new SpotNab(); |
| 292 | 292 | $spotnab->soft_reset(); |
@@ -294,79 +294,79 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $force_keygen_save = false; |
| 297 | -if(array_key_exists("K", $options) || |
|
| 298 | - array_key_exists("force-keygen", $options)){ |
|
| 297 | +if (array_key_exists("K", $options) || |
|
| 298 | + array_key_exists("force-keygen", $options)) { |
|
| 299 | 299 | $spotnab = new SpotNab(); |
| 300 | 300 | $spotnab->keygen(true, true); |
| 301 | 301 | } |
| 302 | -else if(array_key_exists("k", $options) || |
|
| 303 | - array_key_exists("keygen", $options)){ |
|
| 302 | +else if (array_key_exists("k", $options) || |
|
| 303 | + array_key_exists("keygen", $options)) { |
|
| 304 | 304 | $spotnab = new SpotNab(); |
| 305 | 305 | $spotnab->keygen(true); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | -if(array_key_exists("p", $options) || |
|
| 309 | - array_key_exists("post", $options)){ |
|
| 308 | +if (array_key_exists("p", $options) || |
|
| 309 | + array_key_exists("post", $options)) { |
|
| 310 | 310 | echo "Posting... "; |
| 311 | 311 | $spotnab = new SpotNab(); |
| 312 | 312 | $spotnab->post(); |
| 313 | 313 | echo "Done\n"; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | -if(array_key_exists("d", $options) || |
|
| 317 | - array_key_exists("discover", $options)){ |
|
| 316 | +if (array_key_exists("d", $options) || |
|
| 317 | + array_key_exists("discover", $options)) { |
|
| 318 | 318 | echo "Discovering... "; |
| 319 | 319 | $spotnab = new SpotNab(); |
| 320 | 320 | $spotnab->fetch_discovery(); |
| 321 | 321 | echo "Done\n"; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | -if(array_key_exists("F", $options) || |
|
| 325 | - array_key_exists("fetch-backfill", $options)){ |
|
| 326 | - $days = array_key_exists("F", $options)?$options["F"]:$options["fetch-backfill"]; |
|
| 327 | - try{ |
|
| 324 | +if (array_key_exists("F", $options) || |
|
| 325 | + array_key_exists("fetch-backfill", $options)) { |
|
| 326 | + $days = array_key_exists("F", $options) ? $options["F"] : $options["fetch-backfill"]; |
|
| 327 | + try { |
|
| 328 | 328 | $days = abs(intval($days)); |
| 329 | - }catch(Exception $e){ |
|
| 329 | + } catch (Exception $e) { |
|
| 330 | 330 | $days = -1; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if($days <= 0){ |
|
| 333 | + if ($days <= 0) { |
|
| 334 | 334 | echo "Error: A SpotNab fetch backfill requires you specify the number of days to look back.\n"; |
| 335 | 335 | echo "Syntax: php spontnab.php -F=<days>\n"; |
| 336 | 336 | exit(1); |
| 337 | 337 | } |
| 338 | 338 | echo "Fetching $days day(s) back ... "; |
| 339 | 339 | $spotnab = new SpotNab(); |
| 340 | - $spotnab->fetch(time()-($days*86400)); |
|
| 340 | + $spotnab->fetch(time() - ($days * 86400)); |
|
| 341 | 341 | echo "Done\n"; |
| 342 | 342 | |
| 343 | 343 | |
| 344 | -}else if (array_key_exists("f", $options) || |
|
| 345 | - array_key_exists("fetch", $options)){ |
|
| 344 | +} else if (array_key_exists("f", $options) || |
|
| 345 | + array_key_exists("fetch", $options)) { |
|
| 346 | 346 | echo "Fetching... "; |
| 347 | 347 | $spotnab = new SpotNab(); |
| 348 | 348 | $spotnab->fetch(); |
| 349 | 349 | echo "Done\n"; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | -if(array_key_exists("b", $options) || |
|
| 353 | - array_key_exists("broadcast", $options)){ |
|
| 352 | +if (array_key_exists("b", $options) || |
|
| 353 | + array_key_exists("broadcast", $options)) { |
|
| 354 | 354 | echo "Broadcasting... "; |
| 355 | 355 | $spotnab = new SpotNab(); |
| 356 | 356 | $spotnab->post_discovery(); |
| 357 | 357 | echo "Done\n"; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | -if(array_key_exists("t", $options) || |
|
| 361 | - array_key_exists("test", $options)){ |
|
| 360 | +if (array_key_exists("t", $options) || |
|
| 361 | + array_key_exists("test", $options)) { |
|
| 362 | 362 | $spotnab = new SpotNab(); |
| 363 | 363 | |
| 364 | - if($spotnab->has_openssl()) |
|
| 364 | + if ($spotnab->has_openssl()) |
|
| 365 | 365 | { |
| 366 | 366 | printf("%s INFO - Testing SSL Key Generator ...", |
| 367 | 367 | date("Y-m-d H:i:s")); |
| 368 | 368 | $keys = $spotnab->keygen(false); |
| 369 | - if(is_array($keys) && |
|
| 369 | + if (is_array($keys) && |
|
| 370 | 370 | array_key_exists("pubkey", $keys) && |
| 371 | 371 | array_key_exists("prvkey", $keys)) |
| 372 | 372 | { |
@@ -374,8 +374,8 @@ discard block |
||
| 374 | 374 | $pubkey = $spotnab->decompstr($keys['pubkey']); |
| 375 | 375 | $refc = $spotnab->getRandomStr(80); |
| 376 | 376 | $refd = $spotnab->decrypt($spotnab->encrypt($refc, $prvkey), $pubkey); |
| 377 | - echo ($refc == $refd)?"Successful!\n":"Failed!\n"; |
|
| 378 | - }else{ |
|
| 377 | + echo ($refc == $refd) ? "Successful!\n" : "Failed!\n"; |
|
| 378 | + } else { |
|
| 379 | 379 | echo "Failed!\n"; |
| 380 | 380 | } |
| 381 | 381 | |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | date("Y-m-d H:i:s")); |
| 384 | 384 | $preMsg = $spotnab->getRandomStr(800); |
| 385 | 385 | $postMsg = $spotnab->decrypt($spotnab->encrypt($preMsg)); |
| 386 | - if($postMsg === false){ |
|
| 386 | + if ($postMsg === false) { |
|
| 387 | 387 | echo "Failed!\n"; |
| 388 | - }else if(!strcmp($preMsg, $postMsg)){ |
|
| 388 | + } else if (!strcmp($preMsg, $postMsg)) { |
|
| 389 | 389 | echo "Successful!\n"; |
| 390 | - }else{ |
|
| 390 | + } else { |
|
| 391 | 391 | echo "Failed!\n"; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | 'comment' => 'testing comment 1', |
| 407 | 407 | 'username' => 'l2g', |
| 408 | 408 | 'is_visible' => 1, |
| 409 | - 'postdate_utc' => $spotnab->local2utc(time()-86400) |
|
| 409 | + 'postdate_utc' => $spotnab->local2utc(time() - 86400) |
|
| 410 | 410 | ), |
| 411 | 411 | array( |
| 412 | 412 | 'gid' => 'ABCDEFHIJKLMNOPQRSTUVWXYZ0123456', |
@@ -414,19 +414,19 @@ discard block |
||
| 414 | 414 | 'username' => 'l2g-hater', |
| 415 | 415 | 'is_visible' => 1, |
| 416 | 416 | 'comment' => 'testing comment 2', |
| 417 | - 'postdate_utc' => $spotnab->local2utc(time()-86000) |
|
| 417 | + 'postdate_utc' => $spotnab->local2utc(time() - 86000) |
|
| 418 | 418 | ) |
| 419 | 419 | ) |
| 420 | 420 | ); |
| 421 | 421 | $article = $spotnab->encodePost($before, Null, true); |
| 422 | - if($article !== false){ |
|
| 422 | + if ($article !== false) { |
|
| 423 | 423 | $after = $spotnab->decodePost($article[1]); |
| 424 | - if($before === $after){ |
|
| 424 | + if ($before === $after) { |
|
| 425 | 425 | echo "Successful!\n"; |
| 426 | - }else{ |
|
| 426 | + } else { |
|
| 427 | 427 | echo "Failed!\n"; |
| 428 | 428 | } |
| 429 | - }else{ |
|
| 429 | + } else { |
|
| 430 | 430 | echo "Failed!\n"; |
| 431 | 431 | } |
| 432 | 432 | printf("%s INFO - Testing big message encode/decode ...", |
@@ -439,26 +439,26 @@ discard block |
||
| 439 | 439 | 'postdate_utc' => $spotnab->local2utc(), |
| 440 | 440 | 'comments' => [] |
| 441 | 441 | ); |
| 442 | - for($i=0;$i<3000;$i++){ |
|
| 442 | + for ($i = 0; $i < 3000; $i++) { |
|
| 443 | 443 | // Build large post |
| 444 | - $before['comments'][] =array( |
|
| 444 | + $before['comments'][] = array( |
|
| 445 | 445 | 'gid' => 'ABCDEFHIJKLMNOPQRSTUVWXYZ0123456', |
| 446 | 446 | 'cid' => 'ABCDEFHIJKLMNOPQRSTUVWXYZ0123456', |
| 447 | - 'comment' => $refc = $spotnab->getRandomStr(rand(15,200)), |
|
| 447 | + 'comment' => $refc = $spotnab->getRandomStr(rand(15, 200)), |
|
| 448 | 448 | 'username' => 'bb', |
| 449 | 449 | 'is_visible' => 1, |
| 450 | - 'postdate_utc' => $spotnab->local2utc(time()-86400) |
|
| 450 | + 'postdate_utc' => $spotnab->local2utc(time() - 86400) |
|
| 451 | 451 | ); |
| 452 | 452 | } |
| 453 | 453 | $article = $spotnab->encodePost($before, Null, true); |
| 454 | - if($article !== false){ |
|
| 454 | + if ($article !== false) { |
|
| 455 | 455 | $after = $spotnab->decodePost($article[1]); |
| 456 | - if($before === $after){ |
|
| 456 | + if ($before === $after) { |
|
| 457 | 457 | echo "Successful!\n"; |
| 458 | - }else{ |
|
| 458 | + } else { |
|
| 459 | 459 | echo "Failed!\n"; |
| 460 | 460 | } |
| 461 | - }else{ |
|
| 461 | + } else { |
|
| 462 | 462 | echo "Failed!\n"; |
| 463 | 463 | } |
| 464 | 464 | |
@@ -473,21 +473,21 @@ discard block |
||
| 473 | 473 | // We want to find new content, so to make our header |
| 474 | 474 | // new, we need to take our ref time and back down |
| 475 | 475 | // one second so it can be processed.. |
| 476 | - 'ref' => $article[2]['Epoch']-1 |
|
| 476 | + 'ref' => $article[2]['Epoch'] - 1 |
|
| 477 | 477 | )); |
| 478 | 478 | |
| 479 | 479 | // Fake headers (use debug information from encodePost) |
| 480 | 480 | $headers = array($article[2]); |
| 481 | 481 | |
| 482 | 482 | $matched = $spotnab->process_comment_headers($headers, $hash, false); |
| 483 | - if($matched !== false){ |
|
| 483 | + if ($matched !== false) { |
|
| 484 | 484 | $inserted = $matched[0]; |
| 485 | 485 | $updated = $matched[1]; |
| 486 | - echo ($matched > 0)?"Successful!\n":"Failed!\n"; |
|
| 487 | - }else{ |
|
| 486 | + echo ($matched > 0) ? "Successful!\n" : "Failed!\n"; |
|
| 487 | + } else { |
|
| 488 | 488 | echo "Failed\n"; |
| 489 | 489 | } |
| 490 | - }else{ |
|
| 490 | + } else { |
|
| 491 | 491 | printf("%s WARNING - openssl is not correctly installed; broadcasts and posts will be disabled.\n", |
| 492 | 492 | date("Y-m-d H:i:s")); |
| 493 | 493 | } |
@@ -496,36 +496,36 @@ discard block |
||
| 496 | 496 | date("Y-m-d H:i:s")); |
| 497 | 497 | $refa = $spotnab->utc2local(); |
| 498 | 498 | $refb = $spotnab->utc2local($spotnab->local2utc($refa)); |
| 499 | - echo ($refa == $refb)?"Successful!\n":"Failed!\n"; |
|
| 499 | + echo ($refa == $refb) ? "Successful!\n" : "Failed!\n"; |
|
| 500 | 500 | printf("%s INFO - Testing UTC/Local conversions [2/6]...", |
| 501 | 501 | date("Y-m-d H:i:s")); |
| 502 | 502 | $refa = $spotnab->local2utc(); |
| 503 | 503 | $refb = $spotnab->local2utc($spotnab->utc2local($refa)); |
| 504 | - echo ($refa == $refb)?"Successful!\n":"Failed!\n"; |
|
| 504 | + echo ($refa == $refb) ? "Successful!\n" : "Failed!\n"; |
|
| 505 | 505 | printf("%s INFO - Testing UTC/Local conversions [3/6]...", |
| 506 | 506 | date("Y-m-d H:i:s")); |
| 507 | 507 | $refa = $spotnab->local2utc(date("Y-m-d H:i:s")); |
| 508 | 508 | $refb = $spotnab->local2utc($spotnab->utc2local($refa)); |
| 509 | - echo ($refa == $refb)?"Successful!\n":"Failed!\n"; |
|
| 509 | + echo ($refa == $refb) ? "Successful!\n" : "Failed!\n"; |
|
| 510 | 510 | printf("%s INFO - Testing UTC/Local conversions [4/6]...", |
| 511 | 511 | date("Y-m-d H:i:s")); |
| 512 | 512 | $refa = $spotnab->utc2local(time()); |
| 513 | 513 | $refb = $spotnab->utc2local($spotnab->local2utc($refa)); |
| 514 | - echo ($refa == $refb)?"Successful!\n":"Failed!\n"; |
|
| 514 | + echo ($refa == $refb) ? "Successful!\n" : "Failed!\n"; |
|
| 515 | 515 | printf("%s INFO - Testing UTC/Local conversions [5/6]...", |
| 516 | 516 | date("Y-m-d H:i:s")); |
| 517 | 517 | $refa = $spotnab->local2utc(time()); |
| 518 | 518 | $refb = $spotnab->local2utc($spotnab->utc2local($refa)); |
| 519 | - echo ($refa == $refb)?"Successful!\n":"Failed!\n"; |
|
| 519 | + echo ($refa == $refb) ? "Successful!\n" : "Failed!\n"; |
|
| 520 | 520 | printf("%s INFO - Testing UTC/Local conversions [6/6]...", |
| 521 | 521 | date("Y-m-d H:i:s")); |
| 522 | 522 | $refa = $spotnab->utc2local(gmdate("Y-m-d H:i:s")); |
| 523 | 523 | $refb = $spotnab->utc2local($spotnab->local2utc($refa)); |
| 524 | - echo ($refa == $refb)?"Successful!\n":"Failed!\n"; |
|
| 524 | + echo ($refa == $refb) ? "Successful!\n" : "Failed!\n"; |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | -if(array_key_exists("o", $options) || |
|
| 528 | - array_key_exists("clean-orphan-comments", $options)){ |
|
| 527 | +if (array_key_exists("o", $options) || |
|
| 528 | + array_key_exists("clean-orphan-comments", $options)) { |
|
| 529 | 529 | echo "Removing orphan comments..."; |
| 530 | 530 | $spotnab = new SpotNab(); |
| 531 | 531 | printf("%d record(s) removed.\n", $spotnab->orphan_comment_clean()); |
@@ -212,7 +212,8 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $options = getopt($shortopts, $longopts); |
| 214 | 214 | |
| 215 | -function display_help(){ |
|
| 215 | +function display_help() |
|
| 216 | +{ |
|
| 216 | 217 | echo "\n"; |
| 217 | 218 | echo "SpotNab v0.97.4, Author: l2g\n"; |
| 218 | 219 | echo "Syntax: spotnab.php <action>\n"; |
@@ -270,7 +271,7 @@ discard block |
||
| 270 | 271 | |
| 271 | 272 | $delete_broken_releases = false; |
| 272 | 273 | if(array_key_exists("G", $options) || |
| 273 | - array_key_exists("populate-fix-gid", $options)){ |
|
| 274 | + array_key_exists("populate-fix-gid", $options)) { |
|
| 274 | 275 | echo "Updating GID in releases table + fix ..."; |
| 275 | 276 | $spotnab = new SpotNab(); |
| 276 | 277 | $spotnab->processGID(0,5000,true); |
@@ -278,7 +279,7 @@ discard block |
||
| 278 | 279 | } |
| 279 | 280 | |
| 280 | 281 | if(array_key_exists("g", $options) || |
| 281 | - array_key_exists("populate-gid", $options)){ |
|
| 282 | + array_key_exists("populate-gid", $options)) { |
|
| 282 | 283 | echo "Updating GID in releases table ..."; |
| 283 | 284 | $spotnab = new SpotNab(); |
| 284 | 285 | $spotnab->processGID(); |
@@ -286,7 +287,7 @@ discard block |
||
| 286 | 287 | } |
| 287 | 288 | |
| 288 | 289 | if(array_key_exists("r", $options) || |
| 289 | - array_key_exists("soft-reset", $options)){ |
|
| 290 | + array_key_exists("soft-reset", $options)) { |
|
| 290 | 291 | echo "Soft Reseting Spotnab... "; |
| 291 | 292 | $spotnab = new SpotNab(); |
| 292 | 293 | $spotnab->soft_reset(); |
@@ -295,18 +296,17 @@ discard block |
||
| 295 | 296 | |
| 296 | 297 | $force_keygen_save = false; |
| 297 | 298 | if(array_key_exists("K", $options) || |
| 298 | - array_key_exists("force-keygen", $options)){ |
|
| 299 | + array_key_exists("force-keygen", $options)) { |
|
| 299 | 300 | $spotnab = new SpotNab(); |
| 300 | 301 | $spotnab->keygen(true, true); |
| 301 | -} |
|
| 302 | -else if(array_key_exists("k", $options) || |
|
| 303 | - array_key_exists("keygen", $options)){ |
|
| 302 | +} else if(array_key_exists("k", $options) || |
|
| 303 | + array_key_exists("keygen", $options)) { |
|
| 304 | 304 | $spotnab = new SpotNab(); |
| 305 | 305 | $spotnab->keygen(true); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | if(array_key_exists("p", $options) || |
| 309 | - array_key_exists("post", $options)){ |
|
| 309 | + array_key_exists("post", $options)) { |
|
| 310 | 310 | echo "Posting... "; |
| 311 | 311 | $spotnab = new SpotNab(); |
| 312 | 312 | $spotnab->post(); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | if(array_key_exists("d", $options) || |
| 317 | - array_key_exists("discover", $options)){ |
|
| 317 | + array_key_exists("discover", $options)) { |
|
| 318 | 318 | echo "Discovering... "; |
| 319 | 319 | $spotnab = new SpotNab(); |
| 320 | 320 | $spotnab->fetch_discovery(); |
@@ -322,15 +322,15 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if(array_key_exists("F", $options) || |
| 325 | - array_key_exists("fetch-backfill", $options)){ |
|
| 325 | + array_key_exists("fetch-backfill", $options)) { |
|
| 326 | 326 | $days = array_key_exists("F", $options)?$options["F"]:$options["fetch-backfill"]; |
| 327 | - try{ |
|
| 327 | + try { |
|
| 328 | 328 | $days = abs(intval($days)); |
| 329 | - }catch(Exception $e){ |
|
| 329 | + } catch(Exception $e) { |
|
| 330 | 330 | $days = -1; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if($days <= 0){ |
|
| 333 | + if($days <= 0) { |
|
| 334 | 334 | echo "Error: A SpotNab fetch backfill requires you specify the number of days to look back.\n"; |
| 335 | 335 | echo "Syntax: php spontnab.php -F=<days>\n"; |
| 336 | 336 | exit(1); |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | echo "Done\n"; |
| 342 | 342 | |
| 343 | 343 | |
| 344 | -}else if (array_key_exists("f", $options) || |
|
| 345 | - array_key_exists("fetch", $options)){ |
|
| 344 | +} else if (array_key_exists("f", $options) || |
|
| 345 | + array_key_exists("fetch", $options)) { |
|
| 346 | 346 | echo "Fetching... "; |
| 347 | 347 | $spotnab = new SpotNab(); |
| 348 | 348 | $spotnab->fetch(); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | if(array_key_exists("b", $options) || |
| 353 | - array_key_exists("broadcast", $options)){ |
|
| 353 | + array_key_exists("broadcast", $options)) { |
|
| 354 | 354 | echo "Broadcasting... "; |
| 355 | 355 | $spotnab = new SpotNab(); |
| 356 | 356 | $spotnab->post_discovery(); |
@@ -358,24 +358,22 @@ discard block |
||
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | if(array_key_exists("t", $options) || |
| 361 | - array_key_exists("test", $options)){ |
|
| 361 | + array_key_exists("test", $options)) { |
|
| 362 | 362 | $spotnab = new SpotNab(); |
| 363 | 363 | |
| 364 | - if($spotnab->has_openssl()) |
|
| 365 | - { |
|
| 364 | + if($spotnab->has_openssl()) { |
|
| 366 | 365 | printf("%s INFO - Testing SSL Key Generator ...", |
| 367 | 366 | date("Y-m-d H:i:s")); |
| 368 | 367 | $keys = $spotnab->keygen(false); |
| 369 | 368 | if(is_array($keys) && |
| 370 | 369 | array_key_exists("pubkey", $keys) && |
| 371 | - array_key_exists("prvkey", $keys)) |
|
| 372 | - { |
|
| 370 | + array_key_exists("prvkey", $keys)) { |
|
| 373 | 371 | $prvkey = $spotnab->decompstr($keys['prvkey']); |
| 374 | 372 | $pubkey = $spotnab->decompstr($keys['pubkey']); |
| 375 | 373 | $refc = $spotnab->getRandomStr(80); |
| 376 | 374 | $refd = $spotnab->decrypt($spotnab->encrypt($refc, $prvkey), $pubkey); |
| 377 | 375 | echo ($refc == $refd)?"Successful!\n":"Failed!\n"; |
| 378 | - }else{ |
|
| 376 | + } else { |
|
| 379 | 377 | echo "Failed!\n"; |
| 380 | 378 | } |
| 381 | 379 | |
@@ -383,11 +381,11 @@ discard block |
||
| 383 | 381 | date("Y-m-d H:i:s")); |
| 384 | 382 | $preMsg = $spotnab->getRandomStr(800); |
| 385 | 383 | $postMsg = $spotnab->decrypt($spotnab->encrypt($preMsg)); |
| 386 | - if($postMsg === false){ |
|
| 384 | + if($postMsg === false) { |
|
| 387 | 385 | echo "Failed!\n"; |
| 388 | - }else if(!strcmp($preMsg, $postMsg)){ |
|
| 386 | + } else if(!strcmp($preMsg, $postMsg)) { |
|
| 389 | 387 | echo "Successful!\n"; |
| 390 | - }else{ |
|
| 388 | + } else { |
|
| 391 | 389 | echo "Failed!\n"; |
| 392 | 390 | } |
| 393 | 391 | |
@@ -419,14 +417,14 @@ discard block |
||
| 419 | 417 | ) |
| 420 | 418 | ); |
| 421 | 419 | $article = $spotnab->encodePost($before, Null, true); |
| 422 | - if($article !== false){ |
|
| 420 | + if($article !== false) { |
|
| 423 | 421 | $after = $spotnab->decodePost($article[1]); |
| 424 | - if($before === $after){ |
|
| 422 | + if($before === $after) { |
|
| 425 | 423 | echo "Successful!\n"; |
| 426 | - }else{ |
|
| 424 | + } else { |
|
| 427 | 425 | echo "Failed!\n"; |
| 428 | 426 | } |
| 429 | - }else{ |
|
| 427 | + } else { |
|
| 430 | 428 | echo "Failed!\n"; |
| 431 | 429 | } |
| 432 | 430 | printf("%s INFO - Testing big message encode/decode ...", |
@@ -439,7 +437,7 @@ discard block |
||
| 439 | 437 | 'postdate_utc' => $spotnab->local2utc(), |
| 440 | 438 | 'comments' => [] |
| 441 | 439 | ); |
| 442 | - for($i=0;$i<3000;$i++){ |
|
| 440 | + for($i=0;$i<3000;$i++) { |
|
| 443 | 441 | // Build large post |
| 444 | 442 | $before['comments'][] =array( |
| 445 | 443 | 'gid' => 'ABCDEFHIJKLMNOPQRSTUVWXYZ0123456', |
@@ -451,14 +449,14 @@ discard block |
||
| 451 | 449 | ); |
| 452 | 450 | } |
| 453 | 451 | $article = $spotnab->encodePost($before, Null, true); |
| 454 | - if($article !== false){ |
|
| 452 | + if($article !== false) { |
|
| 455 | 453 | $after = $spotnab->decodePost($article[1]); |
| 456 | - if($before === $after){ |
|
| 454 | + if($before === $after) { |
|
| 457 | 455 | echo "Successful!\n"; |
| 458 | - }else{ |
|
| 456 | + } else { |
|
| 459 | 457 | echo "Failed!\n"; |
| 460 | 458 | } |
| 461 | - }else{ |
|
| 459 | + } else { |
|
| 462 | 460 | echo "Failed!\n"; |
| 463 | 461 | } |
| 464 | 462 | |
@@ -480,14 +478,14 @@ discard block |
||
| 480 | 478 | $headers = array($article[2]); |
| 481 | 479 | |
| 482 | 480 | $matched = $spotnab->process_comment_headers($headers, $hash, false); |
| 483 | - if($matched !== false){ |
|
| 481 | + if($matched !== false) { |
|
| 484 | 482 | $inserted = $matched[0]; |
| 485 | 483 | $updated = $matched[1]; |
| 486 | 484 | echo ($matched > 0)?"Successful!\n":"Failed!\n"; |
| 487 | - }else{ |
|
| 485 | + } else { |
|
| 488 | 486 | echo "Failed\n"; |
| 489 | 487 | } |
| 490 | - }else{ |
|
| 488 | + } else { |
|
| 491 | 489 | printf("%s WARNING - openssl is not correctly installed; broadcasts and posts will be disabled.\n", |
| 492 | 490 | date("Y-m-d H:i:s")); |
| 493 | 491 | } |
@@ -525,7 +523,7 @@ discard block |
||
| 525 | 523 | } |
| 526 | 524 | |
| 527 | 525 | if(array_key_exists("o", $options) || |
| 528 | - array_key_exists("clean-orphan-comments", $options)){ |
|
| 526 | + array_key_exists("clean-orphan-comments", $options)) { |
|
| 529 | 527 | echo "Removing orphan comments..."; |
| 530 | 528 | $spotnab = new SpotNab(); |
| 531 | 529 | printf("%d record(s) removed.\n", $spotnab->orphan_comment_clean()); |
@@ -335,7 +335,7 @@ |
||
| 335 | 335 | echo "Syntax: php spontnab.php -F=<days>\n"; |
| 336 | 336 | exit(1); |
| 337 | 337 | } |
| 338 | - echo "Fetching $days day(s) back ... "; |
|
| 338 | + echo "fetching $days day(s) back ... "; |
|
| 339 | 339 | $spotnab = new SpotNab(); |
| 340 | 340 | $spotnab->fetch(time()-($days*86400)); |
| 341 | 341 | echo "Done\n"; |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | if ($result === false || $hash === false) { |
| 55 | 55 | $pdo->log->error('An error occured during update attempt.' . PHP_EOL); |
| 56 | 56 | } else { |
| 57 | - $pdo->log->headerOver("Updated {$user['username']}'s password hash to: ") . $pdo->log->primary("$hash"); |
|
| 57 | + $pdo->log->headerOver("updated {$user['username']}'s password hash to: ") . $pdo->log->primary("$hash"); |
|
| 58 | 58 | } |
| 59 | 59 | } else { |
| 60 | 60 | $pdo->log->error("Unable to find {$field} '{$identifier}' in the users. Cannot change password."); |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | foreach ($arr as &$value) { |
| 54 | 54 | $rel = $pdo->queryExec("TRUNCATE TABLE $value"); |
| 55 | 55 | if ($rel !== false) { |
| 56 | - echo $pdo->log->header("Truncating $value completed."); |
|
| 56 | + echo $pdo->log->header("truncating $value completed."); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | unset($value); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | It is intended for use ONLY if you have a *lot* of users, as this is not |
| 31 | 31 | secure (a user's email addresses may be known to other users). If you only have |
| 32 | 32 | a few users then run setUsersPasswordHash.php for each of them instead. |
| 33 | -WARNING; |
|
| 33 | +warning; |
|
| 34 | 34 | $usage = "\nUsage: php {$argv[0]} <IUnderStandTheRisks>"; |
| 35 | 35 | |
| 36 | 36 | echo $colorCLI->warning($warning); |
@@ -11,15 +11,17 @@ discard block |
||
| 11 | 11 | Utility::clearScreen(); |
| 12 | 12 | $pdo = new DB(); |
| 13 | 13 | |
| 14 | -if (!isset($argv[1]) || (isset($argv[1]) && $argv[1] !== 'true')) |
|
| 14 | +if (!isset($argv[1]) || (isset($argv[1]) && $argv[1] !== 'true')) { |
|
| 15 | 15 | exit($pdo->log->error("\nThis script removes all releases and release related files. To run:\nphp resetdb.php true\n")); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | echo $pdo->log->warning("This script removes all releases, nzb files, samples, previews , nfos, truncates all article tables and resets all groups."); |
| 18 | 19 | echo $pdo->log->header("Are you sure you want reset the DB? Type 'DESTROY' to continue: \n"); |
| 19 | 20 | echo $pdo->log->warningOver("\n"); |
| 20 | 21 | $line = fgets(STDIN); |
| 21 | -if (trim($line) != 'DESTROY') |
|
| 22 | +if (trim($line) != 'DESTROY') { |
|
| 22 | 23 | exit($pdo->log->error("This script is dangerous you must type DESTROY for it function.")); |
| 24 | +} |
|
| 23 | 25 | |
| 24 | 26 | echo "\n"; |
| 25 | 27 | echo $pdo->log->header("Thank you, continuing...\n\n"); |
@@ -41,9 +43,10 @@ discard block |
||
| 41 | 43 | ]; |
| 42 | 44 | foreach ($arr as &$value) { |
| 43 | 45 | $rel = $pdo->queryExec("TRUNCATE TABLE $value"); |
| 44 | - if ($rel !== false) |
|
| 45 | - echo $pdo->log->primary("Truncating ${value} completed."); |
|
| 46 | -} |
|
| 46 | + if ($rel !== false) { |
|
| 47 | + echo $pdo->log->primary("Truncating ${value} completed."); |
|
| 48 | + } |
|
| 49 | + } |
|
| 47 | 50 | unset($value); |
| 48 | 51 | |
| 49 | 52 | $sql = "SHOW table status"; |
@@ -53,8 +56,9 @@ discard block |
||
| 53 | 56 | $tbl = $row['name']; |
| 54 | 57 | if (preg_match('/binaries_\d+/', $tbl) || preg_match('/parts_\d+/', $tbl) || preg_match('/collections_\d+/', $tbl) || preg_match('/partrepair_\d+/', $tbl) || preg_match('/\d+_binaries/', $tbl) || preg_match('/\d+_collections/', $tbl) || preg_match('/\d+_parts/', $tbl) || preg_match('/\d+_partrepair_\d+/', $tbl)) { |
| 55 | 58 | $rel = $pdo->queryDirect(sprintf('DROP TABLE %s', $tbl)); |
| 56 | - if ($rel !== false) |
|
| 57 | - echo $pdo->log->primary("Dropping ${tbl} completed."); |
|
| 59 | + if ($rel !== false) { |
|
| 60 | + echo $pdo->log->primary("Dropping ${tbl} completed."); |
|
| 61 | + } |
|
| 58 | 62 | } |
| 59 | 63 | } |
| 60 | 64 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | foreach ($arr as &$value) { |
| 43 | 43 | $rel = $pdo->queryExec("TRUNCATE TABLE $value"); |
| 44 | 44 | if ($rel !== false) |
| 45 | - echo $pdo->log->primary("Truncating ${value} completed."); |
|
| 45 | + echo $pdo->log->primary("truncating ${value} completed."); |
|
| 46 | 46 | } |
| 47 | 47 | unset($value); |
| 48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | if (preg_match('/binaries_\d+/', $tbl) || preg_match('/parts_\d+/', $tbl) || preg_match('/collections_\d+/', $tbl) || preg_match('/partrepair_\d+/', $tbl) || preg_match('/\d+_binaries/', $tbl) || preg_match('/\d+_collections/', $tbl) || preg_match('/\d+_parts/', $tbl) || preg_match('/\d+_partrepair_\d+/', $tbl)) { |
| 55 | 55 | $rel = $pdo->queryDirect(sprintf('DROP TABLE %s', $tbl)); |
| 56 | 56 | if ($rel !== false) |
| 57 | - echo $pdo->log->primary("Dropping ${tbl} completed."); |
|
| 57 | + echo $pdo->log->primary("dropping ${tbl} completed."); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | if ($collections_rows instanceof \Traversable) { |
| 41 | 41 | foreach ($collections_rows as $row) { |
| 42 | 42 | $groupName = $groups->getNameByID($row['group_id']); |
| 43 | - echo $pdo->log->header("Processing ${groupName}"); |
|
| 43 | + echo $pdo->log->header("processing ${groupname}"); |
|
| 44 | 44 | //collection |
| 45 | 45 | $pdo->queryExec("INSERT IGNORE INTO collections_" . $row['group_id'] . " (subject, fromname, date, xref, totalfiles, group_id, collectionhash, dateadded, filecheck, filesize, releaseid) " |
| 46 | 46 | . "SELECT subject, fromname, date, xref, totalfiles, group_id, collectionhash, dateadded, filecheck, filesize, releaseid FROM collections WHERE group_id = ${row['group_id']}"); |
| 47 | 47 | $collections = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM collections where group_id = " . $row['group_id']); |
| 48 | 48 | $ncollections = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM collections_" . $row['group_id']); |
| 49 | - echo $pdo->log->primary("Group ${groupName}, Collections = ${collections['cnt']} [${ncollections['cnt']}]"); |
|
| 49 | + echo $pdo->log->primary("group ${groupname}, Collections = ${collections['cnt']} [${ncollections['cnt']}]"); |
|
| 50 | 50 | |
| 51 | 51 | //binaries |
| 52 | 52 | $pdo->queryExec("INSERT IGNORE INTO binaries_${row['group_id']} (name, filenumber, totalparts, currentparts, binaryhash, partcheck, partsize, collection_id) " |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | . "INNER JOIN collections_${row['group_id']} n ON c.collectionhash = n.collectionhash AND c.group_id = ${row['group_id']}"); |
| 56 | 56 | $binaries = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM binaries b INNER JOIN collections c ON b.collection_id = c.id where c.group_id = ${row['group_id']}"); |
| 57 | 57 | $nbinaries = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM binaries_${row['group_id']}"); |
| 58 | - echo $pdo->log->primary("Group ${groupName}, Binaries = ${binaries['cnt']} [${nbinaries['cnt']}]"); |
|
| 58 | + echo $pdo->log->primary("group ${groupname}, Binaries = ${binaries['cnt']} [${nbinaries['cnt']}]"); |
|
| 59 | 59 | |
| 60 | 60 | //parts |
| 61 | 61 | $pdo->queryExec("INSERT IGNORE INTO parts_${row['group_id']} (messageid, number, partnumber, size, binaryid, collection_id) " |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | . "INNER JOIN collections_${row['group_id']} c on c.id = n.collection_id AND c.group_id = ${row['group_id']}"); |
| 66 | 66 | $parts = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts p INNER JOIN binaries b ON p.binaryid = b.id INNER JOIN collections c ON b.collection_id = c.id WHERE c.group_id = ${row['group_id']}"); |
| 67 | 67 | $nparts = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts_${row['group_id']}"); |
| 68 | - echo $pdo->log->primary("Group ${groupName}, Parts = ${parts['cnt']} [${nparts['cnt']}]\n"); |
|
| 68 | + echo $pdo->log->primary("group ${groupname}, Parts = ${parts['cnt']} [${nparts['cnt']}]\n"); |
|
| 69 | 69 | $i++; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -11,16 +11,16 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "fmyisam") { |
| 13 | 13 | $tbl = $argv[1]; |
| 14 | - printf($cli->header("Converting $tbl")); |
|
| 14 | + printf($cli->header("converting $tbl")); |
|
| 15 | 15 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=FIXED"); |
| 16 | 16 | } else if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "dmyisam") { |
| 17 | 17 | $tbl = $argv[1]; |
| 18 | - printf($cli->header("Converting $tbl")); |
|
| 18 | + printf($cli->header("converting $tbl")); |
|
| 19 | 19 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=DYNAMIC"); |
| 20 | 20 | } else if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "cinnodb") { |
| 21 | 21 | $tbl = $argv[1]; |
| 22 | 22 | if ($ftinnodb || (!$ftinnodb && $tbl !== 'release_search_data' && $tbl !== 'bookinfo' && $tbl !== 'consoleinfo' && $tbl !== 'musicinfo')) { |
| 23 | - printf($cli->header("Converting $tbl")); |
|
| 23 | + printf($cli->header("converting $tbl")); |
|
| 24 | 24 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 25 | 25 | } else { |
| 26 | 26 | printf($cli->header("Not converting bookinfo / consoleinfo / musicinfo / release_search_data as your INNODB version does not support fulltext indexes")); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } else if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "dinnodb") { |
| 29 | 29 | $tbl = $argv[1]; |
| 30 | 30 | if ($ftinnodb || (!$ftinnodb && $tbl !== 'release_search_data' && $tbl !== 'bookinfo' && $tbl !== 'consoleinfo' && $tbl !== 'musicinfo')) { |
| 31 | - printf($cli->header("Converting $tbl")); |
|
| 31 | + printf($cli->header("converting $tbl")); |
|
| 32 | 32 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 33 | 33 | } else { |
| 34 | 34 | printf($cli->header("Not converting bookinfo / consoleinfo / musicinfo / release_search_data as your INNODB version does not support fulltext indexes")); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $tables = $pdo->query($sql); |
| 39 | 39 | foreach ($tables as $row) { |
| 40 | 40 | $tbl = $row['name']; |
| 41 | - printf($cli->header("Converting $tbl")); |
|
| 41 | + printf($cli->header("converting $tbl")); |
|
| 42 | 42 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=FIXED"); |
| 43 | 43 | } |
| 44 | 44 | } else if (isset($argv[1]) && $argv[1] == "dmyisam") { |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $tables = $pdo->query($sql); |
| 47 | 47 | foreach ($tables as $row) { |
| 48 | 48 | $tbl = $row['name']; |
| 49 | - printf($cli->header("Converting $tbl")); |
|
| 49 | + printf($cli->header("converting $tbl")); |
|
| 50 | 50 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=DYNAMIC"); |
| 51 | 51 | } |
| 52 | 52 | } else if (isset($argv[1]) && $argv[1] == "dinnodb") { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | foreach ($tables as $row) { |
| 56 | 56 | $tbl = $row['name']; |
| 57 | 57 | if ($tbl !== 'release_search_data' && $tbl !== 'bookinfo' && $tbl !== 'consoleinfo' && $tbl !== 'musicinfo') { |
| 58 | - printf($cli->header("Converting $tbl")); |
|
| 58 | + printf($cli->header("converting $tbl")); |
|
| 59 | 59 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $tables = $pdo->query($sql); |
| 65 | 65 | foreach ($tables as $row) { |
| 66 | 66 | $tbl = $row['name']; |
| 67 | - printf($cli->header("Converting $tbl")); |
|
| 67 | + printf($cli->header("converting $tbl")); |
|
| 68 | 68 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 69 | 69 | } |
| 70 | 70 | } else { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | foreach ($tables as $row) { |
| 77 | 77 | $tbl = $row['name']; |
| 78 | 78 | if ($tbl !== 'release_nfos' && $tbl !== 'release_search_data' && $tbl !== 'bookinfo' && $tbl !== 'consoleinfo' && $tbl !== 'musicinfo') { |
| 79 | - printf($cli->header("Converting $tbl")); |
|
| 79 | + printf($cli->header("converting $tbl")); |
|
| 80 | 80 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $tables = $pdo->query($sql); |
| 85 | 85 | foreach ($tables as $row) { |
| 86 | 86 | $tbl = $row['name']; |
| 87 | - printf($cli->header("Converting $tbl")); |
|
| 87 | + printf($cli->header("converting $tbl")); |
|
| 88 | 88 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 89 | 89 | } |
| 90 | 90 | if ($ftinnodb) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $tables = $pdo->query($sql); |
| 93 | 93 | foreach ($tables as $row) { |
| 94 | 94 | $tbl = $row['name']; |
| 95 | - printf($cli->header("Converting $tbl")); |
|
| 95 | + printf($cli->header("converting $tbl")); |
|
| 96 | 96 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 97 | 97 | } |
| 98 | 98 | } else { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | foreach ($tables as $row) { |
| 105 | 105 | $tbl = $row['name']; |
| 106 | 106 | if ($tbl !== 'release_nfos' && $tbl !== 'release_search_data' && $tbl !== 'bookinfo' && $tbl !== 'consoleinfo' && $tbl !== 'musicinfo' && !preg_match('/parts/', $tbl)) { |
| 107 | - printf($cli->header("Converting $tbl")); |
|
| 107 | + printf($cli->header("converting $tbl")); |
|
| 108 | 108 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | $tables = $pdo->query($sql); |
| 113 | 113 | foreach ($tables as $row) { |
| 114 | 114 | $tbl = $row['name']; |
| 115 | - printf($cli->header("Converting $tbl")); |
|
| 115 | + printf($cli->header("converting $tbl")); |
|
| 116 | 116 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=DYNAMIC"); |
| 117 | 117 | } |
| 118 | 118 | $sql = 'SHOW TABLE STATUS WHERE Name LIKE "parts%" AND (Engine != "MyISAM" || Row_format != "Dynamic")'; |
| 119 | 119 | $tables = $pdo->query($sql); |
| 120 | 120 | foreach ($tables as $row) { |
| 121 | 121 | $tbl = $row['name']; |
| 122 | - printf($cli->header("Converting $tbl")); |
|
| 122 | + printf($cli->header("converting $tbl")); |
|
| 123 | 123 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MyISAM ROW_FORMAT=DYNAMIC"); |
| 124 | 124 | } |
| 125 | 125 | if ($ftinnodb) { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $tables = $pdo->query($sql); |
| 128 | 128 | foreach ($tables as $row) { |
| 129 | 129 | $tbl = $row['name']; |
| 130 | - printf($cli->header("Converting $tbl")); |
|
| 130 | + printf($cli->header("converting $tbl")); |
|
| 131 | 131 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=INNODB ROW_FORMAT=COMPRESSED"); |
| 132 | 132 | } |
| 133 | 133 | } else { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $arr = array("parts", "binaries", "collections"); |
| 138 | 138 | foreach ($arr as $row) { |
| 139 | 139 | $tbl = $row; |
| 140 | - printf($cli->header("Converting $tbl")); |
|
| 140 | + printf($cli->header("converting $tbl")); |
|
| 141 | 141 | $pdo->queryExec("ALTER TABLE $tbl ENGINE=MYISAM ROW_FORMAT=FIXED"); |
| 142 | 142 | } |
| 143 | 143 | } else if (isset($argv[1]) && $argv[1] == "mariadb-tokudb") { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | foreach ($tables as $row) { |
| 146 | 146 | $tbl = $row['name']; |
| 147 | 147 | if ($tbl !== 'release_search_data') { |
| 148 | - printf($cli->header("Converting $tbl")); |
|
| 148 | + printf($cli->header("converting $tbl")); |
|
| 149 | 149 | $sql = "ALTER TABLE $tbl ENGINE=TokuDB Compression=tokudb_lzma"; |
| 150 | 150 | $pdo->queryExec($sql); |
| 151 | 151 | $pdo->queryExec("OPTIMIZE TABLE $tbl"); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | foreach ($tables as $row) { |
| 157 | 157 | $tbl = $row['name']; |
| 158 | 158 | if ($tbl !== 'release_search_data') { |
| 159 | - printf($cli->header("Converting $tbl")); |
|
| 159 | + printf($cli->header("converting $tbl")); |
|
| 160 | 160 | $sql = "ALTER TABLE $tbl ENGINE=TokuDB row_format=tokudb_lzma"; |
| 161 | 161 | $pdo->queryExec($sql); |
| 162 | 162 | $pdo->queryExec("OPTIMIZE TABLE $tbl"); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $tables = $pdo->query($sql); |
| 28 | 28 | foreach ($tables as $row) { |
| 29 | 29 | $tbl = $row['name']; |
| 30 | - if (preg_match('/collections_\d+/', $tbl) || preg_match('/binaries_\d+/', $tbl) || preg_match('/parts_\d+/', $tbl) || preg_match('/partrepair_\d+/', $tbl) || preg_match('/\d+_collections/', $tbl) || preg_match('/\d+_binaries/', $tbl) || preg_match('/\d+_parts/', $tbl) || preg_match('/\d+_partrepair_\d+/', $tbl)) { |
|
| 30 | + if (preg_match('/collections_\d+/', $tbl) || preg_match('/binaries_\d+/', $tbl) || preg_match('/parts_\d+/', $tbl) || preg_match('/partrepair_\d+/', $tbl) || preg_match('/\d+_collections/', $tbl) || preg_match('/\d+_binaries/', $tbl) || preg_match('/\d+_parts/', $tbl) || preg_match('/\d+_partrepair_\d+/', $tbl)) { |
|
| 31 | 31 | if ($argv[1] == "drop") { |
| 32 | 32 | $rel = $pdo->queryDirect(sprintf('DROP TABLE %s', $tbl)); |
| 33 | 33 | if ($rel !== false) { |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | foreach ($arr as &$value) { |
| 14 | 14 | $rel = $pdo->queryExec("TRUNCATE TABLE $value"); |
| 15 | 15 | if ($rel !== false) { |
| 16 | - echo $pdo->log->primary("Truncating ${value} completed."); |
|
| 16 | + echo $pdo->log->primary("truncating ${value} completed."); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | unset($value); |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | if ($argv[1] == "drop") { |
| 32 | 32 | $rel = $pdo->queryDirect(sprintf('DROP TABLE %s', $tbl)); |
| 33 | 33 | if ($rel !== false) { |
| 34 | - echo $pdo->log->primary("Dropping ${tbl} completed."); |
|
| 34 | + echo $pdo->log->primary("dropping ${tbl} completed."); |
|
| 35 | 35 | } |
| 36 | 36 | } else { |
| 37 | 37 | $rel = $pdo->queryDirect(sprintf('TRUNCATE TABLE %s', $tbl)); |
| 38 | 38 | if ($rel !== false) { |
| 39 | - echo $pdo->log->primary("Truncating ${tbl} completed."); |
|
| 39 | + echo $pdo->log->primary("truncating ${tbl} completed."); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | function newname($filename) |
| 26 | 26 | { |
| 27 | - rename($filename, dirname($filename)."/".basename($filename,".gz")."_".date("Y_m_d_His", filemtime($filename)).".gz"); |
|
| 27 | + rename($filename, dirname($filename) . "/" . basename($filename, ".gz") . "_" . date("Y_m_d_His", filemtime($filename)) . ".gz"); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | function builddefaultsfile() |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | ."password = " . DB_PASSWORD; |
| 43 | 43 | |
| 44 | 44 | $filehandle = fopen("mysql-defaults.txt", "w+"); |
| 45 | - if(!$filehandle) { |
|
| 45 | + if (!$filehandle) { |
|
| 46 | 46 | exit("Unable to write mysql defaults file! Exiting"); |
| 47 | 47 | } else { |
| 48 | 48 | fwrite($filehandle, $filetext); |
@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | //generate defaults file used to store database login information so it is not in cleartext in ps command for mysqldump |
| 68 | 68 | builddefaultsfile(); |
| 69 | 69 | |
| 70 | -if((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 71 | - $filename = $argv[3]."/".$dbname.".gz"; |
|
| 70 | +if ((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 71 | + $filename = $argv[3] . "/" . $dbname . ".gz"; |
|
| 72 | 72 | echo $pdo->log->header("Dumping $dbname."); |
| 73 | 73 | if (file_exists($filename)) { |
| 74 | 74 | newname($filename); |
| 75 | 75 | } |
| 76 | - $command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use "."$dbname | gzip -9 > $filename"; |
|
| 76 | + $command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use " . "$dbname | gzip -9 > $filename"; |
|
| 77 | 77 | system($command); |
| 78 | -} else if((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 79 | - $filename = $argv[3]."/".$dbname.".gz"; |
|
| 78 | +} else if ((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 79 | + $filename = $argv[3] . "/" . $dbname . ".gz"; |
|
| 80 | 80 | if (file_exists($filename)) { |
| 81 | 81 | echo $pdo->log->header("Restoring $dbname."); |
| 82 | 82 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
@@ -84,26 +84,26 @@ discard block |
||
| 84 | 84 | system($command); |
| 85 | 85 | $pdo->queryExec("SET FOREIGN_KEY_CHECKS=1"); |
| 86 | 86 | } |
| 87 | -} else if((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 87 | +} else if ((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 88 | 88 | $sql = "SHOW tables"; |
| 89 | 89 | $tables = $pdo->query($sql); |
| 90 | - foreach($tables as $row) { |
|
| 91 | - $tbl = $row['Tables_in_'.DB_NAME]; |
|
| 92 | - $filename = $argv[3]."/".$tbl.".gz"; |
|
| 90 | + foreach ($tables as $row) { |
|
| 91 | + $tbl = $row['Tables_in_' . DB_NAME]; |
|
| 92 | + $filename = $argv[3] . "/" . $tbl . ".gz"; |
|
| 93 | 93 | echo $pdo->log->header("Dumping $tbl."); |
| 94 | 94 | if (file_exists($filename)) { |
| 95 | 95 | newname($filename); |
| 96 | 96 | } |
| 97 | - $command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use "."$dbname $tbl | gzip -9 > $filename"; |
|
| 97 | + $command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use " . "$dbname $tbl | gzip -9 > $filename"; |
|
| 98 | 98 | system($command); |
| 99 | 99 | } |
| 100 | -} else if((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 100 | +} else if ((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 101 | 101 | $sql = "SHOW tables"; |
| 102 | 102 | $tables = $pdo->query($sql); |
| 103 | 103 | $pdo->queryExec("SET FOREIGN_KEY_CHECKS=0"); |
| 104 | - foreach($tables as $row) { |
|
| 105 | - $tbl = $row['Tables_in_'.DB_NAME]; |
|
| 106 | - $filename = $argv[3]."/".$tbl.".gz"; |
|
| 104 | + foreach ($tables as $row) { |
|
| 105 | + $tbl = $row['Tables_in_' . DB_NAME]; |
|
| 106 | + $filename = $argv[3] . "/" . $tbl . ".gz"; |
|
| 107 | 107 | if (file_exists($filename)) { |
| 108 | 108 | echo $pdo->log->header("Restoring $tbl."); |
| 109 | 109 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
@@ -111,22 +111,22 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | $pdo->queryExec("SET FOREIGN_KEY_CHECKS=1"); |
| 114 | -} else if((isset($argv[1]) && $argv[1] == "test") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 114 | +} else if ((isset($argv[1]) && $argv[1] == "test") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 115 | 115 | $arr = array("parts", "binaries", "missed_parts", "groups"); |
| 116 | 116 | foreach ($arr as &$tbl) { |
| 117 | - $filename = $argv[3]."/".$tbl.".gz"; |
|
| 117 | + $filename = $argv[3] . "/" . $tbl . ".gz"; |
|
| 118 | 118 | echo $pdo->log->header("Dumping $tbl.."); |
| 119 | 119 | if (file_exists($filename)) { |
| 120 | 120 | newname($filename); |
| 121 | 121 | } |
| 122 | - $command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use "."$dbname $tbl | gzip -9 > $filename"; |
|
| 122 | + $command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use " . "$dbname $tbl | gzip -9 > $filename"; |
|
| 123 | 123 | system($command); |
| 124 | 124 | } |
| 125 | -} else if((isset($argv[1]) && $argv[1] == "test") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 125 | +} else if ((isset($argv[1]) && $argv[1] == "test") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 126 | 126 | $arr = array("parts", "binaries", "missed_parts", "groups"); |
| 127 | 127 | $pdo->queryExec("SET FOREIGN_KEY_CHECKS=0"); |
| 128 | 128 | foreach ($arr as &$tbl) { |
| 129 | - $filename = $argv[3]."/".$tbl.".gz"; |
|
| 129 | + $filename = $argv[3] . "/" . $tbl . ".gz"; |
|
| 130 | 130 | if (file_exists($filename)) { |
| 131 | 131 | echo $pdo->log->header("Restoring $tbl."); |
| 132 | 132 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
@@ -134,25 +134,25 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | $pdo->queryExec("SET FOREIGN_KEY_CHECKS=1"); |
| 137 | -} else if((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "outfile") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 137 | +} else if ((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "outfile") && (isset($argv[3]) && file_exists($argv[3]))) { |
|
| 138 | 138 | $sql = "SHOW tables"; |
| 139 | 139 | $tables = $pdo->query($sql); |
| 140 | - foreach($tables as $row) { |
|
| 141 | - $tbl = $row['Tables_in_'.DB_NAME]; |
|
| 142 | - $filename = $argv[3].$tbl.".csv"; |
|
| 140 | + foreach ($tables as $row) { |
|
| 141 | + $tbl = $row['Tables_in_' . DB_NAME]; |
|
| 142 | + $filename = $argv[3] . $tbl . ".csv"; |
|
| 143 | 143 | echo $pdo->log->header("Dumping $tbl."); |
| 144 | 144 | if (file_exists($filename)) { |
| 145 | 145 | newname($filename); |
| 146 | 146 | } |
| 147 | 147 | $pdo->queryDirect(sprintf("SELECT * INTO OUTFILE %s FROM %s", $pdo->escapeString($filename), $tbl)); |
| 148 | 148 | } |
| 149 | -} else if((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "infile") && (isset($argv[3]) && is_dir($argv[3]))) { |
|
| 149 | +} else if ((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "infile") && (isset($argv[3]) && is_dir($argv[3]))) { |
|
| 150 | 150 | $sql = "SHOW tables"; |
| 151 | 151 | $tables = $pdo->query($sql); |
| 152 | 152 | $pdo->queryExec("SET FOREIGN_KEY_CHECKS=0"); |
| 153 | - foreach($tables as $row) { |
|
| 154 | - $tbl = $row['Tables_in_'.DB_NAME]; |
|
| 155 | - $filename = $argv[3].$tbl.".csv"; |
|
| 153 | + foreach ($tables as $row) { |
|
| 154 | + $tbl = $row['Tables_in_' . DB_NAME]; |
|
| 155 | + $filename = $argv[3] . $tbl . ".csv"; |
|
| 156 | 156 | if (file_exists($filename)) { |
| 157 | 157 | echo $pdo->log->header("Restoring $tbl."); |
| 158 | 158 | $pdo->queryExec(sprintf("LOAD DATA INFILE %s INTO TABLE %s", $pdo->escapeString($filename), $tbl)); |
@@ -177,6 +177,6 @@ discard block |
||
| 177 | 177 | . "php $argv[0] all infile /path/to/restore/from ...: To restore all tables, using INFILE.\n\n"); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | -if(file_exists("mysql-defaults.txt")) { |
|
| 180 | +if (file_exists("mysql-defaults.txt")) { |
|
| 181 | 181 | @unlink("mysql-defaults.txt"); |
| 182 | 182 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) { |
| 71 | 71 | $filename = $argv[3]."/".$dbname.".gz"; |
| 72 | - echo $pdo->log->header("Dumping $dbname."); |
|
| 72 | + echo $pdo->log->header("dumping $dbname."); |
|
| 73 | 73 | if (file_exists($filename)) { |
| 74 | 74 | newname($filename); |
| 75 | 75 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } else if((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) { |
| 79 | 79 | $filename = $argv[3]."/".$dbname.".gz"; |
| 80 | 80 | if (file_exists($filename)) { |
| 81 | - echo $pdo->log->header("Restoring $dbname."); |
|
| 81 | + echo $pdo->log->header("restoring $dbname."); |
|
| 82 | 82 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
| 83 | 83 | $pdo->queryExec("SET FOREIGN_KEY_CHECKS=0"); |
| 84 | 84 | system($command); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | foreach($tables as $row) { |
| 91 | 91 | $tbl = $row['Tables_in_'.DB_NAME]; |
| 92 | 92 | $filename = $argv[3]."/".$tbl.".gz"; |
| 93 | - echo $pdo->log->header("Dumping $tbl."); |
|
| 93 | + echo $pdo->log->header("dumping $tbl."); |
|
| 94 | 94 | if (file_exists($filename)) { |
| 95 | 95 | newname($filename); |
| 96 | 96 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $tbl = $row['Tables_in_'.DB_NAME]; |
| 106 | 106 | $filename = $argv[3]."/".$tbl.".gz"; |
| 107 | 107 | if (file_exists($filename)) { |
| 108 | - echo $pdo->log->header("Restoring $tbl."); |
|
| 108 | + echo $pdo->log->header("restoring $tbl."); |
|
| 109 | 109 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
| 110 | 110 | system($command); |
| 111 | 111 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $arr = array("parts", "binaries", "missed_parts", "groups"); |
| 116 | 116 | foreach ($arr as &$tbl) { |
| 117 | 117 | $filename = $argv[3]."/".$tbl.".gz"; |
| 118 | - echo $pdo->log->header("Dumping $tbl.."); |
|
| 118 | + echo $pdo->log->header("dumping $tbl.."); |
|
| 119 | 119 | if (file_exists($filename)) { |
| 120 | 120 | newname($filename); |
| 121 | 121 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | foreach ($arr as &$tbl) { |
| 129 | 129 | $filename = $argv[3]."/".$tbl.".gz"; |
| 130 | 130 | if (file_exists($filename)) { |
| 131 | - echo $pdo->log->header("Restoring $tbl."); |
|
| 131 | + echo $pdo->log->header("restoring $tbl."); |
|
| 132 | 132 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
| 133 | 133 | system($command); |
| 134 | 134 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | foreach($tables as $row) { |
| 141 | 141 | $tbl = $row['Tables_in_'.DB_NAME]; |
| 142 | 142 | $filename = $argv[3].$tbl.".csv"; |
| 143 | - echo $pdo->log->header("Dumping $tbl."); |
|
| 143 | + echo $pdo->log->header("dumping $tbl."); |
|
| 144 | 144 | if (file_exists($filename)) { |
| 145 | 145 | newname($filename); |
| 146 | 146 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $tbl = $row['Tables_in_'.DB_NAME]; |
| 155 | 155 | $filename = $argv[3].$tbl.".csv"; |
| 156 | 156 | if (file_exists($filename)) { |
| 157 | - echo $pdo->log->header("Restoring $tbl."); |
|
| 157 | + echo $pdo->log->header("restoring $tbl."); |
|
| 158 | 158 | $pdo->queryExec(sprintf("LOAD DATA INFILE %s INTO TABLE %s", $pdo->escapeString($filename), $tbl)); |
| 159 | 159 | } |
| 160 | 160 | } |