Drush: commands/pm/update_info/drupal_6.inc Source File

  1. 7.x doxygen/html/drupal__6_8inc_source.html
  2. master doxygen/html/drupal__6_8inc_source.html
drupal_6.inc
Go to the documentation of this file.
1 <?php
2 
3 /**
4  * @file
5  * Implementation of 'drupal' update_info engine for Drupal 6.
6  */
7 
8 /**
9  * Returns a human readable message based on update status of a project.
10  *
11  * It also may alter the project object and set $project['updateable']
12  * and $project['candidate_version'].
13  *
14  * @see pm_release_recommended()
15  *
16  * Project statuses in Drupal 6 are:
17  * - UPDATE_NOT_SECURE
18  * - UPDATE_REVOKED
19  * - UPDATE_NOT_SUPPORTED
20  * - UPDATE_NOT_CURRENT
21  * - UPDATE_CURRENT
22  * - UPDATE_NOT_CHECKED
23  * - UPDATE_UNKNOWN
24  * - UPDATE_NOT_FETCHED
25  *
26  */
27 function pm_update_filter(&$project) {
28  switch($project['status']) {
29  case UPDATE_NOT_SECURE:
30  $status = dt('SECURITY UPDATE available');
31  pm_release_recommended($project);
32  break;
33  case UPDATE_REVOKED:
34  $status = dt('Installed version REVOKED');
35  pm_release_recommended($project);
36  break;
37  case UPDATE_NOT_SUPPORTED:
38  $status = dt('Installed version not supported');
39  pm_release_recommended($project);
40  break;
41  case UPDATE_NOT_CURRENT:
42  $status = dt('Update available');
43  pm_release_recommended($project);
44  break;
45  case UPDATE_NOT_CHECKED:
46  $status = dt('Unable to check status');
47  break;
48  case UPDATE_CURRENT:
49  $status = dt('Up to date');
50  $project['candidate_version'] = $project['recommended'];
51  break;
52  case UPDATE_UNKNOWN:
53  case UPDATE_NOT_FETCHED:
54  default:
55  $status = dt('Unknown');
56  break;
57  }
58  return $status;
59 }
60 
61 /**
62  * Returns time of last check of available updates.
63  */
65  return variable_get('update_last_check', 0);
66 }
67 
68 /**
69  * Command callback. Refresh update status information.
70  */
71 function _pm_refresh() {
72  drush_print(dt("Refreshing update status information ..."));
73  update_refresh();
74  drush_print(dt("Done."));
75 }
76 
77 /**
78  * Get update information for all installed projects.
79  *
80  * @return An array containing remote and local versions for all
81  * installed projects.
82  */
83 function _pm_get_update_info($projects) {
84  // We force a refresh if the cache is not available.
85  if (!cache_get('update_available_releases', 'cache_update')) {
86  _pm_refresh();
87  }
88 
89  $info = update_get_available(TRUE);
90 
91  // Force to invalidate some update_status caches that are only cleared
92  // when visiting update status report page.
93  if (function_exists('_update_cache_clear')) {
94  _update_cache_clear('update_project_data');
95  _update_cache_clear('update_project_projects');
96  }
97 
98  $data = update_calculate_project_data($info);
99  foreach ($data as $project_name => $project) {
100  // Discard custom projects.
101  if ($project['status'] == UPDATE_UNKNOWN) {
102  unset($data[$project_name]);
103  continue;
104  }
105  // Discard projects with unknown installation path.
106  if ($project_name != 'drupal' && !isset($projects[$project_name]['path'])) {
107  unset($data[$project_name]);
108  continue;
109  }
110  // Allow to update disabled projects.
111  if (in_array($project['project_type'], array('disabled-module', 'disabled-theme'))) {
112  $data[$project_name]['project_type'] = substr($project['project_type'], strpos($project['project_type'], '-') + 1);
113  }
114  // Add some info from the project to $data.
115  $data[$project_name] += array(
116  'path' => isset($projects[$project_name]['path']) ? $projects[$project_name]['path'] : '',
117  'label' => $projects[$project_name]['label'],
118  );
119  }
120 
121  return $data;
122 }
123 

File

