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

Fix wrong use of class constants in DFRN #5036

Merged
merged 2 commits into from
May 13, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/Protocol/DFRN.php
Original file line number Diff line number Diff line change
Expand Up @@ -2141,7 +2141,7 @@ private static function updateContent($current, $item, $importer, $entrytype)

$changed = true;

if ($entrytype == DFRN_REPLY_RC) {
if ($entrytype == DFRN::DFRN_REPLY_RC) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be DFRN::REPLY_RC instead, can you please rename all DFRN_* constants to just * and modify their use?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 736c76d

Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $current["id"]);
}
}
Expand Down Expand Up @@ -2211,12 +2211,12 @@ private static function getEntryType($importer, $item)
}

if ($is_a_remote_action) {
return DFRN_REPLY_RC;
return DFRN::DFRN_REPLY_RC;
} else {
return DFRN_REPLY;
return DFRN::DFRN_REPLY;
}
} else {
return DFRN_TOP_LEVEL;
return DFRN::DFRN_TOP_LEVEL;
}
}

Expand Down Expand Up @@ -2290,7 +2290,7 @@ private static function processVerbs($entrytype, $importer, &$item, &$is_like)
{
logger("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);

if (($entrytype == DFRN_TOP_LEVEL)) {
if (($entrytype == DFRN::DFRN_TOP_LEVEL)) {
// The filling of the the "contact" variable is done for legcy reasons
// The functions below are partly used by ostatus.php as well - where we have this variable
$r = q("SELECT * FROM `contact` WHERE `id` = %d", intval($importer["id"]));
Expand Down Expand Up @@ -2634,7 +2634,7 @@ private static function processEntry($header, $xpath, $entry, $importer, $xml)
$entrytype = self::getEntryType($importer, $item);

// Now assign the rest of the values that depend on the type of the message
if (in_array($entrytype, [DFRN_REPLY, DFRN_REPLY_RC])) {
if (in_array($entrytype, [DFRN::DFRN_REPLY, DFRN::DFRN_REPLY_RC])) {
if (!isset($item["object-type"])) {
$item["object-type"] = ACTIVITY_OBJ_COMMENT;
}
Expand All @@ -2656,10 +2656,10 @@ private static function processEntry($header, $xpath, $entry, $importer, $xml)
}
}

if ($entrytype == DFRN_REPLY_RC) {
if ($entrytype == DFRN::DFRN_REPLY_RC) {
$item["type"] = "remote-comment";
$item["wall"] = 1;
} elseif ($entrytype == DFRN_TOP_LEVEL) {
} elseif ($entrytype == DFRN::DFRN_TOP_LEVEL) {
if (!isset($item["object-type"])) {
$item["object-type"] = ACTIVITY_OBJ_NOTE;
}
Expand Down Expand Up @@ -2708,7 +2708,7 @@ private static function processEntry($header, $xpath, $entry, $importer, $xml)
return;
}

if (in_array($entrytype, [DFRN_REPLY, DFRN_REPLY_RC])) {
if (in_array($entrytype, [DFRN::DFRN_REPLY, DFRN::DFRN_REPLY_RC])) {
$posted_id = Item::insert($item);
$parent = 0;

Expand All @@ -2731,14 +2731,14 @@ private static function processEntry($header, $xpath, $entry, $importer, $xml)
$parent_uri = $r[0]["parent-uri"];
}

if ($posted_id && $parent && ($entrytype == DFRN_REPLY_RC)) {
if ($posted_id && $parent && ($entrytype == DFRN::DFRN_REPLY_RC)) {
logger("Notifying followers about comment ".$posted_id, LOGGER_DEBUG);
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $posted_id);
}

return true;
}
} else { // $entrytype == DFRN_TOP_LEVEL
} else { // $entrytype == DFRN::DFRN_TOP_LEVEL
if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) {
logger("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG);
return;
Expand Down Expand Up @@ -2838,9 +2838,9 @@ private static function processDeletion($xpath, $deletion, $importer)

Item::deleteById($item["id"]);

if ($entrytype != DFRN_TOP_LEVEL) {
if ($entrytype != DFRN::DFRN_TOP_LEVEL) {
// if this is a relayed delete, propagate it to other recipients
if ($entrytype == DFRN_REPLY_RC) {
if ($entrytype == DFRN::DFRN_REPLY_RC) {
logger("Notifying followers about deletion of post " . $item["id"], LOGGER_DEBUG);
Worker::add(PRIORITY_HIGH, "Notifier", "drop", $item["id"]);
}
Expand Down