Runner::before_invoke_command()


Source Source

File: libraries/lifterlms-cli/src/Commands/Restful/Runner.php

	public static function before_invoke_command() {

		/**
		 * If `--user` was passed the user will already be set, otherwise there won't be a user.
		 *
		 * It is "safe" to assume that someone using the CLI has admin access and we'll set the current
		 * user to be the first admin we find in the DB that has the `manage_options` cap.
		 */
		if ( ! get_current_user_id() ) {
			$user = \LLMS_Install::get_can_install_user_id();
			if ( $user ) {
				wp_set_current_user( $user );
			}
		}

		if ( \WP_CLI::get_config( 'debug' ) && ! defined( 'SAVEQUERIES' ) ) {
			define( 'SAVEQUERIES', true );
		}

	}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.