Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/58440


Change subject: Ensure article is not bacon, lettuce & potato
......................................................................

Ensure article is not bacon, lettuce & potato

Bacon, lettuce & potato articles are not appropriate for new users, so
exclude them from the task list.

Change-Id: I99d5d83bd194850c8545134926bec1fc2780e7d0
---
M SpecialGettingStarted.php
1 file changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GettingStarted 
refs/changes/40/58440/1

diff --git a/SpecialGettingStarted.php b/SpecialGettingStarted.php
index c6e3458..a118390 100644
--- a/SpecialGettingStarted.php
+++ b/SpecialGettingStarted.php
@@ -32,6 +32,15 @@
                $output->addHTML( $this->getHtmlResult() );
        }
 
+       public function isBLP( $title ) {
+               $dbr = wfGetDB( DB_SLAVE );
+               $res = $dbr->selectRow( 'categorylinks', '1', array(
+                       'cl_from' => $title->getArticleID(),
+                       'cl_to' => 'Living_people',
+               ), __METHOD__ );
+               return $res !== false;
+       }
+
        public function getHtmlResult() {
                global $wgExtensionAssetsPath, $wgGettingStartedTasks;
 
@@ -67,7 +76,12 @@
                        $taskArticles = array();
                        foreach( $roulette->getRandomArticles( 
self::ARTICLE_COUNT * 4 ) as $article ) {
                                $length = $article->getLength();
-                               if ( $length > 0 && $length <= 
self::MAX_ARTICLE_LENGTH && $article->userCan( 'edit' ) ) {
+                               if (
+                                       $length > 0
+                                       && $length <= self::MAX_ARTICLE_LENGTH
+                                       && $article->userCan( 'edit' )
+                                       && !isBLP( $article )
+                               ) {
                                        $taskArticles[] = $article;
                                }
                                if ( count( $taskArticles ) === 
self::ARTICLE_COUNT ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/58440
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99d5d83bd194850c8545134926bec1fc2780e7d0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GettingStarted
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to