https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113055

Revision: 113055
Author:   kipcool
Date:     2012-03-05 18:11:02 +0000 (Mon, 05 Mar 2012)
Log Message:
-----------
removed some php warnings

Modified Paths:
--------------
    trunk/extensions/Wikidata/OmegaWiki/Controller.php
    trunk/extensions/Wikidata/OmegaWiki/Record.php
    trunk/extensions/Wikidata/OmegaWiki/SpecialImportTSV.php

Modified: trunk/extensions/Wikidata/OmegaWiki/Controller.php
===================================================================
--- trunk/extensions/Wikidata/OmegaWiki/Controller.php  2012-03-05 18:09:08 UTC 
(rev 113054)
+++ trunk/extensions/Wikidata/OmegaWiki/Controller.php  2012-03-05 18:11:02 UTC 
(rev 113055)
@@ -184,6 +184,9 @@
        }
        
        public function add( IdStack $idPath, $record ) {
+               if ( ! $record->expression ) {
+                       return;
+               }
                $definedMeaningId = $idPath->getKeyStack()->peek( 0 
)->definedMeaningId;
                $expressionValue = $record->expression;
                
@@ -308,6 +311,11 @@
        }
 }
 
+/*
+ * Controller to add a new expression directly
+ * i.e. not by translating an existing DM,
+ * but by adding a new word + language + definition
+ */
 class ExpressionController extends DefaultUpdateController {
        protected $spelling;
        protected $filterLanguageId;
@@ -319,6 +327,9 @@
 
        public function add( IdStack $idPath, $record ) {
                if ( $this->filterLanguageId == 0 ) {
+                       if ( ! $record->expression ) {
+                               return;
+                       }
                        $expressionLanguageId = $record->expression->language;
                } else {
                        $expressionLanguageId = $this->filterLanguageId;
@@ -433,6 +444,9 @@
        }
        
        public function add( IdStack $idPath, $record )  {
+               if ( ! $record->link ) {
+                       return;
+               }
                $objectId = $this->objectIdFetcher->fetch( 
$idPath->getKeyStack() );
                $linkAttributeId = $this->determineAttributeId( $idPath, "URL", 
$record->linkAttribute );
                $linkValue = $record->link;

Modified: trunk/extensions/Wikidata/OmegaWiki/Record.php
===================================================================
--- trunk/extensions/Wikidata/OmegaWiki/Record.php      2012-03-05 18:09:08 UTC 
(rev 113054)
+++ trunk/extensions/Wikidata/OmegaWiki/Record.php      2012-03-05 18:11:02 UTC 
(rev 113055)
@@ -88,8 +88,11 @@
         */
        public function setAttributeValuesByOrder( $values ) {
                $atts = $this->structure->getAttributes();
-               for ( $i = 0; $i < count( $atts ); $i++ )
-                       $this->values[$atts[$i]->id] = $values[$i];
+               for ( $i = 0; $i < count( $atts ); $i++ ) {
+                       if ( array_key_exists ( $i, $values ) ) {
+                               $this->values[$atts[$i]->id] = $values[$i];
+                       }
+               }
        }
        
        /*

Modified: trunk/extensions/Wikidata/OmegaWiki/SpecialImportTSV.php
===================================================================
--- trunk/extensions/Wikidata/OmegaWiki/SpecialImportTSV.php    2012-03-05 
18:09:08 UTC (rev 113054)
+++ trunk/extensions/Wikidata/OmegaWiki/SpecialImportTSV.php    2012-03-05 
18:11:02 UTC (rev 113055)
@@ -225,12 +225,5 @@
                }
 
        }
-       
-       
-       /* HELPER METHODS START HERE */
-       
-       function getLanguage( $columnName ) {
-               
-       }
-       
+
 }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to