diff --git a/lib/queue/queuemanager.php b/lib/queue/queuemanager.php index 10310fd43b..e73211a08b 100644 --- a/lib/queue/queuemanager.php +++ b/lib/queue/queuemanager.php @@ -59,18 +59,9 @@ abstract class QueueManager extends IoManager if (empty(self::$qm)) { if (Event::handle('StartNewQueueManager', array(&self::$qm))) { - $enabled = common_config('queue', 'enabled'); - $type = common_config('queue', 'subsystem'); - - if (!$enabled) { - // does everything immediately - self::$qm = new UnQueueManager(); - } else { - switch ($type) { - default: - throw new ServerException("No queue manager class for type '$type'"); - } - } + common_log(LOG_ERR, 'Some form of queue manager must be active' . + '(UnQueue does everything immediately and is the default)'); + throw new ServerException('Some form of queue manager must be active'); } } diff --git a/lib/util/default.php b/lib/util/default.php index 1de401d090..dfefaf2958 100644 --- a/lib/util/default.php +++ b/lib/util/default.php @@ -361,6 +361,7 @@ $default = 'Poll' => [], 'SimpleCaptcha' => [], 'TagSub' => [], + 'UnQueue' => [], 'WebFinger' => [], ], 'locale_path' => false, // Set to a path to use *instead of* each plugin's own locale subdirectories diff --git a/plugins/UnQueue/README b/plugins/UnQueue/README new file mode 100644 index 0000000000..ed90e921cd --- /dev/null +++ b/plugins/UnQueue/README @@ -0,0 +1,14 @@ +UnQueuePlugin wraps the UnQueueManager class which is a queue manager that does all work immediately. + +Installation +============ + +This plugin is enabled by default and cannot be disabled unless another queue manager is in use. +Disabling is not necessary but recommended in such cases. + +Example +======= + +In config.php + +addPlugin('UnQueue'); \ No newline at end of file diff --git a/plugins/UnQueue/UnQueuePlugin.php b/plugins/UnQueue/UnQueuePlugin.php new file mode 100644 index 0000000000..1c6822a075 --- /dev/null +++ b/plugins/UnQueue/UnQueuePlugin.php @@ -0,0 +1,48 @@ +. + +/** + * Immediate action queue + * + * @package GNUsocial + * @author Miguel Dantas + * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org + * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later + */ + +defined('GNUSOCIAL') || die(); + +class UnQueuePlugin extends Plugin +{ + const PLUGIN_VERSION = '0.0.1'; + + public function onStartNewQueueManager(?QueueManager &$qm) + { + $qm = new UnQueueManager(); + return false; + } + + public function onPluginVersion(array &$versions): bool + { + $versions[] = array('name' => 'UnQueue', + 'version' => self::PLUGIN_VERSION, + 'author' => 'Miguel Dantas', + 'description' => + // TRANS: Plugin description. + _m('Plugin using the database as a backend for GNU social queues')); + return true; + } +}; diff --git a/lib/queue/unqueuemanager.php b/plugins/UnQueue/classes/UnQueueManager.php similarity index 100% rename from lib/queue/unqueuemanager.php rename to plugins/UnQueue/classes/UnQueueManager.php