mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
* automatically update highscores_ids_hidden for users who installed myaac before
* update TODO
This commit is contained in:
parent
412908026d
commit
e4110a6981
3
TODO
3
TODO
@ -9,10 +9,13 @@
|
||||
* update Twig to the latest version from 1.x branch
|
||||
* semantic versioning support for plugins (github.com/composer/semver)
|
||||
* add some notice to the user that installing step "Import Schema" will take some time
|
||||
* check user IP on installing to prevent install by random user
|
||||
|
||||
1.0:
|
||||
* i18n support (issue #1 on github)
|
||||
* New Admin Panel layout and interface
|
||||
* add changelog management interface
|
||||
* remove tibiacom template, and include it as a plugin
|
||||
|
||||
2.0
|
||||
* remove compat functions
|
||||
|
@ -27,7 +27,7 @@ session_start();
|
||||
|
||||
define('MYAAC', true);
|
||||
define('MYAAC_VERSION', '0.7.3');
|
||||
define('DATABASE_VERSION', 19);
|
||||
define('DATABASE_VERSION', 20);
|
||||
define('TABLE_PREFIX', 'myaac_');
|
||||
define('START_TIME', microtime(true));
|
||||
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||
|
@ -150,7 +150,7 @@ unset($tmp);
|
||||
|
||||
// new config values for compability
|
||||
if(!isset($config['highscores_ids_hidden'])) {
|
||||
$config['highscores_ids_hidden'] = array();
|
||||
$config['highscores_ids_hidden'] = array(0);
|
||||
}
|
||||
|
||||
// POT
|
||||
|
39
system/migrations/20.php
Normal file
39
system/migrations/20.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
$config_file = BASE . 'config.local.php';
|
||||
if(!is_writable($config_file)) { // we can't do anything, just ignore
|
||||
return;
|
||||
}
|
||||
|
||||
$content_of_file = trim(file_get_contents($config_file));
|
||||
if(strpos($content_of_file, 'highscores_ids_hidden') !== false) { // already present
|
||||
return;
|
||||
}
|
||||
|
||||
$query = $db->query("SELECT `id` FROM `players` WHERE (`name` = " . $db->quote("Rook Sample") . " OR `name` = " . $db->quote("Sorcerer Sample") . " OR `name` = " . $db->quote("Druid Sample") . " OR `name` = " . $db->quote("Paladin Sample") . " OR `name` = " . $db->quote("Knight Sample") . ") ORDER BY `id`;");
|
||||
|
||||
$highscores_ignored_ids = array();
|
||||
if($query->rowCount() > 0) {
|
||||
foreach($query->fetchAll() as $result)
|
||||
$highscores_ignored_ids[] = $result['id'];
|
||||
}
|
||||
else {
|
||||
$highscores_ignored_ids[] = 0;
|
||||
}
|
||||
|
||||
$php_on_end = substr($content_of_file, -2, 2) == '?>';
|
||||
$content = PHP_EOL;
|
||||
if($php_on_end) {
|
||||
$content .= '<?php';
|
||||
}
|
||||
|
||||
$content .= PHP_EOL;
|
||||
$content .= '$config[\'highscores_ids_hidden\'] = array(' . implode(', ', $highscores_ignored_ids) . ');';
|
||||
$content .= PHP_EOL;
|
||||
|
||||
if($php_on_end) {
|
||||
$content .= '?>';
|
||||
}
|
||||
|
||||
file_put_contents($config_file, $content, FILE_APPEND);
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user