Issue Details (XML | Word | Printable)

Key: MDL-14085
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Dongsheng Cai
Reporter: Eloy Lafuente (stronk7)
Votes: 0
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

META: Cleanup of harcoded error() messages

Created: 28/Mar/08 11:35 AM   Updated: 12/Dec/08 02:56 PM
Return to search
Issue 6450 of 20195 issue(s)
<< Previous | MDL-14085 | Next >>
Component/s: General
Affects Version/s: 1.9
Fix Version/s: 2.0

Issue Links:
Relates
 

Participants: Dongsheng Cai, Eloy Lafuente (stronk7) and Nicolas Martignoni
Security Level: None
Resolved date: 12/Dec/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_20_STABLE

Sub-Tasks  All   Open   
 Sub-Task Progress: 
No sub-tasks match this view.

 Description  « Hide
There are thousands of places in Moodle where we are using the error() function to print out hardcoded strings.

In the long term, we should end with ZERO calls to this function, by using the print_error() on instead.

Here it's one plan that could be good to start handling this migration:

1) Move error() to deprecatelib. Just that. 1.9 and HEAD
2) Make print_error() autonomous so it won't rely on error() code anymore (will cause code duplication, I guess, but better in the long term.) 1.9 and HEAD
3) Under HEAD (not under 19_STABLE because it could be the plague!), in the deprecated error() function, add some DEBUG_DEVELOPER debugging() to inform developers. It will cause a lot of output (pain!)
4) Move all current uses of error(get_string('xxxx')) to a proper use of print_error() 1.9 and HEAD
5) Gradually, start creating error strings and changing error() calls to print_error() ones. Moodle 2.0 should be free of error() calls. HEAD only.

This is the overall plan. I think each step above could be a subtask of this. Please review it with MD. I think it could work (although once we do point 3 HEAD will be horrible until we'll have all the error() uses killed).

Ciao :-)

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Dongsheng Cai committed 2 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 01/Apr/08 12:07 PM
MDL-14085, Move error() to deprecatelib.php
MODIFY lib/deprecatedlib.php   Rev. 1.41.2.6    (+62 -2 lines)
MODIFY lib/weblib.php   Rev. 1.970.2.74    (+2 -63 lines)
Dongsheng Cai committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 01/Apr/08 02:15 PM
MDL-14085, Make print_error() autonomous
MODIFY lib/weblib.php   Rev. 1.970.2.75    (+50 -6 lines)
Dongsheng Cai committed 1 file to 'Moodle CVS' - 01/Apr/08 02:19 PM
MDL-14085, Make print_error() autonomous, merged from MOODLE_19_STABLE
MODIFY lib/weblib.php   Rev. 1.1051    (+50 -6 lines)
Dongsheng Cai committed 1 file to 'Moodle CVS' - 01/Apr/08 02:31 PM
MDL-14085, add debug information to error() function,
MODIFY lib/deprecatedlib.php   Rev. 1.48    (+1 -0 lines)
Dongsheng Cai committed 3 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 08/Apr/08 09:45 AM
Dongsheng Cai committed 3 files to 'Moodle CVS' - 08/Apr/08 09:51 AM
MDL-14085, roll back some error() call
MODIFY course/import/groups/index.php   Rev. 1.17    (+5 -5 lines)
MODIFY admin/mnet/peers.php   Rev. 1.19    (+3 -3 lines)
MODIFY blocks/rss_client/Attic/block_rss_client_action.php   Rev. 1.59    (+10 -10 lines)