@@ -806,15 +806,17 @@ def meza_command_update(argv):
806806 subprocess .check_output (["git" , "fetch" , meza_remote , "--tags" ])
807807 except subprocess .CalledProcessError :
808808 # If tag fetch fails due to conflicts, try with --force
809- subprocess .check_output (["git" , "fetch" , meza_remote , "--tags" , "--force" ])
809+ subprocess .check_output (
810+ ["git" , "fetch" , meza_remote , "--tags" , "--force" ])
810811 tags_text = subprocess .check_output (["git" , "tag" , "-l" ]).decode ()
811812
812813 if not argv :
813814 # print fetch.strip()
814815 print ("The following versions are available:" )
815816
816817 # Filter tags to only show those starting with "43" and sort numerically
817- all_tags = [tag .strip () for tag in tags_text .strip ().split ("\n " ) if tag .strip ()]
818+ all_tags = [tag .strip ()
819+ for tag in tags_text .strip ().split ("\n " ) if tag .strip ()]
818820 version_43_tags = [tag for tag in all_tags if tag .startswith ("43." )]
819821
820822 # Sort numerically by parsing version components
@@ -1408,11 +1410,18 @@ def meza_command_setbaseconfig(argv):
14081410 meza_shell_exec_exit (rc )
14091411
14101412
1411- # FIXME #825: It would be great to have this function automatically map all
1412- # scripts in MediaWiki's maintenance directory to all wikis. Then
1413- # you could do:
1414- # $ meza maint runJobs + argv --> run jobs on all wikis
1415- # $ meza maint createAndPromote + argv --> create a user on all wikis
1413+ # General-purpose maintenance script runner implemented.
1414+ # The run-maintenance.yml playbook can now run any MediaWiki
1415+ # maintenance script on all wikis or specific wikis. Examples:
1416+ # $ ansible-playbook run-maintenance.yml -e "maintenance_script=runJobs"
1417+ # $ ansible-playbook run-maintenance.yml -e "maintenance_script=createAndPromote" -e "maintenance_args=--bureaucrat"
1418+ #
1419+ # The meza maint command provides pre-configured shortcuts for common operations:
1420+ # $ meza maint cleanuploadstash <env> --> run cleanupUploadStash.php on all wikis
1421+ # $ meza maint rebuild <env> --> rebuild search index and SMW
1422+ # $ meza maint run-jobs --> run jobs on all wikis
1423+ #
1424+ # For custom scripts, use the playbook directly with maintenance_script parameter.
14161425def meza_command_maint (argv ):
14171426 """
14181427 Executes the specified maintenance sub-command.
@@ -1448,12 +1457,12 @@ def meza_command_maint_run_jobs(argv):
14481457 This function executes the meza `runAllJobs.php` script.
14491458
14501459 By default, it will run jobs for ALL wikis. The wiki id used is just to get
1451- meza to run. If a specific wiki is provided as a command-line argument,
1460+ meza to run. If a specific wiki is provided as a command-line argument,
14521461 the function runs maintenance jobs only for that wiki.
14531462
14541463 Usage:
14551464 Run jobs for all wikis:
1456- sudo meza maint run_jobs
1465+ sudo meza maint run_jobs
14571466
14581467 Run jobs for a specific wiki (e.g., 'demo'):
14591468 sudo meza maint run_jobs -- demo
@@ -2010,7 +2019,8 @@ def _get_github_help_url(filename):
20102019 # Try to detect current git branch
20112020 try :
20122021 branch = subprocess .check_output (
2013- ["git" , f"--git-dir={ install_dir } /meza/.git" , "rev-parse" , "--abbrev-ref" , "HEAD" ],
2022+ ["git" , f"--git-dir={ install_dir } /meza/.git" ,
2023+ "rev-parse" , "--abbrev-ref" , "HEAD" ],
20142024 stderr = subprocess .DEVNULL
20152025 ).decode ().strip ()
20162026 except (subprocess .CalledProcessError , FileNotFoundError ):
@@ -2062,7 +2072,8 @@ def display_docs(name):
20622072
20632073 # Check if content has tables and rich version might have issues
20642074 if '|' in content and 'Command' in content :
2065- console .print ("\n [dim]Note: For best table formatting, view the full documentation at:[/dim]" )
2075+ console .print (
2076+ "\n [dim]Note: For best table formatting, view the full documentation at:[/dim]" )
20662077 github_url = _get_github_help_url (f"{ name } .md" )
20672078 console .print (f"[link]{ github_url } [/link]" )
20682079
@@ -2148,9 +2159,11 @@ def _display_enhanced_plain_text(content, file_path):
21482159 print ("─" * 80 )
21492160 else :
21502161 # Clean up table cells and format
2151- cells = [cell .strip () for cell in line .split ('|' ) if cell .strip ()]
2162+ cells = [cell .strip ()
2163+ for cell in line .split ('|' ) if cell .strip ()]
21522164 if cells :
2153- formatted = " " .join (f"{ cell :<20} " for cell in cells [:4 ]) # Limit to 4 columns
2165+ # Limit to 4 columns
2166+ formatted = " " .join (f"{ cell :<20} " for cell in cells [:4 ])
21542167 print (formatted )
21552168 continue
21562169 else :
@@ -2214,7 +2227,8 @@ def meza_command_help(argv):
22142227 md_file = f'{ install_dir } /meza/manual/meza-cmd/{ command } .md'
22152228 txt_file = f'{ install_dir } /meza/manual/meza-cmd/{ command } .txt'
22162229
2217- help_file = md_file if os .path .exists (md_file ) else (txt_file if os .path .exists (txt_file ) else None )
2230+ help_file = md_file if os .path .exists (md_file ) else (
2231+ txt_file if os .path .exists (txt_file ) else None )
22182232
22192233 if not help_file :
22202234 print (f"Help file not found for command: { command } " )
0 commit comments