• 15 Posts
  • 1.26K Comments
Joined 2 years ago
cake
Cake day: July 8th, 2023

help-circle

  • Had a programmer like this when I was still an apprentice. He was so full of himself. Was originally a Java programmer but had to program in PHP because that was what ran on the server. I never found out why he couldn’t just put Java on the server. We had full control.

    All his variables were first names. Like $klaus and $grobi. Because he was afraid of clashing with reserved keywords. The thing is, in PHP all variables begin with $ exactly to prevent this issue. So he brought that habit over from Java which was far superior and not such a “Mickey Mouse language”.

    I mean, he wasn’t totally wrong, especially back then PHP was awful. But he surrounded every function with <?php and ?> (PHP was designed to be combined with HTML output outside of these tags) and had plenty of whitespace between them and couldn’t fathom why all his html files had huge swaths of whitespace at the start.

    His way of preventing SQL injection was to look for SQL keywords in user input and then throwing an error in the log files.

















  • I’ve made an update script that tries to run the migrations and index updates in one go.

    #!/bin/bash
    /usr/bin/php8.3 /cloud/updater/updater.phar --no-interaction --no-backup
    /usr/bin/php8.3 /cloud/occ maintenance:repair --include-expensive
    /usr/bin/php8.3 /cloud/occ db:add-missing-indices
    

    The updater itself is by far the slowest of the three commands. I think downloading the new version into a different folder and just moving apps and files over would be much quicker. But I haven’t had the time to look at potential errors with that method.