-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dkan linkchecker feature #2339
Conversation
a8bc3ca
to
8cc5235
Compare
e75a05e
to
88485ce
Compare
e8dda20
to
9b2ff14
Compare
32cbb50
to
6da7289
Compare
Fails linting
|
* Implements hook_preprocess_page(). | ||
*/ | ||
function dkan_linkchecker_preprocess_page(&$vars) { | ||
if (arg(2) == 'dkan-linkchecker-report' || arg(4) == 'dkan_linkchecker_reports') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the check on arg(4)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The size of the table is so large that I'm reducing font size so it does not require an annoying amount of scrolling. The arg(4) is to include this small font size on the views UI page for the same reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, lets add a comment to that effect. I think the arg(2) is self explanatory.
*/ | ||
function dkan_linkchecker_menu_alter(&$items) { | ||
// Remove normal linkchecker report link. | ||
$items['admin/reports/linkchecker']['access callback'] = FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am assuming that this report is the default view you disabled previously. In that case, is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't disable the original view there will be multiple report pages and confusion in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the code in dkan_linkchecker_enable do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is removing the link to the disabled view from the admin menu.
class LinkcheckerContext extends RawDKANContext { | ||
|
||
protected $old_global_user; | ||
public static $modules_before_feature = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason for this variables to be public? It looks like we (this class) are managing them through the whole cycle of the use of this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based this code on what is being used in the workbench context, I have no reasoning beyond that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make them private then. public properties are generally not good as we can easily lose control of their state.
test/features/linkchecker.feature
Outdated
| name | mail | roles | | ||
| John | john@example.com | site manager | | ||
|
||
Given groups: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not using the groups or group memberships on the test, I think? Why are we creating them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so the test passes on client sites that require group assignment on their datasets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boooo... Lets add a comment then. Without that knowledge I would have deleted that during clean up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok after looking again I remember I removed the test that created a dataset with a bad link because too much needs to happen to get that bad link into the report. So since we are not creating a dataset I've removed the group background setup.
*/ | ||
class LinkcheckerContext extends RawDKANContext { | ||
|
||
protected $old_global_user; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we should discuss OOP style standards as a group, but I personally like proper camel case both for methods and properties of a class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the PSR standards and they do not say anything about how to name properties, so I will back down for now :)
* Implements hook_preprocess_page(). | ||
*/ | ||
function dkan_linkchecker_preprocess_page(&$vars) { | ||
if (arg(2) == 'dkan-linkchecker-report' || arg(4) == 'dkan_linkchecker_reports') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, lets add a comment to that effect. I think the arg(2) is self explanatory.
*/ | ||
function dkan_linkchecker_menu_alter(&$items) { | ||
// Remove normal linkchecker report link. | ||
$items['admin/reports/linkchecker']['access callback'] = FALSE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the code in dkan_linkchecker_enable do?
*/ | ||
class LinkcheckerContext extends RawDKANContext { | ||
|
||
protected $old_global_user; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the PSR standards and they do not say anything about how to name properties, so I will back down for now :)
class LinkcheckerContext extends RawDKANContext { | ||
|
||
protected $old_global_user; | ||
public static $modules_before_feature = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make them private then. public properties are generally not good as we can easily lose control of their state.
test/features/linkchecker.feature
Outdated
| name | mail | roles | | ||
| John | john@example.com | site manager | | ||
|
||
Given groups: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boooo... Lets add a comment then. Without that knowledge I would have deleted that during clean up.
3a7c35e
to
5d83598
Compare
5d83598
to
8598262
Compare
@janette We QA'd this, but got stuck on the last step! After running cron, there's no Broken Links Report under 'Reports' for admins and no Broken Links Report in the admin menu for site managers. |
@kimwdavidson @dafeder did you run cron? |
@janetteday, yup, ran cron
…On Mon, Apr 23, 2018 at 5:11 PM, Janette Day ***@***.***> wrote:
@kimwdavidson <https://github.com/kimwdavidson> @dafeder
<https://github.com/dafeder> did you run cron?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2339 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AVe-LDBZX9PD_leapIoyNB0TuIf0n13bks5trkOOgaJpZM4RlM2f>
.
--
Kim Davidson
Project Manager | CivicActions <http://civicactions.com>
e: kim.davidson@gmail.com
Skype: kwdavidson
|
@kimwdavidson ok I guess the trick was clearing cache |
@janette yes we did |
@janette: QA'd and this all looks great, except when I'm logged in as a site manager, I can find the broken links report if I go into Site Configuration -> Link Checker Settings, but is it supposed to just be an item at the top of the menu? |
@kimwdavidson do you want to screen share? the link is under Site Configuration if you are a site manager |
Checked that last thing, and it's working as expected, so this is all ready! |
* Adds a linkchecker to DKAN.
* Adds a linkchecker to DKAN.
* Adds a linkchecker to DKAN.
* Adds a linkchecker to DKAN.
User Story
As a user in charge of data integrity, I want to be able to see where links are failing in my data catalog.
QA steps
drush en dkan_linkchecker
drush fr dkan_linkchecker -y
drush cc all
Add a dataset with bad links in multiple fields
Add resource with a bad remote file
Add a harvest source with a bad url
if Local:
drush linkchecker-analyze
drush cron
if Probo:
Admin should see Broken Links Report under 'Reports'
Admin should see Link checker under 'Configuration > Content Authoring'
Sitemanager should see Link Checker Settings in the admin menu under 'Site Configuration'
Sitemanager should see Broken Links Report in the admin menu under 'Site Configuration > Link Checker Settings'
View broken link report and confirm the bad links are listed.
Reminders
Connects https://github.com/NuCivic/client-usva-data/issues/69