Ejemplo n.º 1
0
def staggered_update(db_buildversion):
    """Update pootle database, while displaying progress report for each step"""

    # django's syncdb command prints progress reports to stdout, but
    # mod_wsgi doesn't like stdout, so we reroute to stderr
    stdout = sys.stdout
    sys.stdout = sys.stderr

    yield header(db_buildversion)

    ############## version specific updates ############

    if db_buildversion < 20030:
        yield update_permissions_20030()

    # build missing tables
    yield syncdb()

    if db_buildversion < 21000:
        yield update_tables_21000()
        Directory.objects.root.get_or_make_subdir('projects')
        for project in Project.objects.iterator():
            # saving should force project to update it's directory property
            project.save()

        yield parse_start()
        for store in Store.objects.iterator():
            store.translation_project = store.parent.get_translationproject()
            store.save()
            yield parse_store(store)
            yield import_suggestions(store)
        yield parse_end()

    # first time to visit the front page all stats for projects and
    # languages will be calculated which can take forever, since users
    # don't like webpages that take forever let's precalculate the
    # stats here (copied from dbinit)
    yield stats_start()
    for language in Language.objects.iterator():
        yield stats_language(language)
    for project in Project.objects.iterator():
        yield stats_project(project)
    yield stats_end()

    yield footer()
    # bring back stdout
    sys.stdout = stdout
    return
Ejemplo n.º 2
0
        yield update_tables_22000()

    if tt_buildversion < 12008:
        yield update_ts_tt_12008()

    if tt_buildversion != sys.maxint and db_buildversion >= 21040:
        # sys.maxint is set in siteconfig middleware if toolkit is unchanged.
        # Otherwise, toolkit build version changed. Let's clear stale quality
        # checks data. We can only do that safely if the db schema is
        # already up to date.
        yield update_toolkit_version()
    elif tt_buildversion != sys.maxint:
        # only need to update the toolkit version, not do the upgrade
        save_toolkit_version()

    # first time to visit the front page all stats for projects and
    # languages will be calculated which can take forever, since users
    # don't like webpages that take forever let's precalculate the
    # stats here (copied from dbinit)
    yield stats_start()
    for language in Language.objects.iterator():
        yield stats_language(language)
    for project in Project.objects.iterator():
        yield stats_project(project)
    yield stats_end()

    yield footer()
    # bring back stdout
    sys.stdout = stdout
    return
Ejemplo n.º 3
0
        yield update_ts_tt_12008()

    if needs_toolkit_upgrade:
        # Let's clear stale quality checks data. We can only do that safely if
        # the db schema is already up to date.
        yield update_toolkit_version()
    elif tt_buildversion != sys.maxint:
        # only need to update the toolkit version, not do the upgrade
        save_toolkit_version()

    # First time to visit the front page all stats for projects and
    # languages will be calculated which can take forever, since users
    # don't like webpages that take forever let's precalculate the
    # stats here (copied from dbinit)
    yield stats_start()

    for language in Language.objects.iterator():
        yield stats_language(language)

    for project in Project.objects.iterator():
        yield stats_project(project)

    yield stats_end()

    yield footer()

    # Bring back stdout
    sys.stdout = stdout

    return