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

jw_allvideos kill cli indexer #45

Open
yanncharlou opened this issue Jun 21, 2022 · 2 comments
Open

jw_allvideos kill cli indexer #45

yanncharlou opened this issue Jun 21, 2022 · 2 comments

Comments

@yanncharlou
Copy link

yanncharlou commented Jun 21, 2022

jw_allvideos seems to break command line indexing.

Step to reproduce :

  • Using Joomla 4.x (tested with 4.1.4)
  • Install jw_allvideos plugin
  • Add content using jw_allvideos (maybe not needed)
  • Launch from command line :
php cli/joomla.php finder:index -vvv

Detailed error log

....
 * Processed batch 74 in 0.408 seconds.
  * Skipping pause, as previous batch had a very low processing time (0.408s < 1s)

In jw_allvideos.php line 560:

  [Error]
  Call to undefined method Joomla\CMS\Application\ConsoleApplication::getTemplate()


Exception trace:
  at /var/www/html/plugins/content/jw_allvideos/jw_allvideos.php:560
 plgContentJw_allvideos->getTemplatePath() at /var/www/html/plugins/content/jw_allvideos/jw_allvideos.php:540
 plgContentJw_allvideos->renderAllVideos() at /var/www/html/plugins/content/jw_allvideos/jw_allvideos.php:36
 plgContentJw_allvideos->onContentPrepare() at /var/www/html/libraries/src/Plugin/CMSPlugin.php:285
 Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}() at /var/www/html/libraries/vendor/joomla/event/src/Dispatcher.php:486
 Joomla\Event\Dispatcher->dispatch() at /var/www/html/libraries/src/Application/EventAware.php:111
 Joomla\CMS\Application\ConsoleApplication->triggerEvent() at /var/www/html/administrator/components/com_finder/src/Indexer/Helper.php:480
 Joomla\Component\Finder\Administrator\Indexer\Helper::prepareContent() at /var/www/html/plugins/finder/content/content.php:280
 PlgFinderContent->index() at /var/www/html/administrator/components/com_finder/src/Indexer/Adapter.php:249
 Joomla\Component\Finder\Administrator\Indexer\Adapter->onBuildIndex() at /var/www/html/libraries/src/Plugin/CMSPlugin.php:285
 Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}() at /var/www/html/libraries/vendor/joomla/event/src/Dispatcher.php:486
 Joomla\Event\Dispatcher->dispatch() at /var/www/html/libraries/src/Application/EventAware.php:111
 Joomla\CMS\Application\ConsoleApplication->triggerEvent() at /var/www/html/libraries/src/Console/FinderIndexCommand.php:397
 Joomla\CMS\Console\FinderIndexCommand->index() at /var/www/html/libraries/src/Console/FinderIndexCommand.php:212
 Joomla\CMS\Console\FinderIndexCommand->doExecute() at /var/www/html/libraries/vendor/joomla/console/src/Command/AbstractCommand.php:235
 Joomla\Console\Command\AbstractCommand->execute() at /var/www/html/libraries/vendor/joomla/console/src/Application.php:1181
 Joomla\Console\Application->runCommand() at /var/www/html/libraries/vendor/joomla/console/src/Application.php:403
 Joomla\Console\Application->doExecute() at /var/www/html/libraries/src/Application/ConsoleApplication.php:191
 Joomla\CMS\Application\ConsoleApplication->doExecute() at /var/www/html/libraries/vendor/joomla/console/src/Application.php:448
 Joomla\Console\Application->execute() at /var/www/html/libraries/src/Application/ConsoleApplication.php:234
 Joomla\CMS\Application\ConsoleApplication->execute() at /var/www/html/cli/joomla.php:78

finder:index [--minproctime MINPROCTIME] [--pause PAUSE] [--divisor DIVISOR] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> [<purge>]

Proposal

At web/plugins/content/jw_allvideos/jw_allvideos.php:34, modify function like this :

    // Joomla 2.5+
    public function onContentPrepare($context, &$row, &$params, $page = 0)
    {

        if ($context === 'com_finder.indexer')
	{
		// Don't run this plugin when the content is being indexed and we have no real context
		return;
	}

        $this->renderAllVideos($row, $params, $page = 0);
    }
@sergeytolkachyov
Copy link

I have the same issue,

@noxidsoft
Copy link

noxidsoft commented Jul 2, 2024

I just ran into this issue too. Thank you for the proposed workaround, I'll try it out on my clients dev J4.
$ php joomla.php finder:index --verbose
image

Update: Yes, the workaround code works on Joomla 4.3.4.

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

No branches or pull requests

3 participants