def rotate_backup_inventory(path, dry_run=False, **kwargs): if dry_run: logging.info("! DRY RUN !") for site_details in WPConfig.inventory(path): if site_details.valid == settings.WP_SITE_INSTALL_OK: try: path = WPBackup( WPSite.openshift_env_from_path(site_details.path), site_details.url).path # rotate full backups first for pattern in [["*full.sql"], ["*full.tar", "*full.tar.gz"]]: RotateBackups(FULL_BACKUP_RETENTION_THEME, dry_run=dry_run, include_list=pattern).rotate_backups(path) # rotate incremental backups for pattern in [["*.list"], ["*inc.sql"], ["*inc.tar", "*inc.tar.gz"]]: RotateBackups(INCREMENTAL_BACKUP_RETENTION_THEME, dry_run=dry_run, include_list=pattern).rotate_backups(path) except: logging.error("Site %s - Error %s", site_details.url, sys.exc_info())
def update_plugins_inventory(path, plugin=None, force_plugin=False, force_options=False, strict_list=False, extra_config=None, **kwargs): logging.info("Update plugins from inventory...") for site_details in WPConfig.inventory(path): if site_details.valid == settings.WP_SITE_INSTALL_OK: logging.info("Updating plugins for %s", site_details.url) all_params = { 'openshift_env': WPSite.openshift_env_from_path(site_details.path), 'wp_site_url': site_details.url } # if we have extra configuration to load, if extra_config is not None: all_params = _add_extra_config(extra_config, all_params) WPGenerator(all_params).update_plugins( only_one=plugin, force_plugin=force_plugin, force_options=force_options, strict_plugin_list=strict_list) logging.info("All plugins updates done for path: %s", path)
def backup_inventory(path, dry_run=False, **kwargs): """ Backup all WordPress instances found in a given path :param path: :param dry_run: :param kwargs: :return: """ if dry_run: logging.info("! DRY RUN !") logging.info("Backup from inventory...") for site_details in WPConfig.inventory(path): if site_details.valid == settings.WP_SITE_INSTALL_OK: logging.info("Running backup for %s", site_details.url) try: WPBackup(WPSite.openshift_env_from_path(site_details.path), site_details.url, dry_run=dry_run).backup() except: logging.error("Site %s - Error %s", site_details.url, sys.exc_info()) logging.info("All backups done for path: %s", path)
def backup_inventory(path, **kwargs): logging.info("Backup from inventory...") for site_details in WPConfig.inventory(path): if site_details.valid == settings.WP_SITE_INSTALL_OK: logging.info("Running backup for %s", site_details.url) try: WPBackup(WPSite.openshift_env_from_path(site_details.path), site_details.url).backup() except: logging.error("Site %s - Error %s", site_details.url, sys.exc_info()) logging.info("All backups done for path: %s", path)