示例#1
0
 private function checkdbschema()
 {
     $schemaData = new stdClass();
     // Handle crap versions
     if (preg_match('/^1\\.7/', $this->version) || preg_match('/^1\\.6/', $this->version)) {
         $schemaData->latest = '1.6';
         $schemaData->current = '1.6';
         // Handle Anything Recent
     } else {
         if (!preg_match('/^1\\.5/', $this->version) && file_exists(JPATH_ADMINISTRATOR . '/components/com_installer/models/database.php')) {
             require JPATH_ADMINISTRATOR . '/components/com_installer/models/database.php';
             $InstallerModelDatabase = new InstallerModelDatabase();
             $changeSet = $InstallerModelDatabase->getItems();
             $schemaData->latest = $changeSet->getSchema();
             $schemaData->current = $InstallerModelDatabase->getSchemaVersion();
         } else {
             // Handle Joomla 1.5
             $schemaData->latest = '1.5';
             $schemaData->current = '1.5';
         }
     }
     return json_encode($schemaData);
 }
示例#2
0
 /**
  * Return the DB schema
  * @since 20130929
  */
 private function getDbSchemaVersion()
 {
     require JPATH_ADMINISTRATOR . '/components/com_installer/models/database.php';
     $model = new InstallerModelDatabase();
     $changeSet = $model->getItems();
     bfEncrypt::reply('success', array('latest' => $changeSet->getSchema(), 'current' => $model->getSchemaVersion(), 'schema_errors' => $model->getItems()->check()));
 }
示例#3
0
 /**
  * Make sure the db schema is updated - even Akeeba doesnt do this :-)
  */
 public function finishup()
 {
     require 'bfInitJoomla.php';
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     // Because of the crappy Joomla early days of updates in 3.1.0
     $sql = "CREATE TABLE IF NOT EXISTS `#__content_types` (\n                  `type_id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                  `type_title` varchar(255) NOT NULL DEFAULT '',\n                  `type_alias` varchar(255) NOT NULL DEFAULT '',\n                  `table` varchar(255) NOT NULL DEFAULT '',\n                  `rules` text NOT NULL,\n                   `field_mappings` text NOT NULL,\n                   `router` varchar(255) NOT NULL  DEFAULT '',\n                  PRIMARY KEY (`type_id`),\n                  KEY `idx_alias` (`type_alias`)\n                ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=10000;";
     $db = JFactory::getDbo();
     $db->setQuery($sql);
     if (method_exists($db, 'execute')) {
         $db->execute();
     } else {
         $db->query();
     }
     // Let Joomla handle the grunt work
     $filePath = JPATH_ROOT . '/administrator/components/com_admin/script.php';
     if (file_exists($filePath)) {
         require_once $filePath;
         $o = new JoomlaInstallerScript();
         if (method_exists($o, 'preflight')) {
             $o->preflight('update', NULL);
         }
         if (method_exists($o, 'update')) {
             $o->update(NULL);
         }
         // need to upgrade db as well.
         require JPATH_ROOT . '/administrator/components/com_installer/models/database.php';
         $model = new InstallerModelDatabase();
         $model->fix();
     }
     bfEncrypt::reply('success', array('msg' => json_encode(true)));
 }