Exemplo n.º 1
0
 /**
  * Gets template which are used on $title and replaced the property annotation of
  * $redirectProperty with $targetProperty. Usual constraints apply.
  *
  * @param $title Title
  * @param $redirectProperty string
  * @param $targetProperty string
  * @param $verbose boolean
  * @param & $db database
  */
 private function replacePropertiesOnTemplates(Title $title, $redirectProperty, $targetProperty, $verbose, &$db)
 {
     $templatelinks = $db->tableName('templatelinks');
     $sql = 'tl_from = ' . $title->getArticleID();
     $res = $db->select($templatelinks, array('DISTINCT tl_title', 'tl_namespace'), $sql, 'SMW::replacePropertiesOnTemplates');
     if ($db->numRows($res) > 0) {
         while ($row = $db->fetchObject($res)) {
             $title = Title::newFromText($row->tl_title, $row->tl_namespace);
             if ($title == NULL) {
                 continue;
             }
             $this->replaceProperties($title, $redirectProperty, $targetProperty, $verbose);
         }
     }
     $db->freeResult($res);
 }