Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81605068
PhabricatorSitemapsController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Sep 7, 00:10
Size
3 KB
Mime Type
text/x-php
Expires
Mon, Sep 9, 00:10 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20584589
Attached To
rPH Phabricator
PhabricatorSitemapsController.php
View Options
<?php
final
class
PhabricatorSitemapsController
extends
PhabricatorController
{
public
function
shouldRequireLogin
()
{
return
false
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$user
=
$request
->
getViewer
();
$out
=
array
();
// headers
$out
[]
=
'<?xml version="1.0" encoding="UTF-8"?>'
;
$out
[]
=
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
;
// Static pages
$today
=
date
(
"Y-m-d"
);
$out
[]
=
$this
->
url
(
'/'
,
$today
,
'daily'
,
'1.0'
);
$out
[]
=
$this
->
url
(
'/diffusion/'
,
$today
,
'daily'
,
'0.9'
);
$out
[]
=
$this
->
url
(
'/phriction/'
,
$today
,
'daily'
,
'0.9'
);
$out
[]
=
$this
->
url
(
'/project/'
,
$today
,
'daily'
,
'0.9'
);
$out
[]
=
$this
->
url
(
'/audit/'
,
$today
,
'weekly'
,
'0.5'
);
$out
[]
=
$this
->
url
(
'/differential/'
,
$today
,
'weekly'
,
'0.5'
);
$out
[]
=
$this
->
url
(
'/maniphest/'
,
$today
,
'weekly'
,
'0.5'
);
$out
[]
=
$this
->
url
(
'/paste/'
,
$today
,
'weekly'
,
'0.5'
);
$out
[]
=
$this
->
url
(
'/feed/'
,
$today
,
'weekly'
,
'0.4'
);
$out
[]
=
$this
->
url
(
'/calendar/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/conpherence/'
,
$today
,
'monthly'
,
'0.1'
);
//$out[] = $this->url('/dashboard/', $today, 'monthly', '0.1');
$out
[]
=
$this
->
url
(
'/people/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/phurl/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/badges/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/countdown/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/diviner/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/file/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/flag/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/harbormaster/'
,
$today
,
'monthly'
,
'0.1'
);
//$out[] = $this->url('/herald/', $today, 'monthly', '0.1');
$out
[]
=
$this
->
url
(
'/legalpad/'
,
$today
,
'monthly'
,
'0.1'
);
$out
[]
=
$this
->
url
(
'/macro/'
,
$today
,
'monthly'
,
'0.1'
);
//$out[] = $this->url('/passphrase/', $today, 'monthly', '0.1');
$out
[]
=
$this
->
url
(
'/applications/'
,
$today
,
'yearly'
,
'0.0'
);
$out
[]
=
$this
->
url
(
'/auth/'
,
$today
,
'never'
,
'0.0'
);
$out
[]
=
$this
->
url
(
'/config/'
,
$today
,
'never'
,
'0.0'
);
$out
[]
=
$this
->
url
(
'/daemon/'
,
$today
,
'never'
,
'0.0'
);
$out
[]
=
$this
->
url
(
'/mail/'
,
$today
,
'never'
,
'0.0'
);
//$out[] = $this->url('/conduit/', $today, 'never', '0.0');
// Repositories
$repo
=
id
(
new
PhabricatorRepositoryQuery
())
->
setViewer
(
$user
)
->
withStatus
(
PhabricatorRepositoryQuery
::
STATUS_OPEN
)
->
execute
();
foreach
(
$repo
as
$r
)
{
$out
[]
=
$this
->
url
(
$r
->
getURI
(),
date
(
'c'
,
$r
->
getDateModified
()),
'weekly'
,
'0.8'
);
}
// Projects
$project
=
id
(
new
PhabricatorProjectQuery
())
->
setViewer
(
$user
)
->
execute
();
foreach
(
$project
as
$p
)
{
$out
[]
=
$this
->
url
(
$p
->
getURI
(),
date
(
'c'
,
$p
->
getDateModified
()),
'weekly'
,
'0.8'
);
}
// Wiki
$wiki
=
id
(
new
PhrictionDocumentQuery
())
->
setViewer
(
$user
)
->
needContent
(
true
)
->
withStatus
(
PhrictionDocumentQuery
::
STATUS_OPEN
)
->
execute
();
foreach
(
$wiki
as
$w
)
{
$out
[]
=
$this
->
url
(
$w
->
getSlugURI
(
$w
->
getSlug
()),
date
(
'c'
,
$w
->
getContent
()->
getDateModified
()),
'weekly'
,
'0.8'
);
}
// Footer
$out
[]
=
'</urlset>'
;
$content
=
implode
(
"
\n
"
,
$out
).
"
\n
"
;
return
id
(
new
AphrontFileResponse
())
->
setContent
(
$content
)
->
setMimeType
(
'text/xml'
)
->
setCacheDurationInSeconds
(
phutil_units
(
'10 minutes in seconds'
))
->
setCanCDN
(
true
);
}
private
function
url
(
$loc
,
$mod
,
$freq
,
$priority
)
{
$uri
=
PhabricatorEnv
::
getURI
(
$loc
);
return
"<url>"
.
" <loc>${uri}</loc>"
.
" <lastmod>${mod}</lastmod>"
.
" <changefreq>${freq}</changefreq>"
.
" <priority>${priority}</priority>"
.
"</url>"
;
}
}
Event Timeline
Log In to Comment