From 107a7d86467b1c43c68315c689b6373cf975a4ad Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 18 Dec 2015 12:50:43 -0500
Subject: [PATCH] Removed WorldCatTerms recommendation module due to API
 shutdown. - See
 http://www.oclc.org/research/themes/data-science/termservices.html

---
 config/vufind/searches.ini                    |   6 -
 module/VuFind/config/module.config.php        |   2 +-
 .../src/VuFind/Connection/WorldCatUtils.php   | 134 ------------------
 .../{WorldCatTerms.php => Deprecated.php}     |  80 +----------
 .../VuFind/src/VuFind/Recommend/Factory.php   |  14 --
 module/VuFind/tests/fixtures/worldcat/terms   | Bin 4598 -> 0 bytes
 .../Connection/WorldCatUtilsTest.php          |  15 --
 .../Recommend/WorldCatTermsTest.php           |  94 ------------
 .../templates/Recommend/Deprecated.phtml      |   2 +
 .../templates/Recommend/WorldCatTerms.phtml   |  21 ---
 .../templates/Recommend/Deprecated.phtml      |   2 +
 .../templates/Recommend/WorldCatTerms.phtml   |   1 -
 12 files changed, 12 insertions(+), 359 deletions(-)
 rename module/VuFind/src/VuFind/Recommend/{WorldCatTerms.php => Deprecated.php} (53%)
 delete mode 100644 module/VuFind/tests/fixtures/worldcat/terms
 delete mode 100644 module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/WorldCatTermsTest.php
 create mode 100644 themes/bootstrap3/templates/Recommend/Deprecated.phtml
 delete mode 100644 themes/bootstrap3/templates/Recommend/WorldCatTerms.phtml
 create mode 100644 themes/jquerymobile/templates/Recommend/Deprecated.phtml
 delete mode 100644 themes/jquerymobile/templates/Recommend/WorldCatTerms.phtml

diff --git a/config/vufind/searches.ini b/config/vufind/searches.ini
index 29ec32cf92d..caa2c43310d 100644
--- a/config/vufind/searches.ini
+++ b/config/vufind/searches.ini
@@ -341,11 +341,6 @@ CallNumber = callnumber-sort
 ; WorldCatIdentities
 ;       Use the WorldCat Identities API to find names and related subjects based
 ;       on the current search.
-; WorldCatTerms:[vocabulary]
-;       Use the WorldCat Terminologies API to find Library of Congress Subject
-;       Headings related to the current search.  [vocabulary] is the vocabulary to
-;       use for recommendations; default is "lcsh" but other options include "fast",
-;       "mesh", etc.  See http://tspilot.oclc.org/resources/ for details.
 ;
 ; Available modules recommended for use in the "no results" area:
 ;
@@ -385,7 +380,6 @@ Author[]            = AuthorFacets
 Author[]            = SpellingSuggestions
 ;Author[]           = WorldCatIdentities
 CallNumber[]        = "TopFacets:ResultsTop"    ; disable spelling in this context
-;Subject[]          = WorldCatTerms
 
 [NoResultsRecommendations]
 CallNumber[] = SwitchQuery::wildcard:truncatechar
diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php
index 7ec0151d5db..247c4dfbfe8 100644
--- a/module/VuFind/config/module.config.php
+++ b/module/VuFind/config/module.config.php
@@ -427,7 +427,6 @@ $config = [
                     'visualfacets' => 'VuFind\Recommend\Factory::getVisualFacets',
                     'webresults' => 'VuFind\Recommend\Factory::getWebResults',
                     'worldcatidentities' => 'VuFind\Recommend\Factory::getWorldCatIdentities',
-                    'worldcatterms' => 'VuFind\Recommend\Factory::getWorldCatTerms',
                 ],
                 'invokables' => [
                     'alphabrowselink' => 'VuFind\Recommend\AlphaBrowseLink',
@@ -443,6 +442,7 @@ $config = [
                     'summondatabasesdeferred' => 'VuFind\Recommend\SummonDatabasesDeferred',
                     'summonresultsdeferred' => 'VuFind\Recommend\SummonResultsDeferred',
                     'switchtype' => 'VuFind\Recommend\SwitchType',
+                    'worldcatterms' => 'VuFind\Recommend\Deprecated',
                 ],
             ],
             'recorddriver' => [
diff --git a/module/VuFind/src/VuFind/Connection/WorldCatUtils.php b/module/VuFind/src/VuFind/Connection/WorldCatUtils.php
index cc31e0f886f..dfec2f27ca5 100644
--- a/module/VuFind/src/VuFind/Connection/WorldCatUtils.php
+++ b/module/VuFind/src/VuFind/Connection/WorldCatUtils.php
@@ -442,138 +442,4 @@ class WorldCatUtils implements \Zend\Log\LoggerAwareInterface
 
         return $output;
     }
