<commit_before><?php
/**
 * Controller class
 *
 * @package     Webenq
 * @subpackage  Controllers
 * @author      <NAME> <<EMAIL>>
 */
class InstallController extends Zend_Controller_Action
{
    /**
     * Renders the installer
     */
    public function indexAction()
    {
        // get doctrine config settings
        $config = Zend_Controller_Front::getInstance()
            ->getParam('bootstrap')->getOption('doctrine');

        // get current and latest db schema version
        $migration = new Doctrine_Migration($config['migrations_path']);
        $current = (int) $migration->getCurrentVersion();
        $latest = (int) $migration->getLatestVersion();

//        Doctrine_Core::generateMigrationsFromDiff(
//            $config['migrations_path'],
//            $config['schema_path'] . '/4.yml',
//            $config['schema_path'] . '/6.yml');

//        $migration->migrate(4);
//        die;

        if ($current !== $latest) {

            $form = new Zend_Form();
            $form->addElement($form->createElement('submit', 'migrate', array(
            	'label' => 'Migrate to latest version')));

            if ($this->_request->isPost()) {
                if ($this->_request->migrate) {
                    $migration->migrate($latest);
                    $this->_redirect($this->_request->getPathInfo());
                }
            }
            $this->view->form = $form;
        }

        $this->view->current = $current;
        $this->view->latest = $latest;
    }
}<commit_msg>[5329] migraties naar juiste foreign key constraints<commit_after><?php
/**
 * Controller class
 *
 * @package     Webenq
 * @subpackage  Controllers
 * @author      <NAME> <<EMAIL>>
 */
class InstallController extends Zend_Controller_Action
{
    /**
     * Renders the installer
     */
    public function indexAction()
    {
        // get doctrine config settings
        $config = Zend_Controller_Front::getInstance()
            ->getParam('bootstrap')->getOption('doctrine');

        // get current and latest db schema version
        $migration = new Doctrine_Migration($config['migrations_path']);
        $current = (int) $migration->getCurrentVersion();
        $latest = (int) $migration->getLatestVersion();

//        Doctrine_Core::generateMigrationsFromDiff(
//            $config['migrations_path'],
//            $config['schema_path'] . '/7.yml',
//            $config['schema_path'] . '/8.yml');
//        die('Success!');

//        try {
//            $migration->migrate(8);
//        }
//        catch(Doctrine_Migration_Exception $exception) {
//            die('<pre>' . $exception->getMessage() . '</pre>');
//        }
//        die('Success!');

        if ($current !== $latest) {

            $form = new Zend_Form();
            $form->addElement($form->createElement('submit', 'migrate', array(
            	'label' => 'Migrate to latest version')));

            if ($this->_request->isPost()) {
                if ($this->_request->migrate) {
                    try {
                        $migration->migrate($latest);
                    }
                    catch(Doctrine_Migration_Exception $exception) {
                        die('<pre>' . $exception->getMessage() . '</pre>');
                    }
                    $this->_redirect($this->_request->getPathInfo());
                }
            }
            $this->view->form = $form;
        }

        $this->view->current = $current;
        $this->view->latest = $latest;
    }
}
{'fraction_non_alphanumeric': 0.16030751708428245, 'fraction_numerical': 0.0028473804100227792, 'mean_word_length': 1.8747954173486088, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1681515', 'n_tokens_mistral': 968, 'n_tokens_neox': 952, 'n_words': 173}