#
# @copyright Copyright 2003-2023 Zen Cart Development Team
# @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
# @version $Id: mc12345678 2022 Dec 14 Modified in v1.5.8a $
#

systemChecks:
  backupConfigureFiles:
    runLevel: always
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_ADMIN_CONFIGURE .PHP_EOL; ?>
    methods:
      backupConfigureFiles:
  checkStoreConfigureFile:
    runLevel: always
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_STORE_CONFIGURE . PHP_EOL; ?>
    methods:
      CheckWriteableFile:
        parameters:
          fileDir: <?php echo DIR_FS_ROOT . 'includes/configure.php' . PHP_EOL; ?>
          changePerms: '0664'
          createFile: TRUE
  checkAdminConfigureFile:
    runLevel: always
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_ADMIN_CONFIGURE .PHP_EOL; ?>
    methods:
      CheckWriteableAdminFile:
        parameters:
          fileDir: <?php echo 'includes/configure.php' . PHP_EOL; ?>
          changePerms: '0664'
          createFile: TRUE
  checkPhpVersion:
    runLevel: always
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_PHP_VERSION .PHP_EOL; ?>
    methods:
      checkPhpVersionMin:
        method: checkPhpVersion
        parameters:
          version: 7.3.0
          versionTest: ge
          localErrorText: <?php echo sprintf(TEXT_ERROR_PHP_VERSION_MIN, '7.3') . PHP_EOL; ?>
      checkPhpVersionMax:
        method: checkPhpVersion
        parameters:
          version: 8.3
          versionTest: lt
          localErrorText: <?php echo sprintf(TEXT_ERROR_PHP_VERSION_MAX, '8.2.x') . PHP_EOL; ?>
  checkPhpVersionRecommendation:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo sprintf(TEXT_ERROR_PHP_VERSION_RECOMMENDED, '8.0') . PHP_EOL; ?>
    methods:
      checkPhpVersionRecommended:
        method: checkPhpVersion
        parameters:
          version: 8.0.0
          versionTest: ge
  checkZCversion:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_NEW_VERSION_AVAILABLE .PHP_EOL; ?>
    methods:
      checkIsZCVersionCurrent:
  mysqlExt:
    runLevel: always
    errorLevel: FAIL
    criticalError: true
    mainErrorText: <?php echo TEXT_ERROR_MYSQL_SUPPORT .PHP_EOL; ?>
    methods:
      checkExtension:
        parameters:
          extension: mysqli
  pdomysqlExt:
    runLevel: always
    errorLevel: FAIL
    criticalError: true
    mainErrorText: <?php echo TEXT_ERROR_PDOMYSQL_SUPPORT .PHP_EOL; ?>
    methods:
      checkExtension:
        parameters:
          extension: pdo_mysql
  phpzipExt:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_PHPZIP_SUPPORT .PHP_EOL; ?>
    methods:
      checkExtension:
        parameters:
          extension: zip
  logFolder:
    runLevel: always
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_LOG_FOLDER .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdFolderPerms
    methods:
      checkWriteableDir:
        parameters:
          fileDir: <?php echo DIR_FS_LOGS . PHP_EOL; ?>
  cacheFolder:
    runLevel: always
    errorLevel: FAIL
    mainErrorText:  <?php echo TEXT_ERROR_CACHE_FOLDER .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdFolderPerms
    methods:
      checkWriteableDir:
        parameters:
          fileDir: <?php echo DIR_FS_SQL_CACHE . PHP_EOL; ?>
  imagesFolder:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_IMAGES_FOLDER .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdFolderPerms
    methods:
      checkWriteableDir:
        parameters:
          fileDir: <?php echo DIR_FS_ROOT . 'images' . PHP_EOL; ?>
  htmlIncludesFolder:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_DEFINEPAGES_FOLDER .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdFolderPerms
    methods:
      checkWriteableDir:
        parameters:
          fileDir: <?php echo DIR_FS_ROOT . 'includes/languages/english/html_includes' . PHP_EOL; ?>
  mediaFolder:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_MEDIA_FOLDER .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdFolderPerms
    methods:
      checkWriteableDir:
        parameters:
          fileDir: <?php echo DIR_FS_ROOT . 'media' . PHP_EOL; ?>
  pubFolder:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_PUB_FOLDER .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdFolderPerms
    methods:
      checkWriteableDir:
        parameters:
          fileDir: <?php echo DIR_FS_DOWNLOAD_PUBLIC . PHP_EOL; ?>
  nginxFolder:
    runLevel: always
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_NGINX_FOLDER .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdFolderPerms
    methods:
      checkWriteableDir:
        parameters:
          fileDir: <?php echo DIR_FS_ROOT . 'zc_install/includes/nginx_conf' . PHP_EOL; ?>
  htaccessSupport:
    runLevel: always
    errorLevel: WARN
    mainErrorText:  <?php echo TEXT_ERROR_HTACCESS_SUPPORT .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdHtaccessSupport
    methods:
      checkHtaccessSupport:
  initialSessionCheck:
    runLevel: always
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_SESSION_SUPPORT .PHP_EOL; ?>
    methods:
      checkInitialSession:
        parameters:
          sessionName: zenInstallerId
      checkIniGet1:
        method: checkIniGet
        parameters:
          inigetName: session.use_trans_sid
          expectedValue: FALSE
        localErrorText: <?php echo TEXT_ERROR_SESSION_SUPPORT_USE_TRANS_SID . PHP_EOL; ?>
      checkIniGet2:
        method: checkIniGet
        parameters:
          inigetName: session.auto_start
          expectedValue: FALSE
        localErrorText: <?php echo TEXT_ERROR_SESSION_SUPPORT_AUTO_START . PHP_EOL; ?>
  newDatabaseCheck:
    runLevel: database
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_DB_CONNECTION .PHP_EOL; ?>
    methods:
      checkNewDBConnection:
  existingDatabaseCheck:
    runLevel: upgradeDb
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_DB_CONNECTION_UPGRADE .PHP_EOL; ?>
    methods:
      checkUpgradeDBConnection:
  connectionDatabaseCheck:
    runLevel: always
    errorLevel: WARN
    mainErrorTextHelpId: helpIdConnectionDatabaseCheck
    mainErrorText: <?php echo TEXT_ERROR_DB_CONNECTION_DEFAULT .PHP_EOL; ?>
    methods:
      checkDBConnection:
  checkjson:
    runLevel: always
    errorLevel: FAIL
    mainErrorText: <?php echo TEXT_ERROR_JSON .PHP_EOL; ?>
    methods:
      checkExtension:
        parameters:
          extension: json
  checkfileinfo:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_FILEINFO .PHP_EOL; ?>
    methods:
      checkExtension:
        parameters:
          extension: fileinfo
  checkGD:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_GD .PHP_EOL; ?>
    methods:
      checkExtension:
        parameters:
          extension: gd
  checkZlib:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_ZLIB .PHP_EOL; ?>
    methods:
      checkExtension:
        parameters:
          extension: zlib
  checkOpenssl:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_OPENSSL .PHP_EOL; ?>
    methods:
      checkExtension:
        parameters:
          extension: openssl
  checkCurl:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_CURL .PHP_EOL; ?>
    mainErrorTextHelpId: helpIdCheckCurl
    methods:
      checkExtension:
        parameters:
          extension: curl
        localErrorText: <?php echo sprintf(TEXT_ERROR_EXTENSION_NOT_LOADED, 'curl') . PHP_EOL; ?>
      checkFunctionExists:
        parameters:
          functionName: curl_init
        localErrorText: <?php echo sprintf(TEXT_ERROR_FUNCTION_DOES_NOT_EXIST, 'curl_init') . PHP_EOL; ?>
      checkLiveCurl:
        parameters:
          testUrl: "https://s3.amazonaws.com/zencart-curltest/endpoint"
          testData: "installertest=checking"
        localErrorText: <?php echo TEXT_ERROR_CURL_LIVE_TEST . PHP_EOL; ?>
  checkXML:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_XML .PHP_EOL; ?>
    methods:
      checkFunctionExists:
        parameters:
          functionName: xml_parser_create
  checkGzip:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_GZIP .PHP_EOL; ?>
    methods:
      checkIniGet:
        parameters:
          inigetName: output_buffering
          expectedValue: TRUE
  checkHttpsRequest:
    runLevel: always
    errorLevel: WARN
    mainErrorText: <?php echo TEXT_ERROR_HTTPS .PHP_EOL; ?>
    methods:
      checkHttpsRequest:

  checkDBVersion158:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.8'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.8') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configKeyExists
            keyName: PRODUCT_LISTING_COLUMNS_PER_ROW
          - checkType: configValue
            fieldName: CATEGORIES_TABS_STATUS
            expectedResult: 'Category Header Menu ON/OFF'

  checkDBVersion157:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.7'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.7') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: fieldSchema
            tableName: orders_status
            fieldName: sort_order
            fieldCheck: Type
            expectedResult: 'INT(11)'
          - checkType: fieldSchema
            tableName: orders
            fieldName: language_code
            fieldCheck: Exists
          - checkType: configValue
            fieldName: ADVANCED_SEARCH_INCLUDE_METATAGS
            expectedResult: 'Include meta-tags in product search?'

  checkDBVersion156:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.6'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.6') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: fieldSchema
            tableName: sessions
            fieldName: sesskey
            fieldCheck: Type
            expectedResult: 'VARCHAR(191)'
          - checkType: fieldSchema
            tableName: ezpages_content
            fieldName: pages_html_text
            fieldCheck: Exists
          - checkType: fieldSchema
            tableName: configuration
            fieldName: val_function
            fieldCheck: Type
            expectedResult: 'TEXT'

  checkDBVersion155:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.5'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.5') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: CC_ENABLED_DEBIT
            expectedResult: 'Credit Card Enable Status - Debit'
          - checkType: fieldSchema
            tableName: admin
            fieldName: reset_token
            fieldCheck: Type
            expectedResult: 'VARCHAR(255)'
          - checkType: fieldSchema
            tableName: coupons_description
            fieldName: coupon_name
            fieldCheck: Type
            expectedResult: 'VARCHAR(64)'
          - checkType: configValue
            fieldName: CURRENCY_SERVER_PRIMARY
            expectedResult: 'Currency Exchange Rate: Primary Source'


  checkDBVersion154:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.4'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.4') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: PADSS_AJAX_CHECKOUT
            expectedResult: 'PA-DSS Ajax Checkout?'

  checkDBVersion153:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.3'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.3') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: fieldSchema
            tableName: customers
            fieldName: customers_password
            fieldCheck: Type
            expectedResult: 'VARCHAR(255)'
          - checkType: fieldSchema
            tableName: admin
            fieldName: admin_pass
            fieldCheck: Type
            expectedResult: 'VARCHAR(255)'

  checkDBVersion152:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.2'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.2') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: PADSS_ADMIN_SESSION_TIMEOUT_ENFORCED
            expectedResult: 'PA-DSS Admin Session Timeout Enforced?'
          - checkType: configValue
            fieldName: SHOW_CATEGORY_PRODUCTS_LINKED_STATUS
            expectedResult: 'Show linked status for categories'

  checkDBVersion151:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.1'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.1') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: fieldSchema
            tableName: admin_activity_log
            fieldName: ip_address
            fieldCheck: Type
            expectedResult: 'VARCHAR(45)'

  checkDBVersion150:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.5.0'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.5.0') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: SSLPWSTATUSCHECK
            expectedResult: 'login mode https'
          - checkType: fieldSchema
            tableName: admin
            fieldName: last_failed_ip
            fieldCheck: Exists

  checkDBVersion139:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.3.9'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.3.9') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: SHOW_SPLIT_TAX_CHECKOUT
            expectedResult: 'Show Split Tax Lines'

  checkDBVersion138:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.3.8'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.3.8') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: SHOW_SHOPPING_CART_COMBINED
            expectedResult: 'Show Notice of Combining Shopping Cart on Login'
          - checkType: configValue
            fieldName: MAX_RANDOM_SELECT_FEATURED_PRODUCTS
            expectedResult: 'Random Featured Products for SideBox'

  checkDBVersion137:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.3.7'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.3.7') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configDescription
            fieldName: DEFINE_BREADCRUMB_STATUS
            expectedResult: 'Enable the Breadcrumb Trail Links?<br />0= OFF<br />1= ON<br />2= Off for Home Page Only'
          - checkType: configValue
            fieldName: USE_SPLIT_LOGIN_MODE
            expectedResult: 'Use split-login page'

  checkDBVersion136:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.3.6'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.3.6') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: META_TAG_INCLUDE_MODEL
            expectedResult: 'Meta Tags - Include Product Model in Title'
          - checkType: configValue
            fieldName: SHOW_SHOPPING_CART_EMPTY_UPCOMING
            expectedResult: 'Show Upcoming Products on empty Shopping Cart Page'

  checkDBVersion135:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.3.5'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.3.5') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: PRODUCT_LIST_PRICE_BUY_NOW
            expectedResult: 'Display Product Add to Cart Button (0=off; 1=on; 2=on with Qty Box per Product)'
          - checkType: configValue
            fieldName: PRODUCT_LIST_ALPHA_SORTER
            expectedResult: 'Include Product Listing Alpha Sorter Dropdown'

  checkDBVersion130:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.3.0'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.3.0') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: DEFINE_BREADCRUMB_STATUS
            expectedResult: 'Define Breadcrumb Status'
          - checkType: configValue
            fieldName: EZPAGES_STATUS_HEADER
            expectedResult: 'EZ-Pages Display Status - HeaderBar'

  checkDBVersion127:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.2.7'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.2.7') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configValue
            fieldName: SHOW_VERSION_UPDATE_IN_HEADER
            expectedResult: 'Automatically check to see if a new version of Zen Cart is available. Enabling this can sometimes slow down the loading of Admin pages. (Displayed on main Index page after login, and Server Info page.)'
          - checkType: configValue
            fieldName: SHOW_SHOPPING_CART_BOX_STATUS
            expectedResult: 'Shopping Cart Shows<br />0= Always<br />1= Only when full<br />2= Only when full but not when viewing the Shopping Cart'

  checkDBVersion126:
    runLevel: dbVersion
    errorLevel: WARN
    version: '1.2.6'
    mainErrorText: <?php echo sprintf(TEXT_DB_VERSION_NOT_FOUND, 'v1.2.6') . PHP_EOL; ?>
    methods:
      dbVersionChecker:
        parameters:
          - checkType: configKeyExists
            keyName: CATEGORIES_TABS_STATUS
