Account::getConfigurations PHP Method

getConfigurations() public method

As of 3.2.1, configurations are now backed up for every time the user clicks save. This method continues to work the same, but only returns the most recent configuration version from the history table.
public getConfigurations ( )
    public function getConfigurations()
    {
        $accountID = $this->accountID;
        $prefix = Core::getDbTablePrefix();
        $response = Core::$db->query("\n            SELECT c.*, ch.*, unix_timestamp(c.date_created) as date_created_unix, unix_timestamp(ch.last_updated) as last_updated_unix\n            FROM {$prefix}configurations c\n                LEFT JOIN {$prefix}configuration_history ch\n                    ON ch.configuration_id = c.configuration_id\n                    AND ch.history_id =\n                        (\n                            SELECT history_id\n                            FROM {$prefix}configuration_history ch2\n                            WHERE ch2.configuration_id = c.configuration_id\n                            ORDER BY history_id DESC\n                            LIMIT 1\n                        )\n\t\t\tWHERE account_id = {$accountID}\n\t\t\tORDER BY ch.last_updated DESC\n        ");
        if ($response["success"]) {
            $data = array();
            while ($row = mysqli_fetch_assoc($response["results"])) {
                $data[] = $row;
            }
            $this->configurations = $data;
        } else {
            // TODO
        }
    }