Habari\InstallHandler::upgrade_db_pre PHP Метод

upgrade_db_pre() приватный Метод

private upgrade_db_pre ( $current_version )
    private function upgrade_db_pre($current_version)
    {
        // this is actually a stripped-down version of DatabaseConnection::upgrade() - it doesn't support files
        $upgrade_functions = get_class_methods($this);
        $upgrades = array();
        foreach ($upgrade_functions as $fn) {
            // match all methods named "upgrade_db_pre_<rev#>"
            if (preg_match('%^upgrade_db_pre_([0-9]+)$%i', $fn, $matches)) {
                $upgrade_version = intval($matches[1]);
                if ($upgrade_version > $current_version) {
                    $upgrades[sprintf('%010s_1', $upgrade_version)] = $fn;
                }
            }
        }
        // sort the upgrades by revision, ascending
        ksort($upgrades);
        foreach ($upgrades as $upgrade) {
            $result =& call_user_func(array($this, $upgrade));
            // if we failed, abort
            if ($result === false) {
                break;
            }
        }
    }