Пример #1
0
 /**
  * Detect if a database schema upgrade is required
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return boolean
  **/
 public static function upgradedb()
 {
     return !ShoppSettings()->available() || ShoppSettings()->dbversion() != ShoppVersion::db();
 }
Пример #2
0
 /**
  * Performs database upgrades when required
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function upgrades()
 {
     $installed = ShoppSettings::dbversion();
     // No upgrades required
     if ($installed == ShoppVersion::db()) {
         return;
     }
     shopp_set_setting('shopp_setup', '');
     shopp_set_setting('maintenance', 'on');
     if ($installed < 1100) {
         $this->upgrade_110();
     }
     if ($installed < 1200) {
         $this->upgrade_120();
     }
     if ($installed < 1300) {
         $this->upgrade_130();
     }
     $db = sDB::object();
     file_put_contents(SHOPP_PATH . '/shopp_queries.txt', json_encode($db->queries));
     ShoppSettings()->save('db_version', ShoppVersion::db());
 }