Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL_WDN_Assessment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Fairchild
UNL_WDN_Assessment
Commits
3bea1ab6
Commit
3bea1ab6
authored
15 years ago
by
Brett Bieber
Browse files
Options
Downloads
Patches
Plain Diff
Allow you to validate just the invalid pages.
parent
42010697
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/UNL/WDN/Assessment.php
+30
-2
30 additions, 2 deletions
src/UNL/WDN/Assessment.php
src/UNL/WDN/Assessment/ValidateInvalidLogger.php
+10
-0
10 additions, 0 deletions
src/UNL/WDN/Assessment/ValidateInvalidLogger.php
www/index.php
+4
-1
4 additions, 1 deletion
www/index.php
with
44 additions
and
3 deletions
src/UNL/WDN/Assessment.php
+
30
−
2
View file @
3bea1ab6
...
@@ -11,6 +11,23 @@ class UNL_WDN_Assessment
...
@@ -11,6 +11,23 @@ class UNL_WDN_Assessment
$this
->
db
=
$db
;
$this
->
db
=
$db
;
}
}
function
checkInvalid
()
{
$plogger
=
new
UNL_WDN_Assessment_PageLogger
(
$this
);
$vlogger
=
new
UNL_WDN_Assessment_ValidateInvalidLogger
(
$this
);
$downloader
=
new
Spider_Downloader
();
$parser
=
new
Spider_Parser
();
$spider
=
new
Spider
(
$downloader
,
$parser
);
$spider
->
addLogger
(
$plogger
);
$spider
->
addLogger
(
$vlogger
);
$spider
->
addUriFilter
(
'Spider_AnchorFilter'
);
$spider
->
addUriFilter
(
'Spider_MailtoFilter'
);
$spider
->
addUriFilter
(
'UNL_WDN_Assessment_FileExtensionFilter'
);
$spider
->
spider
(
$this
->
baseUri
);
}
function
reValidate
()
function
reValidate
()
{
{
$this
->
removeEntries
();
$this
->
removeEntries
();
...
@@ -45,13 +62,13 @@ class UNL_WDN_Assessment
...
@@ -45,13 +62,13 @@ class UNL_WDN_Assessment
function
setValidationResult
(
$uri
,
$result
)
function
setValidationResult
(
$uri
,
$result
)
{
{
$sth
=
$this
->
db
->
prepare
(
'UPDATE assessment SET valid = ? WHERE baseurl = ? AND url = ?;'
);
$sth
=
$this
->
db
->
prepare
(
'UPDATE assessment SET valid =
?, timestamp =
? WHERE baseurl = ? AND url = ?;'
);
if
(
$result
)
{
if
(
$result
)
{
$result
=
'true'
;
$result
=
'true'
;
}
else
{
}
else
{
$result
=
'false'
;
$result
=
'false'
;
}
}
$sth
->
execute
(
array
(
$result
,
$this
->
baseUri
,
$uri
));
$sth
->
execute
(
array
(
$result
,
date
(
'Y-m-d H:i:s'
),
$this
->
baseUri
,
$uri
));
}
}
function
getSubPages
()
function
getSubPages
()
...
@@ -60,4 +77,15 @@ class UNL_WDN_Assessment
...
@@ -60,4 +77,15 @@ class UNL_WDN_Assessment
$sth
->
execute
(
array
(
$this
->
baseUri
));
$sth
->
execute
(
array
(
$this
->
baseUri
));
return
$sth
->
fetchAll
();
return
$sth
->
fetchAll
();
}
}
function
pageWasValid
(
$uri
)
{
$sth
=
$this
->
db
->
prepare
(
'SELECT valid FROM assessment WHERE baseurl = ? AND url = ?;'
);
$sth
->
execute
(
array
(
$this
->
baseUri
,
$uri
));
$result
=
$sth
->
fetch
();
if
(
$result
[
'valid'
]
==
'true'
)
{
return
true
;
}
return
false
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/UNL/WDN/Assessment/ValidateInvalidLogger.php
0 → 100644
+
10
−
0
View file @
3bea1ab6
<?php
class
UNL_WDN_Assessment_ValidateInvalidLogger
extends
UNL_WDN_Assessment_ValidationLogger
{
function
log
(
$uri
,
DOMXPath
$xpath
)
{
if
(
!
$this
->
assessment
->
pageWasValid
(
$uri
))
{
parent
::
log
(
$uri
,
$xpath
);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
www/index.php
+
4
−
1
View file @
3bea1ab6
...
@@ -9,14 +9,17 @@ if (isset($_GET['uri'])) {
...
@@ -9,14 +9,17 @@ if (isset($_GET['uri'])) {
$assessment
=
new
UNL_WDN_Assessment
(
$uri
,
$db
);
$assessment
=
new
UNL_WDN_Assessment
(
$uri
,
$db
);
if
(
isset
(
$_GET
[
'revalidate'
]))
{
if
(
isset
(
$_GET
[
'revalidate'
]))
{
$assessment
->
reValidate
();
$assessment
->
reValidate
();
}
elseif
(
isset
(
$_GET
[
'invalid'
]))
{
$assessment
->
checkInvalid
();
}
}
}
}
?>
?>
<h1>
Welcome to the batch validator
</h1>
<h1>
Welcome to the
new
batch validator
</h1>
<form
method=
"GET"
action=
""
>
<form
method=
"GET"
action=
""
>
<input
type=
"text"
name=
"uri"
value=
"
<?php
echo
$uri
;
?>
"
/>
<input
type=
"text"
name=
"uri"
value=
"
<?php
echo
$uri
;
?>
"
/>
Revalidate all?
<input
type=
"checkbox"
name=
"revalidate"
/>
Revalidate all?
<input
type=
"checkbox"
name=
"revalidate"
/>
Revalidate invalid?
<input
type=
"checkbox"
name=
"invalid"
/>
<input
type=
"submit"
name=
"submit"
/></form>
<input
type=
"submit"
name=
"submit"
/></form>
<?php
<?php
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment