Back to ChangeSet class

Method getUpdateFiles

private array|bool
getUpdateFiles
()
Get list of SQL update files for this database
Returns
  • array|bool list of sql update full-path names. False if directory doesn't exist
Since
  • 2.5
Class: ChangeSet
Project: Joomla

Method getUpdateFiles - Source code

/**
 * Get list of SQL update files for this database
 *
 * @return  array|boolean  list of sql update full-path names. False if directory doesn't exist
 *
 * @since   2.5
 */
private function getUpdateFiles()
{
    // Get the folder from the database name
    $sqlFolder = $this->db->getServerType();
    // For `mssql` server types, convert the type to `sqlazure`
    if ($sqlFolder === 'mssql') {
        $sqlFolder = 'sqlazure';
    }
    // Default folder to core com_admin
    if (!$this->folder) {
        $this->folder = JPATH_ADMINISTRATOR . '/components/com_admin/sql/updates/';
    }
    // We don't want to enqueue an error if the directory doesn't exist - this can be handled elsewhere/
    // So bail here.
    if (!is_dir($this->folder . '/' . $sqlFolder)) {
        return [];
    }
    return Folder::files($this->folder . '/' . $sqlFolder, '\\.sql$', 1, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('^\\..*', '.*~'), true);
}