Skip to content

Commit

Permalink
MDL-50066 strings: unable to deprecate string from moodle.php
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Apr 30, 2015
1 parent 84ea226 commit 2960eb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/classes/string_manager_standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ protected function load_deprecated_strings() {
public function string_deprecated($identifier, $component) {
$deprecated = $this->load_deprecated_strings();
list($plugintype, $pluginname) = core_component::normalize_component($component);
return isset($deprecated[$identifier . ',' . $plugintype . '_' . $pluginname]);
$normcomponent = $pluginname ? ($plugintype . '_' . $pluginname) : $plugintype;
return isset($deprecated[$identifier . ',' . $normcomponent]);
}

/**
Expand Down Expand Up @@ -383,7 +384,8 @@ public function get_string($identifier, $component = '', $a = null, $lang = null
// Display a debugging message if sting exists but was deprecated.
if ($this->string_deprecated($identifier, $component)) {
list($plugintype, $pluginname) = core_component::normalize_component($component);
debugging("String [{$identifier},{$plugintype}_{$pluginname}] is deprecated. ".
$normcomponent = $pluginname ? ($plugintype . '_' . $pluginname) : $plugintype;
debugging("String [{$identifier},{$normcomponent}] is deprecated. ".
'Either you should no longer be using that string, or the string has been incorrectly deprecated, in which case you should report this as a bug. '.
'Please refer to https://docs.moodle.org/dev/String_deprecation', DEBUG_DEVELOPER);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/tests/string_manager_standard_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public function test_validate_deprecated_strings_files() {
$this->fail('String "'.$string.'" appearing in one of the lang/en/deprecated.txt files does not have correct syntax');
}
list($pluginttype, $pluginname) = core_component::normalize_component($matches[2]);
if ($matches[2] !== $pluginttype . '_' . $pluginname) {
$normcomponent = $pluginname ? ($pluginttype . '_' . $pluginname) : $pluginttype;
if ($matches[2] !== $normcomponent) {
$this->fail('String "'.$string.'" appearing in one of the lang/en/deprecated.txt files does not have normalised component name');
}
if (!$stringman->string_exists($matches[1], $matches[2])) {
Expand Down

0 comments on commit 2960eb4

Please sign in to comment.