mirror of https://github.com/zulip/zulip.git
python: Sort migrations/management command imports with isort.
This is a preparatory commit for using isort for sorting all of our imports, merging changes to files where we can easily review the changes as something we're happy with. These are also files with relatively little active development, which means we don't expect much merge conflict risk from these changes.
This commit is contained in:
parent
9f8eccdbbf
commit
8e7ce7cc79
|
@ -8,6 +8,7 @@ from django.core.management.base import BaseCommand, CommandParser
|
||||||
from zerver.lib.timestamp import timestamp_to_datetime
|
from zerver.lib.timestamp import timestamp_to_datetime
|
||||||
from zerver.models import Message, Recipient
|
from zerver.models import Message, Recipient
|
||||||
|
|
||||||
|
|
||||||
def compute_stats(log_level: int) -> None:
|
def compute_stats(log_level: int) -> None:
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.setLevel(log_level)
|
logger.setLevel(log_level)
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.utils.timezone import utc
|
||||||
from zerver.lib.statistics import seconds_usage_between
|
from zerver.lib.statistics import seconds_usage_between
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
def analyze_activity(options: Dict[str, Any]) -> None:
|
def analyze_activity(options: Dict[str, Any]) -> None:
|
||||||
day_start = datetime.datetime.strptime(options["date"], "%Y-%m-%d").replace(tzinfo=utc)
|
day_start = datetime.datetime.strptime(options["date"], "%Y-%m-%d").replace(tzinfo=utc)
|
||||||
day_end = day_start + datetime.timedelta(days=options["duration"])
|
day_end = day_start + datetime.timedelta(days=options["duration"])
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
|
import os
|
||||||
|
import time
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from analytics.models import installation_epoch, \
|
|
||||||
last_successful_fill
|
|
||||||
from analytics.lib.counts import COUNT_STATS, CountStat
|
from analytics.lib.counts import COUNT_STATS, CountStat
|
||||||
from zerver.lib.timestamp import floor_to_hour, floor_to_day, verify_UTC, \
|
from analytics.models import installation_epoch, last_successful_fill
|
||||||
TimezoneNotUTCException
|
from zerver.lib.timestamp import TimezoneNotUTCException, floor_to_day, \
|
||||||
|
floor_to_hour, verify_UTC
|
||||||
from zerver.models import Realm
|
from zerver.models import Realm
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
from typing import Any, Dict
|
|
||||||
|
|
||||||
states = {
|
states = {
|
||||||
0: "OK",
|
0: "OK",
|
||||||
1: "WARNING",
|
1: "WARNING",
|
||||||
|
|
|
@ -5,6 +5,7 @@ from django.core.management.base import BaseCommand, CommandError
|
||||||
|
|
||||||
from analytics.lib.counts import do_drop_all_analytics_tables
|
from analytics.lib.counts import do_drop_all_analytics_tables
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Clear analytics tables."""
|
help = """Clear analytics tables."""
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from django.core.management.base import BaseCommand, CommandError
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, do_drop_single_stat
|
from analytics.lib.counts import COUNT_STATS, do_drop_single_stat
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Clear analytics tables."""
|
help = """Clear analytics tables."""
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from django.utils.timezone import now as timezone_now
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import UserActivity
|
from zerver.models import UserActivity
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Report rough client activity globally, for a realm, or for a user
|
help = """Report rough client activity globally, for a realm, or for a user
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, Dict, List, Mapping, Optional, Type
|
from typing import Any, Dict, List, Mapping, Optional, Type
|
||||||
import mock
|
|
||||||
|
|
||||||
|
import mock
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, \
|
from analytics.lib.counts import COUNT_STATS, CountStat, \
|
||||||
CountStat, do_drop_all_analytics_tables
|
do_drop_all_analytics_tables
|
||||||
from analytics.lib.fixtures import generate_time_series_data
|
from analytics.lib.fixtures import generate_time_series_data
|
||||||
from analytics.lib.time_utils import time_range
|
from analytics.lib.time_utils import time_range
|
||||||
from analytics.models import BaseCount, FillState, RealmCount, UserCount, \
|
from analytics.models import BaseCount, FillState, InstallationCount, \
|
||||||
StreamCount, InstallationCount
|
RealmCount, StreamCount, UserCount
|
||||||
from zerver.lib.actions import do_change_is_admin, STREAM_ASSIGNMENT_COLORS
|
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, do_change_is_admin
|
||||||
from zerver.lib.create_user import create_user
|
from zerver.lib.create_user import create_user
|
||||||
from zerver.lib.timestamp import floor_to_day
|
from zerver.lib.timestamp import floor_to_day
|
||||||
from zerver.models import Realm, Stream, Client, \
|
from zerver.models import Client, Realm, Recipient, Stream, Subscription
|
||||||
Recipient, Subscription
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Populates analytics tables with randomly generated data."""
|
help = """Populates analytics tables with randomly generated data."""
|
||||||
|
|
|
@ -6,8 +6,8 @@ from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.models import Message, Realm, Recipient, Stream, \
|
from zerver.models import Message, Realm, Recipient, Stream, Subscription, \
|
||||||
Subscription, UserActivity, UserMessage, UserProfile, get_realm
|
UserActivity, UserMessage, UserProfile, get_realm
|
||||||
|
|
||||||
MOBILE_CLIENT_LIST = ["Android", "ios"]
|
MOBILE_CLIENT_LIST = ["Android", "ios"]
|
||||||
HUMAN_CLIENT_LIST = MOBILE_CLIENT_LIST + ["website"]
|
HUMAN_CLIENT_LIST = MOBILE_CLIENT_LIST + ["website"]
|
||||||
|
|
|
@ -4,8 +4,9 @@ from typing import Any
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from zerver.models import Message, Realm, \
|
from zerver.models import Message, Realm, Recipient, Stream, Subscription, \
|
||||||
Recipient, Stream, Subscription, get_realm
|
get_realm
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Generate statistics on the streams for a realm."
|
help = "Generate statistics on the streams for a realm."
|
||||||
|
|
|
@ -15,6 +15,7 @@ from zerver.lib.remote_server import send_analytics_to_remote_server
|
||||||
from zerver.lib.timestamp import floor_to_hour
|
from zerver.lib.timestamp import floor_to_hour
|
||||||
from zerver.models import Realm
|
from zerver.models import Realm
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Fills Analytics tables.
|
help = """Fills Analytics tables.
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.models import Message, Realm, Stream, UserProfile, get_realm
|
from zerver.models import Message, Realm, Stream, UserProfile, get_realm
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Generate statistics on user activity."
|
help = "Generate statistics on user activity."
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# Generated by Django 1.10.4 on 2017-01-16 20:50
|
# Generated by Django 1.10.4 on 2017-01-16 20:50
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# Generated by Django 1.10.5 on 2017-02-01 22:28
|
# Generated by Django 1.10.5 on 2017-02-01 22:28
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -3,6 +3,7 @@ from django.db import migrations
|
||||||
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
|
|
||||||
|
|
||||||
def delete_messages_sent_to_stream_stat(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
def delete_messages_sent_to_stream_stat(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
||||||
UserCount = apps.get_model('analytics', 'UserCount')
|
UserCount = apps.get_model('analytics', 'UserCount')
|
||||||
StreamCount = apps.get_model('analytics', 'StreamCount')
|
StreamCount = apps.get_model('analytics', 'StreamCount')
|
||||||
|
|
|
@ -3,6 +3,7 @@ from django.db import migrations
|
||||||
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
|
|
||||||
|
|
||||||
def clear_message_sent_by_message_type_values(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
def clear_message_sent_by_message_type_values(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
||||||
UserCount = apps.get_model('analytics', 'UserCount')
|
UserCount = apps.get_model('analytics', 'UserCount')
|
||||||
StreamCount = apps.get_model('analytics', 'StreamCount')
|
StreamCount = apps.get_model('analytics', 'StreamCount')
|
||||||
|
|
|
@ -3,6 +3,7 @@ from django.db import migrations
|
||||||
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
|
|
||||||
|
|
||||||
def clear_analytics_tables(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
def clear_analytics_tables(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
||||||
UserCount = apps.get_model('analytics', 'UserCount')
|
UserCount = apps.get_model('analytics', 'UserCount')
|
||||||
StreamCount = apps.get_model('analytics', 'StreamCount')
|
StreamCount = apps.get_model('analytics', 'StreamCount')
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.11.6 on 2018-01-29 08:14
|
# Generated by Django 1.11.6 on 2018-01-29 08:14
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.11.14 on 2018-09-25 12:02
|
# Generated by Django 1.11.14 on 2018-09-25 12:02
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.11.16 on 2018-12-22 21:05
|
# Generated by Django 1.11.16 on 2018-12-22 21:05
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.11.18 on 2019-01-19 05:01
|
# Generated by Django 1.11.18 on 2019-01-19 05:01
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Generated by Django 1.11.18 on 2019-01-28 13:04
|
# Generated by Django 1.11.18 on 2019-01-28 13:04
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import migrations
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import migrations, connection
|
from django.db import connection, migrations
|
||||||
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
|
|
||||||
from zerver.lib.migrate import do_batch_update
|
from zerver.lib.migrate import do_batch_update
|
||||||
|
|
||||||
|
|
||||||
def rebuild_pgroonga_index(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
def rebuild_pgroonga_index(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
do_batch_update(cursor, 'zerver_message', ['search_pgroonga'],
|
do_batch_update(cursor, 'zerver_message', ['search_pgroonga'],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.db import migrations
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -10,6 +10,7 @@ from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Add users to a MailChimp mailing list."""
|
help = """Add users to a MailChimp mailing list."""
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from django.core.management.base import CommandParser
|
||||||
from zerver.lib.actions import bulk_add_subscriptions, ensure_stream
|
from zerver.lib.actions import bulk_add_subscriptions, ensure_stream
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Add some or all users in a realm to a set of streams."""
|
help = """Add some or all users in a realm to a set of streams."""
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import absolute_import
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from zerver.lib.retention import archive_messages, clean_archived_data
|
from zerver.lib.retention import archive_messages, clean_archived_data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import parse_os_release, run, TIMESTAMP_FORMAT
|
from scripts.lib.zulip_tools import TIMESTAMP_FORMAT, parse_os_release, run
|
||||||
from version import ZULIP_VERSION
|
from version import ZULIP_VERSION
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.logging_handlers import try_git_describe
|
from zerver.logging_handlers import try_git_describe
|
||||||
|
|
|
@ -7,6 +7,7 @@ from zerver.lib.actions import do_mark_all_as_read
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import Message
|
from zerver.models import Message
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Bankrupt one or many users."""
|
help = """Bankrupt one or many users."""
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ from django.core.management.base import CommandError
|
||||||
from zerver.lib.actions import do_change_full_name
|
from zerver.lib.actions import do_change_full_name
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Change the names for many users."""
|
help = """Change the names for many users."""
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import Any
|
||||||
from zerver.lib.actions import do_change_user_delivery_email
|
from zerver.lib.actions import do_change_user_delivery_email
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Change the email address for a user."""
|
help = """Change the email address for a user."""
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,14 @@ import time
|
||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable, Optional
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand, CommandParser, CommandError
|
from django.core.management.base import BaseCommand, CommandError, \
|
||||||
|
CommandParser
|
||||||
|
|
||||||
from zerver.lib.rate_limiter import RateLimitedUser, \
|
from zerver.lib.rate_limiter import RateLimitedUser, client, max_api_calls, \
|
||||||
client, max_api_calls, max_api_window
|
max_api_window
|
||||||
from zerver.models import get_user_profile_by_id
|
from zerver.models import get_user_profile_by_id
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Checks redis to make sure our rate limiting system hasn't grown a bug
|
help = """Checks redis to make sure our rate limiting system hasn't grown a bug
|
||||||
and left redis with a bunch of data
|
and left redis with a bunch of data
|
||||||
|
|
|
@ -4,6 +4,7 @@ from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from zerver.lib.management import check_config
|
from zerver.lib.management import check_config
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Checks your Zulip Voyager Django configuration for issues."""
|
help = """Checks your Zulip Voyager Django configuration for issues."""
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import polib
|
|
||||||
import re
|
import re
|
||||||
import ujson
|
|
||||||
from subprocess import CalledProcessError, check_output
|
from subprocess import CalledProcessError, check_output
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
|
import polib
|
||||||
|
import ujson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.locale import LANG_INFO
|
from django.conf.locale import LANG_INFO
|
||||||
from django.core.management.base import CommandParser
|
from django.core.management.base import CommandParser
|
||||||
|
@ -14,6 +14,7 @@ from django.utils.translation.trans_real import to_language
|
||||||
|
|
||||||
from zerver.lib.i18n import with_language
|
from zerver.lib.i18n import with_language
|
||||||
|
|
||||||
|
|
||||||
class Command(compilemessages.Command):
|
class Command(compilemessages.Command):
|
||||||
|
|
||||||
def add_arguments(self, parser: CommandParser) -> None:
|
def add_arguments(self, parser: CommandParser) -> None:
|
||||||
|
|
|
@ -3,10 +3,12 @@ import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandParser, CommandError
|
from django.core.management.base import BaseCommand, CommandError, \
|
||||||
|
CommandParser
|
||||||
|
|
||||||
from zerver.data_import.gitter import do_convert_data
|
from zerver.data_import.gitter import do_convert_data
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Convert the Gitter data into Zulip data format."""
|
help = """Convert the Gitter data into Zulip data format."""
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,12 @@ spec:
|
||||||
exporting-from-hipchat-server-or-data-center-for-data-portability-950821555.html
|
exporting-from-hipchat-server-or-data-center-for-data-portability-950821555.html
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandParser, CommandError
|
from django.core.management.base import BaseCommand, CommandError, \
|
||||||
|
CommandParser
|
||||||
|
|
||||||
from zerver.data_import.hipchat import do_convert_data
|
from zerver.data_import.hipchat import do_convert_data
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Convert the Hipchat data into Zulip data format."""
|
help = """Convert the Hipchat data into Zulip data format."""
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,12 @@ Test out the realm:
|
||||||
go to browser and use your dev url
|
go to browser and use your dev url
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandParser, CommandError
|
from django.core.management.base import BaseCommand, CommandError, \
|
||||||
|
CommandParser
|
||||||
|
|
||||||
from zerver.data_import.mattermost import do_convert_data
|
from zerver.data_import.mattermost import do_convert_data
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Convert the mattermost data into Zulip data format."""
|
help = """Convert the mattermost data into Zulip data format."""
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,12 @@ import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandParser, CommandError
|
from django.core.management.base import BaseCommand, CommandError, \
|
||||||
|
CommandParser
|
||||||
|
|
||||||
from zerver.data_import.slack import do_convert_data
|
from zerver.data_import.slack import do_convert_data
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Convert the Slack data into Zulip data format."""
|
help = """Convert the Slack data into Zulip data format."""
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from zerver.lib.actions import ensure_stream
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import DefaultStreamGroup
|
from zerver.models import DefaultStreamGroup
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """
|
help = """
|
||||||
Create default stream groups which the users can choose during sign up.
|
Create default stream groups which the users can choose during sign up.
|
||||||
|
|
|
@ -4,6 +4,7 @@ from django.db import connection
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
def create_indexes() -> None:
|
def create_indexes() -> None:
|
||||||
# Creating concurrent indexes is kind of a pain with current versions
|
# Creating concurrent indexes is kind of a pain with current versions
|
||||||
# of Django/postgres, because you will get this error with seemingly
|
# of Django/postgres, because you will get this error with seemingly
|
||||||
|
|
|
@ -4,6 +4,7 @@ from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from zerver.lib.onboarding import create_if_missing_realm_internal_bots
|
from zerver.lib.onboarding import create_if_missing_realm_internal_bots
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """\
|
help = """\
|
||||||
Create realm internal bots if absent, in all realms.
|
Create realm internal bots if absent, in all realms.
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import Any
|
||||||
from zerver.lib.actions import create_stream_if_needed
|
from zerver.lib.actions import create_stream_if_needed
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Create a stream, and subscribe all active users (excluding bots).
|
help = """Create a stream, and subscribe all active users (excluding bots).
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ from zerver.lib.initial_password import initial_password
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import email_to_username
|
from zerver.models import email_to_username
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Create the specified user with a default initial password.
|
help = """Create the specified user with a default initial password.
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import Any
|
||||||
from zerver.lib.actions import do_deactivate_realm
|
from zerver.lib.actions import do_deactivate_realm
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Script to deactivate a realm."""
|
help = """Script to deactivate a realm."""
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,11 @@ from argparse import ArgumentParser
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from zerver.lib.actions import do_deactivate_user
|
from zerver.lib.actions import do_deactivate_user
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.lib.sessions import user_sessions
|
from zerver.lib.sessions import user_sessions
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = "Deactivate a user, including forcibly logging them out."
|
help = "Deactivate a user, including forcibly logging them out."
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ from django.core.management.base import BaseCommand, CommandError
|
||||||
from zerver.lib.actions import do_delete_old_unclaimed_attachments
|
from zerver.lib.actions import do_delete_old_unclaimed_attachments
|
||||||
from zerver.models import get_old_unclaimed_attachments
|
from zerver.models import get_old_unclaimed_attachments
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Remove unclaimed attachments from storage older than a supplied
|
help = """Remove unclaimed attachments from storage older than a supplied
|
||||||
numerical value indicating the limit of how old the attachment can be.
|
numerical value indicating the limit of how old the attachment can be.
|
||||||
|
|
|
@ -7,7 +7,6 @@ machines, as you may encounter multiple sends in a specific race
|
||||||
condition. (Alternatively, you can set `EMAIL_DELIVERER_DISABLED=True`
|
condition. (Alternatively, you can set `EMAIL_DELIVERER_DISABLED=True`
|
||||||
on all but one machine to make the command have no effect.)
|
on all but one machine to make the command have no effect.)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from typing import Any, Dict
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
|
from zerver.lib.actions import do_send_messages
|
||||||
from zerver.lib.logging_util import log_to_file
|
from zerver.lib.logging_util import log_to_file
|
||||||
from zerver.lib.management import sleep_forever
|
from zerver.lib.management import sleep_forever
|
||||||
from zerver.models import ScheduledMessage, Message, get_user_by_delivery_email
|
from zerver.models import Message, ScheduledMessage, get_user_by_delivery_email
|
||||||
from zerver.lib.actions import do_send_messages
|
|
||||||
|
|
||||||
## Setup ##
|
## Setup ##
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -8,6 +8,7 @@ from django.utils.timezone import utc as timezone_utc
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import Message, Recipient, Stream
|
from zerver.models import Message, Recipient, Stream
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = "Dump messages from public streams of a realm"
|
help = "Dump messages from public streams of a realm"
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@ We extract and validate the target stream from information in the
|
||||||
recipient address and retrieve, forward, and archive the message.
|
recipient address and retrieve, forward, and archive the message.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import email
|
import email
|
||||||
import logging
|
import logging
|
||||||
from email.message import Message
|
from email.message import Message
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from zerver.lib.queue import queue_json_publish
|
from zerver.lib.queue import queue_json_publish
|
||||||
|
|
||||||
|
|
||||||
def error(*args: Any) -> None:
|
def error(*args: Any) -> None:
|
||||||
raise Exception('We cannot enqueue because settings.USING_RABBITMQ is False.')
|
raise Exception('We cannot enqueue because settings.USING_RABBITMQ is False.')
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,11 @@ from typing import Any
|
||||||
|
|
||||||
from django.core.management.base import CommandError
|
from django.core.management.base import CommandError
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
|
||||||
from zerver.lib.export import export_realm_wrapper
|
from zerver.lib.export import export_realm_wrapper
|
||||||
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import Message, Reaction
|
from zerver.models import Message, Reaction
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Exports all data from a Zulip realm
|
help = """Exports all data from a Zulip realm
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from typing import Any
|
||||||
from zerver.lib.export import do_export_user
|
from zerver.lib.export import do_export_user
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Exports message data from a Zulip user
|
help = """Exports message data from a Zulip user
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from zerver.lib.export import export_usermessages_batch
|
from zerver.lib.export import export_usermessages_batch
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """UserMessage fetching helper for export.py"""
|
help = """UserMessage fetching helper for export.py"""
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from zerver.lib.cache_helpers import cache_fillers, fill_remote_cache
|
from zerver.lib.cache_helpers import cache_fillers, fill_remote_cache
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('--cache', dest="cache", default=None,
|
parser.add_argument('--cache', dest="cache", default=None,
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any, List, Optional
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
|
||||||
from zerver.lib.fix_unreads import fix
|
from zerver.lib.fix_unreads import fix
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.models import Realm, UserProfile
|
from zerver.models import Realm, UserProfile
|
||||||
|
|
||||||
logging.getLogger('zulip.fix_unreads').setLevel(logging.INFO)
|
logging.getLogger('zulip.fix_unreads').setLevel(logging.INFO)
|
||||||
|
|
|
@ -5,8 +5,9 @@ from django.core.management.base import CommandError
|
||||||
|
|
||||||
from confirmation.models import Confirmation, create_confirmation_link
|
from confirmation.models import Confirmation, create_confirmation_link
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import PreregistrationUser, email_allowed_for_realm, \
|
from zerver.models import DomainNotAllowedForRealmError, PreregistrationUser, \
|
||||||
DomainNotAllowedForRealmError
|
email_allowed_for_realm
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = "Generate activation links for users and print them to stdout."
|
help = "Generate activation links for users and print them to stdout."
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|
||||||
from zerver.lib.actions import ensure_stream, do_create_multiuse_invite_link
|
from zerver.lib.actions import do_create_multiuse_invite_link, ensure_stream
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import Stream, PreregistrationUser
|
from zerver.models import PreregistrationUser, Stream
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = "Generates invite link that can be used for inviting multiple users"
|
help = "Generates invite link that can be used for inviting multiple users"
|
||||||
|
|
|
@ -3,9 +3,10 @@ from typing import Any
|
||||||
from django.db import ProgrammingError
|
from django.db import ProgrammingError
|
||||||
|
|
||||||
from confirmation.models import generate_realm_creation_url
|
from confirmation.models import generate_realm_creation_url
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.models import Realm
|
from zerver.models import Realm
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """
|
help = """
|
||||||
Outputs a randomly generated, 1-time-use link for Organization creation.
|
Outputs a randomly generated, 1-time-use link for Organization creation.
|
||||||
|
|
|
@ -9,6 +9,7 @@ from django.db import DEFAULT_DB_ALIAS
|
||||||
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
||||||
from zerver.lib.test_fixtures import get_migration_status
|
from zerver.lib.test_fixtures import get_migration_status
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Get status of migrations."
|
help = "Get status of migrations."
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,12 @@ from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.core.management.base import BaseCommand, CommandParser, CommandError
|
from django.core.management.base import BaseCommand, CommandError, \
|
||||||
|
CommandParser
|
||||||
|
|
||||||
from zerver.lib.import_realm import do_import_realm, do_import_system_bots
|
|
||||||
from zerver.forms import check_subdomain_available
|
from zerver.forms import check_subdomain_available
|
||||||
|
from zerver.lib.import_realm import do_import_realm, do_import_system_bots
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Import extracted Zulip database dump directories into a fresh Zulip instance.
|
help = """Import extracted Zulip database dump directories into a fresh Zulip instance.
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any, Iterable, Tuple, Optional
|
from typing import Any, Iterable, Optional, Tuple
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from zerver.lib.actions import do_change_is_admin
|
from zerver.lib.actions import do_change_is_admin
|
||||||
from zerver.lib.bulk_create import bulk_create_users
|
from zerver.lib.bulk_create import bulk_create_users
|
||||||
from zerver.models import Realm, UserProfile, \
|
from zerver.models import Realm, UserProfile, email_to_username, get_client, \
|
||||||
email_to_username, get_client, get_system_bot
|
get_system_bot
|
||||||
|
|
||||||
settings.TORNADO_SERVER = None
|
settings.TORNADO_SERVER = None
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ from django.core.management.base import CommandError
|
||||||
from zerver.lib.actions import do_change_is_admin
|
from zerver.lib.actions import do_change_is_admin
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Give an existing user administrative permissions over their (own) Realm.
|
help = """Give an existing user administrative permissions over their (own) Realm.
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from typing import Any
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import Realm
|
from zerver.models import Realm
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """List realms in the server and it's configuration settings(optional).
|
help = """List realms in the server and it's configuration settings(optional).
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.lib.sessions import delete_all_deactivated_user_sessions, \
|
from zerver.lib.sessions import delete_all_deactivated_user_sessions, \
|
||||||
delete_all_user_sessions, delete_realm_user_sessions
|
delete_all_user_sessions, delete_realm_user_sessions
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = "Log out all users."
|
help = "Log out all users."
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ Credit for the approach goes to:
|
||||||
http://stackoverflow.com/questions/2090717
|
http://stackoverflow.com/questions/2090717
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -5,8 +5,9 @@ from zerver.lib.actions import bulk_add_subscriptions, \
|
||||||
bulk_remove_subscriptions, do_deactivate_stream
|
bulk_remove_subscriptions, do_deactivate_stream
|
||||||
from zerver.lib.cache import cache_delete_many, to_dict_cache_key_id
|
from zerver.lib.cache import cache_delete_many, to_dict_cache_key_id
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import Message, Subscription, \
|
from zerver.models import Message, Subscription, get_stream, \
|
||||||
get_stream, get_stream_recipient
|
get_stream_recipient
|
||||||
|
|
||||||
|
|
||||||
def bulk_delete_cache_keys(message_ids_to_clear: List[int]) -> None:
|
def bulk_delete_cache_keys(message_ids_to_clear: List[int]) -> None:
|
||||||
while len(message_ids_to_clear) > 0:
|
while len(message_ids_to_clear) > 0:
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Shows backlog count of ScheduledEmail
|
Shows backlog count of ScheduledEmail
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -11,6 +9,7 @@ from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.models import ScheduledEmail
|
from zerver.models import ScheduledEmail
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Shows backlog count of ScheduledEmail
|
help = """Shows backlog count of ScheduledEmail
|
||||||
(The number of currently overdue (by at least a minute) email jobs)
|
(The number of currently overdue (by at least a minute) email jobs)
|
||||||
|
|
|
@ -12,6 +12,7 @@ from django.utils import autoreload
|
||||||
|
|
||||||
from zerver.worker.queue_processors import get_active_worker_queues, get_worker
|
from zerver.worker.queue_processors import get_active_worker_queues, get_worker
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('--queue_name', metavar='<queue name>', type=str,
|
parser.add_argument('--queue_name', metavar='<queue name>', type=str,
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.core.management.base import BaseCommand
|
||||||
from zerver.lib.queue import SimpleQueueClient
|
from zerver.lib.queue import SimpleQueueClient
|
||||||
from zerver.worker.queue_processors import get_active_worker_queues
|
from zerver.worker.queue_processors import get_active_worker_queues
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument(dest="queue_name", type=str, nargs='?',
|
parser.add_argument(dest="queue_name", type=str, nargs='?',
|
||||||
|
|
|
@ -5,6 +5,7 @@ from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from zproject.backends import query_ldap
|
from zproject.backends import query_ldap
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
parser.add_argument('email', metavar='<email>', type=str,
|
parser.add_argument('email', metavar='<email>', type=str,
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.lib.rate_limiter import RateLimitedUser, \
|
from zerver.lib.rate_limiter import RateLimitedUser, block_access, \
|
||||||
block_access, unblock_access
|
unblock_access
|
||||||
from zerver.models import UserProfile, get_user_profile_by_api_key
|
from zerver.models import UserProfile, get_user_profile_by_api_key
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Manually block or unblock a user from accessing the API"""
|
help = """Manually block or unblock a user from accessing the API"""
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import Any
|
||||||
from zerver.lib.actions import do_reactivate_realm
|
from zerver.lib.actions import do_reactivate_realm
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Script to reactivate a deactivated realm."""
|
help = """Script to reactivate a deactivated realm."""
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,10 @@ from django.core.exceptions import ValidationError
|
||||||
from django.db.utils import IntegrityError
|
from django.db.utils import IntegrityError
|
||||||
|
|
||||||
from zerver.lib.domains import validate_domain
|
from zerver.lib.domains import validate_domain
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.models import RealmDomain, get_realm_domains
|
from zerver.models import RealmDomain, get_realm_domains
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Manage domains for the specified realm"""
|
help = """Manage domains for the specified realm"""
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,10 @@ from argparse import ArgumentParser
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from zerver.lib.actions import do_add_realm_filter, do_remove_realm_filter
|
from zerver.lib.actions import do_add_realm_filter, do_remove_realm_filter
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.models import all_realm_filters
|
from zerver.models import all_realm_filters
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Create a link filter rule for the specified realm.
|
help = """Create a link filter rule for the specified realm.
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
from argparse import ArgumentParser
|
|
||||||
import json
|
import json
|
||||||
import requests
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from argparse import ArgumentParser
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
import requests
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import CommandError
|
from django.core.management.base import CommandError
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
|
|
|
@ -6,6 +6,7 @@ from zerver.lib.actions import bulk_remove_subscriptions
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import get_stream
|
from zerver.models import get_stream
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Remove some or all users in a realm from a stream."""
|
help = """Remove some or all users in a realm from a stream."""
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from zerver.lib.actions import do_rename_stream
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import get_stream
|
from zerver.models import get_stream
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Change the stream name for a realm."""
|
help = """Change the stream name for a realm."""
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.core.management.base import CommandParser
|
from django.core.management.base import CommandParser
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.lib.retention import restore_all_data_from_archive, \
|
from zerver.lib.retention import restore_all_data_from_archive, \
|
||||||
restore_data_from_archive_by_realm, restore_data_from_archive
|
restore_data_from_archive, restore_data_from_archive_by_realm
|
||||||
from zerver.models import ArchiveTransaction
|
from zerver.models import ArchiveTransaction
|
||||||
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """
|
help = """
|
||||||
|
|
|
@ -3,8 +3,8 @@ import sys
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand, \
|
from django.core.management.base import BaseCommand, CommandError, \
|
||||||
CommandError, CommandParser
|
CommandParser
|
||||||
from tornado import ioloop
|
from tornado import ioloop
|
||||||
from tornado.log import app_log
|
from tornado.log import app_log
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ from zerver.tornado.application import create_tornado_application, \
|
||||||
from zerver.tornado.autoreload import start as zulip_autoreload_start
|
from zerver.tornado.autoreload import start as zulip_autoreload_start
|
||||||
from zerver.tornado.event_queue import add_client_gc_hook, \
|
from zerver.tornado.event_queue import add_client_gc_hook, \
|
||||||
missedmessage_hook, process_notification, setup_event_queue
|
missedmessage_hook, process_notification, setup_event_queue
|
||||||
from zerver.tornado.sharding import notify_tornado_queue_name, tornado_return_queue_name
|
from zerver.tornado.sharding import notify_tornado_queue_name, \
|
||||||
|
tornado_return_queue_name
|
||||||
from zerver.tornado.socket import respond_send_message
|
from zerver.tornado.socket import respond_send_message
|
||||||
|
|
||||||
if settings.USING_RABBITMQ:
|
if settings.USING_RABBITMQ:
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import Any
|
||||||
from zerver.lib.actions import do_scrub_realm
|
from zerver.lib.actions import do_scrub_realm
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Script to scrub a deactivated realm."""
|
help = """Script to scrub a deactivated realm."""
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
|
@ -10,6 +9,7 @@ from zerver.lib.send_email import FromAddress, send_email
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
from zerver.templatetags.app_filters import render_markdown_path
|
from zerver.templatetags.app_filters import render_markdown_path
|
||||||
|
|
||||||
|
|
||||||
def send_custom_email(users: List[UserProfile], options: Dict[str, Any]) -> None:
|
def send_custom_email(users: List[UserProfile], options: Dict[str, Any]) -> None:
|
||||||
"""
|
"""
|
||||||
Can be used directly with from a management shell with
|
Can be used directly with from a management shell with
|
||||||
|
|
|
@ -8,6 +8,7 @@ from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.lib.send_email import FromAddress, send_email
|
from zerver.lib.send_email import FromAddress, send_email
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Send email to specified email address."""
|
help = """Send email to specified email address."""
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
|
||||||
from zerver.lib.actions import do_send_realm_reactivation_email
|
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from zerver.lib.actions import do_send_realm_reactivation_email
|
||||||
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Sends realm reactivation email to admins"""
|
help = """Sends realm reactivation email to admins"""
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import Any
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Send some stats to statsd."""
|
help = """Send some stats to statsd."""
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.core.management.commands import sendtestemail
|
||||||
|
|
||||||
from zerver.lib.send_email import FromAddress
|
from zerver.lib.send_email import FromAddress
|
||||||
|
|
||||||
|
|
||||||
class Command(sendtestemail.Command):
|
class Command(sendtestemail.Command):
|
||||||
def handle(self, *args: Any, **kwargs: str) -> None:
|
def handle(self, *args: Any, **kwargs: str) -> None:
|
||||||
if settings.WARN_NO_EMAIL:
|
if settings.WARN_NO_EMAIL:
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
import os
|
|
||||||
import email
|
import email
|
||||||
import ujson
|
import os
|
||||||
|
|
||||||
from email.message import Message
|
from email.message import Message
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
from typing import Dict, Optional
|
||||||
|
|
||||||
|
import ujson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import CommandParser
|
from django.core.management.base import CommandParser
|
||||||
|
|
||||||
from zerver.lib.email_mirror import mirror_email_message
|
from zerver.lib.email_mirror import mirror_email_message
|
||||||
from zerver.lib.email_mirror_helpers import encode_email_address
|
from zerver.lib.email_mirror_helpers import encode_email_address
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
|
from zerver.models import Realm, get_realm, get_stream
|
||||||
from zerver.models import Realm, get_stream, get_realm
|
|
||||||
|
|
||||||
from typing import Dict, Optional
|
|
||||||
|
|
||||||
# This command loads an email from a specified file and sends it
|
# This command loads an email from a specified file and sends it
|
||||||
# to the email mirror. Simple emails can be passed in a JSON file,
|
# to the email mirror. Simple emails can be passed in a JSON file,
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import os
|
import os
|
||||||
import ujson
|
from typing import Dict, Optional, Union
|
||||||
from typing import Union, Dict, Optional
|
|
||||||
|
|
||||||
|
import ujson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import CommandParser
|
from django.core.management.base import CommandParser
|
||||||
from django.test import Client
|
from django.test import Client
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.lib.webhooks.common import standardize_headers
|
from zerver.lib.webhooks.common import standardize_headers
|
||||||
from zerver.models import get_realm
|
from zerver.models import get_realm
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """
|
help = """
|
||||||
Create webhook message based on given fixture
|
Create webhook message based on given fixture
|
||||||
|
|
|
@ -6,9 +6,10 @@ from django.core.management.base import CommandParser
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from zerver.lib import utils
|
from zerver.lib import utils
|
||||||
from zerver.lib.management import ZulipBaseCommand, CommandError
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
||||||
from zerver.models import UserMessage
|
from zerver.models import UserMessage
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Sets user message flags. Used internally by actions.py. Marks all
|
help = """Sets user message flags. Used internally by actions.py. Marks all
|
||||||
Expects a comma-delimited list of user message ids via stdin, and an EOF to terminate."""
|
Expects a comma-delimited list of user message ids via stdin, and an EOF to terminate."""
|
||||||
|
|
|
@ -3,6 +3,7 @@ from typing import Any
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
help = """Show the admins in a realm."""
|
help = """Show the admins in a realm."""
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.lib.topic_mutes import build_topic_mute_checker
|
from zerver.lib.topic_mutes import build_topic_mute_checker
|
||||||
from zerver.models import Recipient, Subscription, UserMessage, UserProfile
|
from zerver.models import Recipient, Subscription, UserMessage, UserProfile
|
||||||
|
|
||||||
|
|
||||||
def get_unread_messages(user_profile: UserProfile) -> List[Dict[str, Any]]:
|
def get_unread_messages(user_profile: UserProfile) -> List[Dict[str, Any]]:
|
||||||
user_msgs = UserMessage.objects.filter(
|
user_msgs = UserMessage.objects.filter(
|
||||||
user_profile=user_profile,
|
user_profile=user_profile,
|
||||||
|
|
|
@ -6,10 +6,11 @@ from django.conf import settings
|
||||||
from django.core.management.base import CommandError
|
from django.core.management.base import CommandError
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.lib.soft_deactivation import do_soft_activate_users, \
|
from zerver.lib.soft_deactivation import do_auto_soft_deactivate_users, \
|
||||||
do_soft_deactivate_users, do_auto_soft_deactivate_users, logger
|
do_soft_activate_users, do_soft_deactivate_users, logger
|
||||||
from zerver.models import Realm, UserProfile
|
from zerver.models import Realm, UserProfile
|
||||||
|
|
||||||
|
|
||||||
def get_users_from_emails(emails: List[str],
|
def get_users_from_emails(emails: List[str],
|
||||||
filter_kwargs: Dict[str, Realm]) -> List[UserProfile]:
|
filter_kwargs: Dict[str, Realm]) -> List[UserProfile]:
|
||||||
# Bug: Ideally, this would be case-insensitive like our other email queries.
|
# Bug: Ideally, this would be case-insensitive like our other email queries.
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|
||||||
from django.db import transaction
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db import transaction
|
||||||
|
|
||||||
from zerver.lib.logging_util import log_to_file
|
from zerver.lib.logging_util import log_to_file
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand, CommandParser, CommandError
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.management.base import BaseCommand, CommandError, \
|
||||||
|
CommandParser
|
||||||
|
|
||||||
from zerver.lib.transfer import transfer_uploads_to_s3
|
from zerver.lib.transfer import transfer_uploads_to_s3
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = """Transfer uploads to S3 """
|
help = """Transfer uploads to S3 """
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue