Completed
Push — master ( 0a158b...207abc )
by Florian
30:32 queued 15:34
created
tests/SectionIOTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
code/SectionIO.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
     {
40 40
         $image = Image::get()->byID($imageID);
41 41
         if ($image && $image->exists()) {
42
-            $exp = 'obj.http.x-url ~ "^/'.preg_quote($image->getFilename()).'$"'; // image itself
43
-            $exp    .= ' || obj.http.x-url ~ "^/'.preg_quote($image->Parent()->getFilename())
44
-                    .'_resampled/(.*)\-'.preg_quote($image->Name).'$"'; // resampled versions
42
+            $exp = 'obj.http.x-url ~ "^/' . preg_quote($image->getFilename()) . '$"'; // image itself
43
+            $exp .= ' || obj.http.x-url ~ "^/' . preg_quote($image->Parent()->getFilename())
44
+                    .'_resampled/(.*)\-' . preg_quote($image->Name) . '$"'; // resampled versions
45 45
             return static::performFlush($exp);
46 46
         }
47 47
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $file = File::get()->byID($fileID);
54 54
         if ($file && $file->exists()) {
55
-            $exp = 'obj.http.x-url ~ "^/'.preg_quote($file->getFilename()).'$"';
55
+            $exp = 'obj.http.x-url ~ "^/' . preg_quote($file->getFilename()) . '$"';
56 56
             return static::performFlush($exp);
57 57
         }
58 58
 
@@ -67,23 +67,23 @@  discard block
 block discarded – undo
67 67
             switch ($strategy) {
68 68
 
69 69
                 case 'single':
70
-                    $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"';
71
-                    $exp .= ' && obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"';
70
+                    $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"';
71
+                    $exp .= ' && obj.http.x-url ~ "^' . preg_quote($sitetree->Link()) . '$"';
72 72
                     break;
73 73
 
74 74
                 case 'parents':
75
-                    $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"';
76
-                    $exp .= ' && (obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"';
75
+                    $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"';
76
+                    $exp .= ' && (obj.http.x-url ~ "^' . preg_quote($sitetree->Link()) . '$"';
77 77
                     $parent = $sitetree->getParent();
78 78
                     while ($parent && $parent->exists()) {
79
-                        $exp .= ' || obj.http.x-url ~ "^'.preg_quote($parent->Link()).'$"';
79
+                        $exp .= ' || obj.http.x-url ~ "^' . preg_quote($parent->Link()) . '$"';
80 80
                         $parent = $parent->getParent();
81 81
                     }
82 82
                     $exp .= ')';
83 83
                     break;
84 84
 
85 85
                 case 'all':
86
-                    $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"';
86
+                    $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"';
87 87
                     break;
88 88
 
89 89
                 case 'everyting':
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     
102 102
     public static function flushURL($url) {
103 103
         if ($url) {
104
-            $exp = 'obj.http.x-url ~ "^'.preg_quote($url).'$"';
104
+            $exp = 'obj.http.x-url ~ "^' . preg_quote($url) . '$"';
105 105
             return static::performFlush($exp);
106 106
         }
107 107
         return false;
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 					$conn = $service->request(null, 'POST', null, $headers, $options);
130 130
 
131 131
 					if ($conn->isError()) {
132
-						SS_Log::log('SectionIO::performFlush :: '.$conn->getStatusCode().' : '.$conn->getStatusDescription().' : '.$url, SS_Log::ERR);
132
+						SS_Log::log('SectionIO::performFlush :: ' . $conn->getStatusCode() . ' : ' . $conn->getStatusDescription() . ' : ' . $url, SS_Log::ERR);
133 133
 						$success = $success && false;
134 134
 					} else {
135
-						SS_Log::log('SectionIO::performFlush :: ban successful. url: '.$url."; ban expression: '".$banExpression."'", SS_Log::NOTICE);
135
+						SS_Log::log('SectionIO::performFlush :: ban successful. url: ' . $url . "; ban expression: '" . $banExpression . "'", SS_Log::NOTICE);
136 136
 					}
137 137
 				}
138 138
 			} else {
Please login to merge, or discard this patch.