mirror of
https://github.com/openvk/openvk
synced 2025-04-23 08:33:02 +03:00
Merge f672e5001a
into ee0dd8c749
This commit is contained in:
commit
31db422578
14 changed files with 142 additions and 18 deletions
36
.github/workflows/analyse.yaml
vendored
Normal file
36
.github/workflows/analyse.yaml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
name: Static analysis
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
phpstan:
|
||||||
|
name: PHPStan
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
# 'push' runs on inner branches, 'pull_request' will run only on outer PRs
|
||||||
|
if: >
|
||||||
|
github.event_name == 'push'
|
||||||
|
|| (github.event_name == 'pull_request'
|
||||||
|
&& github.event.pull_request.head.repo.full_name != github.repository)
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Code Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build and start Docker container
|
||||||
|
working-directory: install/automated/docker
|
||||||
|
run: |
|
||||||
|
docker build -t openvk ../../.. -f openvk.Dockerfile
|
||||||
|
|
||||||
|
- name: Run Docker container with PHPStan
|
||||||
|
working-directory: install/automated/docker
|
||||||
|
run: |
|
||||||
|
docker container run --rm \
|
||||||
|
-v ./chandler.example.yml:/opt/chandler/chandler.yml \
|
||||||
|
-v ./openvk.example.yml:/opt/chandler/extensions/available/openvk/openvk.yml \
|
||||||
|
openvk vendor/bin/phpstan analyse --memory-limit 1G
|
|
@ -18,6 +18,7 @@ define("NANOTON", 1000000000);
|
||||||
class FetchToncoinTransactions extends Command
|
class FetchToncoinTransactions extends Command
|
||||||
{
|
{
|
||||||
private $images;
|
private $images;
|
||||||
|
private $transactions;
|
||||||
|
|
||||||
protected static $defaultName = "fetch-ton";
|
protected static $defaultName = "fetch-ton";
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Wall implements Handler
|
||||||
protected $user;
|
protected $user;
|
||||||
protected $posts;
|
protected $posts;
|
||||||
protected $notes;
|
protected $notes;
|
||||||
|
protected $videos;
|
||||||
|
|
||||||
public function __construct(?User $user)
|
public function __construct(?User $user)
|
||||||
{
|
{
|
||||||
|
|
|
@ -248,8 +248,9 @@ final class Board extends VKAPIRequestHandler
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editComment(int $comment_id, int $group_id = 0, int $topic_id = 0, string $message, string $attachments)
|
public function editComment(string $message, string $attachments, int $comment_id, int $group_id = 0, int $topic_id = 0)
|
||||||
{
|
{
|
||||||
|
# FIXME
|
||||||
/*
|
/*
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
$this->willExecuteWriteAction();
|
$this->willExecuteWriteAction();
|
||||||
|
|
|
@ -45,7 +45,7 @@ final class Groups extends VKAPIRequestHandler
|
||||||
$clbsCount = $user->getClubCount();
|
$clbsCount = $user->getClubCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
$rClubs;
|
$rClubs = array();
|
||||||
|
|
||||||
$ic = sizeof($clbs);
|
$ic = sizeof($clbs);
|
||||||
if (sizeof($clbs) > $count) {
|
if (sizeof($clbs) > $count) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ final class Newsfeed extends VKAPIRequestHandler
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGlobal(string $fields = "", int $start_from = 0, int $start_time = 0, int $end_time = 0, int $offset = 0, int $count = 30, int $extended = 0, int $rss = 0)
|
public function getGlobal(string $fields = "", int $start_from = 0, int $start_time = 0, int $end_time = 0, int $offset = 0, int $count = 30, int $extended = 0, int $rss = 0, int $return_banned = 0)
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
|
|
|
@ -185,12 +185,14 @@ final class Notes extends VKAPIRequestHandler
|
||||||
$this->fail(15, "Access denied");
|
$this->fail(15, "Access denied");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$nodez = (object) [
|
||||||
|
"count" => 0,
|
||||||
|
"notes" => [],
|
||||||
|
];
|
||||||
if (empty($note_ids)) {
|
if (empty($note_ids)) {
|
||||||
|
$nodez->count = (new NotesRepo())->getUserNotesCount($user);
|
||||||
|
|
||||||
$notes = array_slice(iterator_to_array((new NotesRepo())->getUserNotes($user, 1, $count + $offset, $sort == 0 ? "ASC" : "DESC")), $offset);
|
$notes = array_slice(iterator_to_array((new NotesRepo())->getUserNotes($user, 1, $count + $offset, $sort == 0 ? "ASC" : "DESC")), $offset);
|
||||||
$nodez = (object) [
|
|
||||||
"count" => (new NotesRepo())->getUserNotesCount((new UsersRepo())->get($user_id)),
|
|
||||||
"notes" => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($notes as $note) {
|
foreach ($notes as $note) {
|
||||||
if ($note->isDeleted()) {
|
if ($note->isDeleted()) {
|
||||||
|
@ -210,6 +212,7 @@ final class Notes extends VKAPIRequestHandler
|
||||||
$note = (new NotesRepo())->getNoteById((int) $id[0], (int) $id[1]);
|
$note = (new NotesRepo())->getNoteById((int) $id[0], (int) $id[1]);
|
||||||
if ($note && !$note->isDeleted()) {
|
if ($note && !$note->isDeleted()) {
|
||||||
$nodez->notes[] = $note->toVkApiStruct();
|
$nodez->notes[] = $note->toVkApiStruct();
|
||||||
|
$nodez->count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ abstract class VKAPIRequestHandler
|
||||||
$this->platform = $platform;
|
$this->platform = $platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fail(int $code, string $message): void
|
protected function fail(int $code, string $message): never
|
||||||
{
|
{
|
||||||
throw new APIErrorException($message, $code);
|
throw new APIErrorException($message, $code);
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,8 +478,8 @@ return (function () {
|
||||||
define('YEAR', 365 * DAY);
|
define('YEAR', 365 * DAY);
|
||||||
|
|
||||||
define("nullptr", null);
|
define("nullptr", null);
|
||||||
define("OPENVK_DEFAULT_INSTANCE_NAME", "OpenVK", false);
|
define("OPENVK_DEFAULT_INSTANCE_NAME", "OpenVK");
|
||||||
define("OPENVK_VERSION", "Altair Preview ($ver)", false);
|
define("OPENVK_VERSION", "Altair Preview ($ver)");
|
||||||
define("OPENVK_DEFAULT_PER_PAGE", 10, false);
|
define("OPENVK_DEFAULT_PER_PAGE", 10);
|
||||||
define("__OPENVK_ERROR_CLOCK_IN_FUTURE", "Server clock error: FK1200-DTF", false);
|
define("__OPENVK_ERROR_CLOCK_IN_FUTURE", "Server clock error: FK1200-DTF");
|
||||||
});
|
});
|
||||||
|
|
10
chandler_loader.php
Normal file
10
chandler_loader.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace openvk;
|
||||||
|
|
||||||
|
$_SERVER["HTTP_ACCEPT_LANGUAGE"] = false;
|
||||||
|
$bootstrap = require(__DIR__ . "/../../../chandler/Bootstrap.php");
|
||||||
|
$bootstrap->ignite(true);
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"fix": "php-cs-fixer fix",
|
"fix": "php-cs-fixer fix",
|
||||||
"lint": "php-cs-fixer fix --dry-run --diff --verbose"
|
"lint": "php-cs-fixer fix --dry-run --diff --verbose",
|
||||||
|
"analyse": "phpstan analyse --memory-limit 1G"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "~7.3||~8.1",
|
"php": "~7.3||~8.1",
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
},
|
},
|
||||||
"minimum-stability": "beta",
|
"minimum-stability": "beta",
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "^3.68"
|
"friendsofphp/php-cs-fixer": "^3.68",
|
||||||
|
"phpstan/phpstan": "^2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
60
composer.lock
generated
60
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "b92d2ddd207f394a31c429c65d1785a7",
|
"content-hash": "fe88a04383a75cc5c6591abac3128201",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "al/emoji-detector",
|
"name": "al/emoji-detector",
|
||||||
|
@ -3092,6 +3092,64 @@
|
||||||
],
|
],
|
||||||
"time": "2025-01-30T17:00:50+00:00"
|
"time": "2025-01-30T17:00:50+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phpstan/phpstan",
|
||||||
|
"version": "2.1.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
|
"reference": "7d08f569e582ade182a375c366cbd896eccadd3a"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/7d08f569e582ade182a375c366cbd896eccadd3a",
|
||||||
|
"reference": "7d08f569e582ade182a375c366cbd896eccadd3a",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.4|^8.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"phpstan/phpstan-shim": "*"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"phpstan",
|
||||||
|
"phpstan.phar"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"bootstrap.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "PHPStan - PHP Static Analysis Tool",
|
||||||
|
"keywords": [
|
||||||
|
"dev",
|
||||||
|
"static analysis"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"docs": "https://phpstan.org/user-guide/getting-started",
|
||||||
|
"forum": "https://github.com/phpstan/phpstan/discussions",
|
||||||
|
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||||
|
"security": "https://github.com/phpstan/phpstan/security/policy",
|
||||||
|
"source": "https://github.com/phpstan/phpstan-src"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/ondrejmirtes",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/phpstan",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2025-01-21T14:54:06+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/event-dispatcher",
|
"name": "psr/event-dispatcher",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
|
@ -7,9 +7,7 @@ namespace openvk;
|
||||||
|
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
|
|
||||||
$_SERVER["HTTP_ACCEPT_LANGUAGE"] = false;
|
require(__DIR__ . "/chandler_loader.php");
|
||||||
$bootstrap = require(__DIR__ . "/../../../chandler/Bootstrap.php");
|
|
||||||
$bootstrap->ignite(true);
|
|
||||||
|
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
$application->add(new CLI\RebuildImagesCommand());
|
$application->add(new CLI\RebuildImagesCommand());
|
||||||
|
|
14
phpstan.neon
Normal file
14
phpstan.neon
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
parameters:
|
||||||
|
level: 0
|
||||||
|
paths:
|
||||||
|
- CLI
|
||||||
|
- ServiceAPI
|
||||||
|
- VKAPI
|
||||||
|
- Web
|
||||||
|
- bootstrap.php
|
||||||
|
- openvkctl
|
||||||
|
- chandler_loader.php
|
||||||
|
|
||||||
|
bootstrapFiles:
|
||||||
|
- chandler_loader.php
|
||||||
|
- bootstrap.php
|
Loading…
Reference in a new issue