die('Please run this script in cli mode only'); } // Autoloading für Klassen function __autoload($class) { $file = 'lib/' . str_replace('_', '/', $class) . '.php'; if (file_exists($file)) { require $file; } } function db() { return $GLOBALS['db']; } // Funktion require 'inc/functions.php'; // Datenbankverbindung herstellen require 'inc/database.config.php'; if (empty($argv[1])) { require 'install/init.mysql.php'; initDb($db); foreach (update_migration::listPending() as $migration) { if (!system('php setup.php ' . $migration)) { break; } } } else { $migrations = new update_migration(); $migrations->install($argv[1]); echo "\t {$argv[1]} installed.\n"; }
} new update_manager($view, $packages[$_GET['edit']]); } elseif (isset($_GET['storefile'])) { $view->format = 'plain'; $pkg = new update_package(array('id' => $_POST['pkg'])); $pkg->updateFile($_POST['path'], $_POST['content']); $view->content('ok'); } elseif (isset($_GET['addpackage'])) { $view->format = 'plain'; $pkg = new update_package($_POST); $pkg->install($writer); $view->content('ok'); } elseif (isset($_GET['getmigrations'])) { $all = globFiles('migration/*'); $applied = db()->select('update_migration')->assocs('id'); $result = $pending = array(); foreach ($all as $id) { if (empty($applied[$id])) { $pending[] = $id; } } $view->plain(json_encode($pending)); } elseif (!empty($_GET['install'])) { $view->format = 'plain'; $migrations = new update_migration(); $migrations->install($_GET['install']); } else { $view->js('assets/js/update.js'); $view->js('assets/js/migration.js'); $view->content(template('iv.packages.install')->render(array('sources' => $sources, 'packages' => array_values($packages)))); }
$file = __DIR__ . '/lib/' . str_replace('_', '/', $class) . '.php'; if (file_exists($file)) { require $file; } } function db() { return $GLOBALS['db']; } if (!file_exists('inc/mysql.config.php')) { echo 'MYSQL config not found'; } // Funktion require __DIR__ . '/inc/functions.php'; // Datenbankverbindung herstellen require __DIR__ . '/inc/database.config.php'; require __DIR__ . '/install/init.mysql.php'; initDb($db); foreach (update_migration::listPending() as $value) { echo '1'; $migrations = new update_migration(); $migrations->install($value); echo $value . 'installed.'; } mkdir('cache', 0777); echo ' <h1>DONE</h1> <p> <strong>Erstellen sie bitte in der Datenbank Ihren Admin User (Passwort 2x MD5 verschlüsselt) und entfernen Sie diese Datei.</strong> </p> ';
<?php $migrations = new update_migration(); if (!empty($_POST['create'])) { $migrations->create($_POST['create']); throw new redirect(MODUL_SELF); } if (!empty($_GET['apply'])) { db()->update_migration->insert(array('id' => $_GET['apply'])); throw new redirect(MODUL_SELF); } if (!empty($_GET['reset'])) { db()->update_migration->delRow($_GET['reset']); throw new redirect(MODUL_SELF); } if (!empty($_GET['install'])) { $view->format = 'plain'; $migrations->install($_GET['install']); } else { $all = globFiles('migration/*'); $applied = db()->select('update_migration')->assocs('id'); $result = $pending = array(); foreach ($all as $id) { $result[] = array('id' => $id, 'status' => isset($applied[$id]) ? 'applied' : 'pending', 'date' => $applied['create_date']); if (empty($applied[$id])) { $pending[] = $id; } } $grid = $view->grid(); $view->js('assets/js/migration.js'); $form = new form_renderer(MODUL_SELF, 'Erstellen');