Passed
Branch oai_solr_new_directory_structu... (9f1839)
by Erik
02:47
created
plugins/oai/class.tx_dlf_oai.php 3 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         if ($GLOBALS['TYPO3_DB']->sql_affected_rows() === -1) {
80 80
             // Deletion failed.
81
-            $this->devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens',SYSLOG_SEVERITY_WARNING);
81
+            $this->devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens', SYSLOG_SEVERITY_WARNING);
82 82
         }
83 83
     }
84 84
 
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
632 632
             'tx_dlf_documents.tstamp AS tstamp',
633 633
             'tx_dlf_documents',
634
-            'tx_dlf_documents.pid=' . intval($this->conf['pages']),
634
+            'tx_dlf_documents.pid='.intval($this->conf['pages']),
635 635
             '',
636 636
             'tx_dlf_documents.tstamp ASC',
637 637
             '1'
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
             list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
642 642
             $earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
643 643
         } else {
644
-            $this->devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "' . $this->conf['pages'] . '"',SYSLOG_SEVERITY_NOTICE);
644
+            $this->devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "'.$this->conf['pages'].'"', SYSLOG_SEVERITY_NOTICE);
645 645
         }
646 646
 
647 647
         $linkConf = array (
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
         // Add identification node.
654 654
         $Identify = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'Identify');
655 655
         $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'repositoryName', $repositoryName));
656
-        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','baseURL', $baseURL));
657
-        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','protocolVersion', '2.0'));
658
-        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','adminEmail', $adminEmail));
659
-        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','earliestDatestamp', $earliestDatestamp));
660
-        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','deletedRecord', 'transient'));
661
-        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/','granularity', 'YYYY-MM-DDThh:mm:ssZ'));
656
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'baseURL', $baseURL));
657
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'protocolVersion', '2.0'));
658
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'adminEmail', $adminEmail));
659
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'earliestDatestamp', $earliestDatestamp));
660
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'deletedRecord', 'transient'));
661
+        $Identify->appendChild($this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'granularity', 'YYYY-MM-DDThh:mm:ssZ'));
662 662
 
663 663
         return $Identify;
664 664
     }
@@ -892,8 +892,8 @@  discard block
 block discarded – undo
892 892
             $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
893 893
                 'tx_dlf_collections.index_name AS index_name, tx_dlf_collections.uid AS uid, tx_dlf_collections.index_search as index_query ',
894 894
                 'tx_dlf_collections',
895
-                'tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.oai_name=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'],
896
-                    'tx_dlf_collections') . $where . tx_dlf_helper::whereClause('tx_dlf_collections'),
895
+                'tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.oai_name='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['set'],
896
+                    'tx_dlf_collections').$where.tx_dlf_helper::whereClause('tx_dlf_collections'),
897 897
                 '',
898 898
                 '',
899 899
                 '1'
@@ -905,10 +905,10 @@  discard block
 block discarded – undo
905 905
 
906 906
             $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
907 907
 
908
-            if($resArray['index_query'] != "") {
909
-                $solr_query .= '(' . $resArray['index_query'] . ')';
908
+            if ($resArray['index_query'] != "") {
909
+                $solr_query .= '('.$resArray['index_query'].')';
910 910
             } else {
911
-                $solr_query .= 'collection:' . '"' . $resArray['index_name'] . '"';
911
+                $solr_query .= 'collection:'.'"'.$resArray['index_name'].'"';
912 912
             }
913 913
 
914 914
         } else {
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 
920 920
         // Check for required fields.
921 921
         foreach ($this->formats[$this->piVars['metadataPrefix']]['requiredFields'] as $required) {
922
-            $solr_query .= ' NOT ' . $required . ':""';
922
+            $solr_query .= ' NOT '.$required.':""';
923 923
         }
924 924
 
925 925
         $from = "*";
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
                 $timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1,
934 934
                     $date_array['tm_mday'], $date_array['tm_year'] + 1900);
935 935
 
936
-                $from = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) .'.000Z';
936
+                $from = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.000Z';
937 937
 
938 938
             } else {
939 939
                 throw new Exception('badArgument');
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
                 $timestamp = gmmktime($date_array['tm_hour'], $date_array['tm_min'], $date_array['tm_sec'], $date_array['tm_mon'] + 1,
952 952
                     $date_array['tm_mday'], $date_array['tm_year'] + 1900);
953 953
 
954
-                $until = date("Y-m-d", $timestamp) . 'T' . date("H:i:s", $timestamp) . '.999Z';
954
+                $until = date("Y-m-d", $timestamp).'T'.date("H:i:s", $timestamp).'.999Z';
955 955
 
956 956
                 if ($from != "*" && $from > $until) {
957 957
                     throw new Exception('badArgument');
@@ -969,14 +969,14 @@  discard block
 block discarded – undo
969 969
             }
970 970
         }
971 971
 
972
-        $solr_query .= ' AND timestamp:[' . $from . ' TO ' . $until .']';
972
+        $solr_query .= ' AND timestamp:['.$from.' TO '.$until.']';
973 973
 
974
-        $documentSet = array();
974
+        $documentSet = array ();
975 975
 
976 976
         $solr = tx_dlf_solr::getInstance($this->conf['solrcore']);
977 977
 
978 978
         // We only care about the UID in the results and want them sorted
979
-        $parameters = array("fl" => "uid", "sort" => "uid asc");
979
+        $parameters = array ("fl" => "uid", "sort" => "uid asc");
980 980
 
981 981
         $result = $solr->search_raw($solr_query, $parameters);
982 982
 
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
             'tx_dlf_documents',
1006 1006
             'tx_dlf_relations',
1007 1007
             'tx_dlf_collections',
1008
-            'AND tx_dlf_documents.uid IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($documentsToProcess)) . ') AND tx_dlf_documents.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_collections.pid=' . intval($this->conf['pages']) . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . tx_dlf_helper::whereClause('tx_dlf_collections'),
1008
+            'AND tx_dlf_documents.uid IN ('.implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($documentsToProcess)).') AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_collections'),
1009 1009
             'tx_dlf_documents.uid',
1010 1010
             'tx_dlf_documents.tstamp',
1011 1011
             $this->conf['limit']
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
                     $metadata = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'metadata');
1054 1054
 
1055 1055
                     $metadataPrefix = $this->piVars['metadataPrefix'];
1056
-                    if(!$metadataPrefix) {
1056
+                    if (!$metadataPrefix) {
1057 1057
                         // If we resume an action the metadataPrefix is stored with the documentSet
1058 1058
                         $metadataPrefix = $documentListSet->metadata['metadataPrefix'];
1059 1059
                     }
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
             $GLOBALS['TYPO3_DB']->exec_INSERTquery(
1102 1102
                 'tx_dlf_tokens',
1103
-                array(
1103
+                array (
1104 1104
                     'tstamp' => $GLOBALS['EXEC_TIME'],
1105 1105
                     'token' => $token,
1106 1106
                     'options' => serialize($documentListSet),
@@ -1108,15 +1108,15 @@  discard block
 block discarded – undo
1108 1108
                 )
1109 1109
             );
1110 1110
 
1111
-            if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
1111
+            if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
1112 1112
                 $resumptionToken->setAttribute('resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
1113 1113
             } else {
1114
-                $this->devLog('[tx_dlf_oai->verb'. $this->piVars['verb'] .'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
1114
+                $this->devLog('[tx_dlf_oai->verb'.$this->piVars['verb'].'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
1115 1115
             }
1116 1116
         }
1117 1117
 
1118 1118
         $resumptionToken->setAttribute('cursor', intval($documentListSet->metadata['completeListSize']) - count($documentListSet));
1119
-        $resumptionToken->setAttribute('completeListSize',	$documentListSet->metadata['completeListSize']);
1119
+        $resumptionToken->setAttribute('completeListSize', $documentListSet->metadata['completeListSize']);
1120 1120
         $resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
1121 1121
 
1122 1122
         return $resumptionToken;
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 }
1132 1132
 
1133
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php'])	{
1133
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']) {
1134 1134
     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']);
1135 1135
 
1136 1136
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -876,8 +876,7 @@  discard block
 block discarded – undo
876 876
      * @return array
877 877
      * @throws Exception
878 878
      */
879
-    private function fetchDocumentUIDs()
880
-    {
879
+    private function fetchDocumentUIDs() {
881 880
         $solr_query = '';
882 881
 
883 882
         if (!$this->conf['show_userdefined']) {
@@ -1090,8 +1089,7 @@  discard block
 block discarded – undo
1090 1089
      * @param tx_dlf_list $documentListSet
1091 1090
      * @return DOMElement
1092 1091
      */
1093
-    private function generateResumptionTokenForDocumentListSet($documentListSet)
1094
-    {
1092
+    private function generateResumptionTokenForDocumentListSet($documentListSet) {
1095 1093
         $resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken');
1096 1094
 
1097 1095
         if ($documentListSet->count() != 0) {
@@ -1130,7 +1128,7 @@  discard block
 block discarded – undo
1130 1128
 
1131 1129
 }
1132 1130
 
1133
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php'])	{
1131
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']) {
1134 1132
     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']);
1135 1133
 
1136 1134
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1122,7 +1122,7 @@
 block discarded – undo
1122 1122
         return $resumptionToken;
1123 1123
     }
1124 1124
 
1125
-    private function devLog($message, $severity, $data = null) {
1125
+    private function devLog($message, $severity, $data = NULL) {
1126 1126
         if (TYPO3_DLOG) {
1127 1127
             \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($message, $this->extKey, $severity, $data);
1128 1128
         }
Please login to merge, or discard this patch.
common/class.tx_dlf_solr.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -539,8 +539,7 @@
 block discarded – undo
539 539
      *
540 540
      * @return	array       The Apache Solr Documents that were fetched
541 541
      */
542
-    public function search_raw($query = '', $parameters = array ())
543
-    {
542
+    public function search_raw($query = '', $parameters = array ()) {
544 543
         $solr_response = $this->service->search((string) $query, 0, $this->limit, array_merge($this->params, $parameters));
545 544
 
546 545
         $searchresult = array ();
Please login to merge, or discard this patch.