Completed
Pull Request — TYPO3_8 (#234)
by Tomas Norre
10:42 queued 08:58
created
Classes/Hooks/StaticFileCacheCreateUriHook.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      * @param string $uri
54 54
      * @param TypoScriptFrontendController $frontend
55 55
      *
56
-     * @return array
56
+     * @return string[]
57 57
      *
58 58
      * @throws \Exception
59 59
      *
Please login to merge, or discard this 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.
Classes/Api/CrawlerApi.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@
 block discarded – undo
209 209
     /**
210 210
      * Determines if a page is queued
211 211
      *
212
-     * @param $uid
212
+     * @param integer $uid
213 213
      * @param bool $unprocessed_only
214 214
      * @param bool $timed_only
215 215
      * @param bool $timestamp
Please login to merge, or discard this 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.
template/pagination.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php if (!defined('TYPO3_MODE')) die ('Access denied.'); ?>
2 2
 
3 3
 Page:
4
-<?php for($currentPageOffset 	= 0; $currentPageOffset < $this->getTotalPagesCount(); $currentPageOffset++ ){  ?>
4
+<?php for ($currentPageOffset = 0; $currentPageOffset < $this->getTotalPagesCount(); $currentPageOffset++) {  ?>
5 5
 	<a href="index.php?offset=<?php echo htmlspecialchars($currentPageOffset * $this->getPerPage()); ?>">
6 6
 		<?php echo	htmlspecialchars($this->getLabelForPageOffset($currentPageOffset)); ?>
7 7
 	</a>
8
-	<?php if($currentPageOffset+1 < $this->getTotalPagesCount()){ ?>
8
+	<?php if ($currentPageOffset + 1 < $this->getTotalPagesCount()) { ?>
9 9
 	|
10 10
 	<?php } ?>
11 11
 
Please login to merge, or discard this patch.
template/process/list.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,17 +50,17 @@
 block discarded – undo
50 50
 		</tr>
51 51
 	</thead>
52 52
 	<tbody>
53
-		<?php foreach($this->getProcessCollection() as $process): /* @var $process tx_crawler_domain_process */ ?>
54
-			<tr class="<?php echo (++$count % 2 == 0) ? 'odd': 'even' ?>">
53
+		<?php foreach ($this->getProcessCollection() as $process): /* @var $process tx_crawler_domain_process */ ?>
54
+			<tr class="<?php echo (++$count % 2 == 0) ? 'odd' : 'even' ?>">
55 55
 				<td><?php echo $this->getIconForState(htmlspecialchars($process->getState())); ?></td>
56 56
 				<td><?php echo htmlspecialchars($process->getProcess_id()); ?></td>
57 57
 				<td><?php echo htmlspecialchars($this->asDate($process->getTimeForFirstItem())); ?></td>
58 58
 				<td><?php echo htmlspecialchars($this->asDate($process->getTimeForLastItem())); ?></td>
59
-				<td><?php echo htmlspecialchars(floor($process->getRuntime()/ 60)); ?> min. <?php echo htmlspecialchars($process->getRuntime()) % 60 ?> sec.</td>
59
+				<td><?php echo htmlspecialchars(floor($process->getRuntime() / 60)); ?> min. <?php echo htmlspecialchars($process->getRuntime()) % 60 ?> sec.</td>
60 60
 				<td><?php echo htmlspecialchars($this->asDate($process->getTTL())); ?></td>
61 61
 				<td><?php echo htmlspecialchars($process->countItemsProcessed()); ?></td>
62 62
 				<td><?php echo htmlspecialchars($process->countItemsAssigned()); ?></td>
63
-				<td><?php echo htmlspecialchars($process->countItemsToProcess()+$process->countItemsProcessed()); ?></td>
63
+				<td><?php echo htmlspecialchars($process->countItemsToProcess() + $process->countItemsProcessed()); ?></td>
64 64
 				<td>
65 65
 				<?php if ($process->getState() == 'running'): ?>
66 66
 					<div class="crawlerprocessprogress" style="width: 200px;">
Please login to merge, or discard this patch.
ext_autoload.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1 1
 <?php
2 2
 $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler');
3 3
 return array(
4
-	'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php',
5
-	'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php',
6
-	'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php',
7
-	'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php',
8
-	'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php',
9
-	'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php',
10
-	'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php',
11
-	'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php',
12
-	'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php',
13
-	'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php',
14
-	'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php',
15
-	'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php',
16
-	'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php',
17
-	'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php',
18
-	'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php',
19
-	'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php',
20
-	'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php',
21
-	'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php',
22
-	'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php',
23
-	'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php',
4
+	'tx_crawler_lib' => $extensionPath.'class.tx_crawler_lib.php',
5
+	'tx_crawler_cli_flush' => $extensionPath.'cli/class.tx_crawler_cli_flush.php',
6
+	'tx_crawler_cli' => $extensionPath.'cli/class.tx_crawler_cli.php',
7
+	'tx_crawler_cli_im' => $extensionPath.'cli/class.tx_crawler_cli_im.php',
8
+	'tx_crawler_domain_events_dispatcher' => $extensionPath.'domain/events/class.tx_crawler_domain_events_dispatcher.php',
9
+	'tx_crawler_domain_events_observer' => $extensionPath.'domain/events/interface.tx_crawler_domain_events_observer.php',
10
+	'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath.'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php',
11
+	'tx_crawler_domain_process_manager' => $extensionPath.'domain/process/class.tx_crawler_domain_process_manager.php',
12
+	'tx_crawler_domain_process' => $extensionPath.'domain/process/class.tx_crawler_domain_process.php',
13
+	'tx_crawler_domain_process_collection' => $extensionPath.'domain/process/class.tx_crawler_domain_process_collection.php',
14
+	'tx_crawler_domain_process_repository' => $extensionPath.'domain/process/class.tx_crawler_domain_process_repository.php',
15
+	'tx_crawler_domain_queue_entry' => $extensionPath.'domain/queue/class.tx_crawler_domain_queue_entry.php',
16
+	'tx_crawler_domain_queue_repository' => $extensionPath.'domain/queue/class.tx_crawler_domain_queue_repository.php',
17
+	'tx_crawler_domain_reason' => $extensionPath.'domain/reason/class.tx_crawler_domain_reason.php',
18
+	'tx_crawler_hooks_tsfe' => $extensionPath.'hooks/class.tx_crawler_hooks_tsfe.php',
19
+	'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath.'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php',
20
+	'tx_crawler_hooks_processCleanUp' => $extensionPath.'hooks/class.tx_crawler_hooks_processCleanUp.php',
21
+	'tx_crawler_modfunc1' => $extensionPath.'modfunc1/class.tx_crawler_modfunc1.php',
22
+	'tx_crawler_view_pagination' => $extensionPath.'view/class.tx_crawler_view_pagination.php',
23
+	'tx_crawler_view_process_list' => $extensionPath.'view/process/class.tx_crawler_view_process_list.php',
24 24
 );
Please login to merge, or discard this patch.
cli/crawler_multiprocess.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 $processManager = new tx_crawler_domain_process_manager();
7
-$timeout = isset($_SERVER['argv'][1] ) ? intval($_SERVER['argv'][1]) : 10000;
7
+$timeout = isset($_SERVER['argv'][1]) ? intval($_SERVER['argv'][1]) : 10000;
8 8
 
9 9
 try {
10 10
 	$processManager->multiProcess($timeout);
11 11
 } catch (Exception $e) {
12
-	echo PHP_EOL . $e->getMessage();
12
+	echo PHP_EOL.$e->getMessage();
13 13
 }
Please login to merge, or discard this patch.
cli/class.tx_crawler_cli_im.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		$this->cli_options[] = array('-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include.");
58 58
 		$this->cli_options[] = array('-o mode', 'Output mode: "url", "exec", "queue"', "Specifies output modes\nurl : Will list URLs which wget could use as input.\nqueue: Will put entries in queue table.\nexec: Will execute all entries right away!");
59 59
 		$this->cli_options[] = array('-n number', 'Number of items per minute.', 'Specifies how many items are put in the queue per minute. Only valid for output mode "queue"');
60
-		$this->cli_options[] = array('-conf configurationkeys','List of Configuration Keys','A commaseperated list of crawler configurations');
60
+		$this->cli_options[] = array('-conf configurationkeys', 'List of Configuration Keys', 'A commaseperated list of crawler configurations');
61 61
 		#		$this->cli_options[] = array('-v level', 'Verbosity level 0-3', "The value of level can be:\n  0 = all output\n  1 = info and greater (default)\n  2 = warnings and greater\n  3 = errors");
62 62
 
63 63
 		// Setting help texts:
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$this->cli_help['synopsis'] = 'page_id ###OPTIONS###';
66 66
 		$this->cli_help['description'] = "Works as a CLI interface to some functionality from the Web > Info > Site Crawler module; It can put entries in the queue from command line options, return the list of URLs and even execute all entries right away without having to queue them up - this can be useful for immediate re-cache, re-indexing or static publishing from command line.";
67 67
 		$this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler_im 7 -d=2 -conf=<configurationKey> -o=exec\nWill re-cache pages from page 7 and two levels down, executed immediately.\n";
68
-		$this->cli_help['examples'].= "/.../cli_dispatch.phpsh crawler_im 7 -d=0 -conf=<configurationKey> -n=4 -o=queue\nWill put entries for re-caching pages from page 7 into queue, 4 every minute.\n";
68
+		$this->cli_help['examples'] .= "/.../cli_dispatch.phpsh crawler_im 7 -d=0 -conf=<configurationKey> -n=4 -o=queue\nWill put entries for re-caching pages from page 7 into queue, 4 every minute.\n";
69 69
 		$this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009';
70 70
 	}
71 71
 }
