Example #1
0
def admin_backup():
    form = BackupEditForm(request.form)
    if request.method == 'POST':
        if form.validate_on_submit():
            if request.form['backup'] == 'Update':
                pass
            elif request.form['backup'] == 'Start Backup':
                g.db.MM_Server_Database_Trigger_Insert(('python', './subprogram/subprogram_postgresql_backup.py')) # this commits
                flash("Postgresql Database Backup Task Submitted.")
        else:
            flash_errors(form)
    backup_enabled = False
    backup_files = []
    for backup_local in MM_Common_File.MM_Common_File_Dir_List(Config.get('MetaManServer','BackupLocal').strip(), 'dump', False, False, True):
        backup_files.append((backup_local[0], 'Local', MM_Common_String.bytes2human(backup_local[1])))
    # cloud backup list
    for backup_cloud in MM_Common_Cloud.MM_Common_Cloud_Backup_List():
        backup_files.append((backup_cloud.name, backup_cloud.type, MM_Common_String.bytes2human(backup_cloud.size)))
    page, per_page, offset = MM_Common_Pagination.get_page_items()
    pagination = MM_Common_Pagination.get_pagination(page=page,
                                per_page=per_page,
                                total=len(backup_files),
                                record_name='backups',
                                format_total=True,
                                format_number=True,
                                )
    return render_template("admin/admin_backup.html", form=form,
                           backup_list=sorted(backup_files, reverse=True),
                           data_interval=('Hours', 'Days', 'Weekly'),
                           data_class=MM_Common_Cloud.cloud_backup_class,
                           data_enabled=backup_enabled,
                           page=page,
                           per_page=per_page,
                           pagination=pagination
                           )
Example #2
0
def admin_server_link_server():
    page, per_page, offset = MM_Common_Pagination.get_page_items()
    pagination = MM_Common_Pagination.get_pagination(page=page,
                                per_page=per_page,
                                total=g.db.MM_Server_Database_Link_List_Count(),
                                record_name='linked servers',
                                format_total=True,
                                format_number=True,
                                )
    return render_template("admin/admin_link.html", data=g.db.MM_Server_Database_Link_List(offset, per_page),
                           page=page,
                           per_page=per_page,
                           pagination=pagination)
Example #3
0
def admin_cron_display_all():
    page, per_page, offset = MM_Common_Pagination.get_page_items()
    pagination = MM_Common_Pagination.get_pagination(page=page,
                                per_page=per_page,
                                total=g.db.MM_Server_Database_Cron_List_Count(False),
                                record_name='Cron Jobs',
                                format_total=True,
                                format_number=True,
                                )
    return render_template('admin/admin_cron.html', media_cron=g.db.MM_Server_Database_Cron_List(False, offset, per_page),
                           page=page,
                           per_page=per_page,
                           pagination=pagination,
                           )
Example #4
0
def admin_users():
    page, per_page, offset = MM_Common_Pagination.get_page_items()
    pagination = MM_Common_Pagination.get_pagination(page=page,
                                per_page=per_page,
                                total=g.db.MM_Server_Database_User_List_Name_Count(),
                                record_name='users',
                                format_total=True,
                                format_number=True,
                                )
    return render_template('admin/admin_users.html', users=g.db.MM_Server_Database_User_List_Name(offset, per_page),
                           page=page,
                           per_page=per_page,
                           pagination=pagination,
                           )
Example #5
0
def admin_library():
    if request.method == 'POST':
        g.db.MM_Server_Database_Trigger_Insert(('python', './subprogram/subprogram_file_scan.py'))
        flash("Scheduled media scan.")
    page, per_page, offset = MM_Common_Pagination.get_page_items()
    pagination = MM_Common_Pagination.get_pagination(page=page,
                                per_page=per_page,
                                total=g.db.MM_Server_Database_Audit_Paths_Count(),
                                record_name='library dir(s)',
                                format_total=True,
                                format_number=True,
                                )
    return render_template("admin/admin_library.html", media_dir=g.db.MM_Server_Database_Audit_Paths(offset, per_page),
                           page=page,
                           per_page=per_page,
                           pagination=pagination,
                           )