Git Product home page Git Product logo

hongpong / broken-link-checker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from achmafooma/broken-link-checker

10.0 10.0 4.0 2.42 MB

This plugin will check your posts, comments and other content for broken links and missing images, and notify you if any are found. (non-commercial community fork of broken-link-checker)

PHP 97.53% CSS 1.57% JavaScript 0.90%
checker link wordpress wordpress-plugin

broken-link-checker's People

Contributors

achmafooma avatar aleksey-mukho avatar briareos avatar carloslongarela avatar da2x avatar hinaloe avatar hongpong avatar iambz avatar janneaalto avatar kaile avatar kniebremser avatar lanche86 avatar mundschenk-at avatar sebsz avatar sgrivcov-godaddy avatar sofasurfer avatar tannguyen04 avatar zrgisa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

broken-link-checker's Issues

Better scraping: switch to HTTPlug + Guzzle

It is not easy necessarily to include libraries from Composer, they may have to be manually namespaced.

See also #21 as this plugin will need a composer.json file as well to operate this correctly (and thus will need to know its namespace if it has the original or a new fork one)

Recommended by @mlang38 here:

We have switched to HTTP/2 with Let's Encrypt recently.

I guess the problem comes from the Snoopy library which doesn't seem to be really maintained anymore. I suggest switching to HTTPlug with something like Guzzle to implement it.

Don't know if it will solve HTTP/2 and encryption issues, but I think it will be more reliable for the future.

wp__blc_instances doesn't exist

Hi,
I am using the latest version from github. Recently I have received a following email from cron:

Error Table 'mysite.wp__blc_instances' doesn't exist bazy danych WordPressa podczas wykonywania zapytania SELECT instance_id FROM wp__blc_instances WHERE container_id = 18154 AND container_type = 'post' wysłanego przez do_action_ref_array('wp_scheduled_auto_draft_delete'), WP_Hook->do_action, WP_Hook->apply_filters, wp_delete_auto_drafts, wp_delete_post, do_action('delete_post'), WP_Hook->do_action, WP_Hook->apply_filters, blcPostTypeOverlord->post_deleted

It hasn't appear even once with the "old" version.

Automatic plugin CI testing

Improving testing on the plugin would make all development more stable and reduce chance of regressions. Note this would require a site populated with content that has both valid and 404 outgoing links.

In this I am inspired by the testing code on Linkback for Drupal 8 which is very detailed for all functions.

[discussion] questions about this repo

very nice to see someone willing to maintain this plugin

from your comments on WP and your request to transfer ownership, it's unclear to me what the status of this BLC repo is - are you forking it? or just patching it?

i wasn't able to find a license for the original BLC, however given the authors lack of presence i hope you see fit to take over the project and re-release it

i'd like to submit 1 or 2 issues but would like to know the status first

thanks!

Notice: Trying to get property of non-object in hook_the_content()

reported by @johnny538 a few months ago here
https://wordpress.org/support/topic/php-errors-135/

PHP Notice: Trying to get property of non-object in /var/www/html/wp-content/plugins/broken-link-checker/includes/any-post.php on line 298

please fix