Please login to merge, or discard this patch.
cli/bootstrap.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 if (!isAbsPath($tempPathThisScript)) {
13 13
 	$workingDirectory = $_SERVER['PWD'] ? $_SERVER['PWD'] : getcwd();
14 14
 	if ($workingDirectory) {
15
-		$tempPathThisScript = $workingDirectory . '/' . preg_replace('/\.\//', '', $tempPathThisScript);
15
+		$tempPathThisScript = $workingDirectory.'/'.preg_replace('/\.\//', '', $tempPathThisScript);
16 16
 		if (!@is_file($tempPathThisScript)) {
17
-			die('Relative path found, but an error occured during resolving of the absolute path: ' . $tempPathThisScript . PHP_EOL);
17
+			die('Relative path found, but an error occured during resolving of the absolute path: '.$tempPathThisScript.PHP_EOL);
18 18
 		}
19 19
 	} else {
20
-		die('Relative path found, but resolving absolute path is not supported on this platform.' . PHP_EOL);
20
+		die('Relative path found, but resolving absolute path is not supported on this platform.'.PHP_EOL);
21 21
 	}
22 22
 }
23 23
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 			list($key, $value) = explode(':', $additionalHeader, 2);
36 36
 			$key = str_replace('-', '_', strtoupper(trim($key)));
