/** * @covers JInstaller::setUpgrade * @covers JInstaller::isUpgrade */ public function testIsAndSetUpgrade() { $this->object->setUpgrade(false); $this->assertThat($this->object->isUpgrade(), $this->equalTo(false), 'Get or Set Upgrade failed'); $this->assertThat($this->object->setUpgrade(true), $this->equalTo(false), 'setUpgrade did not return the old value properly.'); $this->assertThat($this->object->isUpgrade(), $this->equalTo(true), 'getUpgrade did not return the expected value.'); }
/** * @todo Implement testGetOverwrite(). */ public function testGetAndSetUpgrade() { $this->saveFactoryState(); $newDbo = $this->getMock('test'); JFactory::$database =& $newDbo; $this->object = JInstaller::getInstance(); $this->object->setUpgrade(false); $this->assertThat($this->object->getUpgrade(), $this->equalTo(false), 'Get or Set Upgrade failed'); $this->assertThat($this->object->setUpgrade(true), $this->equalTo(false), 'setUpgrade did not return the old value properly.'); $this->assertThat($this->object->getUpgrade(), $this->equalTo(true), 'getUpgrade did not return the expected value.'); $this->restoreFactoryState(); }
/** * Generic update method for extensions * * @return boolean True on success * * @since 3.4 */ public function update() { // Set the overwrite setting $this->parent->setOverwrite(true); $this->parent->setUpgrade(true); // And make sure the route is set correctly $this->setRoute('update'); // Now jump into the install method to run the update return $this->install(); }
public function installFrameworkAction() { $packageFile = JFactory::getConfig()->get('tmp_path') . '/jsn-tpl_framework.zip'; // Checking downloaded template package if (!is_file($packageFile)) { throw new Exception(JText::_('JSN_TPLFW_ERROR_DOWNLOAD_PACKAGE_FILE_NOT_FOUND')); } // Load install library jimport('joomla.installer.helper'); // Turn off debug mode to catch install error $conf = JFactory::getConfig(); $conf->set('debug', 0); $unpackedInfo = JInstallerHelper::unpack($packageFile); $installer = new JInstaller(); $installer->setUpgrade(true); $installResult = $installer->install($unpackedInfo['dir']); // Clean up temporary data JInstallerHelper::cleanupInstall($packageFile, $unpackedInfo['dir']); // Clean up compressed files $this->_cleanCache(); // Send error if install is failure if (class_exists('JError')) { $error = JError::getError(); if (!empty($error)) { throw $error; } } }