/** * Make sure the #__akeeba_common table exists or create it from scratch * * @return $this */ public function checkAndFixCommonTables() { $db = $this->container->db; $dbInstaller = new Installer($db, JPATH_ADMINISTRATOR . '/components/com_ars/sql/common'); $dbInstaller->updateSchema(); return $this; }
/** * Checks the database for missing / outdated tables using the $dbChecks * data and runs the appropriate SQL scripts if necessary. * * @return $this */ public function checkAndFixDatabase() { $db = $this->container->platform->getDbo(); $dbInstaller = new Installer($db, JPATH_ADMINISTRATOR . '/components/com_ars/sql/xml'); $dbInstaller->updateSchema(); return $this; }
/** * Make sure the #__akeeba_common table exists or create it from scratch * * @return $this */ public function checkAndFixCommonTables() { // Install or update database try { } catch (\Exception $e) { $container = $this->container; $dbInstaller = new Installer($container->db, $container->backEndPath . '/sql/common'); $dbInstaller->updateSchema(); } return $this; }
/** * @covers FOF30\Database\Installer::removeSchema */ public function testRemoveSchema() { $db = static::$container->db; $this->createTable(); $tables = $db->setQuery('SHOW TABLES')->loadColumn(); $prefix = $db->getPrefix(); $this->assertTrue(in_array($prefix . 'foobar_example', $tables), 'The table must exist before testing starts'); $installer = new Installer($db, __DIR__ . '/../_data/installer/pick_right'); $installer->removeSchema(); $tables = $db->setQuery('SHOW TABLES')->loadColumn(); $prefix = $db->getPrefix(); $this->assertFalse(in_array($prefix . 'foobar_example', $tables), 'The table must not exist after running removeSchema'); }
/** * Checks the database for missing / outdated tables and runs the appropriate SQL scripts if necessary. * * @return $this */ public function checkAndFixDatabase() { // Install or update database $dbInstaller = new Installer($this->container->db, JPATH_ADMINISTRATOR . '/components/com_akeeba/sql/xml'); $dbInstaller->updateSchema(); return $this; }
/** * Checks the database for missing / outdated tables and runs the appropriate SQL scripts if necessary. * * @throws RuntimeException If the previous database update is stuck * * @return $this */ public function checkAndFixDatabase() { $params = $this->container->params; // First of all let's check if we are already updating $stuck = $params->get('updatedb', 0); if ($stuck) { throw new RuntimeException('Previous database update is flagged as stuck'); } // Then set the flag $params->set('updatedb', 1); $params->save(); // Install or update database $dbInstaller = new Installer($this->container->db, JPATH_ADMINISTRATOR . '/components/com_akeeba/sql/xml'); $dbInstaller->updateSchema(); // And finally remove the flag if everything went fine $params->set('updatedb', null); $params->save(); return $this; }
/** * Runs on uninstallation * * @param \JInstallerAdapterComponent $parent The parent object */ public function uninstall($parent) { // Uninstall database $dbInstaller = new Installer(JFactory::getDbo(), ($this->schemaXmlPathRelative ? JPATH_ADMINISTRATOR . '/components/' . $this->componentName : '') . '/' . $this->schemaXmlPath); $dbInstaller->removeSchema(); // Uninstall post-installation messages on Joomla! 3.2 and later $this->uninstallPostInstallationMessages(); // Remove ourselves from the list of extensions depending on FOF30 $this->removeDependency('fof30', $this->componentName); // Show the post-uninstallation page $this->renderPostUninstallation($parent); }