-
-    /**
-     * Given a subject term, get related (broader/narrower/alternate) terms.
-     * Loosely adapted from Eric Lease Morgan's Term Finder demo (see
-     * http://zoia.library.nd.edu/sandbox/term-finder/).  Note that this is
-     * intended as a fairly fuzzy search -- $term need not be an exact subject
-     * heading; this function will return best guess matches in the 'exact'
-     * key, possible broader terms in the 'broader' key and possible narrower
-     * terms in the 'narrower' key of the return array.
-     *
-     * @param string $term       Term to get related terms for.
-     * @param string $vocabulary Vocabulary to search (default = LCSH; see OCLC docs
-     * for other options).
-     * @param int    $maxRecords Max # of records to read from API (more = slower).
-     *
-     * @return mixed             False on error, otherwise array of related terms,
-     * keyed by category.
-     */
-    public function getRelatedTerms($term, $vocabulary = 'lcsh', $maxRecords = 10)
-    {
-        // Strip quotes from incoming term:
-        $term = str_replace('"', '', $term);
-
-        // Build the request URL:
-        $url = "http://tspilot.oclc.org/" . urlencode($vocabulary) . "/?" .
-            // Search for the user-supplied term in both preferred and alternative
-            // fields!
-            "query=oclcts.preferredTerm+%3D+%22" . urlencode($term) .
-                "%22+OR+oclcts.alternativeTerms+%3D+%22" . urlencode($term) . "%22" .
-            "&version=1.1" .
-            "&operation=searchRetrieve" .
-            "&recordSchema=info%3Asrw%2Fschema%2F1%2Fmarcxml-v1.1" .
-            "&maximumRecords=" . intval($maxRecords) .
-            "&startRecord=1" .
-            "&resultSetTTL=300" .
-            "&recordPacking=xml" .
-            "&recordXPath=" .
-            "&sortKeys=recordcount";
-
-        // Get the API response:
-        $data = $this->retrieve($url);
-
-        // Extract plain MARCXML from the WorldCat response:
-        $marcxml = XSLTProcessor::process('wcterms-marcxml.xsl', $data);
-
-        // Try to parse the MARCXML into a File_MARC object; if this fails,
-        // we probably have bad MARCXML, which may indicate an API failure
-        // or an empty record set.  Just give up if this happens!
-        try {
-            $marc = new \File_MARCXML($marcxml, File_MARCXML::SOURCE_STRING);
-        } catch (\File_MARC_Exception $e) {
-            return false;
-        }
-
-        // Initialize arrays:
-        $exact = [];
-        $broader = [];
-        $narrower = [];
-
-        while ($record = $marc->next()) {
-            // Get exact terms; only save it if it is not a subset of the requested
-            // term.
-            $main = $this->getExactTerm($record);
-            if ($main && !stristr($term, $main)) {
-                $exact[] = $main;
-            }
-
-            // Get broader/narrower terms:
-            $related = $record->getFields('550');
-            foreach ($related as $current) {
-                $type = $current->getSubfield('w');
-                $value = $current->getSubfield('a');
-                if ($type && $value) {
-                    $type = (string)$type->getData();
-                    $value = (string)$value->getData();
-                    if ($type == 'g') {
-                        // Don't save exact matches to the user-entered term:
-                        if (strcasecmp($term, $value) != 0) {
-                            $broader[] = $value;
-                        }
-                    } else if ($type == 'h') {
-                        // Don't save exact matches to the user-entered term:
-                        if (strcasecmp($term, $value) != 0) {
-                            $narrower[] = $value;
-                        }
-                    }
-                }
-            }
-        }
-
-        // Send back everything we found, sorted and filtered for uniqueness; note
-        // that we do NOT sort FAST results since they support relevance ranking.
-        // As of this writing, other vocabularies do not support relevance.
-        if ($vocabulary !== 'fast') {
-            natcasesort($exact);
-            natcasesort($broader);
-            natcasesort($narrower);
-        }
-        return [
-            'exact' => array_unique($exact),
-            'broader' => array_unique($broader),
-            'narrower' => array_unique($narrower)
-        ];
-    }
-
-    /**
-     * Extract an exact term from a MARC record.
-     *
-     * @param \File_MARC_Record $record MARC record
-     *
-     * @return string
-     */
-    protected function getExactTerm($record)
-    {
-        // Get exact terms:
-        $actual = $record->getField('150');
-        if (!$actual || !($main = $actual->getSubfield('a'))) {
-            return false;
-        }
-
-        // Some versions of File_MARCXML seem to have trouble returning
-        // strings properly (giving back XML objects instead); let's
-        // cast to string to be sure we get what we expect!
-        $main = (string)$main->getData();
-
-        // Add subdivisions:
-        $subdivisions = $actual->getSubfields('x');
-        if ($subdivisions) {
-            foreach ($subdivisions as $current) {
-                $main .= ', ' . (string)$current->getData();
-            }
-        }
-        return $main;
-    }
 }