37 37
 			if ($key != 'HOST') {
38
-				$_SERVER['HTTP_' . $key] = $value;
38
+				$_SERVER['HTTP_'.$key] = $value;
39 39
 			}
40 40
 		}
41 41
 	}
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
 $typo3SitePath = $_SERVER['argv'][1];
58 58
 
59 59
 	// faking the environment
60
-$_SERVER['DOCUMENT_ROOT'] = preg_replace('#' . preg_quote($typo3SitePath, '#') . '$#', '', $typo3Root);
60
+$_SERVER['DOCUMENT_ROOT'] = preg_replace('#'.preg_quote($typo3SitePath, '#').'$#', '', $typo3Root);
61 61
 $_SERVER['HTTP_USER_AGENT'] = 'CLI Mode';
62 62
 $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = $urlParts['host'];
63
-$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $typo3SitePath . 'index.php';
64
-$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'] = $typo3Root . 'index.php';
63
+$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $typo3SitePath.'index.php';
64
+$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'] = $typo3Root.'index.php';
65 65
 $_SERVER['QUERY_STRING'] = (isset($urlParts['query']) ? $urlParts['query'] : '');
66
-$_SERVER['REQUEST_URI'] = $urlParts['path'] . (isset($urlParts['query']) ? '?' . $urlParts['query'] : '');
66
+$_SERVER['REQUEST_URI'] = $urlParts['path'].(isset($urlParts['query']) ? '?'.$urlParts['query'] : '');
67 67
 $_SERVER['REQUEST_METHOD'] = 'GET';
68 68
 
69 69
 	// Define a port if used in the URL:
70 70
 if (isset($urlParts['port'])) {
71
-	$_SERVER['HTTP_HOST'] .= ':' . $urlParts['port'];
71
+	$_SERVER['HTTP_HOST'] .= ':'.$urlParts['port'];
72 72
 	$_SERVER['SERVER_PORT'] = $urlParts['port'];
73 73
 }
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 }
79 79
 
80 80
 chdir($typo3Root);
81
-include($typo3Root . '/index.php');
81
+include($typo3Root.'/index.php');
82 82
 
83 83
 
84 84
 /**
Please login to merge, or discard this patch.
domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 * @param void
50 50
 	 * @return string table name
51 51
 	 */
52
-	public static function getTableName(){
52
+	public static function getTableName() {
53 53
 		return self::$tableName;
54 54
 	}
55 55
 
Please login to merge, or discard this patch.