* inform user about Twig cache failure on installation, instead of http 500 error

* when dir system/cache is not writable by the webserver, then show some
nice notice to the user about it instead of http 500 error
* remember client version and usage stats checkbox in session on install
* fixed some small warning introducted yesterday about
highscores_ids_hidden
* updated TODO
This commit is contained in:
slawkens1 2017-12-19 23:32:30 +01:00
parent 8a7887cf06
commit 412908026d
9 changed files with 54 additions and 23 deletions

View File

@ -1,6 +1,6 @@
[0.7.3 - 18.12.2017]
* auto generate myaac cache & session prefix on install to be unique accross installations
* fixed hidding shop system menu on tibiacom template when disabled in config
* auto generate myaac cache & session prefix on install to be unique across installations
* fixed hiding shop system menu on tibiacom template when disabled in config
* prevent adding duplicated newses with installation
* some changes to sample characters: chanced town_id to 1, posx: 1000, posy: 1000, posz: 1000 and default group_id to 1 so you can change in-game outfits and they will be used
* added version 772 constant to install client choose (OTHire)

8
TODO
View File

@ -3,16 +3,12 @@
0.*
* support duplicated vocation names with different ids
* plugins: option to define custom requirements check in json file, to check if system meets the requirement
* inform user about Twig cache failure on installation, instead of 500 error
* add support for defining max myaac version in plugin.json file
* cache Menus in templates
* don't show error indicators on first time load - createaccount page
* update Twig to the latest version from 1.x branch
* semantic versioning support for plugins (github.com/composer/semver)
* database towns table support for TFS 1.3
* players.is_sample is waste, better save in config.php array of ignored ids
* add some notice to the user that installing step "Import Schema" will take some time
* remember client version in session on install
1.0:
* i18n support (issue #1 on github)
@ -24,6 +20,7 @@
* var/ (for logs, cache and data), config/, bin, public/ (for index and images and other public content), system/ (for php files and classess)
* rename templates to layouts as templates is meant to be used for twig templates
* change gifts_system to shop_system configurable
* move most used options in system/templates dir to separate directories (more transparent)
At any time between (version not specified):
* better news archive with search function (like on tibia.com)
@ -33,4 +30,5 @@ At any time between (version not specified):
* possibility to add extra cache engines with plugins
* preferably configurable (enable/disable) forum TinyMCE editor
* new cache engine - plain php, is good with pure php 7.0+ and opcache
* OTAdmin support in Admin Panel
* OTAdmin support in Admin Panel
* database towns table support for TFS 1.3

View File

@ -78,4 +78,23 @@ function next_form($previous = true, $next = true)
<input type="hidden" name="step" id="step" value="' . $step . '" />' . next_buttons($previous, $next) . '
</form>';
}
?>
function win_is_writable($path) {
if($path[strlen( $path ) - 1] == '/') { // if it looks like a directory, check a random file within the directory
return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
} elseif(is_dir( $path )) { // If it's a directory (and not a file) check a random file within the directory
return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
}
// check tmp file for read/write capabilities
$should_delete_tmp_file = !file_exists( $path );
$f = @fopen( $path, 'a' );
if ( $f === false )
return false;
fclose( $f );
if($should_delete_tmp_file)
unlink($path);
return true;
}

View File

@ -0,0 +1,11 @@
We have detected that you don't have access to write to the system/cache directory. Under linux you can fix it by using this two command, where first one should be enough (for apache):<br/><br/><span class="console">chown -R www-data.www-data /var/www/*</span><br/><span class="console">chmod -R 660 system/cache</span>
<style type="text/css">
.console {
font-family:Courier;
color: #CCCCCC;
background: #000000;
border: 3px double #CCCCCC;
padding: 0px;
}
</style>

View File

@ -91,16 +91,19 @@ else if($step == 'finish') {
$error = false;
// step include
ob_start();
clearstatcache();
if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
ob_start();
$step_id = array_search($step, $steps);
require('steps/' . $step_id . '-' . $step . '.php');
$content = ob_get_contents();
ob_end_clean();
$step_id = array_search($step, $steps);
require('steps/' . $step_id . '-' . $step . '.php');
$content = ob_get_contents();
ob_end_clean();
}
else {
$content = error(file_get_contents(BASE . 'install/includes/twig_error.html'), true);
}
// render
require('template/template.php');
//$_SESSION['laststep'] = $step;
?>
//$_SESSION['laststep'] = $step;

View File

@ -240,9 +240,9 @@ if(!$error) {
$content .= PHP_EOL;
$content .= '$config[\'client_download_linux\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/tar/linux\';';
$content .= PHP_EOL;
$content .= '$config[\'session_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '\';';
$content .= '$config[\'session_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
$content .= PHP_EOL;
$content .= '$config[\'cache_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '\';';
$content .= '$config[\'cache_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
$content .= PHP_EOL;
$file = fopen(BASE . 'config.local.php', 'a+');

View File

@ -149,7 +149,7 @@ $config['data_path'] = $tmp;
unset($tmp);
// new config values for compability
if($config['highscores_ids_hidden'] == null) {
if(!isset($config['highscores_ids_hidden'])) {
$config['highscores_ids_hidden'] = array();
}

View File

@ -1,3 +1,3 @@
<?php
// this migrations has been removed, but file kept for compability
// this migration has been removed, but file kept for compability
?>

View File

@ -23,7 +23,7 @@
<br/>
<select name="vars[client]" id="vars_client">
{% for id, version in clients %}
<option value="{{ id }}">{{ version }}</option>
<option value="{{ id }}"{% if session['var_client'] is not null and session['var_client'] == id %} selected{% endif %}>{{ version }}</option>
{% endfor %}
</select>
</td>
@ -38,7 +38,7 @@
</label>
<br/>
<input type="hidden" value="0" name="vars[usage]">
<input type="checkbox" name="vars[usage]" id="vars_usage" value="1" checked/>
<input type="checkbox" name="vars[usage]" id="vars_usage" value="1"{% if session['var_usage'] is null or session['var_usage'] == 1 %} checked{% endif %}/>
</td>
<td>
<em>{{ locale.step_config_usage_desc }}</em>