diff --git a/module/VuFind/src/VuFind/Recommend/WorldCatTerms.php b/module/VuFind/src/VuFind/Recommend/Deprecated.php
similarity index 53%
rename from module/VuFind/src/VuFind/Recommend/WorldCatTerms.php
rename to module/VuFind/src/VuFind/Recommend/Deprecated.php
index 556adda3a1f..6118aa9ae44 100644
--- a/module/VuFind/src/VuFind/Recommend/WorldCatTerms.php
+++ b/module/VuFind/src/VuFind/Recommend/Deprecated.php
@@ -1,10 +1,11 @@
 <?php
 /**
- * WorldCatTerms Recommendations Module
+ * Deprecated Recommendations Module - used to replace legacy modules that no
+ * longer function due to, for example, external APIs that have been shut down.
  *
  * PHP version 5
  *
- * Copyright (C) Villanova University 2010.
+ * Copyright (C) Villanova University 2015.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2,
@@ -26,13 +27,10 @@
  * @link     http://vufind.org/wiki/vufind2:recommendation_modules Wiki
  */
 namespace VuFind\Recommend;
-use VuFind\Connection\WorldCatUtils;
-use VuFindSearch\Query\Query;
 
 /**
- * WorldCatTerms Recommendations Module
- *
- * This class provides recommendations by using the WorldCat Terminologies API.
+ * Deprecated Recommendations Module - used to replace legacy modules that no
+ * longer function due to, for example, external APIs that have been shut down.
  *
  * @category VuFind2
  * @package  Recommendations
@@ -40,39 +38,8 @@ use VuFindSearch\Query\Query;
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org/wiki/vufind2:recommendation_modules Wiki
  */
