Example #1
0
	/**
	 * Get tables to be migrated.
	 *
	 * @return	array	List of tables without prefix
	 * @since	1.6.4
	 */
	protected function getCopyTables() {
		require_once $this->api;
		require_once KPATH_ADMIN . '/install/schema.php';
		$schema = new KunenaModelSchema();
		$tables = $schema->getSchemaTables('');
		return array_values($tables);
	}
Example #2
0
 /**
  * Get tables to be migrated.
  *
  * @return	array	List of tables without prefix
  * @since	1.6.4
  */
 protected function getCopyTables()
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
     require_once KPATH_ADMIN . '/install/schema.php';
     $schema = new KunenaModelSchema();
     $tables = $schema->getSchemaTables('');
     return array_values($tables);
 }
Example #3
0
 function displaySchemaDiff()
 {
     require_once KPATH_ADMIN . '/install/schema.php';
     $schema = new KunenaModelSchema();
     $diff = $schema->getDiffSchema();
     $sql = $schema->getSchemaSQL($diff);
     echo '<textarea cols="80" rows="20">';
     echo $this->escape($diff->saveXML());
     echo '</textarea>';
     if (KunenaForum::isDev()) {
         echo '<textarea cols="80" rows="20">';
         foreach ($sql as $item) {
             echo $this->escape($item['sql']) . "\n\n";
         }
         echo '</textarea>';
     }
 }
Example #4
0
 public function installDatabase()
 {
     static $schema = null;
     static $create = null;
     static $tables = null;
     if ($schema === null) {
         // Run only once: get table creation SQL and existing tables
         require_once KPATH_ADMIN . '/install/schema.php';
         $schema = new KunenaModelSchema();
         $create = $schema->getCreateSQL();
         $tables = $this->listTables('kunena_', true);
     }
     $app = JFactory::getApplication();
     $state = $app->getUserState('com_kunena.install.dbstate', null);
     // First run: get all tables
     if ($state === null) {
         $state = array_keys($create);
     }
     // Handle only first table in the list
     $table = array_shift($state);
     if ($table) {
         $query = $create[$table];
         if (!isset($tables[$table])) {
             $result = $schema->updateSchemaTable($table);
             if ($result) {
                 $this->addStatus(JText::_('COM_KUNENA_INSTALL_CREATE') . ' ' . $result['name'], $result['success']);
             }
         }
         // Save user state with remaining tables
         $app->setUserState('com_kunena.install.dbstate', $state);
         // Database install continues
         return false;
     } else {
         // Reset user state
         $this->updateVersionState('upgradeDatabase');
         $app->setUserState('com_kunena.install.dbstate', null);
     }
     // Database install complete
     return true;
 }