Skip to content

Commit

Permalink
New error type: deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
live627 committed Oct 27, 2017
1 parent 888c12e commit 6075f8d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -4,7 +4,7 @@ dist: trusty

matrix:
include:
- php: 5.4
- php: 5.5
env:
- DB=mysql-5.6
- WEBTESTS=false
Expand All @@ -19,7 +19,7 @@ matrix:
- DB=mysql-5.7
- WEBTESTS=false
- COVERAGE=false
- php: 5.4
- php: 5.5
env:
- DB=postgres-9.3
- WEBTESTS=false
Expand Down
28 changes: 19 additions & 9 deletions sources/Load.php
Expand Up @@ -785,7 +785,7 @@ function loadPermissions()
{
// Get the general permissions.
$request = $db->query('', '
SELECT
SELECT
permission, add_deny
FROM {db_prefix}permissions
WHERE id_group IN ({array_int:member_groups})
Expand Down Expand Up @@ -816,7 +816,7 @@ function loadPermissions()
throw new Elk_Exception('no_board');

$request = $db->query('', '
SELECT
SELECT
permission, add_deny
FROM {db_prefix}board_permissions
WHERE (id_group IN ({array_int:member_groups})
Expand Down Expand Up @@ -1230,7 +1230,7 @@ function detectBrowser()
* - loads default JS variables for use in every theme
* - loads default JS scripts for use in every theme
*
* @deprecated use the theme object
* @deprecated since 2.0; use the theme object
*
* @param int $id_theme = 0
* @param bool $initialize = true
Expand Down Expand Up @@ -1349,7 +1349,7 @@ function determineSmileySet($user_smiley_set, $known_smiley_sets)
/**
* This loads the bare minimum data.
*
* @deprecated use the theme object
* @deprecated since 2.0; use the theme object
*
* - Needed by scheduled tasks,
* - Needed by any other code that needs language files before the forum (the theme) is loaded.
Expand All @@ -1370,7 +1370,7 @@ function loadEssentialThemeData()
* loading of style sheets with this function is deprecated, use loadCSSFile instead
* - if $settings['template_dirs'] is empty, it delays the loading of the template
*
* @deprecated use the theme object
* @deprecated since 2.0; use the theme object
*
* @uses the requireTemplate() function to actually load the file.
* @param string|false $template_name
Expand All @@ -1382,6 +1382,16 @@ function loadEssentialThemeData()
*/
function loadTemplate($template_name, $style_sheets = array(), $fatal = true)
{
$debug = '<br><br>';
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1] as $var => $$val)
{
$debug .= $var . ': ' . $val . '<br>';
}
Errors::instance()->log_error(sprintf(
'%s is deprecated, use %s instead.%s',
'loadTemplate().',
'theme()->getTemplates()->load().',
$debug) ,'deprecated');
return theme()->getTemplates()->load($template_name, $style_sheets, $fatal);
}

Expand All @@ -1394,7 +1404,7 @@ function loadTemplate($template_name, $style_sheets = array(), $fatal = true)
* - if ?debug is in the query string, shows administrators a marker after every sub template
* for debugging purposes.
*
* @deprecated use the theme object
* @deprecated since 2.0; use the theme object
*
* @param string $sub_template_name
* @param bool|string $fatal = false
Expand Down Expand Up @@ -1619,7 +1629,7 @@ function loadAssetFile($filenames, $params = array(), $id = '')
/**
* Add a Javascript variable for output later (for feeding text strings and similar to JS)
*
* @deprecated use the theme object
* @deprecated since 2.0; use the theme object
*
* @param mixed[] $vars array of vars to include in the output done as 'varname' => 'var value'
* @param bool $escape = false, whether or not to escape the value
Expand All @@ -1638,7 +1648,7 @@ function addJavascriptVar($vars, $escape = false)
* or for scripts that require help from PHP/whatever, this can be useful.
* - all code added with this function is added to the same <script> tag so do make sure your JS is clean!
*
* @deprecated use the theme object
* @deprecated since 2.0; use the theme object
*
* @param string $javascript
* @param bool $defer = false, define if the script should load in <head> or before the closing <html> tag
Expand All @@ -1653,7 +1663,7 @@ function addInlineJavascript($javascript, $defer = false)
*
* - Tries the current and default themes as well as the user and global languages.
*
* @deprecated use the theme object
* @deprecated since 2.0; use the theme object
*
* @param string $template_name
* @param string $lang = ''
Expand Down
9 changes: 9 additions & 0 deletions sources/subs/Errors/Errors.php
Expand Up @@ -149,6 +149,15 @@ private function insertLog($query_string, $error_message, $error_type, $file, $l
/**
* Log an error to the error log if the error logging is enabled.
*
* Available error types:
* - generaal
* - critical
* - database
* - undefined_vars
* - template
* - user
* - deprecated
*
* - filename and line should be __FILE__ and __LINE__, respectively.
*
* Example use:
Expand Down
2 changes: 1 addition & 1 deletion sources/subs/Themes/ThemeLoader.php
Expand Up @@ -234,7 +234,7 @@ private function initTheme()
$settings['actual_theme_dir'] = $settings['theme_dir'];

// Set the name of the default theme to something PHP will recognize.
$themeName = basename($settings['theme_dir']) == 'default'
$themeName = basename($settings['theme_dir']) == 'default'
? 'DefaultTheme'
: ucfirst(basename($settings['theme_dir']));

Expand Down
2 changes: 1 addition & 1 deletion tests/travis-ci/setup-elkarte.sh
Expand Up @@ -43,7 +43,7 @@ then
memcached -p 11213 -d

# Phpunit and support
if [ "$SHORT_PHP" == "5.4" -o "$SHORT_PHP" == "5.3" ]
if [ "$SHORT_PHP" == "5.5" ]
then
# need prior version of phpunit for php 5.5 and below
composer require phpunit/phpunit-selenium:~2.0 phpunit/dbunit:1.4.* phpunit/phpunit:~4.8
Expand Down
2 changes: 2 additions & 0 deletions themes/default/languages/english/Maintenance.english.php
Expand Up @@ -120,6 +120,8 @@
$txt['errortype_template_desc'] = 'Errors related to the loading of templates.';
$txt['errortype_user'] = 'User';
$txt['errortype_user_desc'] = 'Errors resulting from user errors. Includes failed passwords, trying to login when banned, and trying to do an action for which they do not have permission.';
$txt['errortype_deprecated'] = 'Deprecated';
$txt['errortype_deprecated_desc'] = 'Deprecation messsages usually mean that some code is calling a method which is discouraged and will be removed in a future version.';

$txt['maintain_recount'] = 'Recount all forum totals and statistics';
$txt['maintain_recount_info'] = 'Should the total replies of a topic or the number of PMs in your inbox be incorrect: this function will recount all saved counts and statistics for you.';
Expand Down

0 comments on commit 6075f8d

Please sign in to comment.