Completed
Push — master ( c06076...9b020f )
by Florian
04:18
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   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $image = Image::get()->byID($imageID);
40 40
         if ($image && $image->exists()) {
41
-            $exp = 'obj.http.x-url ~ "^/'.preg_quote($image->getFilename()).'$"'; // image itself
42
-            $exp    .= ' || obj.http.x-url ~ "^/'.preg_quote($image->Parent()->getFilename())
43
-                    .'_resampled/(.*)\-'.preg_quote($image->Name).'$"'; // resampled versions
41
+            $exp = 'obj.http.x-url ~ "^/' . preg_quote($image->getFilename()) . '$"'; // image itself
42
+            $exp .= ' || obj.http.x-url ~ "^/' . preg_quote($image->Parent()->getFilename())
43
+                    .'_resampled/(.*)\-' . preg_quote($image->Name) . '$"'; // resampled versions
44 44
             return static::performFlush($exp);
45 45
         }
46 46
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $file = File::get()->byID($fileID);
53 53
         if ($file && $file->exists()) {
54
-            $exp = 'obj.http.x-url ~ "^/'.preg_quote($file->getFilename()).'$"';
54
+            $exp = 'obj.http.x-url ~ "^/' . preg_quote($file->getFilename()) . '$"';
55 55
             return static::performFlush($exp);
56 56
         }
57 57
 
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
             switch ($strategy) {
67 67
 
68 68
                 case 'single':
69
-                    $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"';
70
-                    $exp .= ' && obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"';
69
+                    $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"';
70
+                    $exp .= ' && obj.http.x-url ~ "^' . preg_quote($sitetree->Link()) . '$"';
71 71
                     break;
72 72
 
73 73
                 case 'parents':
74
-                    $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"';
75
-                    $exp .= ' && (obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"';
74
+                    $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"';
75
+                    $exp .= ' && (obj.http.x-url ~ "^' . preg_quote($sitetree->Link()) . '$"';
76 76
                     $parent = $sitetree->getParent();
77 77
                     while ($parent && $parent->exists()) {
78
-                        $exp .= ' || obj.http.x-url ~ "^'.preg_quote($parent->Link()).'$"';
78
+                        $exp .= ' || obj.http.x-url ~ "^' . preg_quote($parent->Link()) . '$"';
79 79
                         $parent = $parent->getParent();
80 80
                     }
81 81
                     $exp .= ')';
82 82
                     break;
83 83
 
84 84
                 case 'all':
85
-                    $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"';
85
+                    $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"';
86 86
                     break;
87 87
 
88 88
                 case 'everyting':
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     
101 101
     public static function flushURL($url) {
102 102
         if ($url) {
103
-            $exp = 'obj.http.x-url ~ "^'.preg_quote($url).'$"';
103
+            $exp = 'obj.http.x-url ~ "^' . preg_quote($url) . '$"';
104 104
             return static::performFlush($exp);
105 105
         }
106 106
         return false;
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 					$conn = $service->request(null, 'POST', null, $headers, $options);
129 129
 
130 130
 					if ($conn->isError()) {
131
-						SS_Log::log('SectionIO::performFlush :: '.$conn->getStatusCode().' : '.$conn->getStatusDescription().' : '.$url, SS_Log::ERR);
131
+						SS_Log::log('SectionIO::performFlush :: ' . $conn->getStatusCode() . ' : ' . $conn->getStatusDescription() . ' : ' . $url, SS_Log::ERR);
132 132
 						$success = $success && false;
133 133
 					} else {
134
-						SS_Log::log('SectionIO::performFlush :: ban successful. url: '.$url."; ban expression: '".$banExpression."'", SS_Log::NOTICE);
134
+						SS_Log::log('SectionIO::performFlush :: ban successful. url: ' . $url . "; ban expression: '" . $banExpression . "'", SS_Log::NOTICE);
135 135
 					}
136 136
 				}
137 137
 			} else {
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     {
179 179
         $cert = ini_get('curl.cainfo');
180 180
         if (!$cert) {
181
-            $cert = BASE_PATH.'/'.SECTIONIO_BASE.'/cert/cacert.pem';
181
+            $cert = BASE_PATH . '/' . SECTIONIO_BASE . '/cert/cacert.pem';
182 182
         }
183 183
 
184 184
         return $cert;
Please login to merge, or discard this patch.