[ Index ]

PHP Cross Reference of Documentation Magento

title

Body

[close]

/ -> install.php (source)

   1  <?php
   2  /**
   3   * Magento
   4   *
   5   * NOTICE OF LICENSE
   6   *
   7   * This source file is subject to the Open Software License (OSL 3.0)
   8   * that is bundled with this package in the file LICENSE.txt.
   9   * It is also available through the world-wide-web at this URL:
  10   * http://opensource.org/licenses/osl-3.0.php
  11   * If you did not receive a copy of the license and are unable to
  12   * obtain it through the world-wide-web, please send an email
  13   * to license@magentocommerce.com so we can send you a copy immediately.
  14   *
  15   * DISCLAIMER
  16   *
  17   * Do not edit or add to this file if you wish to upgrade Magento to newer
  18   * versions in the future. If you wish to customize Magento for your
  19   * needs please refer to http://www.magentocommerce.com for more information.
  20   *
  21   * @category   Mage
  22   * @package    Mage
  23   * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
  24   * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  25   */
  26  
  27  
  28  /**
  29   * There are two modes to run this script:
  30   *
  31   * 1. Dump available locale options (currencies, locales, timezones) and exit
  32   * php -f install.php -- --get_options
  33   *
  34   * The output can be eval'd in a regular PHP array of the following format:
  35   * array (
  36   *   'locale' =>
  37   *   array (
  38   *     0 =>
  39   *     array (
  40   *       'value' => 'zh_TW',
  41   *       'label' => 'Chinese (Taiwan)',
  42   *     ),
  43   *   ),
  44   *   'currency' =>
  45   *   array (
  46   *     0 =>
  47   *     array (
  48   *       'value' => 'zh_TW',
  49   *       'label' => 'Chinese (Taiwan)',
  50   *     ),
  51   *   ),
  52   *   'timezone' =>
  53   *   array (
  54   *     0 =>
  55   *     array (
  56   *       'value' => 'zh_TW',
  57   *       'label' => 'Chinese (Taiwan)',
  58   *     ),
  59   *   ),
  60   * );
  61   *
  62   * or parsed in any other way.
  63   *
  64   * 2. Perform the installation
  65   *
  66   *  php -f install.php -- --license_agreement_accepted yes \
  67   *  --locale en_US --timezone "America/Los_Angeles" --default_currency USD \
  68   *  --db_host localhost --db_name magento_database --db_user magento_user --db_pass 123123 \
  69   *  --db_prefix magento_ \
  70   *  --url "http://magento.example.com/" --use_rewrites yes \
  71   *  --use_secure yes --secure_base_url "https://magento.example.com/" --use_secure_admin yes \
  72   *  --admin_lastname Owner --admin_firstname Store --admin_email "admin@example.com" \
  73   *  --admin_username admin --admin_password 123123 \
  74   *  --encryption_key "Encryption Key"
  75   *
  76   * Possible options are:
  77   * --license_agreement_accepted // required, it will accept 'yes' value only
  78   * Locale settings:
  79   * --locale                     // required, Locale
  80   * --timezone                   // required, Time Zone
  81   * --default_currency           // required, Default Currency
  82   * Database connection options:
  83   * --db_host                    // required, You can specify server port, ex.: localhost:3307
  84   *                              // If you are not using default UNIX socket, you can specify it
  85   *                              // here instead of host, ex.: /var/run/mysqld/mysqld.sock
  86   * --db_model                   // Database type (mysql4 by default)
  87   * --db_name                    // required, Database Name
  88   * --db_user                    // required, Database User Name
  89   * --db_pass                    // required, Database User Password
  90   * --db_prefix                  // optional, Database Tables Prefix
  91   *                              // No table prefix will be used if not specified
  92   * Session options:
  93   * --session_save <files|db>    // optional, where to store session data - in db or files. files by default
  94   * Web access options:
  95   * --admin_frontname <path>     // optional, admin panel path, "admin" by default
  96   * --url                        // required, URL the store is supposed to be available at
  97   * --skip_url_validation        // optional, skip validating base url during installation or not. No by default
  98   * --use_rewrites               // optional, Use Web Server (Apache) Rewrites,
  99   *                              // You could enable this option to use web server rewrites functionality for improved SEO
 100   *                              // Please make sure that mod_rewrite is enabled in Apache configuration
 101   * --use_secure                 // optional, Use Secure URLs (SSL)
 102   *                              // Enable this option only if you have SSL available.
 103   * --secure_base_url            // optional, Secure Base URL
 104   *                              // Provide a complete base URL for SSL connection.
 105   *                              // For example: https://www.mydomain.com/magento/
 106   * --use_secure_admin           // optional, Run admin interface with SSL
 107   * Backend interface options:
 108   * --enable_charts              // optional, Enables Charts on the backend's dashboard
 109   * Admin user personal information:
 110   * --admin_lastname             // required, admin user last name
 111   * --admin_firstname            // required, admin user first name
 112   * --admin_email                // required, admin user email
 113   * Admin user login information:
 114   * --admin_username             // required, admin user login
 115   * --admin_password             // required, admin user password
 116   * Encryption key:
 117   * --encryption_key             // optional, will be automatically generated and displayed on success, if not specified
 118   *
 119   */
 120  
 121  if (version_compare(phpversion(), '5.2.0', '<')===true) {
 122      die('ERROR: Whoops, it looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer.');
 123  }
 124  
 125  require  'app/Mage.php';
 126  
 127  try {
 128      $app = Mage::app('default');
 129  
 130      $installer = Mage::getSingleton('install/installer_console');
 131      /* @var $installer Mage_Install_Model_Installer_Console */
 132  
 133      if ($installer->init($app)          // initialize installer
 134          && $installer->checkConsole()   // check if the script is run in shell, otherwise redirect to web-installer
 135          && $installer->setArgs()        // set and validate script arguments
 136          && $installer->install())       // do install
 137      {
 138          echo 'SUCCESS: ' . $installer->getEncryptionKey() . "\n";
 139          exit;
 140      }
 141  
 142  } catch (Exception $e) {
 143      Mage::printException($e);
 144  }
 145  
 146  // print all errors if there were any
 147  if ($installer instanceof Mage_Install_Model_Installer_Console) {
 148      if ($installer->getErrors()) {
 149          echo "\nFAILED\n";
 150          foreach ($installer->getErrors() as $error) {
 151              echo $error . "\n";
 152          }
 153      }
 154  }
 155  exit(1); // don't delete this as this should notify about failed installation


Développement Magento e-commerce Montréal
Generated: Thu Feb 21 16:42:07 2013 Cross-referenced by PHPXref 0.7.1