Skip to content

Commit

Permalink
Moved getDB.php to mods/getdb.php
Browse files Browse the repository at this point in the history
The script now no longer creates an sql file, but runs the update directly. It can also be run from /pokedex and from cron in the same way as overview_refresh etc.
  • Loading branch information
Ninjasoturi committed Aug 25, 2021
1 parent 28fd774 commit c40b7f3
Show file tree
Hide file tree
Showing 6 changed files with 333 additions and 296 deletions.
6 changes: 6 additions & 0 deletions commands/pokedex.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
'text' => getTranslation('import') . SP . '(ccev pogoinfo)',
'callback_data' => '0:pogoinfo:0'
]
],
[
[
'text' => 'Update Pokemon table',
'callback_data' => '0:getdb:0'
]
]
];
// Set message.
Expand Down
3 changes: 3 additions & 0 deletions core/bot/ddos.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
}else if ($action == 'post_raid' && $update['skip_ddos'] == true) {
$skip_ddos_check = 1;
debug_log('Skipping DDOS check for posting raid directly...','!');
}else if ($action == 'getdb') {
$skip_ddos_check = 1;
debug_log('Skipping DDOS check for database update...','!');
}
} else if(isset($update['cleanup'])) {
$skip_ddos_check = 1;
Expand Down
7 changes: 1 addition & 6 deletions core/bot/logic/bot_upgrade_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ function bot_upgrade_check($current, $latest)
}
// If previous sql upgrades were successfull, update also pokemon table
if(!$require_upgrade) {
if (run_sql_file(ROOT_PATH . '/sql/game-master-raid-boss-pokedex.sql')) {
upgrade_config_version($latest);
} else {
$require_upgrade = true;
info_log('AUTO UPGRADE FAILED: ' . ROOT_PATH . '/sql/game-master-raid-boss-pokedex.sql!');
}
require_once(ROOT_PATH . '/mods/getdb.php');
}
// Signal whether manual action is required or not.
return $require_upgrade;
Expand Down
289 changes: 0 additions & 289 deletions getDB.php

This file was deleted.

5 changes: 4 additions & 1 deletion logic/curl_get_contents.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ function curl_get_contents($url)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" );
$content = curl_exec($ch);
if(!$content = curl_exec($ch)) {
info_log(curl_error($ch));
return false;
}
curl_close($ch);
return $content;
}
Expand Down
Loading

0 comments on commit c40b7f3

Please sign in to comment.