Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
RhinosF1 and coderabbitai[bot] authored May 18, 2024
1 parent b9a1f9f commit 76c084b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions miraheze/swift/fix_container_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ def fix_container_perms(wiki: str) -> None:
out = subprocess.run(['sudo', '-u', 'www-data', 'php', '/srv/mediawiki/1.41/maintenance/run.php', '/srv/mediawiki/1.41/extensions/CreateWiki/maintenance/setContainersAccess.php', '--wiki', wiki], capture_output=True, text=True)
matches = re.findall(r"Making sure 'mwstore:\/\/miraheze-swift\/([^']+)' [^\n]+\.failed\.", out.stdout)
for match in matches:
os.system(f"swift post --read-acl 'mw:media' --write-acl 'mw:media' miraheze-{wiki}-{match}")
subprocess.run(['swift', 'post', '--read-acl', 'mw:media', '--write-acl', 'mw:media', f'miraheze-{wiki}-{match}'], check=True)

os.system(f'sudo -u www-data php /srv/mediawiki/1.41/maintenance/run.php /srv/mediawiki/1.41/extensions/CreateWiki/maintenance/setContainersAccess.php --wiki {wiki}')


def main() -> None:
parser = argparse.ArgumentParser(description='Executes the commands needed to reset wikis')
parser = argparse.ArgumentParser(description='Fix container permissions for a specified wiki')
parser.add_argument('--wiki', required=True, help='wiki database name')

args = parser.parse_args()
Expand Down

0 comments on commit 76c084b

Please sign in to comment.