|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © 2016 Magento. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | +namespace Magento\Cms\Setup; |
| 7 | + |
| 8 | +use Magento\Cms\Model\Page; |
| 9 | +use Magento\Cms\Model\PageFactory; |
| 10 | +use Magento\Framework\Setup\ModuleContextInterface; |
| 11 | +use Magento\Framework\Setup\ModuleDataSetupInterface; |
| 12 | +use Magento\Framework\Setup\UpgradeDataInterface; |
| 13 | + |
| 14 | +class UpgradeData implements UpgradeDataInterface |
| 15 | +{ |
| 16 | + const PRIVACY_COOKIE_PAGE_ID = 4; |
| 17 | + |
| 18 | + /** |
| 19 | + * @var PageFactory |
| 20 | + */ |
| 21 | + private $pageFactory; |
| 22 | + |
| 23 | + /** |
| 24 | + * @param PageFactory $pageFactory |
| 25 | + */ |
| 26 | + public function __construct(PageFactory $pageFactory) |
| 27 | + { |
| 28 | + $this->pageFactory = $pageFactory; |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Create page |
| 33 | + * |
| 34 | + * @return Page |
| 35 | + */ |
| 36 | + private function createPage() |
| 37 | + { |
| 38 | + return $this->pageFactory->create(); |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Upgrades data for a module |
| 43 | + * |
| 44 | + * @param ModuleDataSetupInterface $setup |
| 45 | + * @param ModuleContextInterface $context |
| 46 | + * @return void |
| 47 | + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
| 48 | + */ |
| 49 | + public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) |
| 50 | + { |
| 51 | + $setup->startSetup(); |
| 52 | + if (version_compare($context->getVersion(), '2.0.1', '<')) { |
| 53 | + $newPageContent = <<<EOD |
| 54 | +<div class="privacy-policy cms-content"> |
| 55 | + <div class="message info"> |
| 56 | + <span> |
| 57 | + Please replace this text with you Privacy Policy. |
| 58 | + Please add any additional cookies your website uses below (e.g. Google Analytics). |
| 59 | + </span> |
| 60 | + </div> |
| 61 | + <p> |
| 62 | + This privacy policy sets out how this website (hereafter "the Store") uses and protects any information that |
| 63 | + you give the Store while using this website. The Store is committed to ensuring that your privacy is protected. |
| 64 | + Should we ask you to provide certain information by which you can be identified when using this website, then |
| 65 | + you can be assured that it will only be used in accordance with this privacy statement. The Store may change |
| 66 | + this policy from time to time by updating this page. You should check this page from time to time to ensure |
| 67 | + that you are happy with any changes. |
| 68 | + </p> |
| 69 | + <h2>What we collect</h2> |
| 70 | + <p>We may collect the following information:</p> |
| 71 | + <ul> |
| 72 | + <li>name</li> |
| 73 | + <li>contact information including email address</li> |
| 74 | + <li>demographic information such as postcode, preferences and interests</li> |
| 75 | + <li>other information relevant to customer surveys and/or offers</li> |
| 76 | + </ul> |
| 77 | + <p> |
| 78 | + For the exhaustive list of cookies we collect see the <a href="#list">List of cookies we collect</a> section. |
| 79 | + </p> |
| 80 | + <h2>What we do with the information we gather</h2> |
| 81 | + <p> |
| 82 | + We require this information to understand your needs and provide you with a better service, |
| 83 | + and in particular for the following reasons: |
| 84 | + </p> |
| 85 | + <ul> |
| 86 | + <li>Internal record keeping.</li> |
| 87 | + <li>We may use the information to improve our products and services.</li> |
| 88 | + <li> |
| 89 | + We may periodically send promotional emails about new products, special offers or other information which we |
| 90 | + think you may find interesting using the email address which you have provided. |
| 91 | + </li> |
| 92 | + <li> |
| 93 | + From time to time, we may also use your information to contact you for market research purposes. |
| 94 | + We may contact you by email, phone, fax or mail. We may use the information to customise the website |
| 95 | + according to your interests. |
| 96 | + </li> |
| 97 | + </ul> |
| 98 | + <h2>Security</h2> |
| 99 | + <p> |
| 100 | + We are committed to ensuring that your information is secure. In order to prevent unauthorised access or |
| 101 | + disclosure, we have put in place suitable physical, electronic and managerial procedures to safeguard and |
| 102 | + secure the information we collect online. |
| 103 | + </p> |
| 104 | + <h2>How we use cookies</h2> |
| 105 | + <p> |
| 106 | + A cookie is a small file which asks permission to be placed on your computer's hard drive. |
| 107 | + Once you agree, the file is added and the cookie helps analyse web traffic or lets you know when you visit |
| 108 | + a particular site. Cookies allow web applications to respond to you as an individual. The web application |
| 109 | + can tailor its operations to your needs, likes and dislikes by gathering and remembering information about |
| 110 | + your preferences. |
| 111 | + </p> |
| 112 | + <p> |
| 113 | + We use traffic log cookies to identify which pages are being used. This helps us analyse data about web page |
| 114 | + traffic and improve our website in order to tailor it to customer needs. We only use this information for |
| 115 | + statistical analysis purposes and then the data is removed from the system. |
| 116 | + </p> |
| 117 | + <p> |
| 118 | + Overall, cookies help us provide you with a better website, by enabling us to monitor which pages you find |
| 119 | + useful and which you do not. A cookie in no way gives us access to your computer or any information about you, |
| 120 | + other than the data you choose to share with us. You can choose to accept or decline cookies. |
| 121 | + Most web browsers automatically accept cookies, but you can usually modify your browser setting |
| 122 | + to decline cookies if you prefer. This may prevent you from taking full advantage of the website. |
| 123 | + </p> |
| 124 | + <h2>Links to other websites</h2> |
| 125 | + <p> |
| 126 | + Our website may contain links to other websites of interest. However, once you have used these links |
| 127 | + to leave our site, you should note that we do not have any control over that other website. |
| 128 | + Therefore, we cannot be responsible for the protection and privacy of any information which you provide whilst |
| 129 | + visiting such sites and such sites are not governed by this privacy statement. |
| 130 | + You should exercise caution and look at the privacy statement applicable to the website in question. |
| 131 | + </p> |
| 132 | + <h2>Controlling your personal information</h2> |
| 133 | + <p>You may choose to restrict the collection or use of your personal information in the following ways:</p> |
| 134 | + <ul> |
| 135 | + <li> |
| 136 | + whenever you are asked to fill in a form on the website, look for the box that you can click to indicate |
| 137 | + that you do not want the information to be used by anybody for direct marketing purposes |
| 138 | + </li> |
| 139 | + <li> |
| 140 | + if you have previously agreed to us using your personal information for direct marketing purposes, |
| 141 | + you may change your mind at any time by letting us know using our Contact Us information |
| 142 | + </li> |
| 143 | + </ul> |
| 144 | + <p> |
| 145 | + We will not sell, distribute or lease your personal information to third parties unless we have your permission |
| 146 | + or are required by law to do so. We may use your personal information to send you promotional information |
| 147 | + about third parties which we think you may find interesting if you tell us that you wish this to happen. |
| 148 | + </p> |
| 149 | + <p> |
| 150 | + You may request details of personal information which we hold about you under the Data Protection Act 1998. |
| 151 | + A small fee will be payable. If you would like a copy of the information held on you please email us this |
| 152 | + request using our Contact Us information. |
| 153 | + </p> |
| 154 | + <p> |
| 155 | + If you believe that any information we are holding on you is incorrect or incomplete, |
| 156 | + please write to or email us as soon as possible, at the above address. |
| 157 | + We will promptly correct any information found to be incorrect. |
| 158 | + </p> |
| 159 | + <h2><a name="list"></a>List of cookies we collect</h2> |
| 160 | + <p>The table below lists the cookies we collect and what information they store.</p> |
| 161 | + <table class="data-table data-table-definition-list"> |
| 162 | + <thead> |
| 163 | + <tr> |
| 164 | + <th>Cookie Name</th> |
| 165 | + <th>Cookie Description</th> |
| 166 | + </tr> |
| 167 | + </thead> |
| 168 | + <tbody> |
| 169 | + <tr> |
| 170 | + <th>FORM_KEY</th> |
| 171 | + <td>Stores randomly generated key used to prevent forged requests.</td> |
| 172 | + </tr> |
| 173 | + <tr> |
| 174 | + <th>PHPSESSID</th> |
| 175 | + <td>Your session ID on the server.</td> |
| 176 | + </tr> |
| 177 | + <tr> |
| 178 | + <th>GUEST-VIEW</th> |
| 179 | + <td>Allows guests to view and edit their orders.</td> |
| 180 | + </tr> |
| 181 | + <tr> |
| 182 | + <th>PERSISTENT_SHOPPING_CART</th> |
| 183 | + <td>A link to information about your cart and viewing history, if you have asked for this.</td> |
| 184 | + </tr> |
| 185 | + <tr> |
| 186 | + <th>STF</th> |
| 187 | + <td>Information on products you have emailed to friends.</td> |
| 188 | + </tr> |
| 189 | + <tr> |
| 190 | + <th>STORE</th> |
| 191 | + <td>The store view or language you have selected.</td> |
| 192 | + </tr> |
| 193 | + <tr> |
| 194 | + <th>USER_ALLOWED_SAVE_COOKIE</th> |
| 195 | + <td>Indicates whether a customer allowed to use cookies.</td> |
| 196 | + </tr> |
| 197 | + <tr> |
| 198 | + <th>MAGE-CACHE-SESSID</th> |
| 199 | + <td>Facilitates caching of content on the browser to make pages load faster.</td> |
| 200 | + </tr> |
| 201 | + <tr> |
| 202 | + <th>MAGE-CACHE-STORAGE</th> |
| 203 | + <td>Facilitates caching of content on the browser to make pages load faster.</td> |
| 204 | + </tr> |
| 205 | + <tr> |
| 206 | + <th>MAGE-CACHE-STORAGE-SECTION-INVALIDATION</th> |
| 207 | + <td>Facilitates caching of content on the browser to make pages load faster.</td> |
| 208 | + </tr> |
| 209 | + <tr> |
| 210 | + <th>MAGE-CACHE-TIMEOUT</th> |
| 211 | + <td>Facilitates caching of content on the browser to make pages load faster.</td> |
| 212 | + </tr> |
| 213 | + <tr> |
| 214 | + <th>SECTION-DATA-IDS</th> |
| 215 | + <td>Facilitates caching of content on the browser to make pages load faster.</td> |
| 216 | + </tr> |
| 217 | + <tr> |
| 218 | + <th>PRIVATE_CONTENT_VERSION</th> |
| 219 | + <td>Facilitates caching of content on the browser to make pages load faster.</td> |
| 220 | + </tr> |
| 221 | + <tr> |
| 222 | + <th>X-MAGENTO-VARY</th> |
| 223 | + <td>Facilitates caching of content on the server to make pages load faster.</td> |
| 224 | + </tr> |
| 225 | + <tr> |
| 226 | + <th>MAGE-TRANSLATION-FILE-VERSION</th> |
| 227 | + <td>Facilitates translation of content to other languages.</td> |
| 228 | + </tr> |
| 229 | + <tr> |
| 230 | + <th>MAGE-TRANSLATION-STORAGE</th> |
| 231 | + <td>Facilitates translation of content to other languages.</td> |
| 232 | + </tr> |
| 233 | + </tbody> |
| 234 | + </table> |
| 235 | +</div> |
| 236 | +EOD; |
| 237 | + $privacyAndCookiePolicyPage = $this->createPage()->load(self::PRIVACY_COOKIE_PAGE_ID); |
| 238 | + $privacyAndCookiePolicyPage->setContent($newPageContent); |
| 239 | + $privacyAndCookiePolicyPage->save(); |
| 240 | + } |
| 241 | + $setup->endSetup(); |
| 242 | + } |
| 243 | +} |
0 commit comments