@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $folderIDs = $this->allFixtureIDs('Folder'); |
36 | 36 | foreach ($folderIDs as $folderID) { |
37 | 37 | $folder = DataObject::get_by_id('Folder', $folderID); |
38 | - if (!file_exists(BASE_PATH."/$folder->Filename")) { |
|
39 | - mkdir(BASE_PATH."/$folder->Filename"); |
|
38 | + if (!file_exists(BASE_PATH . "/$folder->Filename")) { |
|
39 | + mkdir(BASE_PATH . "/$folder->Filename"); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $imageIDs = $this->allFixtureIDs('Image'); |
45 | 45 | foreach ($imageIDs as $imageID) { |
46 | 46 | $image = DataObject::get_by_id('Image', $imageID); |
47 | - $filePath = BASE_PATH."/$image->Filename"; |
|
47 | + $filePath = BASE_PATH . "/$image->Filename"; |
|
48 | 48 | $sourcePath = str_replace('assets/SectionTest/', 'section-io/tests/testfiles/', $filePath); |
49 | 49 | if (!file_exists($filePath)) { |
50 | 50 | if (!copy($sourcePath, $filePath)) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $fileIDs = $this->allFixtureIDs('File'); |
58 | 58 | foreach ($fileIDs as $fileID) { |
59 | 59 | $file = DataObject::get_by_id('File', $fileID); |
60 | - $filePath = BASE_PATH."/$file->Filename"; |
|
60 | + $filePath = BASE_PATH . "/$file->Filename"; |
|
61 | 61 | $sourcePath = str_replace('assets/SectionTest/', 'section-io/tests/testfiles/', $filePath); |
62 | 62 | if (!file_exists($filePath)) { |
63 | 63 | if (!copy($sourcePath, $filePath)) { |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $imageIDs = $this->allFixtureIDs('Image'); |
83 | 83 | foreach ($imageIDs as $imageID) { |
84 | 84 | $image = DataObject::get_by_id('Image', $imageID); |
85 | - if ($image && file_exists(BASE_PATH."/$image->Filename")) { |
|
86 | - unlink(BASE_PATH."/$image->Filename"); |
|
85 | + if ($image && file_exists(BASE_PATH . "/$image->Filename")) { |
|
86 | + unlink(BASE_PATH . "/$image->Filename"); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | $fileIDs = $this->allFixtureIDs('File'); |
92 | 92 | foreach ($fileIDs as $fileID) { |
93 | 93 | $file = DataObject::get_by_id('File', $fileID); |
94 | - if ($file && file_exists(BASE_PATH."/$file->Filename")) { |
|
95 | - unlink(BASE_PATH."/$file->Filename"); |
|
94 | + if ($file && file_exists(BASE_PATH . "/$file->Filename")) { |
|
95 | + unlink(BASE_PATH . "/$file->Filename"); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | $folderIDs = $this->allFixtureIDs('Folder'); |
101 | 101 | foreach ($folderIDs as $folderID) { |
102 | 102 | $folder = DataObject::get_by_id('Folder', $folderID); |
103 | - if ($folder && file_exists(BASE_PATH.'/'.$folder->Filename.'_resampled')) { |
|
104 | - Filesystem::removeFolder(BASE_PATH.'/'.$folder->Filename.'_resampled'); |
|
103 | + if ($folder && file_exists(BASE_PATH . '/' . $folder->Filename . '_resampled')) { |
|
104 | + Filesystem::removeFolder(BASE_PATH . '/' . $folder->Filename . '_resampled'); |
|
105 | 105 | } |
106 | - if ($folder && file_exists(BASE_PATH."/$folder->Filename")) { |
|
107 | - Filesystem::removeFolder(BASE_PATH."/$folder->Filename"); |
|
106 | + if ($folder && file_exists(BASE_PATH . "/$folder->Filename")) { |
|
107 | + Filesystem::removeFolder(BASE_PATH . "/$folder->Filename"); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | { |
47 | 47 | $image = Image::get()->byID($imageID); |
48 | 48 | if ($image && $image->exists()) { |
49 | - $exp = 'obj.http.x-url ~ "^/'.preg_quote($image->getFilename()).'$"'; // image itself |
|
50 | - $exp .= ' || obj.http.x-url ~ "^/'.preg_quote($image->Parent()->getFilename()) |
|
51 | - .'_resampled/(.*)\-'.preg_quote($image->Name).'$"'; // resampled versions |
|
49 | + $exp = 'obj.http.x-url ~ "^/' . preg_quote($image->getFilename()) . '$"'; // image itself |
|
50 | + $exp .= ' || obj.http.x-url ~ "^/' . preg_quote($image->Parent()->getFilename()) |
|
51 | + .'_resampled/(.*)\-' . preg_quote($image->Name) . '$"'; // resampled versions |
|
52 | 52 | return static::performFlush($exp); |
53 | 53 | } |
54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $file = File::get()->byID($fileID); |
61 | 61 | if ($file && $file->exists()) { |
62 | - $exp = 'obj.http.x-url ~ "^/'.preg_quote($file->getFilename()).'$"'; |
|
62 | + $exp = 'obj.http.x-url ~ "^/' . preg_quote($file->getFilename()) . '$"'; |
|
63 | 63 | return static::performFlush($exp); |
64 | 64 | } |
65 | 65 | |
@@ -79,23 +79,23 @@ discard block |
||
79 | 79 | switch ($strategy) { |
80 | 80 | |
81 | 81 | case SectionIO::SITETREE_STRATEGY_SINGLE: |
82 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
83 | - $exp .= ' && obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"'; |
|
82 | + $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"'; |
|
83 | + $exp .= ' && obj.http.x-url ~ "^' . preg_quote($sitetree->Link()) . '$"'; |
|
84 | 84 | break; |
85 | 85 | |
86 | 86 | case SectionIO::SITETREE_STRATEGY_PARENTS: |
87 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
88 | - $exp .= ' && (obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"'; |
|
87 | + $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"'; |
|
88 | + $exp .= ' && (obj.http.x-url ~ "^' . preg_quote($sitetree->Link()) . '$"'; |
|
89 | 89 | $parent = $sitetree->getParent(); |
90 | 90 | while ($parent && $parent->exists()) { |
91 | - $exp .= ' || obj.http.x-url ~ "^'.preg_quote($parent->Link()).'$"'; |
|
91 | + $exp .= ' || obj.http.x-url ~ "^' . preg_quote($parent->Link()) . '$"'; |
|
92 | 92 | $parent = $parent->getParent(); |
93 | 93 | } |
94 | 94 | $exp .= ')'; |
95 | 95 | break; |
96 | 96 | |
97 | 97 | case SectionIO::SITETREE_STRATEGY_ALL: |
98 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
98 | + $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"'; |
|
99 | 99 | break; |
100 | 100 | |
101 | 101 | case 'everyting': // compatibility, old typo |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | public static function flushURL($url) { |
116 | 116 | if ($url) { |
117 | - $exp = 'obj.http.x-url ~ "^'.preg_quote($url).'$"'; |
|
117 | + $exp = 'obj.http.x-url ~ "^' . preg_quote($url) . '$"'; |
|
118 | 118 | return static::performFlush($exp); |
119 | 119 | } |
120 | 120 | return false; |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | $conn = $service->request(null, 'POST', null, $headers, $options); |
143 | 143 | |
144 | 144 | if ($conn->isError()) { |
145 | - SS_Log::log('SectionIO::performFlush :: '.$conn->getStatusCode().' : '.$conn->getStatusDescription().' : '.$url, SS_Log::ERR); |
|
145 | + SS_Log::log('SectionIO::performFlush :: ' . $conn->getStatusCode() . ' : ' . $conn->getStatusDescription() . ' : ' . $url, SS_Log::ERR); |
|
146 | 146 | $success = $success && false; |
147 | 147 | } else { |
148 | - SS_Log::log('SectionIO::performFlush :: ban successful. url: '.$url."; ban expression: '".$banExpression."'", SS_Log::NOTICE); |
|
148 | + SS_Log::log('SectionIO::performFlush :: ban successful. url: ' . $url . "; ban expression: '" . $banExpression . "'", SS_Log::NOTICE); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } else { |