Esempio n. 1
0
function upgrade_all($version)
{
    // **** Read upgrades/ directory
    outn("Checking for upgrades..");
    // read versions list from ugprades/
    $versions = array();
    $dir = opendir(UPGRADE_DIR);
    while ($file = readdir($dir)) {
        if ($file[0] != "." && is_dir(UPGRADE_DIR . "/" . $file)) {
            $versions[] = $file;
        }
    }
    closedir($dir);
    // callback to use php's version_compare() to sort
    usort($versions, "version_compare_freepbx");
    // find versions that are higher than the current version
    $starting_version = false;
    foreach ($versions as $check_version) {
        if (version_compare_freepbx($check_version, $version) > 0) {
            // if check_version < version
            $starting_version = $check_version;
            break;
        }
    }
    // run all upgrades from the list of higher versions
    if ($starting_version) {
        $pos = array_search($starting_version, $versions);
        $upgrades = array_slice($versions, $pos);
        // grab the list of versions, starting at $starting_version
        out(count($upgrades) . " found");
        run_upgrade($upgrades);
        /* Set the base version of key modules, currently core and framework, to the
         * Version packaged with this tarball, if any. The expectation is that the
         * packaging scripts will make these module version numbers the same as the
         * release plus a '.0' which can be incremented for bug fixes delivered through
         * the online system between main releases.
         *
         * added if function_exists because if this is being run from framework there is no
         * need to reset the base version.
         */
        if (function_exists('set_base_version')) {
            set_base_version();
        }
    } else {
        out("No upgrades found");
    }
}
<?php

// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) {
    require_once dirname(__FILE__) . '/SSI.php';
} elseif (!defined('SMF')) {
    die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
}
if (isset($_GET['force'])) {
    run_upgrade();
}
function esamup_check_table($table)
{
    $fields = esamup_select("EXPLAIN " . $table, MYSQL_ASSOC, FALSE);
    if (!empty($fields)) {
        return TRUE;
    } else {
        return FALSE;
    }
    // foreach($columns as $c => $vars)
    // {
    // if(!isset($fcolumns[$c]))
    // $missing[] = $c;
    // }
    // if(!empty($missing))
    // {
    // Return(array(FALSE, $missing));
    // }
    // else
}
function esamup_select($sql, $result_form = MYSQL_NUM, $error = TRUE)