Fixed handling of default values for page visibility for robots
authorAlexander Ebert <ebert@woltlab.com>
Sun, 11 Feb 2018 20:46:28 +0000 (21:46 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 11 Feb 2018 20:46:36 +0000 (21:46 +0100)
com.woltlab.wcf/package.xml
com.woltlab.wcf/update_3.1.0.sql [new file with mode: 0644]
com.woltlab.wcf/update_3.1_3.sql
wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php

index e2f1a576c7447ac0a8589248a50b071d2289436e..a44643353fb0528a1f9deecd123ee3bc74ee15be 100644 (file)
@@ -95,6 +95,8 @@
                <instruction type="style">defaultStyle.tar</instruction>
        </instructions>
        
+       <!-- WARNING: RE-IMPORT ALL PAGE.XML-PIPS ALONG WITH THE NEXT UPDATE (3.1.0) -->
+       
        <instructions type="update" fromversion="3.1.0 RC 2">
                <instruction type="acpTemplate">acptemplates_update.tar</instruction>
                <instruction type="file">files_update.tar</instruction>
diff --git a/com.woltlab.wcf/update_3.1.0.sql b/com.woltlab.wcf/update_3.1.0.sql
new file mode 100644 (file)
index 0000000..45eb298
--- /dev/null
@@ -0,0 +1,6 @@
+-- Force-enable the visibility of *all* pages by setting `allowSpidersToIndex` to `2`.
+-- 
+-- This value isn't valid by definition, but because it is considered to be a true-ish
+-- value, we can use this to imply an "implicit yes" without breaking any checks. Check
+-- the PagePackageInstallationPlugin to see what this magic value is good for.
+UPDATE wcf1_page SET allowSpidersToIndex = 2;
index 004a1dbd3bbe5271d30378d6e418dfdaa3f3c12f..129a0fc8a119f3ad9f58e8e13cde9c99e4179ee7 100644 (file)
@@ -138,5 +138,9 @@ INSERT INTO wcf1_contact_option (optionID, optionTitle, optionDescription, optio
 -- default recipient: site administrator
 INSERT INTO wcf1_contact_recipient (recipientID, name, email, isAdministrator, originIsSystem) VALUES (1, 'wcf.contact.recipient.name1', '', 1, 1);
 
--- force-enable the visibility of all non-system pages (the page.xml is shortly after and sets the exact values)
-UPDATE wcf1_page SET allowSpidersToIndex = 1 WHERE pageType <> 'system';
+-- Force-enable the visibility of *all* pages by setting `allowSpidersToIndex` to `2`.
+-- 
+-- This value isn't valid by definition, but because it is considered to be a true-ish
+-- value, we can use this to imply an "implicit yes" without breaking any checks. Check
+-- the PagePackageInstallationPlugin to see what this magic value is good for.
+UPDATE wcf1_page SET allowSpidersToIndex = 2;
index cf6e5182955d704a4b81192b6dd229f93508aef8..8ce0ccda424f5eeb0bc9d34f00020bf4df26e290 100644 (file)
@@ -270,12 +270,23 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        // allow update of `controller`, `handler` and `excludeFromLandingPage`
                        // only, prevents user modifications form being overwritten
                        if (!empty($data['controller'])) {
+                               $allowSpidersToIndex = $row['allowSpidersToIndex'];
+                               if ($allowSpidersToIndex == 2) {
+                                       // The value `2` resolves to be true-ish, eventually resulting in the same behavior
+                                       // when setting it to `1`. This value is special to the 3.0 -> 3.1 upgrade, because
+                                       // it force-enables the visibility, while also being some sort of indicator for non-
+                                       // user-modified values. The page edit form will set it to either `1` or `0`, there-
+                                       // fore `2` means that we can safely update the value w/o breaking the user's choice. 
+                                       $allowSpidersToIndex = $data['allowSpidersToIndex'];
+                               }
+                               
                                $page = parent::import($row, [
                                        'controller' => $data['controller'],
                                        'handler' => $data['handler'],
                                        'options' => $data['options'],
                                        'permissions' => $data['permissions'],
-                                       'excludeFromLandingPage' => $data['excludeFromLandingPage']
+                                       'excludeFromLandingPage' => $data['excludeFromLandingPage'],
+                                       'allowSpidersToIndex' => $allowSpidersToIndex
                                ]);
                        }
                        else {