Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexation cron don't launch #84

Open
MaximeCulea opened this issue Jul 18, 2018 · 1 comment
Open

Indexation cron don't launch #84

MaximeCulea opened this issue Jul 18, 2018 · 1 comment
Assignees
Labels

Comments

@MaximeCulea
Copy link
Contributor

From https://wordpress.org/support/topic/notice-toujours-affichee :

J’ai installé l’extension il y a plusieurs heures, et depuis, la notice “Comme l’extension BEA – Media Analytics vient d’être activée, le processus d’indexation des contenus va se lancer automatiquement en tâche de fond.” est constamment affichée.

Ma bibliothèque de média n’est pas si importante que cela (moins de 360 images).

J’ai bien tous les champs de l’extension, mais tous sont vierges (selon l’extension, aucune image n’est utilisée).

@MaximeCulea MaximeCulea self-assigned this Jul 18, 2018
@Mahjouba91
Copy link

On some environments, crons are not something doable, like in local, the plugin should provide an option in the backend to force the indexation IMO.

Something like this:

<?php
	add_action( 'admin_init', 'add_media_indexing_button' );

	/**
	 * Add option page for media index
	 */
	function add_media_indexing_button(): void {
		add_settings_section(
			'media_indexing',
			__( 'Media Indexing' ),
			'__return_null',
			'media'
		);

		add_settings_field(
			'media_indexing_button',
			__( 'Trigger indexing' ),
			static function() {
				if ( isset( $_GET['force_media_index'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
					BEA\Media_Analytics\Main::get_instance()->force_indexation();

					?>
					<div class="notice notice-info notice-info-stronger"><p>Media index rebuilt successfully</p></div>
					<?php
				}

				?>
				<a href="<?php echo esc_url( add_query_arg( 'force_media_index', 1, menu_page_url( 'options-media', false ) ) ); ?>" class="button">Force media index</a>
				<?php
			},
			'media',
			'media_indexing'
		);
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants