schnitz81/rt-magnet — pull request #5 by atquick (2012-07-02 22:12:27+00:00)
Title: Smaller install script.

This is a smaller install script that does the following:

- Simpler configuration.
- Less lookups and searches.
- Simplifies storage and data access of generated config file.
- Is considerably faster

Configuration of the script can easily be modified at the start of the script. While it would be better to use flags, these default values makes it possible to alter where the global magnet file, and the local rt file is stored, without the risk of missing some detail and breaking the script. Rather than forcing root, we allow for all users that can read to our target file, which makes it easier to configure the files to be stored somewhere else.

Rather than checking if there is a load_start 3-4 times before actually doing anything with it, we grab all the lines in the provided configuration file, and work our magic with it when we already have it. For us, the expensive part isn't loading the string into memory, it's the IO you introduce when you're using the grep command, which is unnecessary to repeatedly call throughout the script.

The global config file is now changed to just store a directory per line, making it much simpler to access through PHP, and stops us from saving unnecessary cruft we don't need.

Removed all the sleep commands, because I would probably kill the person that would artificially make me wait for their script to finish.