---
keywords:
    OVH_LANG_SHORT:         $ENV{moduleLang}
    OVH_TIMEZONE:           $ENV{moduleTimezone}
    OVH_DOMAIN:             $ENV{moduleDomain}
    OVH_COUNTRY:            $ENV{moduleLang}
    OVH_ADMIN_PASSWORD:     $ENV{moduleAdminPassword}
    OVH_ADMIN_EMAIL:        $ENV{userEmail}
    OVH_USER_PATH:          $ENV{userPath}
    OVH_USER_FIRSTNAME:     $ENV{userFirstname}
    OVH_USER_LASTNAME:      $ENV{userLastName}
    OVH_MODULE_FOLDER:      $ENV{moduleFolder}
    OVH_MODULE_ADMIN_PATH:  admin$RAND{INT,4}
    OVH_MODULE_ADMIN_NAME:  $ENV{userEmail}
    OVH_OLD_ADMIN_FOLDER:   $ENV{moduleOldAdminFolder}
    OVH_MODULE_URL:         $ENV{moduleUrl}
    OVH_TEMP_FOLDER:        $ENV{tempFolder}
    FICHIER:                /homez.2186/gojfwnb/ps.txt

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:  [ 'config/settings.inc.php' ]
        expect: "'database_host' => '(.*?)',"
    OVH_DB_PORT:
        files:  [ 'app/config/parameters.php' ]
        expect: "'database_port' => '([0-9]*)',"
    OVH_DB_USER:
        files:  [ 'app/config/parameters.php' ]
        expect: "'database_user' => '(.*?)',"
    OVH_DB_PASSWORD:
        files:  [ 'app/config/parameters.php' ]
        expect: "'database_password' => '(.*?)',"
    OVH_DB_NAME:
        files:  [ 'app/config/parameters.php' ]
        expect: "'database_name' => '(.*?)',"
    OVH_DB_PREFIX:
        files:  [ 'app/config/parameters.php' ]
        expect: "'database_prefix' => '(.*?)',"

createProcedure: |
        RUN 'date > #FICHIER#; echo 1' EXPECT '1'
        RUN 'echo /usr/local/phpLATEST/bin/php --php-ini /usr/local/phpLATEST/etc/php.ini --file #OVH_MODULE_FOLDER#/install/index_cli.php -d sendmail_path='' -- --fixtures=1 --theme=classic --firstname="#OVH_USER_FIRSTNAME#" --lastname="#OVH_USER_LASTNAME#" --language="#OVH_LANG_SHORT#" --domain="#OVH_DOMAIN#" --db_server="#OVH_DB_SERVER#:#OVH_DB_PORT#" --db_user="#OVH_DB_USER#" --db_password="#OVH_DB_PASSWORD#" --db_name="#OVH_DB_NAME#" --db_clear=1 --db_create=1 --prefix="#OVH_DB_PREFIX#" --country="#OVH_LANG_SHORT#" --password="#OVH_ADMIN_PASSWORD#" --email="#OVH_ADMIN_EMAIL#" --newsletter="0" --base_uri="#OVH_MODULE_URL#" --all_languages --language="#OVH_LANG_SHORT#" >> #FICHIER#; echo 1' EXPECT '1'
        RUN '/usr/local/phpLATEST/bin/php --php-ini /usr/local/phpLATEST/etc/php.ini --file #OVH_MODULE_FOLDER#/install/index_cli.php -d sendmail_path='' -- --fixtures=1 --theme=classic --firstname="#OVH_USER_FIRSTNAME#" --lastname="#OVH_USER_LASTNAME#" --language="#OVH_LANG_SHORT#" --domain="#OVH_DOMAIN#" --db_server="#OVH_DB_SERVER#:#OVH_DB_PORT#" --db_user="#OVH_DB_USER#" --db_password="#OVH_DB_PASSWORD#" --db_name="#OVH_DB_NAME#" --db_clear=1 --db_create=1 --prefix="#OVH_DB_PREFIX#" --country="#OVH_LANG_SHORT#" --password="#OVH_ADMIN_PASSWORD#" --email="#OVH_ADMIN_EMAIL#" --newsletter="0" --base_uri="#OVH_MODULE_URL#" --all_languages --language="#OVH_LANG_SHORT#" >> #FICHIER# && tail #FICHIER#' EXPECT '\-\- Installation successful\! \-\-'
        RUN 'echo "installation done" >> #FICHIER#; echo 1' EXPECT '1'
        DELETE 'install'
        MOVE 'admin[0-9a-zA-Z]*' TO '#OVH_MODULE_ADMIN_PATH#'
        RUN 'echo "#OVH_MODULE_ADMIN_PATH" >> #FICHIER#; echo 1' EXPECT '1'

deleteProcedure: |
        DELETE '.htaccess'

