static function install() { require_once 'admin/Migrator.php'; $migrator = new Migrator(); $migrator->migrate(); return; }
/** * Returns the appropriate config. If it's an old version it updates the config and runs migrations * @param {String} the version number for Pattern Lab from builder.php * * @return {Array} the configuration */ public function getConfig() { // make sure migrate doesn't happen by default $migrate = false; $diffVersion = false; // double-check the default config file exists if (!file_exists($this->plConfigPath)) { print "Please make sure config.ini.default exists before trying to have Pattern Lab build the config.ini file automagically.\n"; exit; } // set the default config using the pattern lab config $config = parse_ini_file($this->plConfigPath); $defaultConfig = $config; // check to see if the user config exists, if not create it print "configuring pattern lab...\n"; if (!file_exists($this->userConfigPath)) { $migrate = true; } else { $config = parse_ini_file($this->userConfigPath); } // compare version numbers $diffVersion = $config["v"] != $defaultConfig["v"] ? true : false; // run an upgrade and migrations if necessary if ($migrate || $diffVersion) { print "upgrading your version of pattern lab...\n"; print "checking for migrations...\n"; $m = new Migrator(); $m->migrate(true); if ($migrate) { if (!@copy($this->plConfigPath, $this->userConfigPath)) { print "Please make sure that Pattern Lab can write a new config to config/.\n"; exit; } } else { $config = $this->writeNewConfig($config, $defaultConfig); } } return $config; }
<?php require 'header.php'; ?> <div> <ul class="breadcrumb"> <li> <a href="#">Home</a> </li> <li> <a href="#">Migrate Data</a> </li> </ul> </div> <?php openBox("Migrate Old Options", "user", 12); ?> <p>This version of the Ads EZ Plugin for AdSense uses a new data/option model. When the plugin is activated, all the options from previous versions of Easy AdSense, Google AdSense, AdSense Now, Easy Ads, Easy Chitika etc. are detected and copied over to the new options model. If you have made further changes in the old plugin options and would like to migrate them as well, you can do so here.</p> <p>Note that clicking on the Migrate button does not overwrite existing (already migrated) options. It will only migrate new options created (for instance, by switching to a new theme and running a previous version of one of the afore-mentioned plugins).</p> <div><a href="?migrate" class="btn btn-primary" title="Migrate " data-toggle="tooltip">Migrate Now</a> </div> <div class="clearfix"> </div> <?php if (isset($_REQUEST['migrate'])) { require_once 'Migrator.php'; $migrator = new Migrator(); $migrator->migrate(true); } closeBox(); include 'promo.php'; require 'footer.php';
<?php // Prevent anyone for screwing with the database if this file is not here define('OKAY_TO_MIGRATE', TRUE); set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/-/library'); require_once '-/config.php'; require_once '-/db.php'; require_once 'Migrator.php'; require_once 'QueryTools.php'; if (isset($_GET['start']) and ctype_digit($_GET['start'])) { $start = (int) $_GET['start']; } else { $start = NULL; } $migrator = new Migrator($db, dirname(__FILE__) . '/-/migrations'); $migrator->migrate($start);
$table->increments('id'); $table->integer('user_id')->unsigned(); $table->string('ip_address')->nullable(); $table->integer('attempts')->default(0); $table->boolean('suspended')->default(0); $table->boolean('banned')->default(0); $table->timestamp('last_attempt_at')->nullable(); $table->timestamp('suspended_at')->nullable(); $table->timestamp('banned_at')->nullable(); // We'll need to ensure that MySQL uses the InnoDB engine to // support the indexes, other engines aren't affected. $table->engine = 'InnoDB'; $table->index('user_id'); }); } } /** * seed the database with initial value */ public function seed() { try { Sentry::createUser(array('email' => '*****@*****.**', 'password' => 'password', 'first_name' => 'Website', 'last_name' => 'Administrator', 'activated' => 1, 'permissions' => array('admin' => 1))); } catch (Exception $e) { echo $e->getMessage() . "\n"; } } } $migrator = new Migrator($config['database']['connections'][$config['database']['default']]); $migrator->migrate(); $migrator->seed();