-class WorldCatTerms implements RecommendInterface
+class Deprecated implements RecommendInterface
 {
-    /**
-     * Search results object
-     *
-     * @var \VuFind\Search\Base\Results
-     */
-    protected $searchObject;
-
-    /**
-     * Vocabulary to use.
-     *
-     * @var string
-     */
-    protected $vocab = 'lcsh';
-
-    /**
-     * WorldCat utilities wrapper object.
-     *
-     * @var WorldCatUtils
-     */
-    protected $worldCatUtils;
-
-    /**
-     * Constructor
-     *
-     * @param WorldCatUtils $wcu WorldCat utilities object
-     */
-    public function __construct(WorldCatUtils $wcu)
-    {
-        $this->worldCatUtils = $wcu;
-    }
-
     /**
      * Store the configuration of the recommendation module.
      *
@@ -82,9 +49,6 @@ class WorldCatTerms implements RecommendInterface
      */
     public function setConfig($settings)
     {
-        // Pick a vocabulary (either user-specified, or LCSH by default):
-        $params = trim($settings);
-        $this->vocab = empty($params) ? 'lcsh' : $params;
     }
 
     /**
@@ -101,7 +65,6 @@ class WorldCatTerms implements RecommendInterface
      */
     public function init($params, $request)
     {
-        // No action needed.
     }
 
     /**
@@ -115,34 +78,5 @@ class WorldCatTerms implements RecommendInterface
      */
     public function process($results)
     {
-        $this->searchObject = $results;
-    }
-
-    /**
-     * Get terms related to the query.
-     *
-     * @return array
-     */
-    public function getTerms()
-    {
-        // Extract the first search term from the search object:
-        $search = $this->searchObject->getParams()->getQuery();
-        $lookfor = ($search instanceof Query) ? $search->getString() : '';
-
-        // Get terminology information:
-        $terms = $this->worldCatUtils->getRelatedTerms($lookfor, $this->vocab);
-
-        // Wipe out any empty or unexpected sections of the related terms array;
-        // this will make it easier to only display content in the template if
-        // we have something worth displaying.
-        if (is_array($terms)) {
-            $desiredKeys = ['exact', 'broader', 'narrower'];
-            foreach ($terms as $key => $value) {
-                if (empty($value) || !in_array($key, $desiredKeys)) {
-                    unset($terms[$key]);
-                }
-            }
-        }
-        return $terms;
     }
-}
\ No newline at end of file
+}
diff --git a/module/VuFind/src/VuFind/Recommend/Factory.php b/module/VuFind/src/VuFind/Recommend/Factory.php
index 6f3d9bb934e..f3ec771b4e3 100644
--- a/module/VuFind/src/VuFind/Recommend/Factory.php
+++ b/module/VuFind/src/VuFind/Recommend/Factory.php
@@ -335,18 +335,4 @@ class Factory
             $sm->getServiceLocator()->get('VuFind\WorldCatUtils')
         );
     }
-
-    /**
-     * Factory for WorldCatTerms module.
-     *
-     * @param ServiceManager $sm Service manager.
-     *
-     * @return WorldCatTerms
-     */
-    public static function getWorldCatTerms(ServiceManager $sm)
-    {
-        return new WorldCatTerms(
-            $sm->getServiceLocator()->get('VuFind\WorldCatUtils')
-        );
-    }
 }
