Crons: pad index with zeros to maintain order

Version 1.55


CMD_CRON_JOBS CMD_API_CRON_JOBS the "id" values for each cronjob are integers, but if you had 10, for example the order would be: 1 10 2 3 ... so the order could be confusing. As there are non-integer indexes in this array (eg: MAILTO) we could not simply convert the search/sort to be an integer sort/search. Instead, we've padded the indexes with zeros, so it would now be: 001 002 003 ... 010 so that the order is maintained. The direct_crons feature generates the IDs on the fly, so that's not an issue (nothing would change there), and the per-User crontab.conf file will not be touched until saved. All reads done after this change will convert 1, 2, 3 to id 001, 002, 003 on the fly. So just be sure you're using the "id" tags from the current read before passing it to edit/delete. The id value passed back to DA must match the padded value, so if you see id=001 you must pass id=001 for it to be seen. But if you've coded things correctly where you're not concerned with the indexes being integers, and treat them as strings, then likely no changes should be required to your API calls.

Interested to try DirectAdmin? Get a 30-day Free Trial!