doxygen/html/drupal__6_8inc_source.html
View source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Drush: commands/pm/update_info/drupal_6.inc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Drush
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_afac61274991793aa7e9133a8f4f291e.html">commands</a></li><li class="navelem"><a class="el" href="dir_15591510fc66414792ea8adada328324.html">pm</a></li><li class="navelem"><a class="el" href="dir_bb389c959ae58a652132c9d3301eb53c.html">update_info</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">drupal_6.inc</div>  </div>
</div><!--header-->
<div class="contents">
<a href="drupal__6_8inc.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;&lt;?php</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * @file</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Implementation of &#39;drupal&#39; update_info engine for Drupal 6.</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * Returns a human readable message based on update status of a project.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * It also may alter the project object and set $project[&#39;updateable&#39;]</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * and $project[&#39;candidate_version&#39;].</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * @see pm_release_recommended()</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * Project statuses in Drupal 6 are:</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * - UPDATE_NOT_SECURE</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * - UPDATE_REVOKED</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * - UPDATE_NOT_SUPPORTED</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * - UPDATE_NOT_CURRENT</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * - UPDATE_CURRENT</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> * - UPDATE_NOT_CHECKED</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> * - UPDATE_UNKNOWN</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"> * - UPDATE_NOT_FETCHED</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="code" href="drupal__6_8inc.html#abd7fdb8f03e60e909fba225012233142">   27</a></span>&#160;<span class="keyword">function</span> <a class="code" href="commands_2pm_2update__info_2drupal_8inc.html#abd7fdb8f03e60e909fba225012233142">pm_update_filter</a>(&amp;$project) {</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;  <span class="keywordflow">switch</span>($project[<span class="stringliteral">&#39;status&#39;</span>]) {</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    <span class="keywordflow">case</span> UPDATE_NOT_SECURE:</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;      $status = <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;SECURITY UPDATE available&#39;</span>);</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;      <a class="code" href="updatestatus_8pm_8inc.html#a5cb9b6532e505c344200fa32a29c5868">pm_release_recommended</a>($project);</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="keywordflow">case</span> UPDATE_REVOKED:</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;      $status = <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Installed version REVOKED&#39;</span>);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;      <a class="code" href="updatestatus_8pm_8inc.html#a5cb9b6532e505c344200fa32a29c5868">pm_release_recommended</a>($project);</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keywordflow">case</span> UPDATE_NOT_SUPPORTED:</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;      $status = <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Installed version not supported&#39;</span>);</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;      <a class="code" href="updatestatus_8pm_8inc.html#a5cb9b6532e505c344200fa32a29c5868">pm_release_recommended</a>($project);</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keywordflow">case</span> UPDATE_NOT_CURRENT:</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;      $status = <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Update available&#39;</span>);</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;      <a class="code" href="updatestatus_8pm_8inc.html#a5cb9b6532e505c344200fa32a29c5868">pm_release_recommended</a>($project);</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keywordflow">case</span> UPDATE_NOT_CHECKED:</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;      $status = <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Unable to check status&#39;</span>);</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <span class="keywordflow">case</span> UPDATE_CURRENT:</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;      $status = <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Up to date&#39;</span>);</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;      $project[<span class="stringliteral">&#39;candidate_version&#39;</span>] = $project[<span class="stringliteral">&#39;recommended&#39;</span>];</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keywordflow">case</span> UPDATE_UNKNOWN:</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="keywordflow">case</span> UPDATE_NOT_FETCHED:</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;      $status = <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Unknown&#39;</span>);</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;      <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  }</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <span class="keywordflow">return</span> $status;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;}</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="comment"> * Returns time of last check of available updates.</span></div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="code" href="drupal__6_8inc.html#a35cf870938c0ecdd3e2cead6aec212d2">   64</a></span>&#160;<span class="keyword">function</span> <a class="code" href="commands_2pm_2update__info_2drupal_8inc.html#a35cf870938c0ecdd3e2cead6aec212d2">pm_update_last_check</a>() {</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  <span class="keywordflow">return</span> variable_get(<span class="stringliteral">&#39;update_last_check&#39;</span>, 0);</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;}</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="comment"> * Command callback. Refresh update status information.</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="code" href="drupal__6_8inc.html#ac0ebe2ccf9fef03ac2038f783321b8d5">   71</a></span>&#160;<span class="keyword">function</span> <a class="code" href="commands_2pm_2update__info_2drupal_8inc.html#ac0ebe2ccf9fef03ac2038f783321b8d5">_pm_refresh</a>() {</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  <a class="code" href="group__outputfunctions.html#ga63acbb94925d6d2693e235e966bba740">drush_print</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;Refreshing update status information ...&quot;</span>));</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  update_refresh();</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;  <a class="code" href="group__outputfunctions.html#ga63acbb94925d6d2693e235e966bba740">drush_print</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;Done.&quot;</span>));</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;}</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="comment"> * Get update information for all installed projects.</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="comment"> * @return An array containing remote and local versions for all</span></div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="comment"> *   installed projects.</span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="drupal__6_8inc.html#afa1132bbe8f4d56b787a9a93d4971871">   83</a></span>&#160;<span class="keyword">function</span> <a class="code" href="commands_2pm_2update__info_2drupal_8inc.html#afa1132bbe8f4d56b787a9a93d4971871">_pm_get_update_info</a>($projects) {</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;  <span class="comment">// We force a refresh if the cache is not available.</span></div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  <span class="keywordflow">if</span> (!cache_get(<span class="stringliteral">&#39;update_available_releases&#39;</span>, <span class="stringliteral">&#39;cache_update&#39;</span>)) {</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <a class="code" href="commands_2pm_2update__info_2drupal_8inc.html#ac0ebe2ccf9fef03ac2038f783321b8d5">_pm_refresh</a>();</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;  }</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;  $info = update_get_available(TRUE);</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;  <span class="comment">// Force to invalidate some update_status caches that are only cleared</span></div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;  <span class="comment">// when visiting update status report page.</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  <span class="keywordflow">if</span> (function_exists(<span class="stringliteral">&#39;_update_cache_clear&#39;</span>)) {</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    _update_cache_clear(<span class="stringliteral">&#39;update_project_data&#39;</span>);</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    _update_cache_clear(<span class="stringliteral">&#39;update_project_projects&#39;</span>);</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  }</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  $data = update_calculate_project_data($info);</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  <span class="keywordflow">foreach</span> ($data as $project_name =&gt; $project) {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="comment">// Discard custom projects.</span></div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="keywordflow">if</span> ($project[<span class="stringliteral">&#39;status&#39;</span>] == UPDATE_UNKNOWN) {</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;      unset($data[$project_name]);</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;      <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    }</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="comment">// Discard projects with unknown installation path.</span></div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <span class="keywordflow">if</span> ($project_name != <span class="stringliteral">&#39;drupal&#39;</span> &amp;&amp; !isset($projects[$project_name][<span class="stringliteral">&#39;path&#39;</span>])) {</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;      unset($data[$project_name]);</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;      <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    }</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <span class="comment">// Allow to update disabled projects.</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <span class="keywordflow">if</span> (in_array($project[<span class="stringliteral">&#39;project_type&#39;</span>], array(<span class="stringliteral">&#39;disabled-module&#39;</span>, <span class="stringliteral">&#39;disabled-theme&#39;</span>))) {</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;      $data[$project_name][<span class="stringliteral">&#39;project_type&#39;</span>] = substr($project[<span class="stringliteral">&#39;project_type&#39;</span>], strpos($project[<span class="stringliteral">&#39;project_type&#39;</span>], <span class="charliteral">&#39;-&#39;</span>) + 1);</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    }</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="comment">// Add some info from the project to $data.</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    $data[$project_name] += array(</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;      <span class="stringliteral">&#39;path&#39;</span>  =&gt; isset($projects[$project_name][<span class="stringliteral">&#39;path&#39;</span>]) ? $projects[$project_name][<span class="stringliteral">&#39;path&#39;</span>] : <span class="stringliteral">&#39;&#39;</span>,</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;      <span class="stringliteral">&#39;label&#39;</span> =&gt; $projects[$project_name][<span class="stringliteral">&#39;label&#39;</span>],</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    );</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  }</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;  <span class="keywordflow">return</span> $data;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;}</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 8 2014 09:04:54 for Drush by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>