Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted July 16, 20186 yr Community Expert I thought that the tasks for disabled applications/plugins was finally fixed in 4.3.x but it seems this is still not the case. You have "fixed" the tasks table in the ACP to not show the tasks for disabled applications & plugins but the tasks themselves are still running in background anyway. I noticed because I got a warning about a task that kept locking even thought the application it is attached to is disabled. This is the code you use to load the tasks to display in the table: $table = new \IPS\Helpers\Table\Db( 'core_tasks', \IPS\Http\Url::internal( 'app=core&module=settings&controller=advanced&do=tasks' ), array( array( '(p.plugin_enabled=1 OR a.app_enabled=1)' ) ) ); $table->joins = array( array( 'select' => 'a.app_enabled', 'from' => array( 'core_applications', 'a' ), 'where' => "a.app_directory=app" ), array( 'select' => 'p.plugin_enabled', 'from' => array( 'core_plugins', 'p' ), 'where' => "p.plugin_id=plugin" ) ); And this is the code actually used to load the next tasks that will actually run: /** * Get next queued task * * @return \IPS\Task|NULL */ public static function queued() { $fifteenMinutesAgo = ( time() - 900 ); foreach ( \IPS\Db::i()->select( '*', 'core_tasks', array( 'next_run<? AND enabled=1', ( time() + 60 ) ), 'next_run ASC', NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER ) as $task ) { // [...] } return NULL; } Should I report it as a bug, or was this done on purpose to let the tasks keep running regardless anyway? Because this is highly confusing.
July 16, 20186 yr Toggling the application status will update the tasks table. See \IPS\Application::set__enabled(); (likewise for plugins).
July 16, 20186 yr Author Community Expert After taking another look it seems collect is set to enabled=0 in the table but lock column is 3, so the task is properly NOT running. But then the message should not show for disabled tasks in the first place. Stuart already confirmed he submitted a fix for it though, so all good anyway ?
Archived
This topic is now archived and is closed to further replies.