CLI Scripts

Created by josh
October 17, 2020 3:36:51 PM PDT

As of now, there are a very limited amount of scripts to run in CLI to manage Gaseous. As of version 0.5, these scripts are located in the top-level folder called "cli".

To run a script, call it via PHP in command line, specifying the environment as the first argument. For example

php /var/www/html/cli/run-db-changesets.php dev

The script above will run any unprocessed database changesets in the dev environment. The environment name is established in the @@app/setup/environments.ini@@ file as an array key for the database connection information.


Script Description

Typically, records are archived throughout the tables in Gaseous' database during an update or removal of a record. For updates, the initial record being updated is "archived" and an identical record (with any changes made for the update) is added.

Any workflows that appear to "remove" records actually just likely "archive" the record in the database, rather than actually delete it. For example, the cache table contains an expiration datetime field. When the Cache class is invoked, there is a check to see which cache entries have surpassed the expiration date/time. Any cache record that has expired will be archived (not deleted from the database).

This service, when run, will delete any archived records that have reached a specific age. The setting that specifies this age is called delete_archived_records_days. If it is set to  180, the service will loop through all tables that contain the archived and archived_datetime field and only delete records that are 180 days or older. Having this service run routinely can prevent a buildup of archived data which are no longer useful for the site.


Every so often, an update to the Gaseous app will include SQL that alters the structure of the database (e.g. add or remove tables and columns). During the website GUI's update process, changesets are applied after the code has been updated, so this service should not need to be invoked manually. However, if the update was interrupted or there was an issue during the database update, it may be run manually to see if everything is up-to-date.