Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
141
Issues
141
List
Boards
Labels
Service Desk
Milestones
Merge Requests
27
Merge Requests
27
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
d73937ef
Commit
d73937ef
authored
1 day ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): improved sitemaps with abbeyroad feeds
parent
e0053ad6
master
No related merge requests found
Pipeline
#64228007
passed with stages
in 6 minutes and 58 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
18 deletions
+30
-18
SitemapTrending.php
Core/SEO/Sitemaps/Modules/SitemapTrending.php
+30
-18
No files found.
Core/SEO/Sitemaps/Modules/SitemapTrending.php
View file @
d73937ef
...
...
@@ -5,16 +5,16 @@ namespace Minds\Core\SEO\Sitemaps\Modules;
use
Minds\Core\Di\Di
;
use
Minds\Core\Entities
;
use
Minds\Core\SEO\Sitemaps\SitemapModule
;
use
Minds\Core\
Trending\Repository
;
use
Minds\Core\
Feeds\Top\Manager
;
class
SitemapTrending
extends
SitemapModule
{
/** @var
Repository
*/
protected
$t
rendingRepository
;
/** @var
Manager
*/
protected
$t
opManager
;
public
function
__construct
()
{
$this
->
t
rendingRepository
=
Di
::
_
()
->
get
(
'Trending\Repository
'
);
$this
->
t
opManager
=
Di
::
_
()
->
get
(
'Feeds\Top\Manager
'
);
}
public
function
collect
(
$pages
,
$segments
)
...
...
@@ -24,28 +24,37 @@ class SitemapTrending extends SitemapModule
}
else
{
$param
=
$segments
[
0
];
}
$period
=
$pages
[
1
]
??
'24h'
;
switch
(
$param
)
{
case
'activity'
:
$key
=
'activity'
;
break
;
case
'channels'
:
$key
=
'
channels
'
;
$key
=
'
user
'
;
break
;
case
'images'
:
$key
=
'
images
'
;
$key
=
'
object:image
'
;
break
;
case
'videos'
:
$key
=
'
videos
'
;
$key
=
'
object:video
'
;
break
;
case
'blogs'
:
$key
=
'
blogs
'
;
$key
=
'
object:blog
'
;
break
;
case
'groups'
:
$key
=
'group
s
'
;
$key
=
'group'
;
break
;
}
$entities
=
$this
->
getEntities
(
$key
);
$entities
=
$this
->
getEntities
(
$key
,
$period
);
foreach
(
$entities
as
$entity
)
{
$route
=
''
;
switch
(
$param
)
{
case
'activity'
:
$route
=
'newsfeed/'
.
$entity
->
guid
;
break
;
case
'images'
:
case
'videos'
:
$route
=
'media/'
.
$entity
->
guid
;
...
...
@@ -61,21 +70,24 @@ class SitemapTrending extends SitemapModule
break
;
}
$this
->
addOrUpdateRoute
(
$route
,
time
()
);
$this
->
addOrUpdateRoute
(
$route
,
$entity
->
time_updated
);
}
}
private
function
getEntities
(
$key
)
private
function
getEntities
(
$key
,
$period
=
'24h'
)
{
if
(
!
isset
(
$key
))
{
return
[];
}
$result
=
$this
->
trendingRepository
->
getList
([
'type'
=>
$key
,
'limit'
=>
50
]);
if
(
!
$result
)
{
return
[];
}
$guids
=
$result
[
'guids'
];
return
Entities
::
get
([
'guids'
=>
$guids
]);
$result
=
$this
->
topManager
->
getList
([
'type'
=>
$key
,
'limit'
=>
1000
,
'sync'
=>
false
,
'algorithm'
=>
'top'
,
'period'
=>
$period
,
]);
return
$result
;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment