Merge pull request #11689 from Quix0r/rewrites/double-quotes-single
Changed more double-quotes to single
This commit is contained in:
commit
3c70d592f6
|
@ -26,7 +26,7 @@
|
|||
* This script was taken from http://php.net/manual/en/function.pcntl-fork.php
|
||||
*/
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden');
|
||||
header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -45,13 +45,13 @@ $longopts = ['foreground'];
|
|||
$options = getopt($shortopts, $longopts);
|
||||
|
||||
// Ensure that daemon.php is executed from the base path of the installation
|
||||
if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
||||
$directory = dirname($_SERVER["argv"][0]);
|
||||
if (!file_exists('boot.php') && (sizeof($_SERVER['argv']) != 0)) {
|
||||
$directory = dirname($_SERVER['argv'][0]);
|
||||
|
||||
if (substr($directory, 0, 1) != "/") {
|
||||
$directory = $_SERVER["PWD"] . "/" . $directory;
|
||||
if (substr($directory, 0, 1) != '/') {
|
||||
$directory = $_SERVER['PWD'] . '/' . $directory;
|
||||
}
|
||||
$directory = realpath($directory . "/..");
|
||||
$directory = realpath($directory . '/..');
|
||||
|
||||
chdir($directory);
|
||||
}
|
||||
|
@ -86,16 +86,16 @@ TXT
|
|||
|
||||
$pidfile = DI::config()->get('system', 'pidfile');
|
||||
|
||||
if (in_array("start", $_SERVER["argv"])) {
|
||||
$mode = "start";
|
||||
if (in_array('start', $_SERVER['argv'])) {
|
||||
$mode = 'start';
|
||||
}
|
||||
|
||||
if (in_array("stop", $_SERVER["argv"])) {
|
||||
$mode = "stop";
|
||||
if (in_array('stop', $_SERVER['argv'])) {
|
||||
$mode = 'stop';
|
||||
}
|
||||
|
||||
if (in_array("status", $_SERVER["argv"])) {
|
||||
$mode = "status";
|
||||
if (in_array('status', $_SERVER['argv'])) {
|
||||
$mode = 'status';
|
||||
}
|
||||
|
||||
$foreground = array_key_exists('f', $options) || array_key_exists('foreground', $options);
|
||||
|
@ -104,7 +104,7 @@ if (!isset($mode)) {
|
|||
die("Please use either 'start', 'stop' or 'status'.\n");
|
||||
}
|
||||
|
||||
if (empty($_SERVER["argv"][0])) {
|
||||
if (empty($_SERVER['argv'][0])) {
|
||||
die("Unexpected script behaviour. This message should never occur.\n");
|
||||
}
|
||||
|
||||
|
@ -114,12 +114,12 @@ if (is_readable($pidfile)) {
|
|||
$pid = intval(file_get_contents($pidfile));
|
||||
}
|
||||
|
||||
if (empty($pid) && in_array($mode, ["stop", "status"])) {
|
||||
if (empty($pid) && in_array($mode, ['stop', 'status'])) {
|
||||
DI::config()->set('system', 'worker_daemon_mode', false);
|
||||
die("Pidfile wasn't found. Is the daemon running?\n");
|
||||
}
|
||||
|
||||
if ($mode == "status") {
|
||||
if ($mode == 'status') {
|
||||
if (posix_kill($pid, 0)) {
|
||||
die("Daemon process $pid is running.\n");
|
||||
}
|
||||
|
@ -130,12 +130,12 @@ if ($mode == "status") {
|
|||
die("Daemon process $pid isn't running.\n");
|
||||
}
|
||||
|
||||
if ($mode == "stop") {
|
||||
if ($mode == 'stop') {
|
||||
posix_kill($pid, SIGTERM);
|
||||
|
||||
unlink($pidfile);
|
||||
|
||||
Logger::notice("Worker daemon process was killed", ["pid" => $pid]);
|
||||
Logger::notice('Worker daemon process was killed', ['pid' => $pid]);
|
||||
|
||||
DI::config()->set('system', 'worker_daemon_mode', false);
|
||||
die("Worker daemon process $pid was killed.\n");
|
||||
|
@ -145,7 +145,7 @@ if (!empty($pid) && posix_kill($pid, 0)) {
|
|||
die("Daemon process $pid is already running.\n");
|
||||
}
|
||||
|
||||
Logger::notice('Starting worker daemon.', ["pid" => $pid]);
|
||||
Logger::notice('Starting worker daemon.', ['pid' => $pid]);
|
||||
|
||||
if (!$foreground) {
|
||||
echo "Starting worker daemon.\n";
|
||||
|
@ -194,7 +194,7 @@ $last_cron = 0;
|
|||
// Now running as a daemon.
|
||||
while (true) {
|
||||
if (!$do_cron && ($last_cron + $wait_interval) < time()) {
|
||||
Logger::info('Forcing cron worker call.', ["pid" => $pid]);
|
||||
Logger::info('Forcing cron worker call.', ['pid' => $pid]);
|
||||
$do_cron = true;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ while (true) {
|
|||
}
|
||||
|
||||
$start = time();
|
||||
Logger::info("Sleeping", ["pid" => $pid, 'until' => gmdate(DateTimeFormat::MYSQL, $start + $wait_interval)]);
|
||||
Logger::info('Sleeping', ['pid' => $pid, 'until' => gmdate(DateTimeFormat::MYSQL, $start + $wait_interval)]);
|
||||
|
||||
do {
|
||||
$seconds = (time() - $start);
|
||||
|
@ -236,10 +236,10 @@ while (true) {
|
|||
|
||||
if ($timeout) {
|
||||
$do_cron = true;
|
||||
Logger::info("Woke up after $wait_interval seconds.", ["pid" => $pid, 'sleep' => $wait_interval]);
|
||||
Logger::info('Woke up after $wait_interval seconds.', ['pid' => $pid, 'sleep' => $wait_interval]);
|
||||
} else {
|
||||
$do_cron = false;
|
||||
Logger::info("Worker jobs are calling to be forked.", ["pid" => $pid]);
|
||||
Logger::info('Worker jobs are calling to be forked.', ['pid' => $pid]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -439,8 +439,13 @@ function item_post(App $a) {
|
|||
// Ensure to only modify attachments that you own
|
||||
$srch = '<' . intval($contact_id) . '>';
|
||||
|
||||
$condition = ['allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
|
||||
'id' => $attach];
|
||||
$condition = [
|
||||
'allow_cid' => $srch,
|
||||
'allow_gid' => '',
|
||||
'deny_cid' => '',
|
||||
'deny_gid' => '',
|
||||
'id' => $attach,
|
||||
];
|
||||
if (!Attach::exists($condition)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -614,9 +614,9 @@ class App
|
|||
if (!empty($_GET['zrl']) && $this->mode->isNormal() && !$this->mode->isBackend() && !local_user()) {
|
||||
// Only continue when the given profile link seems valid
|
||||
// Valid profile links contain a path with "/profile/" and no query parameters
|
||||
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") &&
|
||||
strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) {
|
||||
if (Core\Session::get('visitor_home') != $_GET["zrl"]) {
|
||||
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == '') &&
|
||||
strstr(parse_url($_GET['zrl'], PHP_URL_PATH), '/profile/')) {
|
||||
if (Core\Session::get('visitor_home') != $_GET['zrl']) {
|
||||
Core\Session::set('my_url', $_GET['zrl']);
|
||||
Core\Session::set('authenticated', 0);
|
||||
|
||||
|
|
|
@ -1103,7 +1103,7 @@ class BBCode
|
|||
* @param integer $uriid
|
||||
* @return string
|
||||
*/
|
||||
private static function convertImages(string $text, int $simplehtml, int $uriid = 0):string
|
||||
private static function convertImages(string $text, int $simplehtml, int $uriid = 0): string
|
||||
{
|
||||
DI::profiler()->startRecording('rendering');
|
||||
$return = preg_replace_callback(
|
||||
|
|
|
@ -36,7 +36,7 @@ class Plaintext
|
|||
*
|
||||
* @todo For Twitter URLs aren't shortened, but they have to be calculated as if.
|
||||
*/
|
||||
public static function shorten(string $msg, int $limit, int $uid = 0):string
|
||||
public static function shorten(string $msg, int $limit, int $uid = 0): string
|
||||
{
|
||||
$ellipsis = html_entity_decode("…", ENT_QUOTES, 'UTF-8');
|
||||
|
||||
|
|
|
@ -825,6 +825,7 @@ class Database
|
|||
*
|
||||
* @return boolean Are there rows for that condition?
|
||||
* @throws \Exception
|
||||
* @todo Please unwrap the DBStructure::existsTable() call so this method has one behavior only: checking existence on records
|
||||
*/
|
||||
public function exists(string $table, array $condition): bool
|
||||
{
|
||||
|
@ -1719,29 +1720,29 @@ class Database
|
|||
*/
|
||||
public function processlist(): array
|
||||
{
|
||||
$ret = $this->p("SHOW PROCESSLIST");
|
||||
$ret = $this->p('SHOW PROCESSLIST');
|
||||
$data = $this->toArray($ret);
|
||||
|
||||
$processes = 0;
|
||||
$states = [];
|
||||
foreach ($data as $process) {
|
||||
$state = trim($process["State"]);
|
||||
$state = trim($process['State']);
|
||||
|
||||
// Filter out all non blocking processes
|
||||
if (!in_array($state, ["", "init", "statistics", "updating"])) {
|
||||
if (!in_array($state, ['', 'init', 'statistics', 'updating'])) {
|
||||
++$states[$state];
|
||||
++$processes;
|
||||
}
|
||||
}
|
||||
|
||||
$statelist = "";
|
||||
$statelist = '';
|
||||
foreach ($states as $state => $usage) {
|
||||
if ($statelist != "") {
|
||||
$statelist .= ", ";
|
||||
if ($statelist != '') {
|
||||
$statelist .= ', ';
|
||||
}
|
||||
$statelist .= $state . ": " . $usage;
|
||||
$statelist .= $state . ': ' . $usage;
|
||||
}
|
||||
return (["list" => $statelist, "amount" => $processes]);
|
||||
return (['list' => $statelist, 'amount' => $processes]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1958,7 +1958,7 @@ class Contact
|
|||
* @param string $updated Contact update date
|
||||
* @return string avatar link
|
||||
*/
|
||||
public static function getAvatarUrlForId(int $cid, string $size = '', string $updated = '', string $guid = ''):string
|
||||
public static function getAvatarUrlForId(int $cid, string $size = '', string $updated = '', string $guid = ''): string
|
||||
{
|
||||
// We have to fetch the "updated" variable when it wasn't provided
|
||||
// The parameter can be provided to improve performance
|
||||
|
@ -1999,7 +1999,7 @@ class Contact
|
|||
* @param string $size One of the Proxy::SIZE_* constants
|
||||
* @return string avatar link
|
||||
*/
|
||||
public static function getAvatarUrlForUrl(string $url, int $uid, string $size = ''):string
|
||||
public static function getAvatarUrlForUrl(string $url, int $uid, string $size = ''): string
|
||||
{
|
||||
$condition = ["`nurl` = ? AND ((`uid` = ? AND `network` IN (?, ?)) OR `uid` = ?)",
|
||||
Strings::normaliseLink($url), $uid, Protocol::FEED, Protocol::MAIL, 0];
|
||||
|
@ -2015,7 +2015,7 @@ class Contact
|
|||
* @param string $updated Contact update date
|
||||
* @return string header link
|
||||
*/
|
||||
public static function getHeaderUrlForId(int $cid, string $size = '', string $updated = '', string $guid = ''):string
|
||||
public static function getHeaderUrlForId(int $cid, string $size = '', string $updated = '', string $guid = ''): string
|
||||
{
|
||||
// We have to fetch the "updated" variable when it wasn't provided
|
||||
// The parameter can be provided to improve performance
|
||||
|
@ -2312,6 +2312,8 @@ class Contact
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates contact record by provided id and optional network
|
||||
*
|
||||
* @param integer $id contact id
|
||||
* @param string $network Optional network we are probing for
|
||||
* @return boolean
|
||||
|
@ -2335,13 +2337,15 @@ class Contact
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates contact record by provided id and probed data
|
||||
*
|
||||
* @param integer $id contact id
|
||||
* @param array $ret Probed data
|
||||
* @return boolean
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
private static function updateFromProbeArray(int $id, array $ret)
|
||||
private static function updateFromProbeArray(int $id, array $ret): bool
|
||||
{
|
||||
/*
|
||||
Warning: Never ever fetch the public key via Probe::uri and write it into the contacts.
|
||||
|
@ -2552,12 +2556,14 @@ class Contact
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates contact record by provided URL
|
||||
*
|
||||
* @param integer $url contact url
|
||||
* @return integer Contact id
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
public static function updateFromProbeByURL($url)
|
||||
public static function updateFromProbeByURL(string $url): int
|
||||
{
|
||||
$id = self::getIdForURL($url);
|
||||
|
||||
|
@ -2578,7 +2584,7 @@ class Contact
|
|||
* @param string $network Network of that contact
|
||||
* @return string with protocol
|
||||
*/
|
||||
public static function getProtocol($url, $network)
|
||||
public static function getProtocol(string $url, string $network): string
|
||||
{
|
||||
if ($network != Protocol::DFRN) {
|
||||
return $network;
|
||||
|
@ -2945,6 +2951,7 @@ class Contact
|
|||
* Update the local relationship when a local user loses a follower
|
||||
*
|
||||
* @param array $contact User-specific contact (uid != 0) array
|
||||
* @return void
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
|
|
|
@ -103,17 +103,27 @@ class FContact
|
|||
$posts = Post::countPosts(['author-id' => $contact['id'], 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]]);
|
||||
}
|
||||
|
||||
$fields = ['name' => $arr["name"], 'photo' => $arr["photo"],
|
||||
'request' => $arr["request"], 'nick' => $arr["nick"],
|
||||
'addr' => strtolower($arr["addr"]), 'guid' => $arr["guid"],
|
||||
'batch' => $arr["batch"], 'notify' => $arr["notify"],
|
||||
'poll' => $arr["poll"], 'confirm' => $arr["confirm"],
|
||||
'alias' => $arr["alias"], 'pubkey' => $arr["pubkey"],
|
||||
'uri-id' => $uriid, 'interacting_count' => $interacting ?? 0,
|
||||
'interacted_count' => $interacted ?? 0, 'post_count' => $posts ?? 0,
|
||||
'updated' => DateTimeFormat::utcNow()];
|
||||
$fields = [
|
||||
'name' => $arr['name'],
|
||||
'photo' => $arr['photo'],
|
||||
'request' => $arr['request'],
|
||||
'nick' => $arr['nick'],
|
||||
'addr' => strtolower($arr['addr']),
|
||||
'guid' => $arr['guid'],
|
||||
'batch' => $arr['batch'],
|
||||
'notify' => $arr['notify'],
|
||||
'poll' => $arr['poll'],
|
||||
'confirm' => $arr['confirm'],
|
||||
'alias' => $arr['alias'],
|
||||
'pubkey' => $arr['pubkey'],
|
||||
'uri-id' => $uriid,
|
||||
'interacting_count' => $interacting ?? 0,
|
||||
'interacted_count' => $interacted ?? 0,
|
||||
'post_count' => $posts ?? 0,
|
||||
'updated' => DateTimeFormat::utcNow(),
|
||||
];
|
||||
|
||||
$condition = ['url' => $arr["url"], 'network' => $arr["network"]];
|
||||
$condition = ['url' => $arr['url'], 'network' => $arr['network']];
|
||||
|
||||
DBA::update('fcontact', $fields, $condition, true);
|
||||
}
|
||||
|
@ -123,7 +133,6 @@ class FContact
|
|||
* fcontact guid
|
||||
*
|
||||
* @param string $fcontact_guid Hexadecimal string guid
|
||||
*
|
||||
* @return string|null the contact url or null
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
|
|
@ -475,7 +475,10 @@ class Profile extends BaseModule
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates contact from probing
|
||||
*
|
||||
* @param int $contact_id Id of the contact with uid != 0
|
||||
* @return void
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
|
|
|
@ -1547,6 +1547,7 @@ class Processor
|
|||
* Switches a contact to AP if needed
|
||||
*
|
||||
* @param integer $cid Contact ID
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function switchContact(int $cid)
|
||||
|
|
|
@ -1087,6 +1087,7 @@ class Receiver
|
|||
* @param integer $cid Contact ID
|
||||
* @param integer $uid User ID
|
||||
* @param string $url Profile URL
|
||||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
|
@ -1113,6 +1114,7 @@ class Receiver
|
|||
*
|
||||
* @param $receivers
|
||||
* @param $actor
|
||||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
|
|
|
@ -916,7 +916,13 @@ class Transmitter
|
|||
$networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
|
||||
}
|
||||
|
||||
$condition = ['uid' => $uid, 'archive' => false, 'pending' => false, 'blocked' => false, 'network' => Protocol::FEDERATED];
|
||||
$condition = [
|
||||
'uid' => $uid,
|
||||
'archive' => false,
|
||||
'pending' => false,
|
||||
'blocked' => false,
|
||||
'network' => Protocol::FEDERATED,
|
||||
];
|
||||
|
||||
if (!empty($uid)) {
|
||||
$condition['rel'] = [Contact::FOLLOWER, Contact::FRIEND];
|
||||
|
|
|
@ -55,7 +55,7 @@ class ReversedFileReader implements \Iterator
|
|||
* @param string $filename File to open
|
||||
* @return $this
|
||||
*/
|
||||
public function open(string $filename)
|
||||
public function open(string $filename): ReversedFileReader
|
||||
{
|
||||
$this->fh = fopen($filename, 'r');
|
||||
if (!$this->fh) {
|
||||
|
@ -73,9 +73,10 @@ class ReversedFileReader implements \Iterator
|
|||
/**
|
||||
* Read $size bytes behind last position
|
||||
*
|
||||
* @param int $size
|
||||
* @return string
|
||||
*/
|
||||
private function _read($size)
|
||||
private function _read(int $size): string
|
||||
{
|
||||
$this->pos -= $size;
|
||||
fseek($this->fh, $this->pos);
|
||||
|
@ -86,7 +87,7 @@ class ReversedFileReader implements \Iterator
|
|||
* Read next line from end of file
|
||||
* Return null if no lines are left to read
|
||||
*
|
||||
* @return ?string
|
||||
* @return string|null Depending on data being buffered
|
||||
*/
|
||||
private function _readline()
|
||||
{
|
||||
|
@ -140,7 +141,7 @@ class ReversedFileReader implements \Iterator
|
|||
* @see Iterator::key()
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
public function key(): int
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
@ -151,7 +152,7 @@ class ReversedFileReader implements \Iterator
|
|||
* @see Iterator::current()
|
||||
* @return string
|
||||
*/
|
||||
public function current()
|
||||
public function current(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
@ -162,7 +163,7 @@ class ReversedFileReader implements \Iterator
|
|||
* @see Iterator::valid()
|
||||
* @return bool
|
||||
*/
|
||||
public function valid()
|
||||
public function valid(): bool
|
||||
{
|
||||
return ! is_null($this->value);
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ use Friendica\Util\Strings;
|
|||
|
||||
class OnePoll
|
||||
{
|
||||
public static function execute($contact_id = 0, $command = '')
|
||||
public static function execute(int $contact_id = 0, string $command = '')
|
||||
{
|
||||
Logger::notice('Start polling/probing contact', ['id' => $contact_id]);
|
||||
|
||||
$force = ($command == "force");
|
||||
$force = ($command == 'force');
|
||||
|
||||
if (empty($contact_id)) {
|
||||
Logger::notice('no contact provided');
|
||||
|
@ -118,6 +118,7 @@ class OnePoll
|
|||
*
|
||||
* @param array $contact The personal contact entry
|
||||
* @param array $fields The fields that are updated
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function updateContact(array $contact, array $fields)
|
||||
|
|
Loading…
Reference in New Issue
Block a user