a lot of times this kind of notice can be fixed by isset() or property_exists() , however not sure if that would matter because $post is checked for emptiness first ( http://php.net/manual/en/function.empty.php ) . Maybe post is somehow not an object here.

see also https://wordpress.stackexchange.com/questions/88613/notice-trying-to-get-property-of-non-object-in-options-php

looks to me like this

        if ( empty($post) || !in_array($post->post_type, $this->enabled_post_types)) {

Perhaps $post is not empty and $this is unset. That would lead to this condition. More careful checking of the nature of $this may be needed since this could be triggered in an odd place?

  • entering a debug statement, or var_dump($post) and var_dump($this) might be needed to figure this out.
  • Also need to know WP and PHP versions in play here.

Change DB schema due to "zero date" content issue

should aim to have a null date field work just fine. DB schema would have to be incremented (there are spots in code that check for schema)

originally reported by @ghost in 2017:

The default db-schema.php has columns like:

`first_failure` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last_check` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last_success` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`last_check_attempt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',

However, in MySQL 5.7, NO_ZERO_DATE in conjunction with strict mode are defaults. This means that the above schema settings are invalid in a standard MySQL 5.7 installation.

Is there a code-dependent reason for them being set to default to zero?

If not, I think a more compatible schema would be to make them nullable.

Better handle altering system's PHP env values internally

the plugin is altering the PHP environment values and this is a pretty serious intervention in the environment. May want to somehow change how this is set up. Or throw more warnings if it is engaged. And per this report it happens even if the plugin is not active. (given the better batch handling in the fork this may not even be needed anymore. the jobs seem to move along okay without these extreme settings, that can cause other problems elsewhere)

https://wordpress.org/support/topic/plugin-settings-override-server-and-wp-config-even-when-deactivated/

please help me

خطأ Table 'newsliby_wp.wp__blc_instances' doesn't exist في قاعدة بيانات ووردبريس للاستعلام SELECT instance_id FROM wp__blc_instances WHERE container_id = 7087 AND container_type = 'post' القادم من do_action_ref_array('wp_scheduled_auto_draft_delete'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, wp_delete_auto_drafts, wp_delete_post, do_action('delete_post'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, blcPostTypeOverlord->post_deleted

question regarding version vs. official version

i went to install the latest version from this repo but i see in WP that i have 1.11.8 installed and this repo is 1.11.7, yet the code here was updated after .8

can someone help me understand?

WP-CLI integration + testing

change referer 'CURLOPT_REFERER'

/modules/checkers/http.php
line 194, 195:

//Add a semi-plausible referer header to avoid tripping up some bot traps
curl_setopt($ch, CURLOPT_REFERER, home_url());

i'd like to change the referer to google to see if i can avoid some '403 Forbidden' results (vimeo.com) - how do i do this - is the following correct:
curl_setopt($ch, CURLOPT_REFERER, 'google.com');

or do i need to keep the brackets:
curl_setopt($ch, CURLOPT_REFERER, 'google.com'());

Change PHP dependency to only versions that are not EOL (7.1+)

PHP 7.1 should be required since all other PHP versions are now end-of-life.

This will reduce maintenance overhead and prevent problems with modern hosting.

This would not be done immediately but I think would be OK to do after about two releases (like two or three months out from the next, revamped release)

Document which hosts ban this plugin

Certain hosts including WP Engine ban the plugin. Which ones? This should be determined and if there is a way to get back in their good graces.

Cookie support

Hi,
This plugin doesn't like redirect with cookies.

Just add to your site a few links like:
http://physrev.physiology.org/content/81/3/1031.full
http://www.fasebj.org/content/25/1_Supplement/528.2
https://www.nature.com/articles/pr201551

There is a quick fix to get rid of some of those errors. In the file broken-link-checker/modules/checkers/http.php around line 200 add another parameter to CURL:

curl_setopt($ch, CURLOPT_COOKIEFILE, "");

This causes curl to accept cookies and to store them temporarily in the memory. That is fine and it is enough.

It solves some issues, the problem remains with some links and their logic. Because BLC reports me as a redirect link which eventually gets redirected to itself. I think there has to be a check if the final url equals the original url, then there is nothing to report and it is not a redirect, despite there are different url's in between (for example to set cookies).

I will try to to add this logic to BLC a little bit later.

Override "HEAD" remote operations for individual or global link checks, to "GET" requests

in some cases a remote host may not give the same results for a HEAD request instead of a regular GET request.

  • make an option to process an individual link as a GET request
  • make an option to make a default sitewide use of GET request instead of HEAD (which takes more resources. this would not be a module default)

per the discussion here @Pathduck ran into this kind of issue with a remote host probably. https://wordpress.org/support/topic/help-sites-who-always-show-redirect/

This isn't a high priority for me and would probably be after #24 for ease of proper development, however I wanted to get the idea established.

Cookies implementation

See also #24. Guzzle should be able to do this (curl probably can as well with the right args). It would need an interface in the options to load cookie strings most likely, or in some cases just fake its way thru accepting cookies better.

Issue filed here: https://wordpress.org/support/topic/cookies_not_supported/ by @grzegorzjanoszka :

Hi,
I really like this plugin and it helps me to provide reliable sources to information on the Internet. There are more and more websites however doing funny stuff with HTTP requests and they set cookies and require them.
This plugin unfortunately doesn’t support it and as a result I have lots of redirects to URL’s containing:
– ?error=cookies_not_supported
– /action/cookieAbsent
– sth similar
Any idea how to cope with that?
Thank you in advance for any help.

Fix PHP7 warnings and fatal errors

Some may be already fixed by upstream fork contributors.

Originally reported in 2016 by @mAAdhaTTah and @era5mx :

Getting this message for a number of classes:

[23-Jan-2016 20:04:15 UTC] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; blcModule has a deprecated constructor in /path/to/plugins/broken-link-checker/includes/module-base.php on line 15
[23-Jan-2016 20:04:15 UTC] PHP Stack trace:
[23-Jan-2016 20:04:15 UTC] PHP   1. {main}() /path/to/wp/wp-admin/admin-ajax.php:0
[23-Jan-2016 20:04:15 UTC] PHP   2. require_once() /path/to/wp/wp-admin/admin-ajax.php:22
[23-Jan-2016 20:04:15 UTC] PHP   3. require_once() /path/to/wp/wp-load.php:42
[23-Jan-2016 20:04:15 UTC] PHP   4. require_once() /path/to/wp-config.php:9
[23-Jan-2016 20:04:15 UTC] PHP   5. do_action() /path/to/wp/wp-settings.php:392
[23-Jan-2016 20:04:15 UTC] PHP   6. blc_init() /path/to/wp/wp-includes/plugin.php:525
[23-Jan-2016 20:04:15 UTC] PHP   7. require_once() /path/to/plugins/broken-link-checker/core/init.php:303

Getting this message for a number of classes:

[23-Jan-2016 20:04:15 UTC] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; blcModule has a deprecated constructor in /path/to/plugins/broken-link-checker/includes/module-base.php on line 15
[23-Jan-2016 20:04:15 UTC] PHP Stack trace:
[23-Jan-2016 20:04:15 UTC] PHP   1. {main}() /path/to/wp/wp-admin/admin-ajax.php:0
[23-Jan-2016 20:04:15 UTC] PHP   2. require_once() /path/to/wp/wp-admin/admin-ajax.php:22
[23-Jan-2016 20:04:15 UTC] PHP   3. require_once() /path/to/wp/wp-load.php:42
[23-Jan-2016 20:04:15 UTC] PHP   4. require_once() /path/to/wp-config.php:9
[23-Jan-2016 20:04:15 UTC] PHP   5. do_action() /path/to/wp/wp-settings.php:392
[23-Jan-2016 20:04:15 UTC] PHP   6. blc_init() /path/to/wp/wp-includes/plugin.php:525
[23-Jan-2016 20:04:15 UTC] PHP   7. require_once() /path/to/plugins/broken-link-checker/core/init.php:303

Name: Broken Link Checker

FILE: /.../wp-content/plugins/broken-link-checker/includes/admin/table-printer.php

FOUND 1 ERROR AFFECTING 1 LINE

28 | ERROR | Deprecated PHP4 style constructor are not supported since PHP7

FILE: /.../wp-content/plugins/broken-link-checker/includes/utility-class.php

FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE

42 | WARNING | INI directive 'safe_mode' is deprecated from PHP 5.3 and forbidden from PHP 5.4.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.