@@ -16,261 +16,261 @@ |
||
| 16 | 16 | |
| 17 | 17 | class SectionIOTest extends SapphireTest |
| 18 | 18 | { |
| 19 | - protected static $fixture_file = 'SectionIOTest.yml'; |
|
| 19 | + protected static $fixture_file = 'SectionIOTest.yml'; |
|
| 20 | 20 | |
| 21 | - public static function setUpBeforeClass() |
|
| 22 | - { |
|
| 23 | - parent::setUpBeforeClass(); |
|
| 21 | + public static function setUpBeforeClass() |
|
| 22 | + { |
|
| 23 | + parent::setUpBeforeClass(); |
|
| 24 | 24 | |
| 25 | - // add config values |
|
| 26 | - Config::modify()->set(SectionIO::class, 'flush_on_dev_build', true); |
|
| 27 | - Config::modify()->set(SectionIO::class, 'api_url', 'https://example.com'); |
|
| 28 | - Config::modify()->set(SectionIO::class, 'account_id', '123456'); |
|
| 29 | - Config::modify()->set(SectionIO::class, 'application_id', '987654'); |
|
| 30 | - Config::modify()->set(SectionIO::class, 'environment_name', 'Production'); |
|
| 31 | - Config::modify()->set(SectionIO::class, 'proxy_name', 'myproxy'); |
|
| 32 | - Config::modify()->set(SectionIO::class, 'username', 'someuser'); |
|
| 33 | - Config::modify()->set(SectionIO::class, 'password', 'MySafePassword'); |
|
| 34 | - Config::modify()->set(SectionIO::class, 'verify_ssl', false); |
|
| 35 | - |
|
| 36 | - // remove extensions otherwise the fixtures will break the tests (by calling the live flush) |
|
| 37 | - File::remove_extension(SectionIOFileExtension::class); |
|
| 38 | - SiteTree::remove_extension(SectionIOSiteTreeExtension::class); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - public function setUp() |
|
| 42 | - { |
|
| 43 | - parent::setUp(); |
|
| 25 | + // add config values |
|
| 26 | + Config::modify()->set(SectionIO::class, 'flush_on_dev_build', true); |
|
| 27 | + Config::modify()->set(SectionIO::class, 'api_url', 'https://example.com'); |
|
| 28 | + Config::modify()->set(SectionIO::class, 'account_id', '123456'); |
|
| 29 | + Config::modify()->set(SectionIO::class, 'application_id', '987654'); |
|
| 30 | + Config::modify()->set(SectionIO::class, 'environment_name', 'Production'); |
|
| 31 | + Config::modify()->set(SectionIO::class, 'proxy_name', 'myproxy'); |
|
| 32 | + Config::modify()->set(SectionIO::class, 'username', 'someuser'); |
|
| 33 | + Config::modify()->set(SectionIO::class, 'password', 'MySafePassword'); |
|
| 34 | + Config::modify()->set(SectionIO::class, 'verify_ssl', false); |
|
| 35 | + |
|
| 36 | + // remove extensions otherwise the fixtures will break the tests (by calling the live flush) |
|
| 37 | + File::remove_extension(SectionIOFileExtension::class); |
|
| 38 | + SiteTree::remove_extension(SectionIOSiteTreeExtension::class); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + public function setUp() |
|
| 42 | + { |
|
| 43 | + parent::setUp(); |
|
| 44 | 44 | |
| 45 | - // Set backend root to /SectionTest |
|
| 46 | - TestAssetStore::activate('SectionTest'); |
|
| 45 | + // Set backend root to /SectionTest |
|
| 46 | + TestAssetStore::activate('SectionTest'); |
|
| 47 | 47 | |
| 48 | - // Create a test files for each of the fixture references |
|
| 49 | - $fileIDs = array_merge( |
|
| 50 | - $this->allFixtureIDs(File::class), |
|
| 51 | - $this->allFixtureIDs(Image::class) |
|
| 52 | - ); |
|
| 53 | - foreach ($fileIDs as $fileID) { |
|
| 54 | - /** @var File $file */ |
|
| 55 | - $file = DataObject::get_by_id(File::class, $fileID); |
|
| 56 | - $file->setFromString(str_repeat('x', 1000000), $file->getFilename()); |
|
| 57 | - } |
|
| 48 | + // Create a test files for each of the fixture references |
|
| 49 | + $fileIDs = array_merge( |
|
| 50 | + $this->allFixtureIDs(File::class), |
|
| 51 | + $this->allFixtureIDs(Image::class) |
|
| 52 | + ); |
|
| 53 | + foreach ($fileIDs as $fileID) { |
|
| 54 | + /** @var File $file */ |
|
| 55 | + $file = DataObject::get_by_id(File::class, $fileID); |
|
| 56 | + $file->setFromString(str_repeat('x', 1000000), $file->getFilename()); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public static function tearDownAfterClass() |
|
| 62 | - { |
|
| 63 | - // re-add extensions |
|
| 64 | - File::add_extension(SectionIOFileExtension::class); |
|
| 65 | - SiteTree::add_extension(SectionIOSiteTreeExtension::class); |
|
| 61 | + public static function tearDownAfterClass() |
|
| 62 | + { |
|
| 63 | + // re-add extensions |
|
| 64 | + File::add_extension(SectionIOFileExtension::class); |
|
| 65 | + SiteTree::add_extension(SectionIOSiteTreeExtension::class); |
|
| 66 | 66 | |
| 67 | - parent::tearDownAfterClass(); |
|
| 68 | - } |
|
| 67 | + parent::tearDownAfterClass(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - public function tearDown() |
|
| 71 | - { |
|
| 72 | - TestAssetStore::reset(); |
|
| 70 | + public function tearDown() |
|
| 71 | + { |
|
| 72 | + TestAssetStore::reset(); |
|
| 73 | 73 | |
| 74 | - parent::tearDown(); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - public function testFlushAll() |
|
| 78 | - { |
|
| 79 | - $result = SectionIOTest_MySectionIO::flushAll(); |
|
| 80 | - |
|
| 81 | - $this->assertCount( |
|
| 82 | - 1, |
|
| 83 | - $result, |
|
| 84 | - 'one url returned for one application id' |
|
| 85 | - ); |
|
| 86 | - |
|
| 87 | - // url |
|
| 88 | - $this->assertEquals( |
|
| 89 | - 'https://example.com/account/123456/application/987654/environment/Production/proxy/myproxy/state', |
|
| 90 | - $result[0]['url'], |
|
| 91 | - 'URL is concatenated correctly' |
|
| 92 | - ); |
|
| 93 | - |
|
| 94 | - // ban expression |
|
| 95 | - $this->assertEquals( |
|
| 96 | - 'obj.http.x-url ~ /', |
|
| 97 | - $result[0]['banExpression'], |
|
| 98 | - 'ban expression is correct' |
|
| 99 | - ); |
|
| 100 | - |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - public function testFlush() |
|
| 104 | - { |
|
| 105 | - $result = SectionIOTest_MySectionIO::flush(); |
|
| 106 | - |
|
| 107 | - $this->assertCount( |
|
| 108 | - 1, |
|
| 109 | - $result, |
|
| 110 | - 'one url returned for one application id' |
|
| 111 | - ); |
|
| 112 | - |
|
| 113 | - // url |
|
| 114 | - $this->assertEquals( |
|
| 115 | - 'https://example.com/account/123456/application/987654/environment/Production/proxy/myproxy/state', |
|
| 116 | - $result[0]['url'], |
|
| 117 | - 'URL is concatenated correctly' |
|
| 118 | - ); |
|
| 119 | - |
|
| 120 | - // ban expression |
|
| 121 | - $this->assertEquals( |
|
| 122 | - 'obj.http.x-url ~ /', |
|
| 123 | - $result[0]['banExpression'], |
|
| 124 | - 'ban expression is correct' |
|
| 125 | - ); |
|
| 126 | - |
|
| 127 | - // test deactivated flush on build |
|
| 128 | - Config::modify()->set(SectionIO::class, 'flush_on_dev_build', false); |
|
| 129 | - $result = SectionIOTest_MySectionIO::flush(); |
|
| 130 | - $this->assertNull( |
|
| 131 | - $result, |
|
| 132 | - 'null returned if flush on build deactivated' |
|
| 133 | - ); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - public function testMultipleApplicationIDs() |
|
| 137 | - { |
|
| 138 | - // add second application to config |
|
| 139 | - Config::modify()->set(SectionIO::class, 'application_id', '2546987,856954'); |
|
| 140 | - |
|
| 141 | - $result = SectionIOTest_MySectionIO::flushAll(); |
|
| 142 | - |
|
| 143 | - $this->assertCount( |
|
| 144 | - 2, |
|
| 145 | - $result, |
|
| 146 | - 'two urls returned for two application id' |
|
| 147 | - ); |
|
| 148 | - |
|
| 149 | - // url |
|
| 150 | - $this->assertEquals( |
|
| 151 | - 'https://example.com/account/123456/application/2546987/environment/Production/proxy/myproxy/state', |
|
| 152 | - $result[0]['url'], |
|
| 153 | - 'URL is concatenated correctly for app 1' |
|
| 154 | - ); |
|
| 155 | - $this->assertEquals( |
|
| 156 | - 'https://example.com/account/123456/application/856954/environment/Production/proxy/myproxy/state', |
|
| 157 | - $result[1]['url'], |
|
| 158 | - 'URL is concatenated correctly for app 2' |
|
| 159 | - ); |
|
| 160 | - |
|
| 161 | - // add second application to config with spaces in csv |
|
| 162 | - Config::modify()->set(SectionIO::class, 'application_id', '741852, 369258'); |
|
| 163 | - |
|
| 164 | - $result = SectionIOTest_MySectionIO::flushAll(); |
|
| 165 | - |
|
| 166 | - $this->assertCount( |
|
| 167 | - 2, |
|
| 168 | - $result, |
|
| 169 | - 'two urls returned for two application id' |
|
| 170 | - ); |
|
| 171 | - |
|
| 172 | - // url |
|
| 173 | - $this->assertEquals( |
|
| 174 | - 'https://example.com/account/123456/application/741852/environment/Production/proxy/myproxy/state', |
|
| 175 | - $result[0]['url'], |
|
| 176 | - 'URL is concatenated correctly for app 1' |
|
| 177 | - ); |
|
| 178 | - $this->assertEquals( |
|
| 179 | - 'https://example.com/account/123456/application/369258/environment/Production/proxy/myproxy/state', |
|
| 180 | - $result[1]['url'], |
|
| 181 | - 'URL is concatenated correctly for app 2' |
|
| 182 | - ); |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - public function testFlushImage() |
|
| 186 | - { |
|
| 187 | - $imageId = $this->idFromFixture(Image::class, 'testImage'); |
|
| 188 | - |
|
| 189 | - $result = SectionIOTest_MySectionIO::flushImage($imageId); |
|
| 190 | - |
|
| 191 | - // ban expression |
|
| 192 | - $this->assertEquals( |
|
| 193 | - 'obj.http.x-url ~ "^/assets/SectionTest/test_image\.png$"' |
|
| 194 | - .' || obj.http.x-url ~ "^/assets/SectionTest/test_image__[a-zA-Z0-9_]*\.png$"', |
|
| 195 | - $result[0]['banExpression'], |
|
| 196 | - 'ban expression is correct' |
|
| 197 | - ); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - public function testFlushFile() |
|
| 201 | - { |
|
| 202 | - $fileId = $this->idFromFixture(File::class, 'testFile'); |
|
| 203 | - |
|
| 204 | - $result = SectionIOTest_MySectionIO::flushFile($fileId); |
|
| 205 | - |
|
| 206 | - // ban expression |
|
| 207 | - $this->assertEquals( |
|
| 208 | - 'obj.http.x-url ~ "^/assets/SectionTest/test_document\.pdf$"', |
|
| 209 | - $result[0]['banExpression'], |
|
| 210 | - 'ban expression is correct' |
|
| 211 | - ); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - public function testFlushSiteTree() |
|
| 215 | - { |
|
| 216 | - $pageId = $this->idFromFixture(Page::class, 'ceo'); |
|
| 217 | - |
|
| 218 | - // test single page flush |
|
| 219 | - Config::modify()->set(SectionIO::class, 'sitetree_flush_strategy', 'single'); |
|
| 220 | - $result = SectionIOTest_MySectionIO::flushSiteTree($pageId); |
|
| 221 | - $this->assertEquals( |
|
| 222 | - 'obj.http.content-type ~ "text/html"' |
|
| 223 | - .' && obj.http.x-url ~ "^/about\-us/my\-staff/ceo/$"', |
|
| 224 | - $result[0]['banExpression'], |
|
| 225 | - 'ban expression is correct' |
|
| 226 | - ); |
|
| 227 | - |
|
| 228 | - // test parents flush |
|
| 229 | - Config::modify()->set(SectionIO::class, 'sitetree_flush_strategy', 'parents'); |
|
| 230 | - $result = SectionIOTest_MySectionIO::flushSiteTree($pageId); |
|
| 231 | - $this->assertEquals( |
|
| 232 | - 'obj.http.content-type ~ "text/html"' |
|
| 233 | - .' && (obj.http.x-url ~ "^/about\-us/my\-staff/ceo/$" || obj.http.x-url ~ "^/about\-us/my\-staff/$" || obj.http.x-url ~ "^/about\-us/$")', |
|
| 234 | - $result[0]['banExpression'], |
|
| 235 | - 'ban expression is correct' |
|
| 236 | - ); |
|
| 237 | - |
|
| 238 | - // test all pages flush |
|
| 239 | - Config::modify()->set(SectionIO::class, 'sitetree_flush_strategy', 'all'); |
|
| 240 | - $result = SectionIOTest_MySectionIO::flushSiteTree($pageId); |
|
| 241 | - $this->assertEquals( |
|
| 242 | - 'obj.http.content-type ~ "text/html"', |
|
| 243 | - $result[0]['banExpression'], |
|
| 244 | - 'ban expression is correct' |
|
| 245 | - ); |
|
| 246 | - |
|
| 247 | - // test whole site flush |
|
| 248 | - Config::modify()->set(SectionIO::class, 'sitetree_flush_strategy', 'everything'); |
|
| 249 | - $result = SectionIOTest_MySectionIO::flushSiteTree($pageId); |
|
| 250 | - $this->assertEquals( |
|
| 251 | - 'obj.http.x-url ~ /', |
|
| 252 | - $result[0]['banExpression'], |
|
| 253 | - 'ban expression is correct' |
|
| 254 | - ); |
|
| 255 | - } |
|
| 74 | + parent::tearDown(); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + public function testFlushAll() |
|
| 78 | + { |
|
| 79 | + $result = SectionIOTest_MySectionIO::flushAll(); |
|
| 80 | + |
|
| 81 | + $this->assertCount( |
|
| 82 | + 1, |
|
| 83 | + $result, |
|
| 84 | + 'one url returned for one application id' |
|
| 85 | + ); |
|
| 86 | + |
|
| 87 | + // url |
|
| 88 | + $this->assertEquals( |
|
| 89 | + 'https://example.com/account/123456/application/987654/environment/Production/proxy/myproxy/state', |
|
| 90 | + $result[0]['url'], |
|
| 91 | + 'URL is concatenated correctly' |
|
| 92 | + ); |
|
| 93 | + |
|
| 94 | + // ban expression |
|
| 95 | + $this->assertEquals( |
|
| 96 | + 'obj.http.x-url ~ /', |
|
| 97 | + $result[0]['banExpression'], |
|
| 98 | + 'ban expression is correct' |
|
| 99 | + ); |
|
| 100 | + |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + public function testFlush() |
|
| 104 | + { |
|
| 105 | + $result = SectionIOTest_MySectionIO::flush(); |
|
| 106 | + |
|
| 107 | + $this->assertCount( |
|
| 108 | + 1, |
|
| 109 | + $result, |
|
| 110 | + 'one url returned for one application id' |
|
| 111 | + ); |
|
| 112 | + |
|
| 113 | + // url |
|
| 114 | + $this->assertEquals( |
|
| 115 | + 'https://example.com/account/123456/application/987654/environment/Production/proxy/myproxy/state', |
|
| 116 | + $result[0]['url'], |
|
| 117 | + 'URL is concatenated correctly' |
|
| 118 | + ); |
|
| 119 | + |
|
| 120 | + // ban expression |
|
| 121 | + $this->assertEquals( |
|
| 122 | + 'obj.http.x-url ~ /', |
|
| 123 | + $result[0]['banExpression'], |
|
| 124 | + 'ban expression is correct' |
|
| 125 | + ); |
|
| 126 | + |
|
| 127 | + // test deactivated flush on build |
|
| 128 | + Config::modify()->set(SectionIO::class, 'flush_on_dev_build', false); |
|
| 129 | + $result = SectionIOTest_MySectionIO::flush(); |
|
| 130 | + $this->assertNull( |
|
| 131 | + $result, |
|
| 132 | + 'null returned if flush on build deactivated' |
|
| 133 | + ); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + public function testMultipleApplicationIDs() |
|
| 137 | + { |
|
| 138 | + // add second application to config |
|
| 139 | + Config::modify()->set(SectionIO::class, 'application_id', '2546987,856954'); |
|
| 140 | + |
|
| 141 | + $result = SectionIOTest_MySectionIO::flushAll(); |
|
| 142 | + |
|
| 143 | + $this->assertCount( |
|
| 144 | + 2, |
|
| 145 | + $result, |
|
| 146 | + 'two urls returned for two application id' |
|
| 147 | + ); |
|
| 148 | + |
|
| 149 | + // url |
|
| 150 | + $this->assertEquals( |
|
| 151 | + 'https://example.com/account/123456/application/2546987/environment/Production/proxy/myproxy/state', |
|
| 152 | + $result[0]['url'], |
|
| 153 | + 'URL is concatenated correctly for app 1' |
|
| 154 | + ); |
|
| 155 | + $this->assertEquals( |
|
| 156 | + 'https://example.com/account/123456/application/856954/environment/Production/proxy/myproxy/state', |
|
| 157 | + $result[1]['url'], |
|
| 158 | + 'URL is concatenated correctly for app 2' |
|
| 159 | + ); |
|
| 160 | + |
|
| 161 | + // add second application to config with spaces in csv |
|
| 162 | + Config::modify()->set(SectionIO::class, 'application_id', '741852, 369258'); |
|
| 163 | + |
|
| 164 | + $result = SectionIOTest_MySectionIO::flushAll(); |
|
| 165 | + |
|
| 166 | + $this->assertCount( |
|
| 167 | + 2, |
|
| 168 | + $result, |
|
| 169 | + 'two urls returned for two application id' |
|
| 170 | + ); |
|
| 171 | + |
|
| 172 | + // url |
|
| 173 | + $this->assertEquals( |
|
| 174 | + 'https://example.com/account/123456/application/741852/environment/Production/proxy/myproxy/state', |
|
| 175 | + $result[0]['url'], |
|
| 176 | + 'URL is concatenated correctly for app 1' |
|
| 177 | + ); |
|
| 178 | + $this->assertEquals( |
|
| 179 | + 'https://example.com/account/123456/application/369258/environment/Production/proxy/myproxy/state', |
|
| 180 | + $result[1]['url'], |
|
| 181 | + 'URL is concatenated correctly for app 2' |
|
| 182 | + ); |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + public function testFlushImage() |
|
| 186 | + { |
|
| 187 | + $imageId = $this->idFromFixture(Image::class, 'testImage'); |
|
| 188 | + |
|
| 189 | + $result = SectionIOTest_MySectionIO::flushImage($imageId); |
|
| 190 | + |
|
| 191 | + // ban expression |
|
| 192 | + $this->assertEquals( |
|
| 193 | + 'obj.http.x-url ~ "^/assets/SectionTest/test_image\.png$"' |
|
| 194 | + .' || obj.http.x-url ~ "^/assets/SectionTest/test_image__[a-zA-Z0-9_]*\.png$"', |
|
| 195 | + $result[0]['banExpression'], |
|
| 196 | + 'ban expression is correct' |
|
| 197 | + ); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + public function testFlushFile() |
|
| 201 | + { |
|
| 202 | + $fileId = $this->idFromFixture(File::class, 'testFile'); |
|
| 203 | + |
|
| 204 | + $result = SectionIOTest_MySectionIO::flushFile($fileId); |
|
| 205 | + |
|
| 206 | + // ban expression |
|
| 207 | + $this->assertEquals( |
|
| 208 | + 'obj.http.x-url ~ "^/assets/SectionTest/test_document\.pdf$"', |
|
| 209 | + $result[0]['banExpression'], |
|
| 210 | + 'ban expression is correct' |
|
| 211 | + ); |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + public function testFlushSiteTree() |
|
| 215 | + { |
|
| 216 | + $pageId = $this->idFromFixture(Page::class, 'ceo'); |
|
| 217 | + |
|
| 218 | + // test single page flush |
|
| 219 | + Config::modify()->set(SectionIO::class, 'sitetree_flush_strategy', 'single'); |
|
| 220 | + $result = SectionIOTest_MySectionIO::flushSiteTree($pageId); |
|
| 221 | + $this->assertEquals( |
|
| 222 | + 'obj.http.content-type ~ "text/html"' |
|
| 223 | + .' && obj.http.x-url ~ "^/about\-us/my\-staff/ceo/$"', |
|
| 224 | + $result[0]['banExpression'], |
|
| 225 | + 'ban expression is correct' |
|
| 226 | + ); |
|
| 227 | + |
|
| 228 | + // test parents flush |
|
| 229 | + Config::modify()->set(SectionIO::class, 'sitetree_flush_strategy', 'parents'); |
|
| 230 | + $result = SectionIOTest_MySectionIO::flushSiteTree($pageId); |
|
| 231 | + $this->assertEquals( |
|
| 232 | + 'obj.http.content-type ~ "text/html"' |
|
| 233 | + .' && (obj.http.x-url ~ "^/about\-us/my\-staff/ceo/$" || obj.http.x-url ~ "^/about\-us/my\-staff/$" || obj.http.x-url ~ "^/about\-us/$")', |
|
| 234 | + $result[0]['banExpression'], |
|
| 235 | + 'ban expression is correct' |
|
| 236 | + ); |
|
| 237 | + |
|
| 238 | + // test all pages flush |
|
| 239 | + Config::modify()->set(SectionIO::class, 'sitetree_flush_strategy', 'all'); |
|
| 240 | + $result = SectionIOTest_MySectionIO::flushSiteTree($pageId); |
|
| 241 | + $this->assertEquals( |
|
| 242 | + 'obj.http.content-type ~ "text/html"', |
|
| 243 | + $result[0]['banExpression'], |
|
| 244 | + 'ban expression is correct' |
|
| 245 | + ); |
|
| 246 | + |
|
| 247 | + // test whole site flush |
|
| 248 | + Config::modify()->set(SectionIO::class, 'sitetree_flush_strategy', 'everything'); |
|
| 249 | + $result = SectionIOTest_MySectionIO::flushSiteTree($pageId); |
|
| 250 | + $this->assertEquals( |
|
| 251 | + 'obj.http.x-url ~ /', |
|
| 252 | + $result[0]['banExpression'], |
|
| 253 | + 'ban expression is correct' |
|
| 254 | + ); |
|
| 255 | + } |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | class SectionIOTest_MySectionIO extends SectionIO |
| 259 | 259 | { |
| 260 | - protected static function performFlush($banExpression) |
|
| 261 | - { |
|
| 262 | - $result = array(); |
|
| 263 | - $urls = static::getUrls(); |
|
| 264 | - if (count($urls) > 0) { |
|
| 265 | - foreach ($urls as $url) { |
|
| 260 | + protected static function performFlush($banExpression) |
|
| 261 | + { |
|
| 262 | + $result = array(); |
|
| 263 | + $urls = static::getUrls(); |
|
| 264 | + if (count($urls) > 0) { |
|
| 265 | + foreach ($urls as $url) { |
|
| 266 | 266 | |
| 267 | - $data = array(); |
|
| 268 | - $data['url'] = $url; |
|
| 269 | - $data['banExpression'] = $banExpression; |
|
| 270 | - $result[] = $data; |
|
| 267 | + $data = array(); |
|
| 268 | + $data['url'] = $url; |
|
| 269 | + $data['banExpression'] = $banExpression; |
|
| 270 | + $result[] = $data; |
|
| 271 | 271 | |
| 272 | - } |
|
| 273 | - } |
|
| 274 | - return $result; |
|
| 275 | - } |
|
| 272 | + } |
|
| 273 | + } |
|
| 274 | + return $result; |
|
| 275 | + } |
|
| 276 | 276 | } |