Completed
Push — TYPO3_8 ( e42837...eee230 )
by Tomas Norre
14:34
created
domain/process/class.tx_crawler_domain_process.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
 	 */
129 129
 	public function getProgress() {
130 130
 		$all = $this->countItemsAssigned();
131
-		if ($all<=0) {
131
+		if ($all <= 0) {
132 132
 			return 0;
133 133
 		}
134 134
 
Please login to merge, or discard this patch.
domain/process/class.tx_crawler_domain_process_collection.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @return tx_crawler_domain_process
49 49
 	 */
50 50
 	public function offsetGet($index) {
51
-		if (! parent::offsetExists($index)) {
52
-			throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available');
51
+		if (!parent::offsetExists($index)) {
52
+			throw new Exception('Index "'.var_export($index, true).'" for tx_crawler_domain_process are not available');
53 53
 		}
54 54
 		return parent::offsetGet($index);
55 55
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return void
64 64
 	 */
65 65
 	public function offsetSet($index, $subject) {
66
-		if (! $subject instanceof tx_crawler_domain_process ) {
66
+		if (!$subject instanceof tx_crawler_domain_process) {
67 67
 			throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
68 68
 		}
69 69
 		parent::offsetSet($index, $subject);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return void
77 77
 	 */
78 78
 	public function append($subject) {
79
-		if (! $subject instanceof tx_crawler_domain_process ) {
79
+		if (!$subject instanceof tx_crawler_domain_process) {
80 80
 			throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!');
81 81
 		}
82 82
 		parent::append($subject);
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	 * @return array
88 88
 	 */
89 89
 	public function getProcessIds() {
90
-		$result=array();
90
+		$result = array();
91 91
 		foreach ($this->getIterator() as $value) {
92
-			$result[]=$value->getProcess_id();
92
+			$result[] = $value->getProcess_id();
93 93
 		}
94 94
 		return $result;
95 95
 	}
Please login to merge, or discard this patch.
domain/events/class.tx_crawler_domain_events_dispatcher.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
     protected function __construct() {
72 72
     	$this->observers = array();
73
-    	if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) {
73
+    	if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) {
74 74
 			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'] as $classRef) {
75 75
 				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
76 76
 				if (method_exists($hookObj, 'registerObservers')) {
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @return void
123 123
 	 */
124 124
 	public function post($event, $group, $attachedData) {
125
-		if(is_array($this->observers[$event])) {
126
-			foreach($this->observers[$event] as $eventObserver) {
127
-				call_user_func(array($eventObserver['object'],$eventObserver['method']),$event,$group,$attachedData);
125
+		if (is_array($this->observers[$event])) {
126
+			foreach ($this->observers[$event] as $eventObserver) {
127
+				call_user_func(array($eventObserver['object'], $eventObserver['method']), $event, $group, $attachedData);
128 128
 			}
129 129
 		}
130 130
 	}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	public static function getInstance() {
139 139
 
140
-		if(!self::$instance instanceof tx_crawler_domain_events_dispatcher) {
140
+		if (!self::$instance instanceof tx_crawler_domain_events_dispatcher) {
141 141
 			$dispatcher = new tx_crawler_domain_events_dispatcher();
142 142
 			self::$instance = $dispatcher;
143 143
 		}
Please login to merge, or discard this patch.
Classes/Utility/SchedulerUtility.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,36 +42,36 @@
 block discarded – undo
42 42
     {
43 43
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlerQueueTask'] = array(
44 44
             'extension'        => $extKey,
45
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_im.name',
46
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_im.description',
45
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_im.name',
46
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_im.description',
47 47
             'additionalFields' => 'AOE\\Crawler\\Task\\CrawlerQueueTaskAdditionalFieldProvider'
48 48
         );
49 49
 
50 50
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlerTask'] = array(
51 51
             'extension'        => $extKey,
52
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.name',
53
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.description',
52
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.name',
53
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.description',
54 54
             'additionalFields' => 'AOE\\Crawler\\Task\\CrawlerTaskAdditionalFieldProvider'
55 55
         );
56 56
 
57 57
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlMultiProcessTask'] = array(
58 58
             'extension'        => $extKey,
59
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawlMultiProcess.name',
60
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.description',
59
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawlMultiProcess.name',
60
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.description',
61 61
             'additionalFields' => 'AOE\\Crawler\\Task\\CrawlMultiProcessTaskAdditionalFieldProvider'
62 62
         );
63 63
 
64 64
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\FlushQueueTask'] = array(
65 65
             'extension'        => $extKey,
66
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_flush.name',
67
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_flush.description',
66
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_flush.name',
67
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_flush.description',
68 68
             'additionalFields' => 'AOE\\Crawler\\Task\\FlushQueueTaskAdditionalFieldProvider'
69 69
         );
70 70
 
71 71
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\ProcessCleanupTask'] = array(
72 72
             'extension'        => $extKey,
73
-            'title'            => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_processCleanup.name',
74
-            'description'      => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_processCleanup.description',
73
+            'title'            => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_processCleanup.name',
74
+            'description'      => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_processCleanup.description',
75 75
         );
76 76
     }
77 77
 }
Please login to merge, or discard this patch.
Classes/Utility/TypoScriptUtility.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
             $templateUid = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
48 48
                 '*',
49 49
                 'sys_template',
50
-                'root=1 AND pid=' . (int)$page['uid'] .
50
+                'root=1 AND pid='.(int) $page['uid'].
51 51
                 \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_template')
52 52
             );
53 53
 
Please login to merge, or discard this patch.
Classes/Api/CrawlerApi.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     protected function findCrawler()
93 93
     {
94
-        if ( ! is_object($this->crawlerObj)) {
94
+        if (!is_object($this->crawlerObj)) {
95 95
             $this->crawlerObj = GeneralUtility::makeInstance('tx_crawler_lib');
96 96
             $this->crawlerObj->setID = GeneralUtility::md5int(microtime());
97 97
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         if (count($this->allowedConfigrations) > 0) {
127 127
             // 	remove configuration that does not match the current selection
128 128
             foreach ($configurations as $confKey => $confArray) {
129
-                if ( ! in_array($confKey, $this->allowedConfigrations)) {
129
+                if (!in_array($confKey, $this->allowedConfigrations)) {
130 130
                     unset($configurations[$confKey]);
131 131
                 }
132 132
             }
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
         //if the same page is scheduled for the same time and has not be executed?
193 193
         if ($schedule_timestamp == 0) {
194 194
             //untimed elements need an exec_time with 0 because they can occure multiple times
195
-            $where = 'page_id=' . $page_uid . ' AND exec_time = 0 AND scheduled=' . $schedule_timestamp;
195
+            $where = 'page_id='.$page_uid.' AND exec_time = 0 AND scheduled='.$schedule_timestamp;
196 196
         } else {
197 197
             //timed elementes have got a fixed schedule time, if a record with this time
198 198
             //exists it is maybe queued for the future, or is has been queue for the past and therefore
199 199
             //also been processed.
200
-            $where = 'page_id=' . $page_uid . ' AND scheduled=' . $schedule_timestamp;
200
+            $where = 'page_id='.$page_uid.' AND scheduled='.$schedule_timestamp;
201 201
         }
202 202
 
203 203
         $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*) as cnt',
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
         $isPageInQueue = false;
226 226
 
227
-        $whereClause = 'page_id = ' . (integer)$uid;
227
+        $whereClause = 'page_id = '.(integer) $uid;
228 228
 
229 229
         if (false !== $unprocessed_only) {
230 230
             $whereClause .= ' AND exec_time = 0';
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         }
236 236
 
237 237
         if (false !== $timestamp) {
238
-            $whereClause .= ' AND scheduled = ' . (integer)$timestamp;
238
+            $whereClause .= ' AND scheduled = '.(integer) $timestamp;
239 239
         }
240 240
 
241 241
         $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
     {
265 265
         $uid   = intval($uid);
266 266
         $query = 'max(scheduled) as latest';
267
-        $where = ' page_id = ' . $uid;
267
+        $where = ' page_id = '.$uid;
268 268
 
269 269
         if ($future_crawldates_only) {
270
-            $where .= ' AND scheduled > ' . time();
270
+            $where .= ' AND scheduled > '.time();
271 271
         }
272 272
 
273 273
         if ($unprocessed_only) {
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         $limit = $GLOBALS['TYPO3_DB']->fullQuoteStr($limit, 'tx_crawler_queue');
301 301
 
302 302
         $query = 'scheduled, exec_time, set_id';
303
-        $where = ' page_id = ' . $uid;
303
+        $where = ' page_id = '.$uid;
304 304
 
305 305
         $limit_query = ($limit) ? $limit : null;
306 306
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
     {
379 379
         $qid   = intval($qid);
380 380
         $table = 'tx_crawler_queue';
381
-        $where = ' qid=' . $qid;
381
+        $where = ' qid='.$qid;
382 382
         $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where);
383 383
     }
384 384
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
      */
407 407
     protected function getQueueRepository()
408 408
     {
409
-        if ( ! $this->queueRepository instanceof \tx_crawler_domain_queue_repository) {
409
+        if (!$this->queueRepository instanceof \tx_crawler_domain_queue_repository) {
410 410
             $this->queueRepository = new \tx_crawler_domain_queue_repository();
411 411
         }
412 412
 
Please login to merge, or discard this patch.
Classes/Hooks/TsfeHook.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
         if (isset($_SERVER['HTTP_X_T3CRAWLER'])) {
49 49
             //@todo: ask service to exclude current call for special reasons: for example no relevance because the language version is not affected
50 50
 
51
-            list($queueId,$hash) = explode(':', $_SERVER['HTTP_X_T3CRAWLER']);
52
-            list($queueRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval($queueId));
51
+            list($queueId, $hash) = explode(':', $_SERVER['HTTP_X_T3CRAWLER']);
52
+            list($queueRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid='.intval($queueId));
53 53
 
54 54
             // If a crawler record was found and hash was matching, set it up:
55 55
             if (is_array($queueRec) && $hash === md5($queueRec['qid'].'|'.$queueRec['set_id'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
              * Required because some extensions (staticpub) might never be requested to run due to some Core side effects
120 120
              * and since this is considered as error the crawler should handle it properly
121 121
              */
122
-            if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pollSuccess'])) {
123
-                foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pollSuccess'] as $pollable) {
124
-                    if(is_array($params['pObj']->applicationData['tx_crawler']['content']['parameters']['procInstructions']) && in_array($pollable,$params['pObj']->applicationData['tx_crawler']['content']['parameters']['procInstructions'])){
125
-                        if(empty($params['pObj']->applicationData['tx_crawler']['success'][$pollable])) {
122
+            if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pollSuccess'])) {
123
+                foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pollSuccess'] as $pollable) {
124
+                    if (is_array($params['pObj']->applicationData['tx_crawler']['content']['parameters']['procInstructions']) && in_array($pollable, $params['pObj']->applicationData['tx_crawler']['content']['parameters']['procInstructions'])) {
125
+                        if (empty($params['pObj']->applicationData['tx_crawler']['success'][$pollable])) {
126 126
                             $params['pObj']->applicationData['tx_crawler']['errorlog'][] = 'Error: Pollable extension ('.$pollable.') did not complete successfully.';
127 127
                         }
128 128
                     }
Please login to merge, or discard this patch.
Classes/Hooks/ProcessCleanUpHook.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
         $results = $this->getDatabaseConnection()->exec_SELECTgetRows(
71 71
             'process_id, system_process_id',
72 72
             'tx_crawler_process',
73
-            'ttl <= ' . intval(time() - $this->extensionSettings['processMaxRunTime'] - 3600) . ' AND active = 1'
73
+            'ttl <= '.intval(time() - $this->extensionSettings['processMaxRunTime'] - 3600).' AND active = 1'
74 74
         );
75 75
 
76 76
         if (!is_array($results)) {
77 77
             return;
78 78
         }
79 79
         foreach ($results as $result) {
80
-            $systemProcessId = (int)$result['system_process_id'];
80
+            $systemProcessId = (int) $result['system_process_id'];
81 81
             $processId = $result['process_id'];
82 82
             if ($systemProcessId > 1) {
83 83
                 if ($this->doProcessStillExists($systemProcessId)) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $results = $this->getDatabaseConnection()->exec_SELECTgetRows(
99 99
             'process_id, system_process_id',
100 100
             'tx_crawler_process',
101
-            'ttl <= ' . intval(time() - $this->extensionSettings['processMaxRunTime']) . ' AND active = 1'
101
+            'ttl <= '.intval(time() - $this->extensionSettings['processMaxRunTime']).' AND active = 1'
102 102
         );
103 103
 
104 104
         if (!is_array($results)) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         }
107 107
         foreach ($results as $result) {
108 108
             $processExists = false;
109
-            $systemProcessId = (int)$result['system_process_id'];
109
+            $systemProcessId = (int) $result['system_process_id'];
110 110
             $processId = $result['process_id'];
111 111
             if ($systemProcessId > 1) {
112 112
                 $dispatcherProcesses = $this->findDispatcherProcesses();
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                 }
117 117
                 foreach ($dispatcherProcesses as $process) {
118 118
                     $responseArray = $this->createResponseArray($process);
119
-                    if ($systemProcessId === (int)$responseArray[1]) {
119
+                    if ($systemProcessId === (int) $responseArray[1]) {
120 120
                         $processExists = true;
121 121
                     };
122 122
                 }
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
     {
139 139
         $this->getDatabaseConnection()->exec_DELETEquery(
140 140
             'tx_crawler_process',
141
-            'process_id = ' . $this->getDatabaseConnection()->fullQuoteStr($processId, 'tx_crawler_process')
141
+            'process_id = '.$this->getDatabaseConnection()->fullQuoteStr($processId, 'tx_crawler_process')
142 142
         );
143 143
 
144 144
         $this->getDatabaseConnection()->exec_UPDATEquery(
145 145
             'tx_crawler_queue',
146
-            'process_id = ' . $this->getDatabaseConnection()->fullQuoteStr($processId, 'tx_crawler_queue'),
146
+            'process_id = '.$this->getDatabaseConnection()->fullQuoteStr($processId, 'tx_crawler_queue'),
147 147
             array('process_id' => '')
148 148
         );
149 149
     }
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
         $doProcessStillExists = false;
178 178
         if (!$this->isOsWindows()) {
179 179
             // Not windows
180
-            if (file_exists('/proc/' . $pid)) {
180
+            if (file_exists('/proc/'.$pid)) {
181 181
                 $doProcessStillExists = true;
182 182
             }
183 183
         } else {
184 184
             // Windows
185
-            exec('tasklist | find "' . $pid . '"', $returnArray, $returnValue);
185
+            exec('tasklist | find "'.$pid.'"', $returnArray, $returnValue);
186 186
             if (count($returnArray) > 0 && preg_match('/php/i', $returnValue[0])) {
187 187
                 $doProcessStillExists = true;
188 188
             }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             posix_kill($pid, 9);
205 205
         } else {
206 206
             // Windows
207
-            exec('taskkill /PID ' . $pid);
207
+            exec('taskkill /PID '.$pid);
208 208
         }
209 209
     }
210 210
 
Please login to merge, or discard this patch.
Classes/Hooks/StaticFileCacheCreateUriHook.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,10 +66,10 @@
 block discarded – undo
66 66
         if ($this->isCrawlerExtensionRunning($frontend) && preg_match('#^/index.php\?&?id=(\d+)(&.*)?$#', $uri, $matches)) {
67 67
             $speakingUri = $frontend->cObj->typoLink_URL(array('parameter' => $matches[1], 'additionalParams' => $matches[2]));
68 68
             $speakingUriParts = parse_url($speakingUri);
69
-            if(false === $speakingUriParts){
70
-                throw new \Exception('Could not parse URI: ' . $speakingUri, 1289915976);
69
+            if (false === $speakingUriParts) {
70
+                throw new \Exception('Could not parse URI: '.$speakingUri, 1289915976);
71 71
             }
72
-            $speakingUrlPath = '/' . ltrim($speakingUriParts['path'], '/');
72
+            $speakingUrlPath = '/'.ltrim($speakingUriParts['path'], '/');
73 73
             // Don't change anything if speaking URL is part of old URI:
74 74
             // (it might be the case the using the speaking URL failed)
75 75
             if (strpos($uri, $speakingUrlPath) !== 0 || $speakingUrlPath === '/') {
Please login to merge, or discard this patch.