diff --git a/plugins/Realtime/README b/lib/modules/Realtime/README.md
similarity index 100%
rename from plugins/Realtime/README
rename to lib/modules/Realtime/README.md
diff --git a/plugins/Realtime/RealtimePlugin.php b/lib/modules/Realtime/RealtimePlugin.php
similarity index 67%
rename from plugins/Realtime/RealtimePlugin.php
rename to lib/modules/Realtime/RealtimePlugin.php
index cb228b2bff..386ec03fcd 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/lib/modules/Realtime/RealtimePlugin.php
@@ -1,35 +1,31 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Superclass for plugins that do "real time" updates of timelines using Ajax
*
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
* @category Plugin
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @author Mikael Nordfeldth
- * @copyright 2009 StatusNet, Inc.
- * @copyright 2014 Free Software Foundation, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
+ * @copyright 2009-2019 Free Software Foundation, Inc http://www.fsf.org
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
-if (!defined('GNUSOCIAL')) { exit(1); }
+defined('GNUSOCIAL') || die();
/**
* Superclass for plugin to do realtime updates
@@ -37,13 +33,12 @@ if (!defined('GNUSOCIAL')) { exit(1); }
* Based on experience with the Comet and Meteor plugins,
* this superclass extracts out some of the common functionality
*
- * Currently depends on Favorite plugin.
+ * Currently depends on the Favorite module.
*
* @category Plugin
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class RealtimePlugin extends Plugin
{
@@ -53,15 +48,17 @@ class RealtimePlugin extends Plugin
* When it's time to initialize the plugin, calculate and
* pass the URLs we need.
*/
- function onInitializePlugin()
+ public function onInitializePlugin()
{
// FIXME: need to find a better way to pass this pattern in
- $this->showurl = common_local_url('shownotice',
- array('notice' => '0000000000'));
+ $this->showurl = common_local_url(
+ 'shownotice',
+ ['notice' => '0000000000']
+ );
return true;
}
- function onCheckSchema()
+ public function onCheckSchema()
{
$schema = Schema::get();
$schema->ensureTable('realtime_channel', Realtime_channel::schemaDef());
@@ -72,20 +69,25 @@ class RealtimePlugin extends Plugin
* Hook for RouterInitialized event.
*
* @param URLMapper $m path-to-action mapper
- * @return boolean hook return
+ * @return bool hook return
+ * @throws Exception
*/
public function onRouterInitialized(URLMapper $m)
{
- $m->connect('main/channel/:channelkey/keepalive',
- ['action' => 'keepalivechannel'],
- ['channelkey' => '[a-z0-9]{32}']);
- $m->connect('main/channel/:channelkey/close',
- ['action' => 'closechannel'],
- ['channelkey' => '[a-z0-9]{32}']);
+ $m->connect(
+ 'main/channel/:channelkey/keepalive',
+ ['action' => 'keepalivechannel'],
+ ['channelkey' => '[a-z0-9]{32}']
+ );
+ $m->connect(
+ 'main/channel/:channelkey/close',
+ ['action' => 'closechannel'],
+ ['channelkey' => '[a-z0-9]{32}']
+ );
return true;
}
- function onEndShowScripts($action)
+ public function onEndShowScripts(Action $action)
{
$channel = $this->_getChannel($action);
@@ -93,7 +95,7 @@ class RealtimePlugin extends Plugin
return true;
}
- $timeline = $this->_pathToChannel(array($channel->channel_key));
+ $timeline = $this->_pathToChannel([$channel->channel_key]);
// If there's not a timeline on this page,
// just return true
@@ -125,11 +127,10 @@ class RealtimePlugin extends Plugin
if ($action->boolean('realtime')) {
$realtimeUI = ' RealtimeUpdate.initPopupWindow();';
- }
- else {
+ } else {
$pluginPath = common_path('plugins/Realtime/');
- $keepalive = common_local_url('keepalivechannel', array('channelkey' => $channel->channel_key));
- $close = common_local_url('closechannel', array('channelkey' => $channel->channel_key));
+ $keepalive = common_local_url('keepalivechannel', ['channelkey' => $channel->channel_key]);
+ $close = common_local_url('closechannel', ['channelkey' => $channel->channel_key]);
$realtimeUI = ' RealtimeUpdate.initActions('.json_encode($url).', '.json_encode($timeline).', '.json_encode($pluginPath).', '.json_encode($keepalive).', '.json_encode($close).'); ';
}
@@ -144,15 +145,17 @@ class RealtimePlugin extends Plugin
public function onEndShowStylesheets(Action $action)
{
- $urlpath = self::staticPath(str_replace('Plugin','',__CLASS__),
- 'css/realtimeupdate.css');
+ $urlpath = self::staticPath(
+ str_replace('Plugin', '', __CLASS__),
+ 'css/realtimeupdate.css'
+ );
$action->cssLink($urlpath, null, 'screen, projection, tv');
return true;
}
public function onHandleQueuedNotice(Notice $notice)
{
- $paths = array();
+ $paths = [];
// Add to the author's timeline
@@ -165,7 +168,7 @@ class RealtimePlugin extends Plugin
try {
$user = $profile->getUser();
- $paths[] = array('showstream', $user->nickname, null);
+ $paths[] = ['showstream', $user->nickname, null];
} catch (NoSuchUserException $e) {
// We really should handle the remote profile views too
$user = null;
@@ -176,7 +179,7 @@ class RealtimePlugin extends Plugin
$is_local = intval($notice->is_local);
if ($is_local === Notice::LOCAL_PUBLIC ||
($is_local === Notice::REMOTE && !common_config('public', 'localonly'))) {
- $paths[] = array('public', null, null);
+ $paths[] = ['public', null, null];
}
// Add to the tags timeline
@@ -185,7 +188,7 @@ class RealtimePlugin extends Plugin
if (!empty($tags)) {
foreach ($tags as $tag) {
- $paths[] = array('tag', $tag, null);
+ $paths[] = ['tag', $tag, null];
}
}
@@ -196,7 +199,7 @@ class RealtimePlugin extends Plugin
foreach (array_keys($ni) as $user_id) {
$user = User::getKV('id', $user_id);
- $paths[] = array('all', $user->nickname, null);
+ $paths[] = ['all', $user->getNickname(), null];
}
// Add to the replies timeline
@@ -208,7 +211,7 @@ class RealtimePlugin extends Plugin
while ($reply->fetch()) {
$user = User::getKV('id', $reply->profile_id);
if (!empty($user)) {
- $paths[] = array('replies', $user->nickname, null);
+ $paths[] = ['replies', $user->getNickname(), null];
}
}
}
@@ -222,12 +225,11 @@ class RealtimePlugin extends Plugin
if ($gi->find()) {
while ($gi->fetch()) {
$ug = User_group::getKV('id', $gi->group_id);
- $paths[] = array('showgroup', $ug->nickname, null);
+ $paths[] = ['showgroup', $ug->getNickname(), null];
}
}
if (count($paths) > 0) {
-
$json = $this->noticeAsJson($notice);
$this->_connect();
@@ -236,13 +238,14 @@ class RealtimePlugin extends Plugin
// new queue item for each path
foreach ($paths as $path) {
-
list($action, $arg1, $arg2) = $path;
$channels = Realtime_channel::getAllChannels($action, $arg1, $arg2);
- $this->log(LOG_INFO, sprintf(_("%d candidate channels for notice %d"),
- count($channels),
- $notice->id));
+ $this->log(LOG_INFO, sprintf(
+ _("%d candidate channels for notice %d"),
+ count($channels),
+ $notice->id
+ ));
foreach ($channels as $channel) {
@@ -255,14 +258,18 @@ class RealtimePlugin extends Plugin
$profile = Profile::getKV('id', $channel->user_id);
}
if ($notice->inScope($profile)) {
- $this->log(LOG_INFO,
- sprintf(_("Delivering notice %d to channel (%s, %s, %s) for user '%s'"),
- $notice->id,
- $channel->action,
- $channel->arg1,
- $channel->arg2,
- ($profile) ? ($profile->nickname) : ""));
- $timeline = $this->_pathToChannel(array($channel->channel_key));
+ $this->log(
+ LOG_INFO,
+ sprintf(
+ _m("Delivering notice %d to channel (%s, %s, %s) for user '%s'"),
+ $notice->id,
+ $channel->action,
+ $channel->arg1,
+ $channel->arg2,
+ ($profile ? $profile->getNickname() : '')
+ )
+ );
+ $timeline = $this->_pathToChannel([$channel->channel_key]);
$this->_publish($timeline, $json);
}
}
@@ -274,18 +281,23 @@ class RealtimePlugin extends Plugin
return true;
}
- function onStartShowBody($action)
+ public function onStartShowBody(Action $action)
{
$realtime = $action->boolean('realtime');
if (!$realtime) {
return true;
}
- $action->elementStart('body',
- (common_current_user()) ? array('id' => $action->trimmed('action'),
- 'class' => 'user_in realtime-popup')
- : array('id' => $action->trimmed('action'),
- 'class'=> 'realtime-popup'));
+ $action->elementStart(
+ 'body',
+ (common_current_user() ? [
+ 'id' => $action->trimmed('action'),
+ 'class' => 'user_in realtime-popup',
+ ] : [
+ 'id' => $action->trimmed('action'),
+ 'class'=> 'realtime-popup',
+ ])
+ );
// XXX hack to deal with JS that tries to get the
// root url from page output
@@ -294,14 +306,17 @@ class RealtimePlugin extends Plugin
if (common_config('singleuser', 'enabled')) {
$user = User::singleUser();
- $url = common_local_url('showstream', array('nickname' => $user->nickname));
+ $url = common_local_url('showstream', ['nickname' => $user->nickname]);
} else {
$url = common_local_url('public');
}
- $action->element('a', array('class' => 'url',
- 'href' => $url),
- '');
+ $action->element(
+ 'a',
+ ['class' => 'url',
+ 'href' => $url],
+ ''
+ );
$action->elementEnd('address');
@@ -311,7 +326,7 @@ class RealtimePlugin extends Plugin
return false; // No default processing
}
- function noticeAsJson(Notice $notice)
+ public function noticeAsJson(Notice $notice)
{
// FIXME: this code should be abstracted to a neutral third
// party, like Notice::asJson(). I'm not sure of the ethics
@@ -347,7 +362,7 @@ class RealtimePlugin extends Plugin
return $arr;
}
- function getNoticeTags(Notice $notice)
+ public function getNoticeTags(Notice $notice)
{
$tags = null;
@@ -355,7 +370,7 @@ class RealtimePlugin extends Plugin
$nt->notice_id = $notice->id;
if ($nt->find()) {
- $tags = array();
+ $tags = [];
while ($nt->fetch()) {
$tags[] = $nt->tag;
}
@@ -367,11 +382,13 @@ class RealtimePlugin extends Plugin
return $tags;
}
- function _getScripts()
+ public function _getScripts(): array
{
- $urlpath = self::staticPath(str_replace('Plugin','',__CLASS__),
- 'js/realtimeupdate.js');
- return array($urlpath);
+ $urlpath = self::staticPath(
+ str_replace('Plugin', '', __CLASS__),
+ 'js/realtimeupdate.js'
+ );
+ return [$urlpath];
}
/**
@@ -380,9 +397,10 @@ class RealtimePlugin extends Plugin
* @param Action $action
* @param array $messages
*
- * @return boolean hook return value
+ * @return bool hook return value
+ * @throws Exception
*/
- function onEndScriptMessages($action, &$messages)
+ public function onEndScriptMessages(Action $action, array &$messages)
{
// TRANS: Text label for realtime view "play" button, usually replaced by an icon.
$messages['realtime_play'] = _m('BUTTON', 'Play');
@@ -400,40 +418,40 @@ class RealtimePlugin extends Plugin
return true;
}
- function _updateInitialize($timeline, $user_id)
+ public function _updateInitialize($timeline, int $user_id)
{
return "RealtimeUpdate.init($user_id, \"$this->showurl\"); ";
}
- function _connect()
+ public function _connect()
{
}
- function _publish($timeline, $json)
+ public function _publish($timeline, $json)
{
}
- function _disconnect()
+ public function _disconnect()
{
}
- function _pathToChannel($path)
+ public function _pathToChannel(array $path): string
{
return '';
}
- function _getTimeline($action)
+ public function _getTimeline(Action $action)
{
$channel = $this->_getChannel($action);
if (empty($channel)) {
return null;
}
- return $this->_pathToChannel(array($channel->channel_key));
+ return $this->_pathToChannel([$channel->channel_key]);
}
- function _getChannel($action)
+ public function _getChannel(Action $action)
{
$timeline = null;
$arg1 = null;
@@ -478,15 +496,17 @@ class RealtimePlugin extends Plugin
$user_id = (!empty($user)) ? $user->id : null;
- $channel = Realtime_channel::getChannel($user_id,
- $action_name,
- $arg1,
- $arg2);
+ $channel = Realtime_channel::getChannel(
+ $user_id,
+ $action_name,
+ $arg1,
+ $arg2
+ );
return $channel;
}
- function onStartReadWriteTables(&$alwaysRW, &$rwdb)
+ public function onStartReadWriteTables(&$alwaysRW, &$rwdb)
{
$alwaysRW[] = 'realtime_channel';
return true;
diff --git a/plugins/Realtime/actions/closechannel.php b/lib/modules/Realtime/actions/closechannel.php
similarity index 53%
rename from plugins/Realtime/actions/closechannel.php
rename to lib/modules/Realtime/actions/closechannel.php
index d9a9df60a2..dd4a87bc45 100644
--- a/plugins/Realtime/actions/closechannel.php
+++ b/lib/modules/Realtime/actions/closechannel.php
@@ -1,48 +1,38 @@
.
- *
- * @category Realtime
- * @package StatusNet
- * @author Evan Prodromou
- * @copyright 2011 StatusNet, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
- * @link http://status.net/
- */
-
-if (!defined('STATUSNET')) {
- // This check helps protect against security problems;
- // your code file can't be executed directly from the web.
- exit(1);
-}
+// This file is part of GNU social - https://www.gnu.org/software/social
+//
+// GNU social is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// GNU social is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with GNU social. If not, see .
/**
* Action to close a channel
*
* @category Realtime
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
- * @copyright 2011 StatusNet, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
- * @link http://status.net/
+ * @copyright 2011-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();
+
+/**
+ * Action to close a channel
+ *
+ * @category Realtime
+ * @package GNUsocial
+ * @author Evan Prodromou
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class ClosechannelAction extends Action
{
@@ -57,7 +47,7 @@ class ClosechannelAction extends Action
* @return boolean true
* @throws ClientException
*/
- function prepare(array $args = [])
+ public function prepare(array $args = [])
{
parent::prepare($args);
@@ -88,7 +78,7 @@ class ClosechannelAction extends Action
*
* @return void
*/
- function handle()
+ public function handle(): void
{
$this->channel->decrement();
@@ -104,9 +94,9 @@ class ClosechannelAction extends Action
*
* @param array $args other arguments
*
- * @return boolean is read only action?
+ * @return bool is read only action?
*/
- function isReadOnly($args)
+ public function isReadOnly($args): bool
{
return false;
}
diff --git a/plugins/Realtime/actions/keepalivechannel.php b/lib/modules/Realtime/actions/keepalivechannel.php
similarity index 93%
rename from plugins/Realtime/actions/keepalivechannel.php
rename to lib/modules/Realtime/actions/keepalivechannel.php
index a2a4301d43..0a397beec3 100644
--- a/plugins/Realtime/actions/keepalivechannel.php
+++ b/lib/modules/Realtime/actions/keepalivechannel.php
@@ -54,10 +54,10 @@ class KeepalivechannelAction extends Action
*
* @param array $args misc. arguments
*
- * @return boolean true
+ * @return bool true
* @throws ClientException
*/
- function prepare(array $args = [])
+ public function prepare(array $args = []): bool
{
parent::prepare($args);
@@ -88,7 +88,7 @@ class KeepalivechannelAction extends Action
*
* @return void
*/
- function handle()
+ public function handle(): void
{
$this->channel->touch();
@@ -104,9 +104,9 @@ class KeepalivechannelAction extends Action
*
* @param array $args other arguments
*
- * @return boolean is read only action?
+ * @return bool is read only action?
*/
- function isReadOnly($args)
+ public function isReadOnly($args): bool
{
return false;
}
diff --git a/plugins/Realtime/classes/Realtime_channel.php b/lib/modules/Realtime/classes/Realtime_channel.php
similarity index 61%
rename from plugins/Realtime/classes/Realtime_channel.php
rename to lib/modules/Realtime/classes/Realtime_channel.php
index e8431d0728..723fd5011f 100644
--- a/plugins/Realtime/classes/Realtime_channel.php
+++ b/lib/modules/Realtime/classes/Realtime_channel.php
@@ -23,7 +23,7 @@
* @category Realtime
* @package GNUsocial
* @author Evan Prodromou
- * @copyright 2011 StatusNet, Inc.
+ * @copyright 2011-2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
@@ -32,10 +32,9 @@ defined('GNUSOCIAL') || die();
/**
* A channel for real-time browser data
*
- * @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*
- * @see DB_DataObject
+ * @see DB_DataObject
*/
class Realtime_channel extends Managed_DataObject
{
@@ -57,64 +56,64 @@ class Realtime_channel extends Managed_DataObject
*/
public static function schemaDef()
{
- return array(
+ return [
'description' => 'A channel of realtime notice data',
- 'fields' => array(
- 'user_id' => array('type' => 'int',
- 'not null' => false,
- 'description' => 'user viewing page; can be null'),
- 'action' => array('type' => 'varchar',
- 'length' => 191,
- 'not null' => true,
- 'description' => 'page being viewed'),
- 'arg1' => array('type' => 'varchar',
- 'length' => 191,
- 'not null' => false,
- 'description' => 'page argument, like username or tag'),
- 'arg2' => array('type' => 'varchar',
- 'length' => 191,
- 'not null' => false,
- 'description' => 'second page argument, like tag for showstream'),
- 'channel_key' => array('type' => 'varchar',
- 'length' => 32,
- 'not null' => true,
- 'description' => 'shared secret key for this channel'),
- 'audience' => array('type' => 'int',
- 'not null' => true,
- 'default' => 0,
- 'description' => 'reference count'),
- 'created' => array('type' => 'datetime',
- 'not null' => true,
- 'description' => 'date this record was created'),
- 'modified' => array('type' => 'datetime',
- 'not null' => true,
- 'description' => 'date this record was modified'),
- ),
- 'primary key' => array('channel_key'),
- 'unique keys' => array('realtime_channel_user_page_idx' => array('user_id', 'action', 'arg1', 'arg2')),
- 'foreign keys' => array(
- 'realtime_channel_user_id_fkey' => array('user', array('user_id' => 'id')),
- ),
- 'indexes' => array(
- 'realtime_channel_modified_idx' => array('modified'),
- 'realtime_channel_page_idx' => array('action', 'arg1', 'arg2')
- ),
- );
+ 'fields' => [
+ 'user_id' => ['type' => 'int',
+ 'not null' => false,
+ 'description' => 'user viewing page; can be null'],
+ 'action' => ['type' => 'varchar',
+ 'length' => 191,
+ 'not null' => true,
+ 'description' => 'page being viewed'],
+ 'arg1' => ['type' => 'varchar',
+ 'length' => 191,
+ 'not null' => false,
+ 'description' => 'page argument, like username or tag'],
+ 'arg2' => ['type' => 'varchar',
+ 'length' => 191,
+ 'not null' => false,
+ 'description' => 'second page argument, like tag for showstream'],
+ 'channel_key' => ['type' => 'varchar',
+ 'length' => 32,
+ 'not null' => true,
+ 'description' => 'shared secret key for this channel'],
+ 'audience' => ['type' => 'int',
+ 'not null' => true,
+ 'default' => 0,
+ 'description' => 'reference count'],
+ 'created' => ['type' => 'datetime',
+ 'not null' => true,
+ 'description' => 'date this record was created'],
+ 'modified' => ['type' => 'datetime',
+ 'not null' => true,
+ 'description' => 'date this record was modified'],
+ ],
+ 'primary key' => ['channel_key'],
+ 'unique keys' => ['realtime_channel_user_page_idx' => ['user_id', 'action', 'arg1', 'arg2']],
+ 'foreign keys' => [
+ 'realtime_channel_user_id_fkey' => ['user', ['user_id' => 'id']],
+ ],
+ 'indexes' => [
+ 'realtime_channel_modified_idx' => ['modified'],
+ 'realtime_channel_page_idx' => ['action', 'arg1', 'arg2']
+ ],
+ ];
}
- public static function saveNew($user_id, $action, $arg1, $arg2)
+ public static function saveNew(int $user_id, Action $action, $arg1, $arg2): Realtime_channel
{
$channel = new Realtime_channel();
$channel->user_id = $user_id;
- $channel->action = $action;
- $channel->arg1 = $arg1;
- $channel->arg2 = $arg2;
- $channel->audience = 1;
+ $channel->action = $action;
+ $channel->arg1 = $arg1;
+ $channel->arg2 = $arg2;
+ $channel->audience = 1;
$channel->channel_key = common_random_hexstr(16); // 128-bit key, 32 hex chars
- $channel->created = common_sql_now();
+ $channel->created = common_sql_now();
$channel->modified = $channel->created;
$channel->insert();
@@ -122,7 +121,7 @@ class Realtime_channel extends Managed_DataObject
return $channel;
}
- public static function getChannel($user_id, $action, $arg1, $arg2)
+ public static function getChannel(int $user_id, Action $action, $arg1, $arg2): Realtime_channel
{
$channel = self::fetchChannel($user_id, $action, $arg1, $arg2);
@@ -143,7 +142,7 @@ class Realtime_channel extends Managed_DataObject
return $channel;
}
- public static function getAllChannels($action, $arg1, $arg2)
+ public static function getAllChannels(Action $action, $arg1, $arg2): array
{
$channel = new Realtime_channel();
@@ -172,7 +171,7 @@ class Realtime_channel extends Managed_DataObject
return $channels;
}
- public static function fetchChannel($user_id, $action, $arg1, $arg2)
+ public static function fetchChannel(int $user_id, Action $action, $arg1, $arg2): ?Realtime_channel
{
$channel = new Realtime_channel();
@@ -204,7 +203,7 @@ class Realtime_channel extends Managed_DataObject
}
}
- public function increment()
+ public function increment(): void
{
// XXX: race
$orig = clone($this);
@@ -213,7 +212,7 @@ class Realtime_channel extends Managed_DataObject
$this->update($orig);
}
- public function touch()
+ public function touch(): void
{
// XXX: race
$orig = clone($this);
@@ -221,7 +220,7 @@ class Realtime_channel extends Managed_DataObject
$this->update($orig);
}
- public function decrement()
+ public function decrement(): void
{
// XXX: race
if ($this->audience == 1) {
diff --git a/plugins/Realtime/locale/Realtime.pot b/lib/modules/Realtime/locale/Realtime.pot
similarity index 100%
rename from plugins/Realtime/locale/Realtime.pot
rename to lib/modules/Realtime/locale/Realtime.pot
diff --git a/plugins/Realtime/locale/af/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/af/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/af/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/af/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ar/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ar/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ar/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ar/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/arz/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/arz/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/arz/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/arz/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ast/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ast/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ast/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ast/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/be-tarask/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/be-tarask/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/be-tarask/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/be-tarask/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/bg/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/bg/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/bg/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/bg/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/bn_IN/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/bn_IN/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/bn_IN/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/bn_IN/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/br/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/br/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/br/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/br/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ca/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ca/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ca/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ca/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/cs/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/cs/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/cs/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/cs/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/da/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/da/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/da/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/da/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/de/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/de/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/de/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/de/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/el/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/el/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/el/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/el/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/en_GB/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/en_GB/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/en_GB/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/en_GB/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/eo/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/eo/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/eo/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/eo/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/es/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/es/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/es/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/es/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/eu/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/eu/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/eu/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/eu/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/fa/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/fa/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/fa/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/fa/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/fi/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/fi/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/fi/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/fi/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/fr/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/fr/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/fr/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/fr/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/fur/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/fur/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/fur/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/fur/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/gl/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/gl/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/gl/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/gl/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/he/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/he/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/he/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/he/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/hsb/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/hsb/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/hsb/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/hsb/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/hu/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/hu/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/hu/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/hu/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/hy_AM/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/hy_AM/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/hy_AM/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/hy_AM/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ia/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ia/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ia/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ia/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/id/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/id/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/id/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/id/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/io/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/io/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/io/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/io/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/is/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/is/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/is/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/is/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/it/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/it/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/it/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/it/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ja/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ja/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ja/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ja/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ka/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ka/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ka/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ka/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ko/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ko/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ko/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ko/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ksh/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ksh/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ksh/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ksh/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/lb/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/lb/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/lb/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/lb/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/lt/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/lt/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/lt/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/lt/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/lv/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/lv/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/lv/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/lv/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/mg/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/mg/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/mg/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/mg/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/mk/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/mk/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/mk/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/mk/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ml/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ml/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ml/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ml/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ms/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ms/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ms/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ms/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/my/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/my/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/my/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/my/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/nb/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/nb/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/nb/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/nb/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ne/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ne/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ne/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ne/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/nl/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/nl/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/nl/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/nl/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/nn/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/nn/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/nn/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/nn/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/pl/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/pl/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/pl/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/pl/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/pt/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/pt/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/pt/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/pt/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/pt_BR/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/pt_BR/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/pt_BR/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/pt_BR/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ro_RO/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ro_RO/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ro_RO/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ro_RO/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ru/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ru/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ru/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ru/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/sl/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/sl/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/sl/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/sl/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/sr-ec/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/sr-ec/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/sr-ec/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/sr-ec/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/sv/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/sv/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/sv/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/sv/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ta/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ta/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ta/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ta/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/te/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/te/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/te/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/te/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/tl/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/tl/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/tl/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/tl/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/tr/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/tr/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/tr/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/tr/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/uk/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/uk/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/uk/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/uk/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/ur_PK/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/ur_PK/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/ur_PK/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/ur_PK/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/vi/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/vi/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/vi/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/vi/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/zh/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/zh/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/zh/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/zh/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/zh_CN/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/zh_CN/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/zh_CN/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/zh_CN/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/locale/zh_TW/LC_MESSAGES/Realtime.po b/lib/modules/Realtime/locale/zh_TW/LC_MESSAGES/Realtime.po
similarity index 100%
rename from plugins/Realtime/locale/zh_TW/LC_MESSAGES/Realtime.po
rename to lib/modules/Realtime/locale/zh_TW/LC_MESSAGES/Realtime.po
diff --git a/plugins/Realtime/scripts/cleanupchannels.php b/lib/modules/Realtime/scripts/cleanupchannels.php
similarity index 95%
rename from plugins/Realtime/scripts/cleanupchannels.php
rename to lib/modules/Realtime/scripts/cleanupchannels.php
index 3cdc4aed7d..51c65982a7 100755
--- a/plugins/Realtime/scripts/cleanupchannels.php
+++ b/lib/modules/Realtime/scripts/cleanupchannels.php
@@ -20,7 +20,7 @@
*
* @package Realtime
* @author Mikael Nordfeldth
- * @copyright 2011 StatusNet, Inc.
+ * @copyright 2011-2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
@@ -28,7 +28,7 @@ define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'u';
-$longoptions = array('universe');
+$longoptions = ['universe'];
$helptext = <<
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
+ */
class TheFreeNetworkModule extends Module
{
const MODULE_VERSION = '0.1.0alpha0';
diff --git a/plugins/ActivityPub/ActivityPubPlugin.php b/plugins/ActivityPub/ActivityPubPlugin.php
index 6d5e6fc652..9c48278f84 100644
--- a/plugins/ActivityPub/ActivityPubPlugin.php
+++ b/plugins/ActivityPub/ActivityPubPlugin.php
@@ -46,6 +46,8 @@ const ACTIVITYPUB_HTTP_CLIENT_HEADERS = [
];
/**
+ * Adds ActivityPub support to GNU social when enabled
+ *
* @category Plugin
* @package GNUsocial
* @author Diogo Cordeiro
diff --git a/plugins/Comet/CometPlugin.php b/plugins/Comet/CometPlugin.php
index 3ebb0d97de..0a6e19b368 100644
--- a/plugins/Comet/CometPlugin.php
+++ b/plugins/Comet/CometPlugin.php
@@ -31,7 +31,7 @@ if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
exit(1);
}
-require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php';
+require_once INSTALLDIR . DIRECTORY_SEPARATOR . 'lib/modules/Realtime/RealtimePlugin.php';
/**
* Plugin to do realtime updates using Comet
@@ -52,8 +52,12 @@ class CometPlugin extends RealtimePlugin
public $prefix = null;
protected $bay = null;
- function __construct($server=null, $username=null, $password=null, $prefix=null)
- {
+ public function __construct(
+ ?string $server = null,
+ ?string $username = null,
+ ?string $password = null,
+ ?string $prefix = null
+ ) {
$this->server = $server;
$this->username = $username;
$this->password = $password;
@@ -62,11 +66,11 @@ class CometPlugin extends RealtimePlugin
parent::__construct();
}
- function _getScripts()
+ public function _getScripts(): array
{
$scripts = parent::_getScripts();
- $ours = array('js/jquery.comet.js', 'js/cometupdate.js');
+ $ours = ['js/jquery.comet.js', 'js/cometupdate.js'];
foreach ($ours as $script) {
$scripts[] = $this->path($script);
@@ -75,30 +79,30 @@ class CometPlugin extends RealtimePlugin
return $scripts;
}
- function _updateInitialize($timeline, $user_id)
+ public function _updateInitialize($timeline, int $user_id)
{
$script = parent::_updateInitialize($timeline, $user_id);
return $script." CometUpdate.init(\"$this->server\", \"$timeline\", $user_id, \"$this->replyurl\", \"$this->favorurl\", \"$this->deleteurl\");";
}
- function _connect()
+ public function _connect(): void
{
- require_once INSTALLDIR.'/plugins/Comet/extlib/Bayeux/Bayeux.class.php';
+ require_once __DIR__. DIRECTORY_SEPARATOR . 'extlib/Bayeux/Bayeux.class.php';
// Bayeux? Comet? Huh? These terms confuse me
$this->bay = new Bayeux($this->server, $this->user, $this->password);
}
- function _publish($timeline, $json)
+ public function _publish($timeline, $json): void
{
$this->bay->publish($timeline, $json);
}
- function _disconnect()
+ public function _disconnect(): void
{
unset($this->bay);
}
- function _pathToChannel($path)
+ public function _pathToChannel(array $path): string
{
if (!empty($this->prefix)) {
array_unshift($path, $this->prefix);
@@ -108,14 +112,16 @@ class CometPlugin extends RealtimePlugin
public function onPluginVersion(array &$versions): bool
{
- $versions[] = array('name' => 'Comet',
- 'version' => self::PLUGIN_VERSION,
- 'author' => 'Evan Prodromou',
- 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/Comet',
- 'rawdescription' =>
- // TRANS: Plugin description message. Bayeux is a protocol for transporting asynchronous messages
- // TRANS: and Comet is a web application model.
- _m('Plugin to make updates using Comet and Bayeux.'));
+ $versions[] = [
+ 'name' => 'Comet',
+ 'version' => self::PLUGIN_VERSION,
+ 'author' => 'Evan Prodromou',
+ 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/Comet',
+ 'rawdescription' =>
+ // TRANS: Plugin description message. Bayeux is a protocol for transporting asynchronous messages
+ // TRANS: and Comet is a web application model.
+ _m('Plugin to make updates using Comet and Bayeux.')
+ ];
return true;
}
}
diff --git a/plugins/Comet/README b/plugins/Comet/README.md
similarity index 100%
rename from plugins/Comet/README
rename to plugins/Comet/README.md
diff --git a/plugins/Comet/extlib/Bayeux/Bayeux.class.php b/plugins/Comet/extlib/Bayeux/Bayeux.class.php
index 4fe8600f84..99dbceed5a 100644
--- a/plugins/Comet/extlib/Bayeux/Bayeux.class.php
+++ b/plugins/Comet/extlib/Bayeux/Bayeux.class.php
@@ -30,36 +30,36 @@ class Bayeux
public $sUrl = '';
- function __construct($sUrl, $sUser='', $sPassword='')
+ public function __construct($sUrl, $sUser='', $sPassword='')
{
$this->sUrl = $sUrl;
$this->oCurl = curl_init();
- $aHeaders = array();
+ $aHeaders = [];
$aHeaders[] = 'Connection: Keep-Alive';
curl_setopt($this->oCurl, CURLOPT_URL, $sUrl);
curl_setopt($this->oCurl, CURLOPT_HTTPHEADER, $aHeaders);
curl_setopt($this->oCurl, CURLOPT_HEADER, 0);
curl_setopt($this->oCurl, CURLOPT_POST, 1);
- curl_setopt($this->oCurl, CURLOPT_RETURNTRANSFER,1);
+ curl_setopt($this->oCurl, CURLOPT_RETURNTRANSFER, 1);
if (!is_null($sUser) && mb_strlen($sUser) > 0) {
- curl_setopt($this->oCurl, CURLOPT_USERPWD,"$sUser:$sPassword");
+ curl_setopt($this->oCurl, CURLOPT_USERPWD, "$sUser:$sPassword");
}
$this->handShake();
}
- function __destruct()
+ public function __destruct()
{
$this->disconnect();
}
- function handShake()
+ public function handShake()
{
- $msgHandshake = array();
+ $msgHandshake = [];
$msgHandshake['channel'] = '/meta/handshake';
$msgHandshake['version'] = "1.0";
$msgHandshake['minimumVersion'] = "0.9";
@@ -70,8 +70,9 @@ class Bayeux
$data = curl_exec($this->oCurl);
- if(curl_errno($this->oCurl))
- die("Error: " . curl_error($this->oCurl));
+ if (curl_errno($this->oCurl)) {
+ die("Error: " . curl_error($this->oCurl));
+ }
$oReturn = json_decode($data);
@@ -81,8 +82,7 @@ class Bayeux
$bSuccessful = ($oReturn->successful) ? true : false;
- if($bSuccessful)
- {
+ if ($bSuccessful) {
$this->clientId = $oReturn->clientId;
$this->connect();
@@ -101,9 +101,9 @@ class Bayeux
$data = curl_exec($this->oCurl);
}
- function disconnect()
+ public function disconnect()
{
- $msgHandshake = array();
+ $msgHandshake = [];
$msgHandshake['channel'] = '/meta/disconnect';
$msgHandshake['id'] = $this->nNextId++;
$msgHandshake['clientId'] = $this->clientId;
@@ -115,10 +115,11 @@ class Bayeux
public function publish($sChannel, $oData)
{
- if(!$sChannel || !$oData)
- return;
+ if (!$sChannel || !$oData) {
+ return;
+ }
- $aMsg = array();
+ $aMsg = [];
$aMsg['channel'] = $sChannel;
$aMsg['id'] = $this->nNextId++;
diff --git a/plugins/Meteor/MeteorPlugin.php b/plugins/Meteor/MeteorPlugin.php
index a374a76c94..3dab95885d 100644
--- a/plugins/Meteor/MeteorPlugin.php
+++ b/plugins/Meteor/MeteorPlugin.php
@@ -1,46 +1,40 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Plugin to do "real time" updates using Meteor
*
- * PHP version 5
- *
- * LICENCE: This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
* @category Plugin
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
- * @copyright 2009 StatusNet, Inc.
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
+ * @copyright 2010-2019 Free Software Foundation, Inc http://www.fsf.org
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
-if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
-require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php';
+require_once INSTALLDIR . DIRECTORY_SEPARATOR . 'lib/modules/Realtime/RealtimePlugin.php';
/**
* Plugin to do realtime updates using Meteor
*
- * @category Plugin
- * @package StatusNet
- * @author Evan Prodromou
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
+ * @category Plugin
+ * @package GNUsocial
+ * @author Evan Prodromou
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class MeteorPlugin extends RealtimePlugin
{
@@ -55,8 +49,14 @@ class MeteorPlugin extends RealtimePlugin
public $persistent = true;
protected $_socket = null;
- function __construct($webserver=null, $webport=4670, $controlport=4671, $controlserver=null, $channelbase='', $protocol='http')
- {
+ public function __construct(
+ ?string $webserver = null,
+ int $webport = 4670,
+ int $controlport = 4671,
+ ?string $controlserver = null,
+ string $channelbase = '',
+ string $protocol = 'http'
+ ) {
global $config;
$this->webserver = (empty($webserver)) ? $config['site']['server'] : $webserver;
@@ -64,22 +64,24 @@ class MeteorPlugin extends RealtimePlugin
$this->controlport = $controlport;
$this->controlserver = (empty($controlserver)) ? $webserver : $controlserver;
$this->channelbase = $channelbase;
- $this->protocol = $protocol;
-
+ $this->protocol = $protocol;
+
parent::__construct();
}
/**
* Pull settings from config file/database if set.
*/
- function initialize()
+ public function initialize()
{
- $settings = array('webserver',
- 'webport',
- 'controlport',
- 'controlserver',
- 'channelbase',
- 'protocol');
+ $settings = [
+ 'webserver',
+ 'webport',
+ 'controlport',
+ 'controlserver',
+ 'channelbase',
+ 'protocol',
+ ];
foreach ($settings as $name) {
$val = common_config('meteor', $name);
if ($val !== false) {
@@ -90,47 +92,57 @@ class MeteorPlugin extends RealtimePlugin
return parent::initialize();
}
- function _getScripts()
+ public function _getScripts()
{
$scripts = parent::_getScripts();
if ($this->protocol == 'https') {
- $scripts[] = 'https://'.$this->webserver.(($this->webport == 443) ? '':':'.$this->webport).'/meteor.js';
+ $scripts[] = 'https://' . $this->webserver . (($this->webport == 443) ? '' : ':' . $this->webport) . '/meteor.js';
} else {
- $scripts[] = 'http://'.$this->webserver.(($this->webport == 80) ? '':':'.$this->webport).'/meteor.js';
+ $scripts[] = 'http://' . $this->webserver . (($this->webport == 80) ? '' : ':' . $this->webport) . '/meteor.js';
}
$scripts[] = $this->path('js/meteorupdater.js');
return $scripts;
}
- function _updateInitialize($timeline, $user_id)
+ public function _updateInitialize($timeline, int $user_id)
{
$script = parent::_updateInitialize($timeline, $user_id);
- $ours = sprintf("MeteorUpdater.init(%s, %s, %s, %s);",
- json_encode($this->webserver),
- json_encode($this->webport),
- json_encode($this->protocol),
- json_encode($timeline));
+ $ours = sprintf(
+ "MeteorUpdater.init(%s, %s, %s, %s);",
+ json_encode($this->webserver),
+ json_encode($this->webport),
+ json_encode($this->protocol),
+ json_encode($timeline)
+ );
return $script." ".$ours;
}
- function _connect()
+ public function _connect()
{
$controlserver = (empty($this->controlserver)) ? $this->webserver : $this->controlserver;
$errno = $errstr = null;
$timeout = 5;
$flags = STREAM_CLIENT_CONNECT;
- if ($this->persistent) $flags |= STREAM_CLIENT_PERSISTENT;
+ if ($this->persistent) {
+ $flags |= STREAM_CLIENT_PERSISTENT;
+ }
// May throw an exception.
- $this->_socket = stream_socket_client("tcp://{$controlserver}:{$this->controlport}", $errno, $errstr, $timeout, $flags);
+ $this->_socket = stream_socket_client(
+ "tcp://{$controlserver}:{$this->controlport}",
+ $errno,
+ $errstr,
+ $timeout,
+ $flags
+ );
if (!$this->_socket) {
// TRANS: Exception. %1$s is the control server, %2$s is the control port.
- throw new Exception(sprintf(_m('Could not connect to %1$s on %2$s.'),$controlserver,$this->controlport));
+ throw new Exception(sprintf(_m('Could not connect to %1$s on %2$s.'), $controlserver, $this->controlport));
}
}
- function _publish($channel, $message)
+ public function _publish($channel, $message)
{
$message = json_encode($message);
$message = addslashes($message);
@@ -139,12 +151,12 @@ class MeteorPlugin extends RealtimePlugin
$result = fgets($this->_socket);
if (preg_match('/^ERR (.*)$/', $result, $matches)) {
// TRANS: Exception. %s is the Meteor message that could not be added.
- throw new Exception(sprintf(_m('Error adding meteor message "%s".'),$matches[1]));
+ throw new Exception(sprintf(_m('Error adding meteor message "%s".'), $matches[1]));
}
// TODO: parse and deal with result
}
- function _disconnect()
+ public function _disconnect()
{
if (!$this->persistent) {
$cnt = fwrite($this->_socket, "QUIT\n");
@@ -154,7 +166,7 @@ class MeteorPlugin extends RealtimePlugin
// Meteord flips out with default '/' separator
- function _pathToChannel($path)
+ public function _pathToChannel(array $path): string
{
if (!empty($this->channelbase)) {
array_unshift($path, $this->channelbase);
@@ -164,13 +176,15 @@ class MeteorPlugin extends RealtimePlugin
public function onPluginVersion(array &$versions): bool
{
- $versions[] = array('name' => 'Meteor',
- 'version' => self::PLUGIN_VERSION,
- 'author' => 'Evan Prodromou',
- 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/Meteor',
- 'rawdescription' =>
- // TRANS: Plugin description.
- _m('Plugin to do "real time" updates using Meteor.'));
+ $versions[] = [
+ 'name' => 'Meteor',
+ 'version' => self::PLUGIN_VERSION,
+ 'author' => 'Evan Prodromou',
+ 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/Meteor',
+ 'rawdescription' =>
+ // TRANS: Plugin description.
+ _m('Plugin to do "real time" updates using Meteor.')
+ ];
return true;
}
}
diff --git a/plugins/Meteor/README b/plugins/Meteor/README.md
similarity index 89%
rename from plugins/Meteor/README
rename to plugins/Meteor/README.md
index f21828cdc5..ba5adcc4f9 100644
--- a/plugins/Meteor/README
+++ b/plugins/Meteor/README.md
@@ -4,7 +4,7 @@ FriendFeed's "real time" news.
It requires a meteor server.
- http://meteorserver.org/
+ https://github.com/visitsb/meteorserver/
Note that the controller interface needs to be accessible by the Web server, and
the subscriber interface needs to be accessible by your Web users. You MUST
@@ -13,7 +13,7 @@ push any message to your subscribers. Not good!
You can enable the plugin with this line in config.php:
-addPlugin('Meteor', array('webserver' => 'meteor server address'));
+addPlugin('Meteor', ['webserver' => 'meteor server address']);
Available parameters:
* webserver: Web server address. Defaults to site server.
diff --git a/plugins/Realtime/Makefile b/plugins/Realtime/Makefile
deleted file mode 100644
index 4eb2bcb879..0000000000
--- a/plugins/Realtime/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-.fake: all clean
-
-all: realtimeupdate.min.js
-
-clean:
- rm -f js/realtimeupdate.min.js
-
-realtimeupdate.min.js: js/realtimeupdate.js
- yui-compressor js/realtimeupdate.js > js/realtimeupdate.min.js