updateSchema() публичный Метод

Creates or updates the database schema
public updateSchema ( ) : void
Результат void
Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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;
 }
Пример #3
0
 /**
  * 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;
 }
Пример #4
0
 /**
  * @covers  FOF30\Database\Installer::__construct
  * @covers  FOF30\Database\Installer::updateSchema
  * @covers  FOF30\Database\Installer::findSchemaXml
  * @covers  FOF30\Database\Installer::openAndVerify
  * @covers  FOF30\Database\Installer::conditionMet
  *
  * @throws \Exception
  */
 public function testCanFail()
 {
     $db = static::$container->db;
     $installer = new Installer($db, __DIR__ . '/../_data/installer');
     $installer->setForcedFile(__DIR__ . '/../_data/installer/test_canfail.xml');
     $installer->updateSchema();
     // Required for PHPUnit to mark the test as complete
     $this->assertTrue(true);
 }
Пример #5
0
 /**
  * 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;
 }
Пример #6
0
 /**
  * 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;
 }
Пример #7
0
 /**
  * Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing
  * or updating your component. This is the last chance you've got to perform any additional installations, clean-up,
  * database updates and similar housekeeping functions.
  *
  * @param   string                       $type   install, update or discover_update
  * @param   \JInstallerAdapterComponent  $parent Parent object
  */
 public function postflight($type, $parent)
 {
     // Add ourselves to the list of extensions depending on FOF30
     $this->addDependency('fof30', $this->componentName);
     // Install or update database
     // Uninstall database
     $dbInstaller = new Installer(JFactory::getDbo(), ($this->schemaXmlPathRelative ? JPATH_ADMINISTRATOR . '/components/' . $this->componentName : '') . '/' . $this->schemaXmlPath);
     $dbInstaller->updateSchema();
     // Make sure menu items are installed
     $this->_createAdminMenus($parent);
     // Make sure menu items are published (surprise goal in the 92' by JInstaller wins the cup for "most screwed up
     // bug in the history of Joomla!")
     $this->_reallyPublishAdminMenuItems($parent);
     // Which files should I remove?
     if ($this->isPaid) {
         // This is the paid version, only remove the removeFilesAllVersions files
         $removeFiles = $this->removeFilesAllVersions;
     } else {
         // This is the free version, remove the removeFilesAllVersions and removeFilesFree files
         $removeFiles = array('files' => array(), 'folders' => array());
         if (isset($this->removeFilesAllVersions['files'])) {
             if (isset($this->removeFilesFree['files'])) {
                 $removeFiles['files'] = array_merge($this->removeFilesAllVersions['files'], $this->removeFilesFree['files']);
             } else {
                 $removeFiles['files'] = $this->removeFilesAllVersions['files'];
             }
         } elseif (isset($this->removeFilesFree['files'])) {
             $removeFiles['files'] = $this->removeFilesFree['files'];
         }
         if (isset($this->removeFilesAllVersions['folders'])) {
             if (isset($this->removeFilesFree['folders'])) {
                 $removeFiles['folders'] = array_merge($this->removeFilesAllVersions['folders'], $this->removeFilesFree['folders']);
             } else {
                 $removeFiles['folders'] = $this->removeFilesAllVersions['folders'];
             }
         } elseif (isset($this->removeFilesFree['folders'])) {
             $removeFiles['folders'] = $this->removeFilesFree['folders'];
         }
     }
     // Remove obsolete files and folders
     $this->removeFilesAndFolders($removeFiles);
     // Copy the CLI files (if any)
     $this->copyCliFiles($parent);
     // Show the post-installation page
     $this->renderPostInstallation($parent);
     // Uninstall obsolete subextensions
     $this->uninstallObsoleteSubextensions($parent);
     // Clear the FOF cache
     $false = false;
     $cache = \JFactory::getCache('fof', '');
     $cache->store($false, 'cache', 'fof');
     // Make sure the Joomla! menu structure is correct
     $this->_rebuildMenu();
     // Add post-installation messages on Joomla! 3.2 and later
     $this->_applyPostInstallationMessages();
 }