/** * Shortcut for the application "is installed" getter * * @return bool * @throws Magento_Exception * * @todo Remove in favour of Mage_Core_Model_App::isInstalled() as soon as dependencies on application are injected */ public static function isInstalled() { if (!self::$_app) { throw new Magento_Exception('Application instance has not been initialized yet.'); } return self::$_app->isInstalled(); }
public function testIsInstalled() { $this->assertTrue($this->_mageModel->isInstalled()); }
/** * Install Magento * * @return boolean */ public function install() { try { /** * Check if already installed */ if ($this->_app->isInstalled()) { $this->addError('ERROR: Magento is already installed'); return false; } /** * Prepare data */ $this->_prepareData(); if ($this->hasErrors()) { return false; } $installer = $this->_getInstaller(); /** * Install configuration */ $installer->installConfig($this->_getDataModel()->getConfigData()); // TODO fix wizard and simplify this everythere if ($this->hasErrors()) { return false; } /** * Reinitialize configuration (to use new config data) */ $this->_app->cleanCache(); Mage::getConfig()->reinit(); /** * Install database */ $installer->installDb(); if ($this->hasErrors()) { return false; } /** * Create primary administrator user */ $installer->createAdministrator($this->_getDataModel()->getAdminData()); if ($this->hasErrors()) { return false; } /** * Save encryption key or create if empty */ $encryptionKey = empty($this->_args['encryption_key']) ? md5(time()) : $this->_args['encryption_key']; $this->_getDataModel()->setEncryptionKey($encryptionKey); $installer->installEnryptionKey($encryptionKey); if ($this->hasErrors()) { return false; } /** * Installation finish */ $installer->finish(); if ($this->hasErrors()) { return false; } /** * Change directories mode to be writable by apache user */ @chmod('var/cache', 0777); @chmod('var/session', 0777); } catch (Exception $e) { $this->addError('ERROR: ' . $e->getMessage()); return false; } return true; }