\ No newline at end of file
diff --git a/module/VuFind/tests/fixtures/worldcat/terms b/module/VuFind/tests/fixtures/worldcat/terms
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72x9`UCq%6q>tS7fH-p_IEX?+t?_{b&7z=i^8!)qNF
z48MI%m~J1hy5xlUZk90;lHrW@qZqbluUIDs!cA(g_H_tG3@t4!E!Y`8JXe{z@~PqE
zw(XGZU0`$ilP1d)s<G!jhDr4eHd(d=viPf2FNL}jGq=8Hn$+DZXPc*4`dk^)sXY6Q
zwYUxQ{&P|s$h@?2tTf<O?`$zbxy%;<7S<$A3f*D!a~UOO`?#mjCSM!$l%or;C_1JT
z?7(<y`zlnlTbPD#E;#NqTQ>9Rxiwg*jU3LbkZzQZmSrPNbK97-^cbH8pIBZ*(7-kZ
z-MPJgMzL$nLLlF3wb`EVxOmcWlH1Y$Z6Kh<fugBBvRTryjjPHeb(c0W^waewCBi8m
zqT5_AH!<Vus)UeW2k$%Pg<yFmWSrK<X5QA>@00oc`7n=iMel{Z7t_RT$5TRZzx|%E
z7KY&l-PM@o4i*N3Vf(i{?8f`p7oz;x%RlKc{X%iT;gVWjDuW*OA7c9@l!`}!ErU<s
z%(lp!*IzwSI1RhomrdD!|I|3CDAF(}M6+X)qil%c<&t4V1O2bZ7P69P9|e3=yLk3W
zR<gne59t`hC2L3W7&0q7svOTb=k5x)_I6pJ{osd7?a_#4)=F}f><NeIkLG8+1973e
ztfdqEH!o-h&QjYy{@NC;5EAvxtetql=WK3lN-gr`&Ism&tz9E)Z0YugnpkNLkdc&Y
zbvuRDC%eTt;hupjwZz(v)^%HO;|pnWe<tC99}1NEd9jp{OLbKbDu=Y@KC%kfn5mIZ
Tk1Bx2FA2~NhOl`j0O0=scPGei

diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Connection/WorldCatUtilsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Connection/WorldCatUtilsTest.php
index c078496d75f..42979533887 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Connection/WorldCatUtilsTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Connection/WorldCatUtilsTest.php
@@ -111,21 +111,6 @@ class WorldCatUtilsTest extends \PHPUnit_Framework_TestCase
         $this->assertFalse($client->getRelatedIdentities(''));
     }
 
-    /**
-     * Test related terminology
-     *
-     * @return void
-     */
-    public function testGetRelatedTerms()
-    {
-        $client = $this->getClient('terms');
-        $terms = $client->getRelatedTerms('hogs');
-        $this->assertEquals(4, count($terms['exact']));
-        $this->assertEquals(7, count($terms['broader']));
-        $this->assertEquals(4, count($terms['narrower']));
-        $this->assertTrue(in_array('Construction workers', $terms['broader']));
-    }
-
     /**
      * Load WorldCatUtils client w/ fixture
      *
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/WorldCatTermsTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/WorldCatTermsTest.php
deleted file mode 100644
index f59ef4829fb..00000000000
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Recommend/WorldCatTermsTest.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * WorldCatTerms recommendation module Test Class
- *
- * PHP version 5
- *
- * Copyright (C) Villanova University 2010.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * @category VuFind2
- * @package  Tests
- * @author   Demian Katz <demian.katz@villanova.edu>
- * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:unit_tests Wiki
- */
-namespace VuFindTest\Recommend;
-use VuFind\Recommend\WorldCatTerms;
-
-/**
- * WorldCatTerms recommendation module Test Class
- *
- * @category VuFind2
- * @package  Tests
- * @author   Demian Katz <demian.katz@villanova.edu>
- * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:unit_tests Wiki
- */
-class WorldCatTermsTest extends \VuFindTest\Unit\TestCase
-{
-    /**
-     * Test normal operation of the module.
-     *
-     * @return void
-     */
-    public function testNormalOperation()
-    {
-        $terms = [
-            'exact' => 'exact', 'junk' => 'junk'
-        ];
-        $wcu = $this->getMockWorldCatUtils();
-        $wcu->expects($this->once())->method('getRelatedTerms')
-            ->with($this->equalTo('foo'), $this->equalTo('lcsh'))
-            ->will($this->returnValue($terms));
-        $results = $this->getMockResults();
-        $request = new \Zend\StdLib\Parameters([]);
-        $module = new WorldCatTerms($wcu);
-        $module->setConfig('');
-        $module->init($results->getParams(), $request);
-        $module->process($results);
-        $this->assertEquals(['exact' => 'exact'], $module->getTerms());
-    }
-
-    /**
-     * Get a mock WorldCatUtils object.
-     *
-     * @return \VuFind\Connection\WorldCatUtils
-     */
-    protected function getMockWorldCatUtils()
-    {
-        return $this->getMockBuilder('VuFind\Connection\WorldCatUtils')
-            ->disableOriginalConstructor()->getMock();
-    }
-
-    /**
-     * Get a mock results object.
-     *
-     * @return \VuFind\Search\Solr\Results
-     */
-    protected function getMockResults()
-    {
-        $query = new \VuFindSearch\Query\Query('foo', 'bar');
-        $params = $this->getMockBuilder('VuFind\Search\Solr\Params')
-            ->disableOriginalConstructor()->getMock();
-        $params->expects($this->any())->method('getQuery')
-            ->will($this->returnValue($query));
-        $results = $this->getMockBuilder('VuFind\Search\Solr\Results')
-            ->disableOriginalConstructor()->getMock();
-        $results->expects($this->any())->method('getParams')
-            ->will($this->returnValue($params));
-        return $results;
-    }
-}
\ No newline at end of file
diff --git a/themes/bootstrap3/templates/Recommend/Deprecated.phtml b/themes/bootstrap3/templates/Recommend/Deprecated.phtml
new file mode 100644
index 00000000000..63445d34f9c
--- /dev/null
+++ b/themes/bootstrap3/templates/Recommend/Deprecated.phtml
@@ -0,0 +1,2 @@
+<? /* do nothing -- this module is a placeholder for old deprecated features
+      to prevent legacy configurations from causing fatal errors. */ ?>
\ No newline at end of file
diff --git a/themes/bootstrap3/templates/Recommend/WorldCatTerms.phtml b/themes/bootstrap3/templates/Recommend/WorldCatTerms.phtml
deleted file mode 100644
index ed9c6bbfc0f..00000000000
--- a/themes/bootstrap3/templates/Recommend/WorldCatTerms.phtml
+++ /dev/null
@@ -1,21 +0,0 @@
-<? $worldCatTerms = $this->recommend->getTerms(); if (!empty($worldCatTerms)): ?>
-<h4><?=$this->transEsc('Subject Recommendations')?></h4>
-<div class="row">
-  <? $i = 0; foreach ($worldCatTerms as $type => $section): ?>
-    <? $moreClass = 'WCTerms'.$this->escapeHtml($type).' hidden'; ?>
-    <div class="col-sm-<?=floor(12/count($worldCatTerms)) ?>">
-      <dl>
-        <dt><?=$this->transEsc('wcterms_' . $type)?></dt>
-        <? $j = 0; foreach ($section as $subj): ?>
-          <? if (++$j == 4): ?>
-            <dd id="moreWCTerms<?=$this->escapeHtml($type)?>"><a href="#" onclick="moreFacets('WCTerms<?=$this->escapeHtml($type)?>'); return false;"><?=$this->transEsc('more')?> ...</a></dd>
-          <? endif; ?>
-          <dd<? if($j >= 4): ?> class="<?=$moreClass ?>"<? endif ?>>&bull; <a href="<?=$this->url('search-results')?>?lookfor=%22<?=urlencode($subj)?>%22&amp;type=Subject"><?=$this->escapeHtml($subj)?></a></dd>
-        <? endforeach; ?>
-        <? if ($j > 3): ?><dd class="<?=$moreClass ?>"><a href="#" onclick="lessFacets('WCTerms<?=$this->escapeHtml($type)?>'); return false;"><?=$this->transEsc('less')?> ...</a></dd><? endif; ?>
-      </dl>
-    </div>
-  <? endforeach; ?>
-  <div class="clearfix"></div>
-</div>
-<? endif; ?>
diff --git a/themes/jquerymobile/templates/Recommend/Deprecated.phtml b/themes/jquerymobile/templates/Recommend/Deprecated.phtml
new file mode 100644
index 00000000000..63445d34f9c
--- /dev/null
+++ b/themes/jquerymobile/templates/Recommend/Deprecated.phtml
@@ -0,0 +1,2 @@
+<? /* do nothing -- this module is a placeholder for old deprecated features
+      to prevent legacy configurations from causing fatal errors. */ ?>
\ No newline at end of file
diff --git a/themes/jquerymobile/templates/Recommend/WorldCatTerms.phtml b/themes/jquerymobile/templates/Recommend/WorldCatTerms.phtml
deleted file mode 100644
index 0df1e74df18..00000000000
--- a/themes/jquerymobile/templates/Recommend/WorldCatTerms.phtml
+++ /dev/null
@@ -1 +0,0 @@
-<? /* Not supported in mobile theme. */ ?>
\ No newline at end of file
-- 
GitLab