jenkins-bot has submitted this change and it was merged.

Change subject: Excluded a number of common bots from the zero log, stricter 
css & js inclsion
......................................................................


Excluded a number of common bots from the zero log, stricter css & js inclsion

Be stricter about inclusion of JS and CSS in case UA is feature phone.

Change-Id: If544e3b3d03f4cc846fbea11e29f9f166a69b514
---
M includes/PageRenderingHooks.php
1 file changed, 14 insertions(+), 6 deletions(-)

Approvals:
  Dr0ptp4kt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/PageRenderingHooks.php b/includes/PageRenderingHooks.php
index 160c232..c93293f 100644
--- a/includes/PageRenderingHooks.php
+++ b/includes/PageRenderingHooks.php
@@ -332,14 +332,16 @@
                                        $warn .= ' && zero referer';
                                }
                        }
-                       if ( $warn !== '' && $this->request->getHeader( 'FROM' 
) !== 'googlebot(at)googlebot.com' ) {
+                       $ua = $this->request->getHeader( 'USER-AGENT' );
+                       if ( $warn !== ''
+                               && $this->request->getHeader( 'FROM' ) !== 
'googlebot(at)googlebot.com'
+                               && strpos( $ua, 'Googlebot' ) === false
+                               && strpos( $ua, 'bingbot' ) === false
+                               && strpos( $ua, 'YandexBot' ) === false
+                               && strpos( $ua, 'msnbot' ) === false
+                       ) {
                                self::logDebug( '!config' . $warn );
                        }
-               }
-
-               if ( $this->getConfigId() !== null || $this->isZeroSubdomain ) {
-                       $out->addModuleStyles( 'mobile.zero.styles' );
-                       $out->addModules( 'mobile.zero.scripts' );
                }
 
                // @TODO: Delete this section after a collection window
@@ -349,6 +351,12 @@
                        wfDebugLog( 'zero', "502-16 $omr $ua" );
                }
 
+
+               if ( $this->getConfig() !== null || $this->isZeroSubdomain ) {
+                       $out->addModuleStyles( 'mobile.zero.styles' );
+                       $out->addModules( 'mobile.zero.scripts' );
+               }
+
                $out->addVaryHeader( 'X-CS' );
                $out->addVaryHeader( 'X-Subdomain' );
                $out->addVaryHeader( 'X-Images' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If544e3b3d03f4cc846fbea11e29f9f166a69b514
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ZeroRatedMobileAccess
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
Gerrit-Reviewer: Dr0ptp4kt <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to