Esempio n. 1
0
#!/usr/bin/env php
<?php 
require 'dbscripts.module';
if (in_array('help', $_SERVER['argv'])) {
    print dbscripts_help('restore');
} else {
    $options = dbscripts_get_options($_SERVER['argv']);
    print dbscripts_restore($options['file'], $options['filter']);
}
Esempio n. 2
0
#!/usr/bin/env php
<?php 
require 'dbscripts.module';
if (in_array('help', $_SERVER['argv'])) {
    print dbscripts_help('erase');
} else {
    $_SERVER['argv'][1] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'full';
    print dbscripts_erase($_SERVER['argv'][1]);
}
Esempio n. 3
0
#!/usr/bin/env php
<?php 
require 'dbscripts.module';
require 'config.inc';
if (in_array('help', $_SERVER['argv'])) {
    print dbscripts_help('find');
} else {
    $options = $_SERVER['argv'];
    // Find all tables with auto_increment
    if (isset($options[1]) && $options[1] == 'increment') {
        $branch = isset($options[2]) ? $options[2] : 'development';
        $filter_option = isset($options[3]) ? $options[3] : 'full';
        $list = dbscripts_find_tables_with_increment($branch, $filter_option);
        print_r($list);
        // Find all possible references to a given table
    } elseif (isset($options[1]) && $options[1] == 'possible-references') {
        $branch = isset($options[3]) ? $options[3] : 'development';
        $filter_option = isset($options[4]) ? $options[4] : 'full';
        $list = array();
        if (isset($options[2]) && $options[2] != 'all') {
            $table = $options[2];
            $list = dbscripts_find_possible_table_references($table, $branch, $filter_option);
        } else {
            print "\n Please wait. This can take awhile.  'ctrl+c' to cancel.\n\n";
            $table_list = dbscripts_find_tables_with_increment($branch, $filter_option);
            if (is_array($table_list)) {
                foreach ($table_list as $table) {
                    $references = dbscripts_find_possible_table_references($table, $branch, $filter_option);
                    if (is_array($references)) {
                        $list[$table] = $references;
                    }
Esempio n. 4
0
#!/usr/bin/env php
<?php 
require 'dbscripts.module';
if (in_array('help', $_SERVER['argv'])) {
    print dbscripts_help('merge');
} else {
    // Findout if the user wants to continue from a previous merge
    $continue = FALSE;
    if (in_array('continue', $_SERVER['argv'])) {
        $continue = TRUE;
    }
    // Reset the array by removing the other set variables
    foreach ($_SERVER['argv'] as $key => $variable) {
        if ($variable = 'continue') {
            unset($_SERVER['argv'][$key]);
        }
    }
    foreach ($_SERVER['argv'] as $variable) {
        $_SERVER['argv'][] = $variable;
    }
    $dev_db = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : FALSE;
    $lastmerge_db = isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : FALSE;
    $prod_db = isset($_SERVER['argv'][3]) ? $_SERVER['argv'][3] : FALSE;
    print dbscripts_merge($dev_db, $lastmerge_db, $prod_db, $continue);
}
Esempio n. 5
0
#!/usr/bin/env php
<?php 
require 'dbscripts.module';
if (in_array('help', $_SERVER['argv'])) {
    print dbscripts_help('dump');
} else {
    $options = dbscripts_get_options($_SERVER['argv']);
    print dbscripts_dump($options['branch'], $options['filter'], $options['last-merge']);
}
Esempio n. 6
0
#!/usr/bin/env php
<?php 
require 'dbscripts.module';
if (in_array('help', $_SERVER['argv'])) {
    print dbscripts_help('raise_increments');
} else {
    $options = $_SERVER['argv'];
    if (isset($options[1]) && $options[1] != 'all') {
        if (isset($options[3])) {
            $table = $options[1];
            $start_at = $options[2];
            $change_to = $options[3];
            $branch = isset($options[5]) ? $options[5] : 'development';
            $filter_option = isset($options[6]) ? $options[6] : 'full';
            print dbscripts_raise_table_increments($table, $start_at, $change_to, $branch, $filter_option);
        } else {
            print "\n\nMust provide a table, increment to start at, and increment to change to\n\n";
        }
    } else {
        print dbscripts_raise_all_increments();
    }
}