Remove unused code

- Remove commented code
- Remove unused/immediately overwritten variables
- Remove extraneous parameters
- Remove unreachable code
- Remove duplicate array keys
This commit is contained in:
Hypolite Petovan 2019-01-07 12:09:10 -05:00
parent 0c4f8277e6
commit 4a95ca280d
42 changed files with 43 additions and 218 deletions

View file

@ -143,13 +143,11 @@ class Cron
$manual_id = 0;
$generation = 0;
$force = false;
$restart = false;
if ($parameter == 'force') {
$force = true;
}
if ($parameter == 'restart') {
$restart = true;
$generation = intval($generation);
if (!$generation) {
exit();
@ -167,8 +165,6 @@ class Cron
Addon::reload();
$d = DateTimeFormat::utcNow();
// Only poll from those with suitable relationships,
// and which have a polling address and ignore Diaspora since
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.

View file

@ -60,8 +60,6 @@ class DBClean {
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
private static function removeOrphans($stage) {
$count = 0;
// We split the deletion in many small tasks
$limit = Config::get('system', 'dbclean-expire-limit', 1000);

View file

@ -30,11 +30,7 @@ class OnePoll
Logger::log('Start for contact ' . $contact_id);
$manual_id = 0;
$generation = 0;
$hub_update = false;
$force = false;
$restart = false;
if ($command == "force") {
$force = true;
@ -45,7 +41,6 @@ class OnePoll
return;
}
$d = DateTimeFormat::utcNow();
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
if (!DBA::isResult($contact)) {
@ -580,7 +575,7 @@ class OnePoll
$datarray['allow_cid'] = '<' . $contact['id'] . '>';
}
$stored_item = Item::insert($datarray);
Item::insert($datarray);
switch ($mailconf['action']) {
case 0:

View file

@ -26,8 +26,6 @@ class PubSubPublish
private static function publish($id)
{
$a = BaseObject::getApp();
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
if (!DBA::isResult($subscriber)) {
return;
@ -58,8 +56,6 @@ class PubSubPublish
$postResult = Network::post($subscriber['callback_url'], $params, $headers);
$ret = $postResult->getReturnCode();
$condition = ['id' => $subscriber['id']];
if ($ret >= 200 && $ret <= 299) {
Logger::log('Successfully pushed to ' . $subscriber['callback_url']);