diff --git a/app/Controllers/Contribute.php b/app/Controllers/Contribute.php index cd976775..8fdff2e9 100644 --- a/app/Controllers/Contribute.php +++ b/app/Controllers/Contribute.php @@ -2,7 +2,7 @@ namespace App\Controllers; -use Github\Exception\ExceptionInterface; +use Psr\Http\Client\ClientExceptionInterface; class Contribute extends BaseController { @@ -16,7 +16,9 @@ public function index() // Contributors are already sorted, so grab the first 12 $data['contributors'][$id] = array_slice($contributors, 0, 12); } - } catch (ExceptionInterface $e) { + } catch (ClientExceptionInterface $e) { + log_message('error', '[' . __METHOD__ . '] ' . get_class($e) . ': ' . $e->getMessage()); + $data['contributors'] = null; } diff --git a/app/Controllers/Download.php b/app/Controllers/Download.php index 0bcfe437..c1e01de7 100644 --- a/app/Controllers/Download.php +++ b/app/Controllers/Download.php @@ -2,7 +2,7 @@ namespace App\Controllers; -use Github\Exception\ExceptionInterface; +use Psr\Http\Client\ClientExceptionInterface; class Download extends BaseController { @@ -18,7 +18,9 @@ public function index() 'v3link' => end($releases['framework3'])->download_url, 'v4link' => end($releases['framework4'])->download_url, ]; - } catch (ExceptionInterface $e) { + } catch (ClientExceptionInterface $e) { + log_message('error', '[' . __METHOD__ . '] ' . get_class($e) . ': ' . $e->getMessage()); + $data = [ 'v3name' => 'unknown', 'v4name' => 'unknown', diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 610f063e..cd4f63be 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -2,7 +2,7 @@ namespace App\Controllers; -use Github\Exception\ExceptionInterface; +use Psr\Http\Client\ClientExceptionInterface; class Home extends BaseController { @@ -17,7 +17,9 @@ public function index() 'stargazers_count' => number_format($repos['codeigniter4']->stargazers_count), 'forks_count' => number_format($repos['codeigniter4']->forks_count), ]; - } catch (ExceptionInterface $e) { + } catch (ClientExceptionInterface $e) { + log_message('error', '[' . __METHOD__ . '] ' . get_class($e) . ': ' . $e->getMessage()); + $data = [ 'html_url' => 'https://github.com/codeigniter4/CodeIgniter4', 'stargazers_count' => '', diff --git a/app/Views/contribute.php b/app/Views/contribute.php index 5cce03f3..9037a94f 100644 --- a/app/Views/contribute.php +++ b/app/Views/contribute.php @@ -7,7 +7,7 @@
heart icon -

Contribute to CodeIgniter

+

Contribute to CodeIgniter

@@ -20,12 +20,6 @@ on the CodeIgniter4 repository on GitHub.

-
-

- The CodeIgniter 4 roadmap is explained on our forum. -

-
-

Issues are a quick way to point out a bug. If you find a bug or documentation error in CodeIgniter then please check a few things first: @@ -35,7 +29,7 @@

  • There is not already an open Issue
  • The issue has already been fixed (check the develop branch, or look for closed Issues)
  • Is it something really obvious that you fix it yourself?
  • -
  • If you are unsure if you have found a bug, then start a new thread in the CodeIgniter forum, in the Issues section!
  • +
  • If you are unsure if you have found a bug, then start a new thread in the CodeIgniter forum, in the Issues section!
  • @@ -47,9 +41,8 @@

    -
    CodeIgniter 3

    - CodeIgniter 3 has its own Github repository. + CodeIgniter 3 has its own GitHub repository.

    @@ -58,7 +51,7 @@

    Security issues should be reported with an email to our security team, rather than being brought up on the forum or - raised as a Github issue, thanks! Read more about responsible disclosure. + raised as a GitHub issue, thanks! Read more about responsible disclosure.

    @@ -72,12 +65,9 @@
    Testers

    We always need feedback on what works and what does not! Most of the development effort is going into Version 4, - so that is where the need is greatest. If you find something that is definitely a bug, and you are a Github user, - please create a new "issue". If you are not a Github user, or if you are unsure if you have found a bug, then start - a new thread in the CodeIgniter forum Issues section! -

    -

    - CodeIgniter 3 has its own support subforum. + so that is where the need is greatest. If you find something that is definitely a bug, and you are a GitHub user, + please create a new "issue". If you are not a GitHub user, or if you are unsure if you have found a bug, then start + a new thread in the CodeIgniter forum Issues section!

    @@ -86,7 +76,7 @@
    Writers

    - Every project needs good documentation! The CodeIgniter user guide is part of the Github project (mentioned above), + Every project needs good documentation! The CodeIgniter user guide is part of the GitHub project (mentioned above), and there is always room for more tutorials.

    @@ -120,7 +110,7 @@

    Designers

    Suggestions and help with our website, User Guide, and forum design are always welcome! We are working on themes - for each of these, which will be shared in their own Github repository. + for each of these, which will be shared in their own GitHub repository.

    @@ -135,14 +125,14 @@
    Coders

    - If you would like to get involved in helping to build CodeIgniter4, join us on Github! + If you would like to get involved in helping to build CodeIgniter4, join us on GitHub! A detailed contribution guide is in Contributing to CodeIgniter, that it is properly documented, and that you use the Git-Flow branching model.

    - CodeIgniter 3 equivalent link: its repository. + CodeIgniter 3 equivalent link: its repository.

    diff --git a/app/Views/discuss.php b/app/Views/discuss.php index 0f033da7..d6a729ea 100644 --- a/app/Views/discuss.php +++ b/app/Views/discuss.php @@ -19,7 +19,7 @@

    Security issues should be reported with an email to our security team, rather than being brought up on the forum or - raised as a Github issue, thanks! + raised as a GitHub issue, thanks!

    @@ -65,16 +65,16 @@ class="link-primary" target="_blank">signup for it :)
    -
    Github
    +
    GitHub

    - The development action takes place on Github. See the contribute page for more details. + The development action takes place on GitHub. See the contribute page for more details.

    - The Github repository is where you can file bug reports (github issues), or where you can submit pull requests - for enhancements to or fixes for framework. Github is *not* for support or help ... use the forum instead. + The GitHub repository is where you can file bug reports (github issues), or where you can submit pull requests + for enhancements to or fixes for framework. GitHub is *not* for support or help ... use the forum instead.

    - Github issues are also used for tracking planned and approved enhancements, often tied in to specific releases. + GitHub issues are also used for tracking planned and approved enhancements, often tied in to specific releases.

    CodeIgniter 3 diff --git a/app/Views/home.php b/app/Views/home.php index 01039a72..0405210e 100644 --- a/app/Views/home.php +++ b/app/Views/home.php @@ -195,7 +195,7 @@

    diff --git a/composer.json b/composer.json index fffae634..df3087b8 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "http-interop/http-factory-guzzle": "^1.0", "knplabs/github-api": "^3.0", "league/commonmark": "^2.3", - "psr/container": "^1.1" + "psr/container": "^2.0" }, "require-dev": { "codeigniter4/devkit": "^1.0", diff --git a/composer.lock b/composer.lock index caf29f3d..2b58a52c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b43f65b381ee9de85b5af516b8d2162f", + "content-hash": "4e0ef27e6546203a8148419c3bc7ae2e", "packages": [ { "name": "clue/stream-filter", @@ -143,16 +143,16 @@ }, { "name": "codeigniter4/framework", - "version": "v4.4.4", + "version": "v4.4.5", "source": { "type": "git", "url": "https://github.com/codeigniter4/framework.git", - "reference": "7c170c4e6bde1b879ee67a8a5457c06cfc3ad07a" + "reference": "f5844cb9790d87ff6043203953821740ba3aa592" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codeigniter4/framework/zipball/7c170c4e6bde1b879ee67a8a5457c06cfc3ad07a", - "reference": "7c170c4e6bde1b879ee67a8a5457c06cfc3ad07a", + "url": "https://api.github.com/repos/codeigniter4/framework/zipball/f5844cb9790d87ff6043203953821740ba3aa592", + "reference": "f5844cb9790d87ff6043203953821740ba3aa592", "shasum": "" }, "require": { @@ -164,9 +164,9 @@ "psr/log": "^1.1" }, "require-dev": { - "codeigniter/coding-standard": "^1.5", + "codeigniter/coding-standard": "^1.7", "fakerphp/faker": "^1.9", - "friendsofphp/php-cs-fixer": "~3.41.0", + "friendsofphp/php-cs-fixer": "^3.47.1", "kint-php/kint": "^5.0.4", "mikey179/vfsstream": "^1.6", "nexusphp/cs-config": "^3.6", @@ -214,7 +214,7 @@ "slack": "https://codeigniterchat.slack.com", "source": "https://github.com/codeigniter4/CodeIgniter4" }, - "time": "2023-12-28T10:37:53+00:00" + "time": "2024-01-27T03:57:48+00:00" }, { "name": "dflydev/dot-access-data", @@ -826,16 +826,16 @@ }, { "name": "league/commonmark", - "version": "2.4.1", + "version": "2.4.2", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5" + "reference": "91c24291965bd6d7c46c46a12ba7492f83b1cadf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/3669d6d5f7a47a93c08ddff335e6d945481a1dd5", - "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/91c24291965bd6d7c46c46a12ba7492f83b1cadf", + "reference": "91c24291965bd6d7c46c46a12ba7492f83b1cadf", "shasum": "" }, "require": { @@ -848,7 +848,7 @@ }, "require-dev": { "cebe/markdown": "^1.0", - "commonmark/cmark": "0.30.0", + "commonmark/cmark": "0.30.3", "commonmark/commonmark.js": "0.30.0", "composer/package-versions-deprecated": "^1.8", "embed/embed": "^4.4", @@ -858,10 +858,10 @@ "michelf/php-markdown": "^1.4 || ^2.0", "nyholm/psr7": "^1.5", "phpstan/phpstan": "^1.8.2", - "phpunit/phpunit": "^9.5.21", + "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0", "scrutinizer/ocular": "^1.8.1", - "symfony/finder": "^5.3 | ^6.0", - "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0", + "symfony/finder": "^5.3 | ^6.0 || ^7.0", + "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 || ^7.0", "unleashedtech/php-coding-standard": "^3.1.1", "vimeo/psalm": "^4.24.0 || ^5.0.0" }, @@ -928,7 +928,7 @@ "type": "tidelift" } ], - "time": "2023-08-30T16:55:00+00:00" + "time": "2024-02-02T11:59:32+00:00" }, { "name": "league/config", @@ -1701,22 +1701,27 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -1743,9 +1748,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/event-dispatcher", diff --git a/tests/feature/BasicPagesTest.php b/tests/feature/BasicPagesTest.php index 4a52da30..df13be5f 100644 --- a/tests/feature/BasicPagesTest.php +++ b/tests/feature/BasicPagesTest.php @@ -1,7 +1,11 @@ assertSee('The small framework with powerful features'); } + public function testCanViewHomeWhenConnectException() + { + $github = $this->getMockBuilder(GitHub::class) + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() + ->disallowMockingUnknownTypes() + ->onlyMethods(['getRepos']) + ->getMock(); + $github->method('getRepos')->willThrowException( + new ConnectException( + 'cURL error 6: Could not resolve host: api.github.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.github.com/repos/bcit-ci/CodeIgniter', + new Request( + 'GET', + 'https://api.github.com/repos/bcit-ci/CodeIgniter' + ) + ) + ); + Services::injectMock('github', $github); + + $result = $this->get('/'); + + $result->assertStatus(200); + $result->assertSee('The small framework with powerful features'); + } + public function testCanViewDiscuss() { $result = $this->get('/discuss');