Custom setting additional date to customize the date display#463
Custom setting additional date to customize the date display#463DinhHien0307 wants to merge 1 commit intomdjnelson:MOODLE_311_STABLEfrom
Conversation
…e the hard code way) mdjnelson#456
| @@ -178,5 +178,46 @@ function xmldb_customcert_upgrade($oldversion) { | |||
| upgrade_mod_savepoint(true, 2020110901, 'customcert'); | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
This change I did to change all old items in DB which are saved in format '1', '2'... to new format
| @@ -305,11 +305,12 @@ public static function get_date_formats() { | |||
| $date = 1530849658; | |||
|
|
|||
| $suffix = self::get_ordinal_number_suffix(userdate($date, '%d')); | |||
There was a problem hiding this comment.
These changes are the new way I change the format date. User will add new settings like "=%d# %B, %Y", which = is always the first character and '#' to present for 1st, 2nd, 3rd as handling by this function get_ordinal_number_suffix, and should add an intro for this symbol in the description too.
| ]); | ||
| $DB->update_record('customcert_elements', $updateelement); | ||
| }} | ||
| $transaction->allow_commit();upgrade_mod_savepoint(true, 2021101100, 'customcert'); |
There was a problem hiding this comment.
These should be on a separate line.
| } | ||
|
|
||
| if ($oldversion < 2021101100) { | ||
| $transaction = $DB->start_delegated_transaction(); |
There was a problem hiding this comment.
Don't need to put this into a transaction.
There was a problem hiding this comment.
I think this improves performance as well as makes it more predictable
| $records = $DB->get_records('customcert_elements', ['element' => 'date']); | ||
| $total = count($records); | ||
| $done = 0; | ||
| $pbar = new progress_bar('mod_customcert_change_formatdate', 500, true); |
There was a problem hiding this comment.
No need for a progress bar as this is a quick change. I think all the code related to this progress bar can be removed. Thoughts?
There was a problem hiding this comment.
If a server had a very large number of custom certificates, it's possible to take a long time so I think it makes sense to add a progress bar here. What do you think?
|
Hi @mdjnelson, |
49b746c to
8bc26b9
Compare
Hi @mdjnelson
I have created this pull request for issue #456.
Please take a look at it