mirror of
https://github.com/friendica/friendica
synced 2025-01-31 08:19:47 +00:00
Replace Logger with $this->logger in Module Twitter classes
This commit is contained in:
parent
b0a5494a8f
commit
d4873dbc6b
6 changed files with 9 additions and 16 deletions
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Module\Api\Twitter;
|
namespace Friendica\Module\Api\Twitter;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
|
@ -29,7 +28,7 @@ class Favorites extends BaseApi
|
||||||
|
|
||||||
// in friendica starred item are private
|
// in friendica starred item are private
|
||||||
// return favorites only for self
|
// return favorites only for self
|
||||||
Logger::info(BaseApi::LOG_PREFIX . 'for {self}', ['module' => 'api', 'action' => 'favorites']);
|
$this->logger->info(BaseApi::LOG_PREFIX . 'for {self}', ['module' => 'api', 'action' => 'favorites']);
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$count = $this->getRequestValue($request, 'count', 20, 1, 100);
|
$count = $this->getRequestValue($request, 'count', 20, 1, 100);
|
||||||
|
|
|
@ -12,7 +12,6 @@ use Friendica\App\Arguments;
|
||||||
use Friendica\App\BaseURL;
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\AppHelper;
|
use Friendica\AppHelper;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Factory\Api\Twitter\User as TwitterUser;
|
use Friendica\Factory\Api\Twitter\User as TwitterUser;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
@ -47,21 +46,21 @@ class Destroy extends ContactEndpoint
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
$owner = User::getOwnerDataById($uid);
|
||||||
if (!$owner) {
|
if (!$owner) {
|
||||||
Logger::notice(BaseApi::LOG_PREFIX . 'No owner {uid} found', ['module' => 'api', 'action' => 'friendships_destroy', 'uid' => $uid]);
|
$this->logger->notice(BaseApi::LOG_PREFIX . 'No owner {uid} found', ['module' => 'api', 'action' => 'friendships_destroy', 'uid' => $uid]);
|
||||||
throw new HTTPException\NotFoundException('Error Processing Request');
|
throw new HTTPException\NotFoundException('Error Processing Request');
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact_id = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), 0);
|
$contact_id = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), 0);
|
||||||
|
|
||||||
if (empty($contact_id)) {
|
if (empty($contact_id)) {
|
||||||
Logger::notice(BaseApi::LOG_PREFIX . 'No user_id specified', ['module' => 'api', 'action' => 'friendships_destroy']);
|
$this->logger->notice(BaseApi::LOG_PREFIX . 'No user_id specified', ['module' => 'api', 'action' => 'friendships_destroy']);
|
||||||
throw new HTTPException\BadRequestException('no user_id specified');
|
throw new HTTPException\BadRequestException('no user_id specified');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Contact by given id
|
// Get Contact by given id
|
||||||
$ucid = Contact::getUserContactId($contact_id, $uid);
|
$ucid = Contact::getUserContactId($contact_id, $uid);
|
||||||
if (!$ucid) {
|
if (!$ucid) {
|
||||||
Logger::notice(BaseApi::LOG_PREFIX . 'Not following contact', ['module' => 'api', 'action' => 'friendships_destroy']);
|
$this->logger->notice(BaseApi::LOG_PREFIX . 'Not following contact', ['module' => 'api', 'action' => 'friendships_destroy']);
|
||||||
throw new HTTPException\NotFoundException('Not following Contact');
|
throw new HTTPException\NotFoundException('Not following Contact');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ class Destroy extends ContactEndpoint
|
||||||
try {
|
try {
|
||||||
Contact::unfollow($contact);
|
Contact::unfollow($contact);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Logger::error(BaseApi::LOG_PREFIX . $e->getMessage(), ['contact' => $contact]);
|
$this->logger->error(BaseApi::LOG_PREFIX . $e->getMessage(), ['contact' => $contact]);
|
||||||
throw new HTTPException\InternalServerErrorException('Unable to unfollow this contact, please contact your administrator');
|
throw new HTTPException\InternalServerErrorException('Unable to unfollow this contact, please contact your administrator');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Module\Api\Twitter\Media\Metadata;
|
namespace Friendica\Module\Api\Twitter\Media\Metadata;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
use Friendica\Network\HTTPException\BadRequestException;
|
use Friendica\Network\HTTPException\BadRequestException;
|
||||||
|
@ -44,7 +43,7 @@ class Create extends BaseApi
|
||||||
throw new BadRequestException('No alt text.');
|
throw new BadRequestException('No alt text.');
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info('Updating metadata', ['media_id' => $data['media_id']]);
|
$this->logger->info('Updating metadata', ['media_id' => $data['media_id']]);
|
||||||
|
|
||||||
$condition = ['id' => $data['media_id'], 'uid' => $uid];
|
$condition = ['id' => $data['media_id'], 'uid' => $uid];
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Module\Api\Twitter\Media;
|
namespace Friendica\Module\Api\Twitter\Media;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\DI;
|
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
use Friendica\Network\HTTPException\BadRequestException;
|
use Friendica\Network\HTTPException\BadRequestException;
|
||||||
|
@ -49,7 +47,7 @@ class Upload extends BaseApi
|
||||||
"friendica_preview_url" => $media["preview"]
|
"friendica_preview_url" => $media["preview"]
|
||||||
];
|
];
|
||||||
|
|
||||||
Logger::info('Media uploaded', ['return' => $returndata]);
|
$this->logger->info('Media uploaded', ['return' => $returndata]);
|
||||||
|
|
||||||
$this->response->addFormattedContent('media', ['media' => $returndata], $this->parameters['extension'] ?? null);
|
$this->response->addFormattedContent('media', ['media' => $returndata], $this->parameters['extension'] ?? null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Module\Api\Twitter\Statuses;
|
namespace Friendica\Module\Api\Twitter\Statuses;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Module\BaseApi;
|
use Friendica\Module\BaseApi;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
@ -34,7 +33,7 @@ class Show extends BaseApi
|
||||||
throw new BadRequestException('An id is missing.');
|
throw new BadRequestException('An id is missing.');
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::notice('API: api_statuses_show: ' . $id);
|
$this->logger->notice('API: api_statuses_show: ' . $id);
|
||||||
|
|
||||||
$conversation = !empty($request['conversation']);
|
$conversation = !empty($request['conversation']);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Module\Api\Twitter\Statuses;
|
namespace Friendica\Module\Api\Twitter\Statuses;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -27,7 +26,7 @@ class UserTimeline extends BaseApi
|
||||||
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
$this->checkAllowedScope(BaseApi::SCOPE_READ);
|
||||||
$uid = BaseApi::getCurrentUserID();
|
$uid = BaseApi::getCurrentUserID();
|
||||||
|
|
||||||
Logger::info('api_statuses_user_timeline', ['api_user' => $uid, '_REQUEST' => $request]);
|
$this->logger->info('api_statuses_user_timeline', ['api_user' => $uid, '_REQUEST' => $request]);
|
||||||
|
|
||||||
$cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), $uid);
|
$cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), $uid);
|
||||||
$count = $this->getRequestValue($request, 'count', 20, 1, 100);
|
$count = $this->getRequestValue($request, 'count', 20, 1, 100);
|
||||||
|
|
Loading…
Add table
Reference in a new issue