mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
Enhance CyberPanel functionality with FTP Quota and Bandwidth Management features: Added models, views, and templates for managing FTP quotas and bandwidth resets. Implemented IP blocking functionality with associated views and templates. Updated system scripts for improved repository synchronization and OS detection. Removed outdated workflow files.
This commit is contained in:
70
cli/repositorySync.py
Normal file
70
cli/repositorySync.py
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
# Add CyberPanel to Python path
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
from repositorySync.repositorySyncManager import RepositorySyncManager
|
||||
from plogical.upgrade import Upgrade
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='CyberPanel Repository Sync Tool')
|
||||
parser.add_argument('--force', action='store_true', help='Force sync even if conflicts exist')
|
||||
parser.add_argument('--status', action='store_true', help='Show sync status')
|
||||
parser.add_argument('--sync', action='store_true', help='Perform repository sync')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.status:
|
||||
# Show sync status
|
||||
try:
|
||||
status = Upgrade.getRepositorySyncStatus()
|
||||
print("Repository Sync Status:")
|
||||
print(f"Last Sync: {status.get('last_sync', 'Never')}")
|
||||
print(f"Branches Synced: {status.get('branches_synced', [])}")
|
||||
print(f"Tags Synced: {status.get('tags_synced', False)}")
|
||||
if 'errors' in status:
|
||||
print(f"Errors: {status['errors']}")
|
||||
except Exception as e:
|
||||
print(f"Error getting status: {str(e)}")
|
||||
sys.exit(1)
|
||||
|
||||
elif args.sync:
|
||||
# Perform sync
|
||||
try:
|
||||
print("Starting repository synchronization...")
|
||||
success, message = Upgrade.syncRepositoryToGitee(force_sync=args.force)
|
||||
if success:
|
||||
print(f"✓ {message}")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print(f"✗ {message}")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(f"Error during sync: {str(e)}")
|
||||
sys.exit(1)
|
||||
|
||||
else:
|
||||
# Default action - perform sync
|
||||
try:
|
||||
print("Starting repository synchronization...")
|
||||
success, message = Upgrade.syncRepositoryToGitee(force_sync=args.force)
|
||||
if success:
|
||||
print(f"✓ {message}")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print(f"✗ {message}")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(f"Error during sync: {str(e)}")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user