---
keywords:
    OVH_SALT_16:            $RAND{CHARS,16}
    OVH_ID_RAND_4:          $RAND{INT,4}
    OVH_USER_EMAIL:         $ENV{userEmail}
    OVH_USER_PATH:          $ENV{userPath}
    OVH_MODULE_FOLDER:      $ENV{moduleFolder}
    OVH_ADMIN_PASSWORD:     $ENV{moduleAdminPassword}
    OVH_MODULE_ADMIN_PATH:  administrator/
    OVH_MODULE_ADMIN_NAME:  $ENV{moduleAdminName}
    OVH_MODULE_LANG_DASH:   $ENV{moduleLangDash}
    OVH_TEMP_FOLDER:        $ENV{tempFolder}

dependencies:
    - types:        [ 'mysql' ]
      mandatory:    true
      keywords:
        OVH_DB_SERVER:      server
        OVH_DB_PORT:        port
        OVH_DB_USER:        user
        OVH_DB_PASSWORD:    password
        OVH_DB_NAME:        name
        OVH_DB_PREFIX:      prefix

fallbackFiles:
    OVH_DB_SERVER:
        files:  [ 'configuration.php' ]
        expect: public \$host = '(.*?)';
    OVH_DB_PORT:
        files:  [ 'configuration.php' ]
        expect: public \$host = '(.*?)';
    OVH_DB_USER:
        files:  [ 'configuration.php' ]
        expect: public \$user = '(.*?)';
    OVH_DB_PASSWORD:
        files:  [ 'configuration.php' ]
        expect: public \$password = '(.*?)';
    OVH_DB_NAME:
        files:  [ 'configuration.php' ]
        expect: public \$db = '(.*?)';
    OVH_DB_PREFIX:
        files:  [ 'configuration.php' ]
        expect: public \$dbprefix = '(.*?)';

createProcedure: |
    PARSE_FILE 'configuration.php'
    INSERT_DEPENDENCY '0' DUMP 'joomla.sql'
    DELETE 'joomla.sql'
    PARSE_FILE 'cli/OVH_changePassword.php'
    RUN '/usr/local/php7.0/bin/php --php-ini /usr/local/php7.0/etc/php.ini #OVH_MODULE_FOLDER#/cli/OVH_changePassword.php' EXPECT '^password set'
    DELETE 'cli/OVH_changePassword.php'

changePasswordProcedure: |
    RUN 'cp #OVH_TEMP_FOLDER#/OVH_changePassword.php #OVH_MODULE_FOLDER#/cli/OVH_changePassword.php && ls #OVH_MODULE_FOLDER#/cli/OVH_changePassword.php' EXPECT 'cli/OVH_changePassword.php$'
    PARSE_FILE 'cli/OVH_changePassword.php'
    RUN '/usr/local/php7.0/bin/php --php-ini /usr/local/php7.0/etc/php.ini #OVH_MODULE_FOLDER#/cli/OVH_changePassword.php' EXPECT '^password set'
    DELETE 'cli/OVH_changePassword.php'


upgradeProcedure: |

deleteProcedure: |

