mirror of https://github.com/zulip/zulip.git
management: Move commands to all use ZulipBaseCommand.
This commit is contained in:
parent
a68bc645ed
commit
88be3246a0
|
@ -3,12 +3,12 @@ import time
|
|||
from datetime import timedelta
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
from analytics.lib.counts import ALL_COUNT_STATS, CountStat
|
||||
from analytics.models import installation_epoch
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.timestamp import TimeZoneNotUTCError, floor_to_day, floor_to_hour, verify_UTC
|
||||
from zerver.models import Realm
|
||||
|
||||
|
@ -20,7 +20,7 @@ states = {
|
|||
}
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Checks FillState table.
|
||||
|
||||
Run as a cron job that runs every hour."""
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
from argparse import ArgumentParser
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.management.base import CommandError
|
||||
from typing_extensions import override
|
||||
|
||||
from analytics.lib.counts import do_drop_all_analytics_tables
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Clear analytics tables."""
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
from argparse import ArgumentParser
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.management.base import CommandError
|
||||
from typing_extensions import override
|
||||
|
||||
from analytics.lib.counts import ALL_COUNT_STATS, do_drop_single_stat
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Clear analytics tables."""
|
||||
|
||||
@override
|
||||
|
|
|
@ -3,7 +3,6 @@ from datetime import timedelta
|
|||
from typing import Any, Dict, List, Mapping, Type, Union
|
||||
|
||||
from django.core.files.uploadedfile import UploadedFile
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import TypeAlias, override
|
||||
|
||||
|
@ -21,6 +20,7 @@ from analytics.models import (
|
|||
from zerver.actions.create_realm import do_create_realm
|
||||
from zerver.actions.users import do_change_user_role
|
||||
from zerver.lib.create_user import create_user
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.storage import static_path
|
||||
from zerver.lib.stream_color import STREAM_ASSIGNMENT_COLORS
|
||||
from zerver.lib.timestamp import floor_to_day
|
||||
|
@ -38,7 +38,7 @@ from zerver.models import (
|
|||
from zerver.models.groups import SystemGroups
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Populates analytics tables with randomly generated data."""
|
||||
|
||||
DAYS_OF_DATA = 100
|
||||
|
|
|
@ -5,19 +5,18 @@ from datetime import timezone
|
|||
from typing import Any, Dict
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils.dateparse import parse_datetime
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
from analytics.lib.counts import ALL_COUNT_STATS, logger, process_count_stat
|
||||
from zerver.lib.management import abort_unless_locked
|
||||
from zerver.lib.management import ZulipBaseCommand, abort_unless_locked
|
||||
from zerver.lib.remote_server import send_server_data_to_push_bouncer
|
||||
from zerver.lib.timestamp import floor_to_hour
|
||||
from zerver.models import Realm
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Fills Analytics tables.
|
||||
|
||||
Run as a cron job that runs every hour."""
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import abort_unless_locked
|
||||
from zerver.lib.management import ZulipBaseCommand, abort_unless_locked
|
||||
from zerver.lib.retention import archive_messages, clean_archived_data
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
@override
|
||||
@abort_unless_locked
|
||||
def handle(self, *args: Any, **options: str) -> None:
|
||||
|
|
|
@ -3,15 +3,16 @@ import time
|
|||
from typing import Any, Callable, Optional
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand, CommandError, CommandParser
|
||||
from django.core.management.base import CommandError, CommandParser
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.partial import partial
|
||||
from zerver.lib.rate_limiter import RateLimitedUser, client
|
||||
from zerver.models.users import get_user_profile_by_id
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Checks Redis to make sure our rate limiting system hasn't grown a bug
|
||||
and left Redis with a bunch of data
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import check_config
|
||||
from zerver.lib.management import ZulipBaseCommand, check_config
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Checks /etc/zulip/settings.py for common configuration issues."""
|
||||
|
||||
@override
|
||||
|
|
|
@ -16,12 +16,13 @@ Test out the realm:
|
|||
go to browser and use your dev url
|
||||
"""
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError, CommandParser
|
||||
from django.core.management.base import CommandError, CommandParser
|
||||
|
||||
from zerver.data_import.mattermost import do_convert_data
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Convert the mattermost data into Zulip data format."""
|
||||
|
||||
@override
|
||||
|
|
|
@ -2,13 +2,14 @@ import argparse
|
|||
import os
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError, CommandParser
|
||||
from django.core.management.base import CommandError, CommandParser
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.data_import.rocketchat import do_convert_data
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Convert the Rocketchat data into Zulip data format."""
|
||||
|
||||
@override
|
||||
|
|
|
@ -4,13 +4,14 @@ import tempfile
|
|||
from typing import Any
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand, CommandError, CommandParser
|
||||
from django.core.management.base import CommandError, CommandParser
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.data_import.slack import do_convert_data
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Convert the Slack data into Zulip data format."""
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.onboarding import create_if_missing_realm_internal_bots
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """\
|
||||
Create realm internal bots if absent, in all realms.
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@ from argparse import ArgumentParser
|
|||
from datetime import timedelta
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.management.base import CommandError
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.actions.uploads import do_delete_old_unclaimed_attachments
|
||||
from zerver.lib.attachments import get_old_unclaimed_attachments
|
||||
from zerver.lib.management import abort_unless_locked
|
||||
from zerver.lib.management import ZulipBaseCommand, abort_unless_locked
|
||||
from zerver.lib.upload import all_message_attachments, delete_message_attachments
|
||||
from zerver.models import ArchivedAttachment, Attachment
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Remove unclaimed attachments from storage older than a supplied
|
||||
numerical value indicating the limit of how old the attachment can be.
|
||||
The default is five weeks."""
|
||||
|
|
|
@ -10,12 +10,12 @@ import time
|
|||
from typing import Any
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import transaction
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.logging_util import log_to_file
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.send_email import EmailNotDeliveredError, deliver_scheduled_emails
|
||||
from zerver.models import ScheduledEmail
|
||||
|
||||
|
@ -24,7 +24,7 @@ logger = logging.getLogger(__name__)
|
|||
log_to_file(logger, settings.EMAIL_DELIVERER_LOG_PATH)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Send emails queued by various parts of Zulip
|
||||
for later delivery.
|
||||
|
||||
|
|
|
@ -4,19 +4,19 @@ from datetime import timedelta
|
|||
from typing import Any
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.actions.scheduled_messages import try_deliver_one_scheduled_message
|
||||
from zerver.lib.logging_util import log_to_file
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
## Setup ##
|
||||
logger = logging.getLogger(__name__)
|
||||
log_to_file(logger, settings.DELIVER_SCHEDULED_MESSAGES_LOG_PATH)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Deliver scheduled messages from the ScheduledMessage table.
|
||||
Run this command under supervisor.
|
||||
|
||||
|
|
|
@ -26,10 +26,11 @@ from imaplib import IMAP4_SSL
|
|||
from typing import Any, Generator
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.management.base import CommandError
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.email_mirror import logger, process_message
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
## Setup ##
|
||||
|
||||
|
@ -79,7 +80,7 @@ def get_imap_messages() -> Generator[EmailMessage, None, None]:
|
|||
mbox.logout()
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = __doc__
|
||||
|
||||
@override
|
||||
|
|
|
@ -3,20 +3,19 @@ from datetime import timedelta
|
|||
from typing import Any
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.digest import DIGEST_CUTOFF, enqueue_emails
|
||||
from zerver.lib.logging_util import log_to_file
|
||||
from zerver.lib.management import abort_unless_locked
|
||||
from zerver.lib.management import ZulipBaseCommand, abort_unless_locked
|
||||
|
||||
## Logging setup ##
|
||||
logger = logging.getLogger(__name__)
|
||||
log_to_file(logger, settings.DIGEST_LOG_PATH)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Enqueue digest emails for users that haven't checked the app
|
||||
in a while.
|
||||
"""
|
||||
|
|
|
@ -3,9 +3,9 @@ from argparse import ArgumentParser
|
|||
from typing import IO, Any
|
||||
|
||||
import orjson
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.queue import queue_json_publish
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ def enqueue_file(queue_name: str, f: IO[str]) -> None:
|
|||
queue_json_publish(queue_name, data, error)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Read JSON lines from a file and enqueue them to a worker queue.
|
||||
|
||||
Each line in the file should either be a JSON payload or two tab-separated
|
||||
|
|
|
@ -4,13 +4,13 @@ import os
|
|||
from argparse import ArgumentParser
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.export import export_usermessages_batch
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """UserMessage fetching helper for export.py"""
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from argparse import ArgumentParser
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.cache_helpers import cache_fillers, fill_remote_cache
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
@override
|
||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||
parser.add_argument(
|
||||
|
|
|
@ -2,15 +2,15 @@ import argparse
|
|||
import os
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import DEFAULT_DB_ALIAS
|
||||
from typing_extensions import override
|
||||
|
||||
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.test_fixtures import get_migration_status
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = "Get status of migrations."
|
||||
|
||||
@override
|
||||
|
|
|
@ -8,14 +8,15 @@ from typing import Any
|
|||
from django.conf import settings
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import BaseCommand, CommandError, CommandParser
|
||||
from django.core.management.base import CommandError, CommandParser
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.forms import OverridableValidationError, check_subdomain_available
|
||||
from zerver.lib.import_realm import do_import_realm
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Import extracted Zulip database dump directories into a fresh Zulip instance.
|
||||
|
||||
This command should be used only on a newly created, empty Zulip instance to
|
||||
|
|
|
@ -9,11 +9,12 @@ from types import FrameType
|
|||
from typing import Any, Iterator, List, Optional
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.management.base import CommandError
|
||||
from django.utils import autoreload
|
||||
from sentry_sdk import configure_scope
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.worker.queue_processors import get_active_worker_queues, get_worker
|
||||
|
||||
|
||||
|
@ -33,7 +34,7 @@ def log_and_exit_if_exception(
|
|||
sys.exit(1)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
@override
|
||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||
parser.add_argument("--queue_name", metavar="<queue name>", help="queue to process")
|
||||
|
|
|
@ -2,14 +2,14 @@ from argparse import ArgumentParser
|
|||
from typing import Any
|
||||
|
||||
from django.core.management import CommandError
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.queue import SimpleQueueClient
|
||||
from zerver.worker.queue_processors import get_active_worker_queues
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
@override
|
||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||
parser.add_argument(dest="queue_name", nargs="?", help="queue to purge")
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
from argparse import ArgumentParser
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zproject.backends import query_ldap
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
@override
|
||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||
parser.add_argument("email", metavar="<email>", help="email of user to query")
|
||||
|
|
|
@ -7,10 +7,12 @@ from urllib.parse import SplitResult
|
|||
|
||||
from asgiref.sync import async_to_sync, sync_to_async
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand, CommandError, CommandParser
|
||||
from django.core.management.base import CommandError, CommandParser
|
||||
from tornado.platform.asyncio import AsyncIOMainLoop
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
settings.RUNNING_INSIDE_TORNADO = True
|
||||
if settings.PRODUCTION:
|
||||
settings.SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
|
@ -34,7 +36,7 @@ if settings.USING_RABBITMQ:
|
|||
asyncio.set_event_loop_policy(NoAutoCreateEventLoopPolicy())
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = "Starts a Tornado Web server wrapping Django."
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
from typing import Any
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand, CommandError, CommandParser
|
||||
from django.core.management.base import CommandError, CommandParser
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.transfer import transfer_uploads_to_s3
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Transfer uploads to S3 """
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from typing import Any, Dict, List
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.actions.create_user import do_create_user
|
||||
|
@ -9,13 +8,14 @@ from zerver.actions.reactions import do_add_reaction
|
|||
from zerver.actions.streams import bulk_add_subscriptions
|
||||
from zerver.actions.user_settings import do_change_avatar_fields
|
||||
from zerver.lib.emoji import get_emoji_data
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.streams import ensure_stream
|
||||
from zerver.lib.upload import upload_avatar_image
|
||||
from zerver.models import Message, UserProfile
|
||||
from zerver.models.realms import get_realm
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Add a mock conversation to the development environment.
|
||||
|
||||
Usage: ./manage.py add_mock_conversation
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from django.core.management.base import CommandParser
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
from corporate.lib.stripe import RemoteServerBillingSession
|
||||
from scripts.lib.zulip_tools import TIMESTAMP_FORMAT
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zilencer.models import RemoteZulipServer
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = "Assigns an existing RemoteZulipServer to the legacy plan"
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
from typing import Any
|
||||
|
||||
import orjson
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from django.core.management.base import CommandParser
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """
|
||||
Compare rendered messages from files.
|
||||
Usage: ./manage.py compare_messages <dump1> <dump2>
|
||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any
|
|||
import bmemcached
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import F
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.models import UserMessage
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Script to mark all messages as unread."""
|
||||
|
||||
@override
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import Any, Dict, Optional
|
|||
|
||||
import stripe
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from django.core.management.base import CommandParser
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
|
@ -24,6 +24,7 @@ from zerver.actions.create_realm import do_create_realm
|
|||
from zerver.actions.create_user import do_create_user
|
||||
from zerver.actions.streams import bulk_add_subscriptions
|
||||
from zerver.apps import flush_cache
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.remote_server import get_realms_info_for_push_bouncer
|
||||
from zerver.lib.streams import create_stream_if_needed
|
||||
from zerver.models import Realm, UserProfile
|
||||
|
@ -63,7 +64,7 @@ class CustomerProfile:
|
|||
remote_server_plan_start_date: str = "billing_cycle_end_date"
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = "Populate database with different types of realms that can exist."
|
||||
|
||||
@override
|
||||
|
|
|
@ -11,7 +11,7 @@ from django.conf import settings
|
|||
from django.contrib.sessions.models import Session
|
||||
from django.core.files.base import File
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from django.core.management.base import CommandParser
|
||||
from django.core.validators import validate_email
|
||||
from django.db import connection
|
||||
from django.db.models import F
|
||||
|
@ -36,6 +36,7 @@ from zerver.actions.user_settings import do_change_user_setting
|
|||
from zerver.actions.users import do_change_user_role
|
||||
from zerver.lib.bulk_create import bulk_create_streams
|
||||
from zerver.lib.generate_test_data import create_test_data, generate_topics
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.onboarding import create_if_missing_realm_internal_bots
|
||||
from zerver.lib.push_notifications import logger as push_notifications_logger
|
||||
from zerver.lib.remote_server import get_realms_info_for_push_bouncer
|
||||
|
@ -201,7 +202,7 @@ def create_alert_words(realm_id: int) -> None:
|
|||
AlertWord.objects.bulk_create(recs)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = "Populate a test database"
|
||||
|
||||
@override
|
||||
|
|
|
@ -2,14 +2,15 @@ import csv
|
|||
from timeit import timeit
|
||||
from typing import Any, Union
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from django.core.management.base import CommandParser
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.queue import SimpleQueueClient, queue_json_publish
|
||||
from zerver.worker.test import BatchNoopWorker, NoopWorker
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Times the overhead of enqueuing and dequeuing messages from RabbitMQ."""
|
||||
|
||||
@override
|
||||
|
|
|
@ -2,10 +2,11 @@ import os
|
|||
from typing import Any, Iterator
|
||||
|
||||
import orjson
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from django.core.management.base import CommandParser
|
||||
from django.db.models import QuerySet
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.markdown import render_message_markdown
|
||||
from zerver.models import Message
|
||||
|
||||
|
@ -19,7 +20,7 @@ def queryset_iterator(queryset: QuerySet[Message], chunksize: int = 5000) -> Ite
|
|||
queryset = queryset.filter(id__gt=msg_id)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """
|
||||
Render messages to a file.
|
||||
Usage: ./manage.py render_messages <destination> [--amount=10000]
|
||||
|
|
|
@ -2,15 +2,15 @@ import os
|
|||
from configparser import ConfigParser
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.models import UserProfile
|
||||
from zerver.models.realms import get_realm
|
||||
from zerver.models.users import get_user_by_delivery_email
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Sync your API key from ~/.zuliprc into your development instance"""
|
||||
|
||||
@override
|
||||
|
|
Loading…
Reference in New Issue